2022-08-09 14:44:47 +00:00
|
|
|
|
2023-01-31 10:34:18 +01:00
|
|
|
ifeq ($(VERBOSE),)
|
|
|
|
VERBOSE=false
|
|
|
|
endif
|
2023-02-15 17:44:46 +01:00
|
|
|
|
2023-01-31 10:34:18 +01:00
|
|
|
ifeq ($(PERSIST),)
|
|
|
|
PERSIST=false
|
|
|
|
endif
|
|
|
|
|
2023-02-27 16:52:57 +01:00
|
|
|
ifeq ($(UNCONFIGURE),)
|
|
|
|
UNCONFIGURE=false
|
|
|
|
endif
|
|
|
|
|
2023-01-31 10:34:18 +01:00
|
|
|
ifeq ($(TEST),)
|
|
|
|
TEST=all
|
|
|
|
endif
|
|
|
|
|
2023-02-28 18:59:15 +01:00
|
|
|
ifeq ($(DEBUG),)
|
|
|
|
DEBUG=false
|
|
|
|
endif
|
|
|
|
|
2023-03-07 22:09:20 -05:00
|
|
|
ifeq ($(UBUNTU_CODENAME),)
|
|
|
|
UBUNTU_CODENAME=$(shell grep '^UBUNTU_CODENAME=' /etc/os-release | cut -f2- -d=)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(ARCH),)
|
|
|
|
ARCH=$(shell dpkg --print-architecture)
|
|
|
|
endif
|
|
|
|
|
2023-01-31 10:34:18 +01:00
|
|
|
list_tests = @(grep -r ') Test' *_test.go | cut -d '*' -f2 | cut -d '(' -f1 | \
|
|
|
|
tr -d ' ' | tr ')' '/' | sed 's/Suite//')
|
|
|
|
|
|
|
|
.PHONY: help
|
|
|
|
help:
|
|
|
|
@echo "Make targets:"
|
|
|
|
@echo " test - run tests"
|
|
|
|
@echo " build - build test infra"
|
|
|
|
@echo " build-debug - build test infra (vpp debug image)"
|
|
|
|
@echo " build-go - just build golang files"
|
|
|
|
@echo " fixstyle - format .go source files"
|
|
|
|
@echo " list-tests - list all tests"
|
|
|
|
@echo
|
|
|
|
@echo "Make arguments:"
|
|
|
|
@echo " UBUNTU_VERSION - ubuntu version for docker image"
|
|
|
|
@echo " PERSIST=[true|false] - whether clean up topology and dockers after test"
|
|
|
|
@echo " VERBOSE=[true|false] - verbose output"
|
2023-02-28 14:51:03 -08:00
|
|
|
@echo " UNCONFIGURE=[true|false] - unconfigure selected test"
|
2023-02-28 18:59:15 +01:00
|
|
|
@echo " DEBUG=[true|false] - attach VPP to GDB"
|
2023-01-31 10:34:18 +01:00
|
|
|
@echo " TEST=[test-name] - specific test to run"
|
|
|
|
@echo
|
|
|
|
@echo "List of all tests:"
|
|
|
|
$(call list_tests)
|
|
|
|
|
|
|
|
.PHONY: list-tests
|
|
|
|
list-tests:
|
|
|
|
$(call list_tests)
|
|
|
|
|
|
|
|
build-vpp-release:
|
|
|
|
@make -C ../.. build-release
|
|
|
|
|
|
|
|
build-vpp-debug:
|
|
|
|
@make -C ../.. build
|
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test: .deps.ok .build.vpp
|
2023-02-27 16:52:57 +01:00
|
|
|
@bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
|
2023-02-28 18:59:15 +01:00
|
|
|
--unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST)
|
2023-01-31 10:34:18 +01:00
|
|
|
|
|
|
|
build-go:
|
2022-08-09 14:44:47 +00:00
|
|
|
go build ./tools/http_server
|
|
|
|
|
2023-01-31 10:34:18 +01:00
|
|
|
build: .deps.ok build-vpp-release build-go
|
2023-03-07 22:09:20 -05:00
|
|
|
@rm -f .build.vpp
|
2023-01-31 10:34:18 +01:00
|
|
|
bash ./script/build.sh release
|
|
|
|
@touch .build.vpp
|
|
|
|
|
|
|
|
build-debug: .deps.ok build-vpp-debug build-go
|
2023-03-07 22:09:20 -05:00
|
|
|
@rm -f .build.vpp
|
2023-01-31 10:34:18 +01:00
|
|
|
bash ./script/build.sh debug
|
|
|
|
@touch .build.vpp
|
|
|
|
|
|
|
|
.PHONY: install-deps
|
|
|
|
install-deps:
|
2023-03-07 22:09:20 -05:00
|
|
|
@rm -f .deps.ok
|
2023-03-08 13:53:32 -05:00
|
|
|
@apt-get update \
|
|
|
|
&& apt-get install -y apt-transport-https ca-certificates curl software-properties-common \
|
|
|
|
&& apt-get install -y golang apache2-utils wrk bridge-utils
|
|
|
|
@if [ ! -f /usr/share/keyrings/docker-archive-keyring.gpg ] ; then \
|
|
|
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg; \
|
|
|
|
echo "deb [arch=$(ARCH) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(UBUNTU_CODENAME) stable" \
|
|
|
|
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ; \
|
|
|
|
apt-get update; \
|
|
|
|
fi
|
|
|
|
@apt-get install -y docker-ce
|
2023-01-31 10:34:18 +01:00
|
|
|
@touch .deps.ok
|
2022-08-09 14:44:47 +00:00
|
|
|
|
2023-01-31 10:34:18 +01:00
|
|
|
.PHONY: fixstyle
|
2023-01-09 12:07:09 +01:00
|
|
|
fixstyle:
|
|
|
|
@gofmt -w .
|
2023-02-14 12:56:49 +01:00
|
|
|
@go mod tidy
|