9559e2acde567cfbc504ccc93007e9d764612c7e
[vpp.git] / test / scripts / compress_failed.sh
1 #!/bin/bash
2
3 if [ "$(ls -A ${VPP_TEST_FAILED_DIR})" ]
4 then
5     if [ "${COMPRESS_FAILED_TEST_LOGS}" == "yes" ]
6     then
7         echo -n "Compressing files in temporary directories from failed test runs... "
8         cd ${VPP_TEST_FAILED_DIR}
9         for d in *
10         do
11             cd ${d}
12             find . ! -path . -print0 | xargs -0 -n1 gzip
13             cd ${VPP_TEST_FAILED_DIR}
14         done
15         echo "done."
16         if [ -n "$WORKSPACE" ]
17         then
18             echo "Copying failed test logs into build log archive directory ($WORKSPACE/archives)... "
19             for failed_test in $(ls $VPP_TEST_FAILED_DIR)
20             do
21                 mkdir -p $WORKSPACE/archives/$failed_test
22                 cp -a $VPP_TEST_FAILED_DIR/$failed_test/* $WORKSPACE/archives/$failed_test
23             done
24             echo "done."
25         fi
26         
27     else
28         echo "Not compressing files in temporary directories from failed test runs."
29     fi
30 else
31     echo "No symlinks to failed tests' temporary directories found in ${VPP_TEST_FAILED_DIR}."
32 fi
33
34 # This script gets run only if there was a 'make test' failure,
35 # so return failure error status so that the build results are
36 # recorded correctly.
37 exit 1