blob: 29cbd0ea01efb5204b9f71cad439776f746c2e4e [file] [log] [blame]
Filip Tehlar229f5fc2022-08-09 14:44:47 +00001
Filip Tehlar671cf512023-01-31 10:34:18 +01002ifeq ($(VERBOSE),)
3VERBOSE=false
4endif
Maros Ondrejicka2ddb2fd2023-02-15 17:44:46 +01005
Filip Tehlar671cf512023-01-31 10:34:18 +01006ifeq ($(PERSIST),)
7PERSIST=false
8endif
9
Maros Ondrejickaaf004dd2023-02-27 16:52:57 +010010ifeq ($(UNCONFIGURE),)
11UNCONFIGURE=false
12endif
13
Filip Tehlar671cf512023-01-31 10:34:18 +010014ifeq ($(TEST),)
15TEST=all
16endif
17
Filip Tehlarec5c40b2023-02-28 18:59:15 +010018ifeq ($(DEBUG),)
19DEBUG=false
20endif
21
Filip Tehlar671cf512023-01-31 10:34:18 +010022list_tests = @(grep -r ') Test' *_test.go | cut -d '*' -f2 | cut -d '(' -f1 | \
23 tr -d ' ' | tr ')' '/' | sed 's/Suite//')
24
25.PHONY: help
26help:
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"
Florin Corase2415f72023-02-28 14:51:03 -080039 @echo " UNCONFIGURE=[true|false] - unconfigure selected test"
Filip Tehlarec5c40b2023-02-28 18:59:15 +010040 @echo " DEBUG=[true|false] - attach VPP to GDB"
Filip Tehlar671cf512023-01-31 10:34:18 +010041 @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
47list-tests:
48 $(call list_tests)
49
50build-vpp-release:
51 @make -C ../.. build-release
52
53build-vpp-debug:
54 @make -C ../.. build
55
56.PHONY: test
57test: .deps.ok .build.vpp
Maros Ondrejickaaf004dd2023-02-27 16:52:57 +010058 @bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
Filip Tehlarec5c40b2023-02-28 18:59:15 +010059 --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST)
Filip Tehlar671cf512023-01-31 10:34:18 +010060
61build-go:
Filip Tehlar229f5fc2022-08-09 14:44:47 +000062 go build ./tools/http_server
Filip Tehlar229f5fc2022-08-09 14:44:47 +000063
Filip Tehlar671cf512023-01-31 10:34:18 +010064build: .deps.ok build-vpp-release build-go
65 @rm .build.vpp || exit 0
66 bash ./script/build.sh release
67 @touch .build.vpp
Filip Tehlar229f5fc2022-08-09 14:44:47 +000068
Filip Tehlar671cf512023-01-31 10:34:18 +010069build-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
75install-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
Filip Tehlarf3ee2b62023-01-09 12:07:09 +010081fixstyle:
82 @gofmt -w .
Maros Ondrejicka7d7ab102023-02-14 12:56:49 +010083 @go mod tidy
Filip Tehlarf3ee2b62023-01-09 12:07:09 +010084