X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=extras%2Fhs-test%2FMakefile;h=3d7673a7267dbc558f9cf954188e8e32553a510b;hb=608d0069d98579b0635be978dea8e316f77a8841;hp=7460026ed52b4529d1f14f66bf91a16a7008b72c;hpb=671cf51d6d0b08c216a99696aa30f17faff5e653;p=vpp.git diff --git a/extras/hs-test/Makefile b/extras/hs-test/Makefile index 7460026ed52..3d7673a7267 100644 --- a/extras/hs-test/Makefile +++ b/extras/hs-test/Makefile @@ -7,10 +7,30 @@ ifeq ($(PERSIST),) PERSIST=false endif +ifeq ($(UNCONFIGURE),) +UNCONFIGURE=false +endif + ifeq ($(TEST),) TEST=all endif +ifeq ($(DEBUG),) +DEBUG=false +endif + +ifeq ($(CPUS),) +CPUS=1 +endif + +ifeq ($(UBUNTU_CODENAME),) +UBUNTU_CODENAME=$(shell grep '^UBUNTU_CODENAME=' /etc/os-release | cut -f2- -d=) +endif + +ifeq ($(ARCH),) +ARCH=$(shell dpkg --print-architecture) +endif + list_tests = @(grep -r ') Test' *_test.go | cut -d '*' -f2 | cut -d '(' -f1 | \ tr -d ' ' | tr ')' '/' | sed 's/Suite//') @@ -28,7 +48,10 @@ help: @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" + @echo " UNCONFIGURE=[true|false] - unconfigure selected test" + @echo " DEBUG=[true|false] - attach VPP to GDB" @echo " TEST=[test-name] - specific test to run" + @echo " CPUS=[n-cpus] - number of cpus to run with vpp" @echo @echo "List of all tests:" $(call list_tests) @@ -45,29 +68,41 @@ build-vpp-debug: .PHONY: test test: .deps.ok .build.vpp - @bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) --test=$(TEST) + @bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \ + --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) build-go: go build ./tools/http_server build: .deps.ok build-vpp-release build-go - @rm .build.vpp || exit 0 + @rm -f .build.vpp bash ./script/build.sh release @touch .build.vpp build-debug: .deps.ok build-vpp-debug build-go - @rm .build.vpp || exit 0 + @rm -f .build.vpp bash ./script/build.sh debug @touch .build.vpp +.deps.ok: + @sudo make install-deps + .PHONY: install-deps install-deps: - @rm .deps.ok || exit 0 - @apt update -y && apt install -y golang docker-ce apache2-utils wrk bridge-utils + @rm -f .deps.ok + @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 @touch .deps.ok .PHONY: fixstyle fixstyle: @gofmt -w . @go mod tidy -