From abb01cfc03af4ded08a88247b57236f3d1d8b766 Mon Sep 17 00:00:00 2001 From: brarcher Date: Mon, 23 Dec 2013 16:29:42 +0000 Subject: [PATCH] test_xml_output: add tests for valid duration for tests This is to check for the case where the duration is not -1 or in [0, CK_DEFAULT_TIMEOUT]. There was an issue with NO_FORK mode where the duration was not valid. git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@927 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- tests/test_xml_output.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_xml_output.sh b/tests/test_xml_output.sh index 9bec8de..6a3aa29 100755 --- a/tests/test_xml_output.sh +++ b/tests/test_xml_output.sh @@ -1,6 +1,7 @@ #!/bin/sh OUTPUT_FILE=test.log.xml +CK_DEFAULT_TIMEOUT=4 . ./test_vars @@ -142,6 +143,7 @@ expected_duration_count=8 fi rm -f ${OUTPUT_FILE} +export CK_DEFAULT_TIMEOUT ./ex_xml_output${EXEEXT} > /dev/null actual_xml=`cat ${OUTPUT_FILE} | tr -d "\r" | grep -v \ | grep -v \ | grep -v \` if [ x"${expected_xml}" != x"${actual_xml}" ]; then @@ -159,4 +161,13 @@ if [ x"${expected_duration_count}" != x"${actual_duration_count}" ]; then exit 1; fi +for duration in `grep "\" ${OUTPUT_FILE} | cut -d ">" -f 2 | cut -d "<" -f 1`; do +int_duration=`echo -n $duration | cut -d "." -f 1` +if [ "${int_duration}" -ne "-1" ] && [ "${int_duration}" -gt "${CK_DEFAULT_TIMEOUT}" ]; then + echo "Problem with duration ${duration}; is not valid. Should be -1 or in [0, ${CK_DEFAULT_TIMEOUT}]" + exit 1 +fi +done + + exit 0 -- 2.40.0