summaryrefslogtreecommitdiffstats
path: root/extras/hs-test/Makefile
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2023-01-31 10:34:18 +0100
committerFilip Tehlar <ftehlar@cisco.com>2023-02-24 14:38:15 +0100
commit671cf51d6d0b08c216a99696aa30f17faff5e653 (patch)
tree569ca122ed05396a4174c91c775d289b75769cf4 /extras/hs-test/Makefile
parent182d2b466d158de4b2320fd280c1e7beb5bb37e4 (diff)
hs-test: improve test infra
- add support for building/running debug/release images - have one point of control (Makefile) - list all test cases Type: test Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: I97949abc2fff85d7a2b3784122be159aeec72b52
Diffstat (limited to 'extras/hs-test/Makefile')
-rw-r--r--extras/hs-test/Makefile71
1 files changed, 64 insertions, 7 deletions
diff --git a/extras/hs-test/Makefile b/extras/hs-test/Makefile
index c4eadabf869..7460026ed52 100644
--- a/extras/hs-test/Makefile
+++ b/extras/hs-test/Makefile
@@ -1,16 +1,73 @@
-all: build docker
-install-dep:
- apt update -y && apt install -y golang docker-ce apache2-utils wrk bridge-utils
+ifeq ($(VERBOSE),)
+VERBOSE=false
+endif
-build:
+ifeq ($(PERSIST),)
+PERSIST=false
+endif
+
+ifeq ($(TEST),)
+TEST=all
+endif
+
+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"
+ @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
+ @bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) --test=$(TEST)
+
+build-go:
go build ./tools/http_server
-docker:
- bash ./script/build.sh
+build: .deps.ok build-vpp-release build-go
+ @rm .build.vpp || exit 0
+ bash ./script/build.sh release
+ @touch .build.vpp
+
+build-debug: .deps.ok build-vpp-debug build-go
+ @rm .build.vpp || exit 0
+ bash ./script/build.sh debug
+ @touch .build.vpp
+
+.PHONY: install-deps
+install-deps:
+ @rm .deps.ok || exit 0
+ @apt update -y && apt install -y golang docker-ce apache2-utils wrk bridge-utils
+ @touch .deps.ok
+.PHONY: fixstyle
fixstyle:
@gofmt -w .
@go mod tidy
-.PHONY: docker