Missing quote was courtesy of is-tty lacking trailing semi-colon. Refactor test report paths into vars to shorten coverage command line and have named files to for clean target to remove
Change-Id: I30bed3351f69aee67167ca13dba71bad7357928d
diff --git a/Makefile b/Makefile
index 06f8525..3c63603 100644
--- a/Makefile
+++ b/Makefile
@@ -121,13 +121,22 @@
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
+coverage-out := ./tests/results/go-test-coverage.out
+coverage-xml := ./tests/results/go-test-coverage.xml
+
+results-out := ./tests/results/go-test-results.out
+results-xml := ./tests/results/go-test-results.xml
+
test-unit: clean local-omci-lib-go # @HELP Execute unit tests
@echo "Running unit tests..."
@mkdir -p ./tests/results
- @${GO} test -mod=vendor -bench=. -v -coverprofile ./tests/results/go-test-coverage.out -covermode count ./... 2>&1 | tee ./tests/results/go-test-results.out ;\
+ @${GO} test -mod=vendor -bench=. -v \
+ -coverprofile $(coverage-out) \
+ -covermode count ./... \
+ 2>&1 | tee $(results-out) ;\
RETURN=$$? ;\
- ${GO_JUNIT_REPORT} < ./tests/results/go-test-results.out > ./tests/results/go-test-results.xml ;\
- ${GOCOVER_COBERTURA} < ./tests/results/go-test-coverage.out > ./tests/results/go-test-coverage.xml ;\
+ ${GO_JUNIT_REPORT} < $(results-out) > $(results-xml) ;\
+ ${GOCOVER_COBERTURA} < $(coverage-out) > $(coverage-xml) ;\
exit $$RETURN
## -----------------------------------------------------------------------
@@ -139,6 +148,12 @@
docker $(RM) -f bbsim
## -----------------------------------------------------------------------
+## Intgent: Update sources in the vendor/ directory.
+## Todo:
+## o chicken-n-egg problem:
+## - vendor/ is under revision control
+## - go mod tidy will delete vendor
+## - sandbox left unbuildable when mod-update target fails.
## -----------------------------------------------------------------------
mod-update: # @HELP Download the dependencies to the vendor folder
${GO} mod tidy
@@ -238,6 +253,12 @@
@$(RM) -r tools/bin
@$(RM) -r release
+ @$(RM) $(coverage-out)
+ @$(RM) $(coverage-xml)
+
+ @$(RM) $(results-out)
+ @$(RM) $(results-xml)
+
sterile :: clean
## -----------------------------------------------------------------------
diff --git a/makefiles/tools.mk b/makefiles/tools.mk
index 03aeb9d..b1bab03 100644
--- a/makefiles/tools.mk
+++ b/makefiles/tools.mk
@@ -35,7 +35,7 @@
## --interactive: Attach streams if running interactively (!jenkins)
## --tty : Attach stdout else jenkins::docker is silent.
## -----------------------------------------------------------------------
-is-stdin = $(shell test -t 0 && { echo '--interactive' })
+is-stdin = $(shell test -t 0 && { echo '--interactive'; })
is-stdin += --tty
# Docker volume mounts: container:/app/release <=> localhost:{pwd}/release
diff --git a/tests/results/.gitignore b/tests/results/.gitignore
index d6b7ef3..28da4c4 100644
--- a/tests/results/.gitignore
+++ b/tests/results/.gitignore
@@ -1,2 +1,8 @@
+# -*- makefile -*-
+
*
!.gitignore
+*.out
+*.xml
+
+# [EOF]
\ No newline at end of file