diff options
author | Adrian Villin <avillin@cisco.com> | 2025-01-30 19:14:24 +0100 |
---|---|---|
committer | Adrian Villin <avillin@cisco.com> | 2025-01-31 08:02:36 +0000 |
commit | d39fa81d599f53d67994e79c6816369688d8f4cd (patch) | |
tree | cb8e01f28fe9da91adf5cc97d83c9ab615618ce0 | |
parent | d35f7f0988cc891dac29be0ae2b343d13f03f985 (diff) |
hs-test: fixed incorrect exit status
Type: fix
Change-Id: Icabe556448ad7109f4802ad48a701667911652de
Signed-off-by: Adrian Villin <avillin@cisco.com>
-rw-r--r-- | extras/hs-test/hs_test.sh | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/extras/hs-test/hs_test.sh b/extras/hs-test/hs_test.sh index 59edf57afc2..4a9378c60b4 100644 --- a/extras/hs-test/hs_test.sh +++ b/extras/hs-test/hs_test.sh @@ -140,25 +140,40 @@ fi mkdir -p summary # shellcheck disable=SC2086 sudo -E go run github.com/onsi/ginkgo/v2/ginkgo --json-report=summary/report.json $ginkgo_args -- $args +exit_status=$? -if [ $? != 0 ]; then +if [ -e "summary/failed-summary.log" ]; then + rm summary/failed-summary.log +fi + +if [ $exit_status != 0 ]; then jq -r '.[0] | .SpecReports[] | select((.State == "failed") or (.State == "timedout") or (.State == "panicked")) | select(.Failure != null) | "TestName: \(.LeafNodeText) Suite: \(.Failure.FailureNodeLocation.FileName) Message:\n" -+(if .ReportEntries? then .ReportEntries[] | select(.Name == "VPP Backtrace") | -"\tVPP crashed ++ ( + if .ReportEntries? then + (.ReportEntries[] | select(.Name == "VPP Backtrace") | + "\tVPP crashed Full Back Trace: -\(.Value.Representation | ltrimstr("{{red}}") | rtrimstr("{{/}}"))" else - "\(.Failure.Message)" - + (if .Failure.Message == "A spec timeout occurred" then "\n" else -"\nFull Stack Trace: -\(.Failure.Location.FullStackTrace)\n" end) end)' summary/report.json > summary/failed-summary.log \ - && echo "Summary generated -> summary/failed-summary.log" +\(.Value.Representation | ltrimstr("{{red}}") | rtrimstr("{{/}}"))" + ) // "\(.Failure.Message)" + else + "parse error" + end +) ++ ( + if .Failure.Message == "A spec timeout occurred" then + "\n" + else + "\nFull Stack Trace: +\(.Failure.Location.FullStackTrace)\n" + end +)' summary/report.json > summary/failed-summary.log \ +&& echo "Summary generated -> summary/failed-summary.log" + exit $exit_status else - if [ -e "summary/failed-summary.log" ]; then - rm summary/failed-summary.log - fi + exit $exit_status fi |