summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorShyamsundarR <srangana@redhat.com>2018-08-14 14:00:41 -0400
committerAtin Mukherjee <amukherj@redhat.com>2018-08-27 02:42:19 +0000
commitd34455a2d2d267c545c25ad7fa710ae2677d5afb (patch)
tree5d8ea2230b8168045536c91d182862c57a9bb729 /tests
parent43f037f6b10c5b1da1b56bc4e2ae4c4ae5c475ec (diff)
tests: Preserve tarball of tests when they timeout
When tests timeout, the timeout command sends TERM signal to the command being executed. In the case of run-tests.sh it invokes prove, which further invokes perl and finally the test is run using bash. The TERM signal does not seem to be reachnig the end bash that is actually executing the tests, and hence when any test is terminated due to a timeout, the cleanup routine in include.rc does not get a chance to run and preserve the tarball. Further, cleanup invokes tarball generation, but is invoked at the beginning and end of every test, and at times in beteween as well. This caused way too many tarballs in case we decide to preserve the same whenever generated by cleanup. This patch hence moves the tarball generation to run-tests.sh instead, and further stores them named <test>-iteration-<n>.tar and also prints tarball name generated and stored per iteration. This should help relate failed runs to the tarball iteration # and to look at relevant logs. Further the patch also provides a -p option to run-tests.sh for unit testing purposes, where running a test in a loop without the option will generate as many tarballs, and using the option will reduce this to preserving the last tarball, saving space in smaller unit test setups. Fixes: bz#1614062 Change-Id: I0aee76c89df0691cf4d0c1fcd4c04dffe0d7c896 Signed-off-by: ShyamsundarR <srangana@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/include.rc18
1 files changed, 0 insertions, 18 deletions
diff --git a/tests/include.rc b/tests/include.rc
index 5692754563a..d76f13b8d07 100644
--- a/tests/include.rc
+++ b/tests/include.rc
@@ -680,24 +680,6 @@ function cleanup()
return 1;
fi >&2
- # tar logs at the start and end of every test
- if [ -n "$LOGDIR" -a -z "$STOP_WASTING_SPACE" ]
- then
- tarname=$(basename $0 .t)
- # Can't use --exclude here because NetBSD doesn't have it.
- # However, both it and Linux have -X to take patterns from
- # a file, so use that.
- (echo '*.tar'; echo .notar) > ${LOGDIR}/.notar \
- && \
- tar -cf ${LOGDIR}/${tarname}.tar -X ${LOGDIR}/.notar \
- ${LOGDIR}/* 2> /dev/null \
- && \
- find $LOGDIR/* -maxdepth 0 -name '*.tar' -prune \
- -o -exec rm -rf '{}' ';'
- else
- echo "LOGDIR is not set"
- fi
-
mkdir -p $WORKDIRS
# This is usually the last thing a test script calls, so our return
# value becomes their exit value. While it's not great for the mkdir