vpp/test/scripts/compress_failed.sh
Tom Jones c3b416c492 build: Explicitly use bash for shell scripts
VPP requires bash for all shell scripts. Align shebang lines in build
and test scripts to look up the location of bash rather than hard coding
'/bin/bash'.

Look up the location of bash for makefiles.

Type: improvement
Change-Id: I23b705d81d60389fa8af61c680cf0abd74f0ea24
Signed-off-by: Tom Jones <thj@freebsd.org>
2024-01-19 12:30:01 +00:00

38 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
if [ "$(ls -A ${FAILED_DIR})" ]
then
if [ "${COMPRESS_FAILED_TEST_LOGS}" == "yes" ]
then
echo -n "Compressing files in temporary directories from failed test runs... "
cd ${FAILED_DIR}
for d in *
do
cd ${d}
find . ! -path . -print0 | xargs -0 -n1 gzip
cd ${FAILED_DIR}
done
echo "done."
if [ -n "$WORKSPACE" ]
then
echo "Copying failed test logs into build log archive directory ($WORKSPACE/archives)... "
for failed_test in $(ls $FAILED_DIR)
do
mkdir -p $WORKSPACE/archives/$failed_test
cp -a $FAILED_DIR/$failed_test/* $WORKSPACE/archives/$failed_test
done
echo "done."
fi
else
echo "Not compressing files in temporary directories from failed test runs."
fi
else
echo "No symlinks to failed tests' temporary directories found in ${FAILED_DIR}."
fi
# This script gets run only if there was a 'make test' failure,
# so return failure error status so that the build results are
# recorded correctly.
exit 1