From b9a5d85d15ed82477a2491e55d6322e3d0d3d29a Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Sun, 15 Jul 2018 19:42:55 +0530 Subject: run-tests.sh: provide option to write 'failure' output to a file Change-Id: I42f5e0f3513ba758a09b1a7330e49fc3c8fc218e updates: bz#1600963 Signed-off-by: Amar Tumballi --- run-tests.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/run-tests.sh b/run-tests.sh index 7f1c6faad19..3eb8e381247 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -10,6 +10,7 @@ tests="" exit_on_failure="yes" skip_bad_tests="yes" skip_known_bugs="yes" +result_output="/tmp/gluster_regression.txt" section_separator="========================================" run_timeout=200 kill_after_time=5 @@ -368,13 +369,16 @@ function run_tests() echo "$key - ${ELAPSEDTIMEMAP["$key"]} second" done | sort -rn -k3 + # Output the errors into a file + echo > "${result_output}" if [ ${RES} -ne 0 ] ; then FAILED=$( echo ${FAILED} | tr ' ' '\n' | sort -u ) FAILED_COUNT=$( echo -n "${FAILED}" | grep -c '^' ) - echo -e "\n$FAILED_COUNT test(s) failed \n${FAILED}" + echo -e "\n$FAILED_COUNT test(s) failed \n${FAILED}" >> "${result_output}" GENERATED_CORE=$( echo ${GENERATED_CORE} | tr ' ' '\n' | sort -u ) GENERATED_CORE_COUNT=$( echo -n "${GENERATED_CORE}" | grep -c '^' ) - echo -e "\n$GENERATED_CORE_COUNT test(s) generated core \n${GENERATED_CORE}" + echo -e "\n$GENERATED_CORE_COUNT test(s) generated core \n${GENERATED_CORE}" >> "${result_output}" + cat "${result_output}" fi TESTS_NEEDED_RETRY=$( echo ${TESTS_NEEDED_RETRY} | tr ' ' '\n' | sort -u ) RETRY_COUNT=$( echo -n "${TESTS_NEEDED_RETRY}" | grep -c '^' ) @@ -409,7 +413,7 @@ function run_head_tests() } function parse_args () { - args=`getopt frcbkhH "$@"` + args=`getopt frcbkhHo "$@"` set -- $args while [ $# -gt 0 ]; do case "$1" in @@ -420,6 +424,7 @@ function parse_args () { -c) exit_on_failure="no" ;; -b) skip_bad_tests="no" ;; -k) skip_known_bugs="no" ;; + -o) result_output="$2"; shift;; --) shift; break;; esac shift -- cgit