hs-test: temp skip some tests
[vpp.git] / extras / hs-test / Makefile
1 export HS_ROOT=$(CURDIR)
2
3 ifeq ($(VERBOSE),)
4 VERBOSE=false
5 endif
6
7 ifeq ($(PERSIST),)
8 PERSIST=false
9 endif
10
11 ifeq ($(UNCONFIGURE),)
12 UNCONFIGURE=false
13 endif
14
15 ifeq ($(TEST),)
16 TEST=all
17 endif
18
19 ifeq ($(TEST-HS),)
20 TEST-HS=all
21 endif
22
23 ifeq ($(DEBUG),)
24 DEBUG=false
25 endif
26
27 ifeq ($(CPUS),)
28 CPUS=1
29 endif
30
31 ifeq ($(PARALLEL),)
32 PARALLEL=1
33 endif
34
35 ifeq ($(REPEAT),)
36 REPEAT=0
37 endif
38
39 ifeq ($(VPPSRC),)
40 VPPSRC=$(shell pwd)/../..
41 endif
42
43 ifeq ($(UBUNTU_CODENAME),)
44 UBUNTU_CODENAME=$(shell grep '^UBUNTU_CODENAME=' /etc/os-release | cut -f2- -d=)
45 endif
46
47 ifeq ($(ARCH),)
48 ARCH=$(shell dpkg --print-architecture)
49 endif
50
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'
53
54 .PHONY: help
55 help:
56         @echo "Make targets:"
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"
65         @echo
66         @echo "make build arguments:"
67         @echo " UBUNTU_VERSION           - ubuntu version for docker image"
68         @echo " HST_EXTENDED_TESTS       - build extended tests"
69         @echo
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"
80         @echo
81         @echo "List of all tests:"
82         $(call list_tests)
83
84 .PHONY: list-tests
85 list-tests:
86         $(call list_tests)
87
88 .PHONY: build-vpp-release
89 build-vpp-release:
90         @make -C ../.. build-release
91
92 .PHONY: build-vpp-debug
93 build-vpp-debug:
94         @make -C ../.. build
95
96 .PHONY: build-vpp-gcov
97 build-vpp-gcov:
98         @make -C ../.. build-vpp-gcov
99
100 .build.ok: build
101         @touch .build.ok
102
103 .build_debug.ok: build-debug
104         @touch .build.ok
105
106 .PHONY: test
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
114
115 .PHONY: test-debug
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
123
124 .PHONY: test-cov
125 test-cov: .deps.ok .build.ok
126         -bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
127                 --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST-HS) --cpus=$(CPUS) \
128                 --vppsrc=$(VPPSRC)
129         @make -C ../.. test-cov-post HS_TEST=1
130         @bash ./script/compress.sh
131
132 .PHONY: build-go
133 build-go:
134         go build ./tools/http_server
135
136 .PHONY: build
137 build: .deps.ok build-vpp-release build-go
138         @rm -f .build.ok
139         bash ./script/build_hst.sh release
140         @touch .build.ok
141
142 .PHONY: build-cov
143 build-cov: .deps.ok build-vpp-gcov build-go
144         @rm -f .build.vpp
145         bash ./script/build_hst.sh gcov
146         @touch .build.vpp
147
148 .PHONY: build-debug
149 build-debug: .deps.ok build-vpp-debug build-go
150         @rm -f .build.ok
151         bash ./script/build_hst.sh debug
152         @touch .build.ok
153
154 .deps.ok:
155         @sudo make install-deps
156
157 .PHONY: install-deps
158 install-deps:
159         @rm -f .deps.ok
160         @apt-get update \
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 ; \
167                 apt-get update; \
168         fi
169         @touch .deps.ok
170
171 .PHONY: fixstyle
172 fixstyle:
173         @gofmt -w .
174         @go mod tidy