+export HS_ROOT=$(CURDIR)
ifeq ($(VERBOSE),)
VERBOSE=false
TEST=all
endif
+ifeq ($(TEST-HS),)
+TEST-HS=all
+endif
+
ifeq ($(DEBUG),)
DEBUG=false
endif
@echo " test - run tests"
@echo " test-debug - run tests (vpp debug image)"
@echo " build - build test infra"
+ @echo " build-cov - coverage build of VPP and Docker images"
@echo " build-debug - build test infra (vpp debug image)"
@echo " build-go - just build golang files"
@echo " fixstyle - format .go source files"
@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 " CPUS=[n-cpus] - number of cpus to allocate to VPP and containers"
@echo " VPPSRC=[path-to-vpp-src] - path to vpp source files (for gdb)"
@echo " PARALLEL=[n-cpus] - number of test processes to spawn to run in parallel"
@echo " REPEAT=[n] - repeat tests up to N times or until a failure occurs"
.PHONY: build-vpp-release
build-vpp-release:
- @make -C ../.. build-release
+ @$(MAKE) -C ../.. build-release
.PHONY: build-vpp-debug
build-vpp-debug:
- @make -C ../.. build
+ @$(MAKE) -C ../.. build
+
+.PHONY: build-vpp-gcov
+build-vpp-gcov:
+ @$(MAKE) -C ../.. build-vpp-gcov
.build.ok: build
@touch .build.ok
+.build.cov.ok: build-vpp-gcov
+ @touch .build.cov.ok
+
.build_debug.ok: build-debug
@touch .build.ok
.PHONY: test
test: .deps.ok .build.ok
+ # '-' ignores the exit status, it is set in compress.sh
+ # necessary so gmake won't skip executing the bash script
-bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
--unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
--vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT)
- $(call jq-summary)
@bash ./script/compress.sh
.PHONY: test-debug
test-debug: .deps.ok .build_debug.ok
- @bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
+ # '-' ignores the exit status, it is set in compress.sh
+ # necessary so gmake won't skip executing the bash script
+ -bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
--unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST) --cpus=$(CPUS) \
--vppsrc=$(VPPSRC) --parallel=$(PARALLEL) --repeat=$(REPEAT)
+ @bash ./script/compress.sh
+
+.PHONY: test-cov
+test-cov: .deps.ok .build.cov.ok
+ -bash ./test --persist=$(PERSIST) --verbose=$(VERBOSE) \
+ --unconfigure=$(UNCONFIGURE) --debug=$(DEBUG) --test=$(TEST-HS) --cpus=$(CPUS) \
+ --vppsrc=$(VPPSRC)
+ @$(MAKE) -C ../.. test-cov-post HS_TEST=1
+ @bash ./script/compress.sh
.PHONY: build-go
build-go:
bash ./script/build_hst.sh release
@touch .build.ok
+.PHONY: build-cov
+build-cov: .deps.ok build-vpp-gcov build-go
+ @rm -f .build.cov.ok
+ bash ./script/build_hst.sh gcov
+ @touch .build.cov.ok
+
.PHONY: build-debug
build-debug: .deps.ok build-vpp-debug build-go
@rm -f .build.ok
@touch .build.ok
.deps.ok:
- @sudo make install-deps
+ @sudo $(MAKE) install-deps
.PHONY: install-deps
install-deps:
fixstyle:
@gofmt -w .
@go mod tidy
-
-# splitting this into multiple lines breaks the command
-jq-summary = @jq -r '.[0] | .SpecReports[] | select(.State == "failed") | select(.Failure != null) | "TestName: \(.LeafNodeText)\nMessage:\n\(.Failure.Message)\n Full Stack Trace:\n\(.Failure.Location.FullStackTrace)\n"' summary/report.json > summary/failed-summary.log \
- && echo "Summary generated -> failed-summary.log"