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 | |
Filip Tehlar | ec5c40b | 2023-02-28 18:59:15 +0100 | [diff] [blame] | 18 | ifeq ($(DEBUG),) |
| 19 | DEBUG=false |
| 20 | endif |
| 21 | |
Dave Wallace | 05120fb | 2023-03-07 22:09:20 -0500 | [diff] [blame] | 22 | ifeq ($(UBUNTU_CODENAME),) |
| 23 | UBUNTU_CODENAME=$(shell grep '^UBUNTU_CODENAME=' /etc/os-release | cut -f2- -d=) |
| 24 | endif |
| 25 | |
| 26 | ifeq ($(ARCH),) |
| 27 | ARCH=$(shell dpkg --print-architecture) |
| 28 | endif |
| 29 | |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 30 | list_tests = @(grep -r ') Test' *_test.go | cut -d '*' -f2 | cut -d '(' -f1 | \ |
| 31 | tr -d ' ' | tr ')' '/' | sed 's/Suite//') |
| 32 | |
| 33 | .PHONY: help |
| 34 | help: |
| 35 | @echo "Make targets:" |
| 36 | @echo " test - run tests" |
| 37 | @echo " build - build test infra" |
| 38 | @echo " build-debug - build test infra (vpp debug image)" |
| 39 | @echo " build-go - just build golang files" |
| 40 | @echo " fixstyle - format .go source files" |
| 41 | @echo " list-tests - list all tests" |
| 42 | @echo |
| 43 | @echo "Make arguments:" |
| 44 | @echo " UBUNTU_VERSION - ubuntu version for docker image" |
| 45 | @echo " PERSIST=[true|false] - whether clean up topology and dockers after test" |
| 46 | @echo " VERBOSE=[true|false] - verbose output" |
Florin Coras | e2415f7 | 2023-02-28 14:51:03 -0800 | [diff] [blame] | 47 | @echo " UNCONFIGURE=[true|false] - unconfigure selected test" |
Filip Tehlar | ec5c40b | 2023-02-28 18:59:15 +0100 | [diff] [blame] | 48 | @echo " DEBUG=[true|false] - attach VPP to GDB" |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 49 | @echo " TEST=[test-name] - specific test to run" |
| 50 | @echo |
| 51 | @echo "List of all tests:" |
| 52 | $(call list_tests) |
| 53 | |
| 54 | .PHONY: list-tests |
| 55 | list-tests: |
| 56 | $(call list_tests) |
| 57 | |
| 58 | build-vpp-release: |
| 59 | @make -C ../.. build-release |
| 60 | |
| 61 | build-vpp-debug: |
| 62 | @make -C ../.. build |
| 63 | |
| 64 | .PHONY: test |
| 65 | test: .deps.ok .build.vpp |
Maros Ondrejicka | af004dd | 2023-02-27 16:52:57 +0100 | [diff] [blame] | 66 | @bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \ |
Filip Tehlar | ec5c40b | 2023-02-28 18:59:15 +0100 | [diff] [blame] | 67 | --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 68 | |
| 69 | build-go: |
Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 70 | go build ./tools/http_server |
Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 71 | |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 72 | build: .deps.ok build-vpp-release build-go |
Dave Wallace | 05120fb | 2023-03-07 22:09:20 -0500 | [diff] [blame] | 73 | @rm -f .build.vpp |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 74 | bash ./script/build.sh release |
| 75 | @touch .build.vpp |
Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 76 | |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 77 | build-debug: .deps.ok build-vpp-debug build-go |
Dave Wallace | 05120fb | 2023-03-07 22:09:20 -0500 | [diff] [blame] | 78 | @rm -f .build.vpp |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 79 | bash ./script/build.sh debug |
| 80 | @touch .build.vpp |
| 81 | |
| 82 | .PHONY: install-deps |
| 83 | install-deps: |
Dave Wallace | 05120fb | 2023-03-07 22:09:20 -0500 | [diff] [blame] | 84 | @rm -f .deps.ok |
Dave Wallace | f72bb6f | 2023-03-08 13:53:32 -0500 | [diff] [blame] | 85 | @apt-get update \ |
| 86 | && apt-get install -y apt-transport-https ca-certificates curl software-properties-common \ |
| 87 | && apt-get install -y golang apache2-utils wrk bridge-utils |
| 88 | @if [ ! -f /usr/share/keyrings/docker-archive-keyring.gpg ] ; then \ |
| 89 | curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg; \ |
| 90 | echo "deb [arch=$(ARCH) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(UBUNTU_CODENAME) stable" \ |
| 91 | | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ; \ |
| 92 | apt-get update; \ |
| 93 | fi |
| 94 | @apt-get install -y docker-ce |
Filip Tehlar | 671cf51 | 2023-01-31 10:34:18 +0100 | [diff] [blame] | 95 | @touch .deps.ok |
| 96 | |
| 97 | .PHONY: fixstyle |
Filip Tehlar | f3ee2b6 | 2023-01-09 12:07:09 +0100 | [diff] [blame] | 98 | fixstyle: |
| 99 | @gofmt -w . |
Maros Ondrejicka | 7d7ab10 | 2023-02-14 12:56:49 +0100 | [diff] [blame] | 100 | @go mod tidy |