X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fshunit%2Fshunit2;h=0dd9acad8c5c0dcc53ebdde8907888a671a112b7;hb=e7fb349dd75afd715b425408d1088ef15e948b95;hp=a56ed4a5cb18460fccd6b9fdee0a226affcbd4b5;hpb=c0dfe4eab68221440698e260ab7d19fc57515cce;p=feisty_meow.git diff --git a/scripts/shunit/shunit2 b/scripts/shunit/shunit2 index a56ed4a5..0dd9acad 100755 --- a/scripts/shunit/shunit2 +++ b/scripts/shunit/shunit2 @@ -862,6 +862,16 @@ _shunit_generateReport() _shunit_msg_="${_shunit_msg_})" fi + if [ -z "$suite_end" ]; then + # make sure we don't get confused, since suite aborted early. + suite_end=$(date +%s) + fi + duration_s=$(($suite_end - $suite_start)) + duration_m=$(($duration_s / 60)) + duration_h=$(($duration_m / 60)) + if [ $duration_m -lt 10 ]; then duration_m="0$duration_m"; fi + if [ $duration_h -lt 10 ]; then duration_h="0$duration_h"; fi + echo "Test suite ran for $duration_s total seconds [$duration_h:$duration_m hh:mm]" echo echo "$(date): ${_shunit_msg_}" __shunit_reportGenerated=${SHUNIT_TRUE} @@ -1041,6 +1051,9 @@ if [ "${__shunit_mode}" = "${__SHUNIT_MODE_STANDALONE}" ]; then . "`_shunit_prepForSourcing \"${__shunit_script}\"`" fi +# record when the tests started running. +suite_start=$(date +%s) + # execute the oneTimeSetUp function (if it exists) oneTimeSetUp @@ -1063,6 +1076,8 @@ _shunit_execSuite # execute the oneTimeTearDown function (if it exists) oneTimeTearDown +suite_end=$(date +%s) + # generate the report _shunit_generateReport