1 export HS_ROOT=$(CURDIR)
11 ifeq ($(UNCONFIGURE),)
40 VPPSRC=$(shell pwd)/../..
43 ifeq ($(UBUNTU_CODENAME),)
44 UBUNTU_CODENAME=$(shell grep '^UBUNTU_CODENAME=' /etc/os-release | cut -f2- -d=)
48 ARCH=$(shell dpkg --print-architecture)
51 list_tests = @go run github.com/onsi/ginkgo/v2/ginkgo --dry-run -v --no-color --seed=2 | head -n -1 | grep 'Test' | \
52 sed 's/^/* /; s/\(Suite\) /\1\//g'
57 @echo " test - run tests"
58 @echo " test-debug - run tests (vpp debug image)"
59 @echo " build - build test infra"
60 @echo " build-cov - coverage build of VPP and Docker images"
61 @echo " build-debug - build test infra (vpp debug image)"
62 @echo " build-go - just build golang files"
63 @echo " fixstyle - format .go source files"
64 @echo " list-tests - list all tests"
66 @echo "make build arguments:"
67 @echo " UBUNTU_VERSION - ubuntu version for docker image"
68 @echo " HST_EXTENDED_TESTS - build extended tests"
70 @echo "make test arguments:"
71 @echo " PERSIST=[true|false] - whether clean up topology and dockers after test"
72 @echo " VERBOSE=[true|false] - verbose output"
73 @echo " UNCONFIGURE=[true|false] - unconfigure selected test"
74 @echo " DEBUG=[true|false] - attach VPP to GDB"
75 @echo " TEST=[test-name] - specific test to run"
76 @echo " CPUS=[n-cpus] - number of cpus to allocate to VPP and containers"
77 @echo " VPPSRC=[path-to-vpp-src] - path to vpp source files (for gdb)"
78 @echo " PARALLEL=[n-cpus] - number of test processes to spawn to run in parallel"
79 @echo " REPEAT=[n] - repeat tests up to N times or until a failure occurs"
81 @echo "List of all tests:"
88 .PHONY: build-vpp-release
90 @make -C ../.. build-release
92 .PHONY: build-vpp-debug
96 .PHONY: build-vpp-gcov
98 @make -C ../.. build-vpp-gcov
103 .build_debug.ok: build-debug
107 test: .deps.ok .build.ok
108 # '-' ignores the exit status, it is set in compress.sh
109 # necessary so gmake won't skip executing the bash script
110 -bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
111 --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
112 --vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT)
113 @bash ./script/compress.sh
116 test-debug: .deps.ok .build_debug.ok
117 # '-' ignores the exit status, it is set in compress.sh
118 # necessary so gmake won't skip executing the bash script
119 -bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
120 --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
121 --vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT)
122 @bash ./script/compress.sh
125 test-cov: .deps.ok .build.ok
126 -bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
127 --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST-HS) --cpus=$(CPUS) \
129 @make -C ../.. test-cov-post HS_TEST=1
130 @bash ./script/compress.sh
134 go build ./tools/http_server
137 build: .deps.ok build-vpp-release build-go
139 bash ./script/build_hst.sh release
143 build-cov: .deps.ok build-vpp-gcov build-go
145 bash ./script/build_hst.sh gcov
149 build-debug: .deps.ok build-vpp-debug build-go
151 bash ./script/build_hst.sh debug
155 @sudo make install-deps
161 && apt-get install -y apt-transport-https ca-certificates curl software-properties-common \
162 apache2-utils wrk bridge-utils
163 @if [ ! -f /usr/share/keyrings/docker-archive-keyring.gpg ] ; then \
164 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg; \
165 echo "deb [arch=$(ARCH) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(UBUNTU_CODENAME) stable" \
166 | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ; \