aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'extras/hs-test/Makefile')
-rw-r--r--extras/hs-test/Makefile53
1 files changed, 43 insertions, 10 deletions
diff --git a/extras/hs-test/Makefile b/extras/hs-test/Makefile
index f0ec755afb2..6ee89bc2770 100644
--- a/extras/hs-test/Makefile
+++ b/extras/hs-test/Makefile
@@ -23,6 +23,14 @@ ifeq ($(CPUS),)
CPUS=1
endif
+ifeq ($(PARALLEL),)
+PARALLEL=1
+endif
+
+ifeq ($(REPEAT),)
+REPEAT=0
+endif
+
ifeq ($(VPPSRC),)
VPPSRC=$(shell pwd)/../..
endif
@@ -35,13 +43,14 @@ ifeq ($(ARCH),)
ARCH=$(shell dpkg --print-architecture)
endif
-list_tests = @(grep -r ') Test' *_test.go | cut -d '*' -f2 | cut -d '(' -f1 | \
- tr -d ' ' | tr ')' '/' | sed 's/Suite//')
+list_tests = @go run github.com/onsi/ginkgo/v2/ginkgo --dry-run -v --no-color --seed=2 | head -n -1 | grep 'Test' | \
+ sed 's/^/* /; s/\(Suite\) /\1\//g'
.PHONY: help
help:
@echo "Make targets:"
@echo " test - run tests"
+ @echo " test-debug - run tests (vpp debug image)"
@echo " build - build test infra"
@echo " build-debug - build test infra (vpp debug image)"
@echo " build-go - just build golang files"
@@ -60,6 +69,8 @@ help:
@echo " TEST=[test-name] - specific test to run"
@echo " CPUS=[n-cpus] - number of cpus to run with vpp"
@echo " VPPSRC=[path-to-vpp-src] - path to vpp source files (for gdb)"
+ @echo " PARALLEL=[n-cpus] - number of test processes to spawn to run in parallel"
+ @echo " REPEAT=[n] - repeat tests up to N times or until a failure occurs"
@echo
@echo "List of all tests:"
$(call list_tests)
@@ -68,30 +79,49 @@ help:
list-tests:
$(call list_tests)
+.PHONY: build-vpp-release
build-vpp-release:
@make -C ../.. build-release
+.PHONY: build-vpp-debug
build-vpp-debug:
@make -C ../.. build
+.build.ok: build
+ @touch .build.ok
+
+.build_debug.ok: build-debug
+ @touch .build.ok
+
.PHONY: test
-test: .deps.ok .build.vpp
+test: .deps.ok .build.ok
+ -bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
+ --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
+ --vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT)
+ $(call jq-summary)
+ @bash ./script/compress.sh
+
+.PHONY: test-debug
+test-debug: .deps.ok .build_debug.ok
@bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
--unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
- --vppsrc=$(VPPSRC)
+ --vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT)
+.PHONY: build-go
build-go:
go build ./tools/http_server
+.PHONY: build
build: .deps.ok build-vpp-release build-go
- @rm -f .build.vpp
+ @rm -f .build.ok
bash ./script/build_hst.sh release
- @touch .build.vpp
+ @touch .build.ok
+.PHONY: build-debug
build-debug: .deps.ok build-vpp-debug build-go
- @rm -f .build.vpp
+ @rm -f .build.ok
bash ./script/build_hst.sh debug
- @touch .build.vpp
+ @touch .build.ok
.deps.ok:
@sudo make install-deps
@@ -101,17 +131,20 @@ install-deps:
@rm -f .deps.ok
@apt-get update \
&& apt-get install -y apt-transport-https ca-certificates curl software-properties-common \
- && apt-get install -y golang apache2-utils wrk bridge-utils
+ apache2-utils wrk bridge-utils
@if [ ! -f /usr/share/keyrings/docker-archive-keyring.gpg ] ; then \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg; \
echo "deb [arch=$(ARCH) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(UBUNTU_CODENAME) stable" \
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ; \
apt-get update; \
fi
- @apt-get install -y docker-ce
@touch .deps.ok
.PHONY: fixstyle
fixstyle:
@gofmt -w .
@go mod tidy
+
+# splitting this into multiple lines breaks the command
+jq-summary = @jq -r '.[0] | .SpecReports[] | select(.State == "failed") | select(.Failure != null) | "TestName: \(.LeafNodeText)\nMessage:\n\(.Failure.Message)\n Full Stack Trace:\n\(.Failure.Location.FullStackTrace)\n"' summary/report.json > summary/failed-summary.log \
+ && echo "Summary generated -> failed-summary.log"