hs-test: add option to unconfigure topology
[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 list_tests = @(grep -r ') Test' *_test.go | cut -d '*' -f2 | cut -d '(' -f1 | \
19                 tr -d ' ' | tr ')' '/' | sed 's/Suite//')
20
21 .PHONY: help
22 help:
23         @echo "Make targets:"
24         @echo " test                 - run tests"
25         @echo " build                - build test infra"
26         @echo " build-debug          - build test infra (vpp debug image)"
27         @echo " build-go             - just build golang files"
28         @echo " fixstyle             - format .go source files"
29         @echo " list-tests           - list all tests"
30         @echo
31         @echo "Make arguments:"
32         @echo " UBUNTU_VERSION           - ubuntu version for docker image"
33         @echo " PERSIST=[true|false]     - whether clean up topology and dockers after test"
34         @echo " VERBOSE=[true|false]     - verbose output"
35         @echo " TEST=[test-name]         - specific test to run"
36         @echo
37         @echo "List of all tests:"
38         $(call list_tests)
39
40 .PHONY: list-tests
41 list-tests:
42         $(call list_tests)
43
44 build-vpp-release:
45         @make -C ../.. build-release
46
47 build-vpp-debug:
48         @make -C ../.. build
49
50 .PHONY: test
51 test: .deps.ok .build.vpp
52         @bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
53                 --unconfigure=$(UNCONFIGURE) --test=$(TEST)
54
55 build-go:
56         go build ./tools/http_server
57
58 build: .deps.ok build-vpp-release build-go
59         @rm .build.vpp || exit 0
60         bash ./script/build.sh release
61         @touch .build.vpp
62
63 build-debug: .deps.ok build-vpp-debug build-go
64         @rm .build.vpp || exit 0
65         bash ./script/build.sh debug
66         @touch .build.vpp
67
68 .PHONY: install-deps
69 install-deps:
70         @rm .deps.ok || exit 0
71         @apt update -y && apt install -y golang docker-ce apache2-utils wrk bridge-utils
72         @touch .deps.ok
73
74 .PHONY: fixstyle
75 fixstyle:
76         @gofmt -w .
77         @go mod tidy
78