Tom Jones | c3b416c | 2024-01-18 14:51:44 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Klement Sekera | f413bef | 2017-08-15 07:09:02 +0200 | [diff] [blame] | 2 | |
juraj.linkes | f18eb86 | 2018-12-03 14:08:07 +0100 | [diff] [blame] | 3 | if [ "$(ls -A ${FAILED_DIR})" ] |
Klement Sekera | f413bef | 2017-08-15 07:09:02 +0200 | [diff] [blame] | 4 | then |
Dave Wallace | 25dc167 | 2017-09-30 01:53:26 -0400 | [diff] [blame] | 5 | if [ "${COMPRESS_FAILED_TEST_LOGS}" == "yes" ] |
| 6 | then |
| 7 | echo -n "Compressing files in temporary directories from failed test runs... " |
juraj.linkes | f18eb86 | 2018-12-03 14:08:07 +0100 | [diff] [blame] | 8 | cd ${FAILED_DIR} |
Dave Wallace | 25dc167 | 2017-09-30 01:53:26 -0400 | [diff] [blame] | 9 | for d in * |
| 10 | do |
| 11 | cd ${d} |
| 12 | find . ! -path . -print0 | xargs -0 -n1 gzip |
juraj.linkes | f18eb86 | 2018-12-03 14:08:07 +0100 | [diff] [blame] | 13 | cd ${FAILED_DIR} |
Dave Wallace | 25dc167 | 2017-09-30 01:53:26 -0400 | [diff] [blame] | 14 | done |
| 15 | echo "done." |
| 16 | if [ -n "$WORKSPACE" ] |
| 17 | then |
| 18 | echo "Copying failed test logs into build log archive directory ($WORKSPACE/archives)... " |
juraj.linkes | f18eb86 | 2018-12-03 14:08:07 +0100 | [diff] [blame] | 19 | for failed_test in $(ls $FAILED_DIR) |
Dave Wallace | 25dc167 | 2017-09-30 01:53:26 -0400 | [diff] [blame] | 20 | do |
| 21 | mkdir -p $WORKSPACE/archives/$failed_test |
juraj.linkes | f18eb86 | 2018-12-03 14:08:07 +0100 | [diff] [blame] | 22 | cp -a $FAILED_DIR/$failed_test/* $WORKSPACE/archives/$failed_test |
Dave Wallace | 25dc167 | 2017-09-30 01:53:26 -0400 | [diff] [blame] | 23 | done |
| 24 | echo "done." |
| 25 | fi |
juraj.linkes | f18eb86 | 2018-12-03 14:08:07 +0100 | [diff] [blame] | 26 | |
Dave Wallace | 25dc167 | 2017-09-30 01:53:26 -0400 | [diff] [blame] | 27 | else |
| 28 | echo "Not compressing files in temporary directories from failed test runs." |
| 29 | fi |
Klement Sekera | f413bef | 2017-08-15 07:09:02 +0200 | [diff] [blame] | 30 | else |
juraj.linkes | f18eb86 | 2018-12-03 14:08:07 +0100 | [diff] [blame] | 31 | echo "No symlinks to failed tests' temporary directories found in ${FAILED_DIR}." |
Klement Sekera | f413bef | 2017-08-15 07:09:02 +0200 | [diff] [blame] | 32 | fi |
Dave Wallace | 25dc167 | 2017-09-30 01:53:26 -0400 | [diff] [blame] | 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 |