ethernet: check destination mac for L3 in ethernet-input node
[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 ($(PARALLEL),)
27 PARALLEL=1
28 endif
29
30 ifeq ($(REPEAT),)
31 REPEAT=0
32 endif
33
34 ifeq ($(VPPSRC),)
35 VPPSRC=$(shell pwd)/../..
36 endif
37
38 ifeq ($(UBUNTU_CODENAME),)
39 UBUNTU_CODENAME=$(shell grep '^UBUNTU_CODENAME=' /etc/os-release | cut -f2- -d=)
40 endif
41
42 ifeq ($(ARCH),)
43 ARCH=$(shell dpkg --print-architecture)
44 endif
45
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'
48
49 .PHONY: help
50 help:
51         @echo "Make targets:"
52         @echo " test                 - run tests"
53         @echo " build                - build test infra"
54         @echo " build-debug          - build test infra (vpp debug image)"
55         @echo " build-go             - just build golang files"
56         @echo " fixstyle             - format .go source files"
57         @echo " list-tests           - list all tests"
58         @echo
59         @echo "make build arguments:"
60         @echo " UBUNTU_VERSION           - ubuntu version for docker image"
61         @echo " HST_EXTENDED_TESTS       - build extended tests"
62         @echo
63         @echo "make test arguments:"
64         @echo " PERSIST=[true|false]     - whether clean up topology and dockers after test"
65         @echo " VERBOSE=[true|false]     - verbose output"
66         @echo " UNCONFIGURE=[true|false] - unconfigure selected test"
67         @echo " DEBUG=[true|false]       - attach VPP to GDB"
68         @echo " TEST=[test-name]         - specific test to run"
69         @echo " CPUS=[n-cpus]            - number of cpus to run with vpp"
70         @echo " VPPSRC=[path-to-vpp-src] - path to vpp source files (for gdb)"
71         @echo " PARALLEL=[n-cpus]        - number of test processes to spawn to run in parallel"
72         @echo " REPEAT=[n]               - repeat tests up to N times or until a failure occurs"
73         @echo
74         @echo "List of all tests:"
75         $(call list_tests)
76
77 .PHONY: list-tests
78 list-tests:
79         $(call list_tests)
80
81 .PHONY: build-vpp-release
82 build-vpp-release:
83         @make -C ../.. build-release
84
85 .PHONY: build-vpp-debug
86 build-vpp-debug:
87         @make -C ../.. build
88
89 .build.ok: build
90         @touch .build.ok
91
92 .PHONY: test
93 test: .deps.ok .build.ok
94         @bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
95                 --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
96                 --vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT)
97
98 .PHONY: build-go
99 build-go:
100         go build ./tools/http_server
101
102 .PHONY: build
103 build: .deps.ok build-vpp-release build-go
104         @rm -f .build.ok
105         bash ./script/build_hst.sh release
106         @touch .build.ok
107
108 .PHONY: build-debug
109 build-debug: .deps.ok build-vpp-debug build-go
110         @rm -f .build.ok
111         bash ./script/build_hst.sh debug
112         @touch .build.ok
113
114 .deps.ok:
115         @sudo make install-deps
116
117 .PHONY: install-deps
118 install-deps:
119         @rm -f .deps.ok
120         @apt-get update \
121                 && apt-get install -y apt-transport-https ca-certificates curl software-properties-common \
122                 apache2-utils wrk bridge-utils
123         @if [ ! -f /usr/share/keyrings/docker-archive-keyring.gpg ] ; then \
124                 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg; \
125                 echo "deb [arch=$(ARCH) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(UBUNTU_CODENAME) stable" \
126                         | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ; \
127                 apt-get update; \
128         fi
129         @touch .deps.ok
130
131 .PHONY: fixstyle
132 fixstyle:
133         @gofmt -w .
134         @go mod tidy