10 ifeq ($(UNCONFIGURE),)
35 VPPSRC=$(shell pwd)/../..
38 ifeq ($(UBUNTU_CODENAME),)
39 UBUNTU_CODENAME=$(shell grep '^UBUNTU_CODENAME=' /etc/os-release | cut -f2- -d=)
43 ARCH=$(shell dpkg --print-architecture)
46 list_tests = @go run github.com/onsi/ginkgo/v2/ginkgo --dry-run -v --no-color --seed=2 | head -n -1 | grep 'Test' | \
47 sed 's/^/* /; s/\(Suite\) /\1\//g'
52 @echo " test - run tests"
53 @echo " test-debug - run tests (vpp debug image)"
54 @echo " build - build test infra"
55 @echo " build-debug - build test infra (vpp debug image)"
56 @echo " build-go - just build golang files"
57 @echo " fixstyle - format .go source files"
58 @echo " list-tests - list all tests"
60 @echo "make build arguments:"
61 @echo " UBUNTU_VERSION - ubuntu version for docker image"
62 @echo " HST_EXTENDED_TESTS - build extended tests"
64 @echo "make test arguments:"
65 @echo " PERSIST=[true|false] - whether clean up topology and dockers after test"
66 @echo " VERBOSE=[true|false] - verbose output"
67 @echo " UNCONFIGURE=[true|false] - unconfigure selected test"
68 @echo " DEBUG=[true|false] - attach VPP to GDB"
69 @echo " TEST=[test-name] - specific test to run"
70 @echo " CPUS=[n-cpus] - number of cpus to run with vpp"
71 @echo " VPPSRC=[path-to-vpp-src] - path to vpp source files (for gdb)"
72 @echo " PARALLEL=[n-cpus] - number of test processes to spawn to run in parallel"
73 @echo " REPEAT=[n] - repeat tests up to N times or until a failure occurs"
75 @echo "List of all tests:"
82 .PHONY: build-vpp-release
84 @make -C ../.. build-release
86 .PHONY: build-vpp-debug
93 .build_debug.ok: build-debug
97 test: .deps.ok .build.ok
98 -bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
99 --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
100 --vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT)
102 @bash ./script/compress.sh
105 test-debug: .deps.ok .build_debug.ok
106 @bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
107 --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
108 --vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT)
112 go build ./tools/http_server
115 build: .deps.ok build-vpp-release build-go
117 bash ./script/build_hst.sh release
121 build-debug: .deps.ok build-vpp-debug build-go
123 bash ./script/build_hst.sh debug
127 @sudo make install-deps
133 && apt-get install -y apt-transport-https ca-certificates curl software-properties-common \
134 apache2-utils wrk bridge-utils
135 @if [ ! -f /usr/share/keyrings/docker-archive-keyring.gpg ] ; then \
136 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg; \
137 echo "deb [arch=$(ARCH) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(UBUNTU_CODENAME) stable" \
138 | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ; \
148 # splitting this into multiple lines breaks the command
149 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 \
150 && echo "Summary generated -> failed-summary.log"