Files
vpp/extras/hs-test/script/compress.sh
Adrian Villin 514098ee82 hs-test: various improvements
- fixed timed out/panicked tests not copying logs to CI archives
- fixed log formatting
- renamed SuiteTimeout to TestTimeout
- fixed ginkgo node leak on test timeout -> added AssertChannelClosed
- updated docs

Type: test

Change-Id: Ia71d765bd61576230a4cfd26d4b14fd1be1692c7
Signed-off-by: Adrian Villin <avillin@cisco.com>
2024-10-15 16:49:40 +00:00

43 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
if [ $1 == 2 ]
then
exit 1
fi
# if failed-summary.log is not empty, exit status = 1
if [ -s "${HS_ROOT}/summary/failed-summary.log" ]
then
if [ -n "${WORKSPACE}" ]
then
echo -n "Copying docker logs..."
dirs=$(jq -r '.[0] | .SpecReports[] | select((.State == "failed") or (.State == "timedout") or (.State == "panicked")) | .LeafNodeText | split("/")[1]' ${HS_ROOT}/summary/report.json)
for dirName in $dirs; do
logDir=/tmp/hs-test/$dirName
if [ -d "$logDir" ]; then
mkdir -p ${WORKSPACE}/archives/summary
rsync -a --exclude 'volumes' $logDir ${WORKSPACE}/archives/summary/
fi
done
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."
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."
else
echo "Not compressing files in temporary directories from test runs."
fi
echo "*************************** SUMMARY ***************************"
cat "${HS_ROOT}/summary/failed-summary.log"
exit 1
else
exit $1
fi