Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 1 | |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 2 | ifeq ($(VERBOSE),) |
| 3 | VERBOSE=false |
| 4 | endif |
Maros Ondrejicka | 2ddb2fd | 2023-02-15 17:44:46 +0100 | [diff] [blame] | 5 | |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 6 | ifeq ($(PERSIST),) |
| 7 | PERSIST=false |
| 8 | endif |
| 9 | |
Maros Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame] | 10 | ifeq ($(UNCONFIGURE),) |
| 11 | UNCONFIGURE=false |
| 12 | endif |
| 13 | |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 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" |
Florin Coras | e2415f7 | 2023-02-28 14:51:03 -0800 | [diff] [blame] | 35 | @echo " UNCONFIGURE=[true|false] - unconfigure selected test" |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 36 | @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 |
| 42 | list-tests: |
| 43 | $(call list_tests) |
| 44 | |
| 45 | build-vpp-release: |
| 46 | @make -C ../.. build-release |
| 47 | |
| 48 | build-vpp-debug: |
| 49 | @make -C ../.. build |
| 50 | |
| 51 | .PHONY: test |
| 52 | test: .deps.ok .build.vpp |
Maros Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame] | 53 | @bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \ |
| 54 | --unconfigure=$(UNCONFIGURE) --test=$(TEST) |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 55 | |
| 56 | build-go: |
Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 57 | go build ./tools/http_server |
Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 58 | |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 59 | build: .deps.ok build-vpp-release build-go |
| 60 | @rm .build.vpp || exit 0 |
| 61 | bash ./script/build.sh release |
| 62 | @touch .build.vpp |
Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 63 | |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 64 | build-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 |
| 70 | install-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 Tehlar | f3ee2b6 | 2023-01-09 12:07:09 +0100 | [diff] [blame] | 76 | fixstyle: |
| 77 | @gofmt -w . |
Maros Ondrejicka | 7d7ab10 | 2023-02-14 12:56:49 +0100 | [diff] [blame] | 78 | @go mod tidy |
Filip Tehlar | f3ee2b6 | 2023-01-09 12:07:09 +0100 | [diff] [blame] | 79 | |