summaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rw-r--r--extras/hs-test/Makefile13
-rw-r--r--extras/hs-test/script/compress.sh53
-rw-r--r--[-rwxr-xr-x]extras/hs-test/test3
3 files changed, 36 insertions, 33 deletions
diff --git a/extras/hs-test/Makefile b/extras/hs-test/Makefile
index 6ee89bc2770..e247bf44160 100644
--- a/extras/hs-test/Makefile
+++ b/extras/hs-test/Makefile
@@ -1,3 +1,4 @@
+export HS_ROOT=$(CURDIR)
ifeq ($(VERBOSE),)
VERBOSE=false
@@ -95,17 +96,21 @@ build-vpp-debug:
.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: build-go
build-go:
@@ -144,7 +149,3 @@ 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"
diff --git a/extras/hs-test/script/compress.sh b/extras/hs-test/script/compress.sh
index 92a2fbd6789..1f0205c1efb 100644
--- a/extras/hs-test/script/compress.sh
+++ b/extras/hs-test/script/compress.sh
@@ -1,34 +1,33 @@
#!/usr/bin/env bash
-if [ "${COMPRESS_FAILED_TEST_LOGS}" == "yes" -a -s "${HS_SUMMARY}/failed-summary.log" ]
+# if failed-summary.log is not empty, exit status = 1
+if [ -s "${HS_ROOT}/summary/failed-summary.log" ]
then
- echo -n "Copying docker logs..."
- dirs=$(jq -r '.[0] | .SpecReports[] | select(.State == "failed") | .LeafNodeText' ${HS_SUMMARY}/report.json)
- for dirName in $dirs; do
- logDir=/tmp/hs-test/$dirName
- if [ -d "$logDir" ]; then
- mkdir -p $WORKSPACE/archives/summary
- cp -r $logDir $WORKSPACE/archives/summary/
- fi
- done
- echo "Done."
-
- if [ -n "$WORKSPACE" ]
+ if [ -n "${WORKSPACE}" ]
then
- echo -n "Copying failed test logs into build log archive directory ($WORKSPACE/archives)... "
- mkdir -p $WORKSPACE/archives/summary
- cp -a ${HS_SUMMARY}/* $WORKSPACE/archives/summary
- echo "Done."
- fi
+ echo -n "Copying docker logs..."
+ dirs=$(jq -r '.[0] | .SpecReports[] | select(.State == "failed") | .LeafNodeText' ${HS_ROOT}/summary/report.json)
+ for dirName in $dirs; do
+ logDir=/tmp/hs-test/$dirName
+ if [ -d "$logDir" ]; then
+ mkdir -p ${WORKSPACE}/archives/summary
+ cp -r $logDir ${WORKSPACE}/archives/summary/
+ fi
+ done
+ echo "Done."
- echo -n "Compressing files in $WORKSPACE/archives from test runs... "
- cd $WORKSPACE/archives
- find . -type f \( -name "*.json" -o -name "*.log" \) -exec gzip {} \;
- echo "Done."
+ echo -n "Copying failed test logs into build log archive directory (${WORKSPACE}/archives)... "
+ mkdir -p ${WORKSPACE}/archives/summary
+ cp -a ${HS_ROOT}/summary/* ${WORKSPACE}/archives/summary
+ echo "Done."
-else
- echo "Not compressing files in temporary directories from test runs."
- exit 0
-fi
+ echo -n "Compressing files in ${WORKSPACE}/archives from test runs... "
+ cd ${WORKSPACE}/archives
+ find . -type f \( -name "*.json" -o -name "*.log" \) -exec gzip {} \;
+ echo "Done."
-exit 1 \ No newline at end of file
+ else
+ echo "Not compressing files in temporary directories from test runs."
+ fi
+ exit 1
+fi
diff --git a/extras/hs-test/test b/extras/hs-test/test
index fd17feb2c50..398e2b39edb 100755..100644
--- a/extras/hs-test/test
+++ b/extras/hs-test/test
@@ -89,3 +89,6 @@ fi
mkdir -p summary
sudo -E go run github.com/onsi/ginkgo/v2/ginkgo --no-color --trace --json-report=summary/report.json $ginkgo_args -- $args
+
+jq -r '.[0] | .SpecReports[] | select((.State == "failed") or (.State == "timedout") or (.State == "panicked")) | select(.Failure != null) | "TestName: \(.LeafNodeText)\nSuite:\n\(.Failure.Location.FileName)\nMessage:\n\(.Failure.Message)\n Full Stack Trace:\n\(.Failure.Location.FullStackTrace)\n"' summary/report.json > summary/failed-summary.log \
+ && echo "Summary generated -> summary/failed-summary.log" \ No newline at end of file