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