hs-test: add nginx+quic test
[vpp.git] / extras / hs-test / Makefile
1
2 ifeq ($(VERBOSE),)
3 VERBOSE=false
4 endif
5
6 ifeq ($(PERSIST),)
7 PERSIST=false
8 endif
9
10 ifeq ($(UNCONFIGURE),)
11 UNCONFIGURE=false
12 endif
13
14 ifeq ($(TEST),)
15 TEST=all
16 endif
17
18 ifeq ($(DEBUG),)
19 DEBUG=false
20 endif
21
22 ifeq ($(CPUS),)
23 CPUS=1
24 endif
25
26 ifeq ($(UBUNTU_CODENAME),)
27 UBUNTU_CODENAME=$(shell grep '^UBUNTU_CODENAME=' /etc/os-release | cut -f2- -d=)
28 endif
29
30 ifeq ($(ARCH),)
31 ARCH=$(shell dpkg --print-architecture)
32 endif
33
34 list_tests = @(grep -r ') Test' *_test.go | cut -d '*' -f2 | cut -d '(' -f1 | \
35                 tr -d ' ' | tr ')' '/' | sed 's/Suite//')
36
37 .PHONY: help
38 help:
39         @echo "Make targets:"
40         @echo " test                 - run tests"
41         @echo " build                - build test infra"
42         @echo " build-debug          - build test infra (vpp debug image)"
43         @echo " build-go             - just build golang files"
44         @echo " fixstyle             - format .go source files"
45         @echo " list-tests           - list all tests"
46         @echo
47         @echo "make build arguments:"
48         @echo " UBUNTU_VERSION           - ubuntu version for docker image"
49         @echo " HST_EXTENDED_TESTS       - build extended tests"
50         @echo
51         @echo "make test arguments:"
52         @echo " PERSIST=[true|false]     - whether clean up topology and dockers after test"
53         @echo " VERBOSE=[true|false]     - verbose output"
54         @echo " UNCONFIGURE=[true|false] - unconfigure selected test"
55         @echo " DEBUG=[true|false]       - attach VPP to GDB"
56         @echo " TEST=[test-name]         - specific test to run"
57         @echo " CPUS=[n-cpus]            - number of cpus to run with vpp"
58         @echo
59         @echo "List of all tests:"
60         $(call list_tests)
61
62 .PHONY: list-tests
63 list-tests:
64         $(call list_tests)
65
66 build-vpp-release:
67         @make -C ../.. build-release
68
69 build-vpp-debug:
70         @make -C ../.. build
71
72 .PHONY: test
73 test: .deps.ok .build.vpp
74         @bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
75                 --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS)
76
77 build-go:
78         go build ./tools/http_server
79
80 build: .deps.ok build-vpp-release build-go
81         @rm -f .build.vpp
82         bash ./script/build_hst.sh release
83         @touch .build.vpp
84
85 build-debug: .deps.ok build-vpp-debug build-go
86         @rm -f .build.vpp
87         bash ./script/build_hst.sh debug
88         @touch .build.vpp
89
90 .deps.ok:
91         @sudo make install-deps
92
93 .PHONY: install-deps
94 install-deps:
95         @rm -f .deps.ok
96         @apt-get update \
97                 && apt-get install -y apt-transport-https ca-certificates curl software-properties-common \
98                 && apt-get install -y golang apache2-utils wrk bridge-utils
99         @if [ ! -f /usr/share/keyrings/docker-archive-keyring.gpg ] ; then \
100                 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg; \
101                 echo "deb [arch=$(ARCH) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(UBUNTU_CODENAME) stable" \
102                         | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ; \
103                 apt-get update; \
104         fi
105         @apt-get install -y docker-ce
106         @touch .deps.ok
107
108 .PHONY: fixstyle
109 fixstyle:
110         @gofmt -w .
111         @go mod tidy