blob: 268a518b7ca35982ef62955cd19239ec5823b2fa [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
18list_tests = @(grep -r ') Test' *_test.go | cut -d '*' -f2 | cut -d '(' -f1 | \
19 tr -d ' ' | tr ')' '/' | sed 's/Suite//')
20
21.PHONY: help
22help:
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"
Florin Corase2415f72023-02-28 14:51:03 -080035 @echo " UNCONFIGURE=[true|false] - unconfigure selected test"
Filip Tehlar671cf512023-01-31 10:34:18 +010036 @echo " TEST=[test-name] - specific test to run"
37 @echo
38 @echo "List of all tests:"
39 $(call list_tests)
40
41.PHONY: list-tests
42list-tests:
43 $(call list_tests)
44
45build-vpp-release:
46 @make -C ../.. build-release
47
48build-vpp-debug:
49 @make -C ../.. build
50
51.PHONY: test
52test: .deps.ok .build.vpp
Maros Ondrejickaaf004dd2023-02-27 16:52:57 +010053 @bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
54 --unconfigure=$(UNCONFIGURE) --test=$(TEST)
Filip Tehlar671cf512023-01-31 10:34:18 +010055
56build-go:
Filip Tehlar229f5fc2022-08-09 14:44:47 +000057 go build ./tools/http_server
Filip Tehlar229f5fc2022-08-09 14:44:47 +000058
Filip Tehlar671cf512023-01-31 10:34:18 +010059build: .deps.ok build-vpp-release build-go
60 @rm .build.vpp || exit 0
61 bash ./script/build.sh release
62 @touch .build.vpp
Filip Tehlar229f5fc2022-08-09 14:44:47 +000063
Filip Tehlar671cf512023-01-31 10:34:18 +010064build-debug: .deps.ok build-vpp-debug build-go
65 @rm .build.vpp || exit 0
66 bash ./script/build.sh debug
67 @touch .build.vpp
68
69.PHONY: install-deps
70install-deps:
71 @rm .deps.ok || exit 0
72 @apt update -y && apt install -y golang docker-ce apache2-utils wrk bridge-utils
73 @touch .deps.ok
74
75.PHONY: fixstyle
Filip Tehlarf3ee2b62023-01-09 12:07:09 +010076fixstyle:
77 @gofmt -w .
Maros Ondrejicka7d7ab102023-02-14 12:56:49 +010078 @go mod tidy
Filip Tehlarf3ee2b62023-01-09 12:07:09 +010079