X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=scripts%2Fshunit%2Fshunit2;h=0dd9acad8c5c0dcc53ebdde8907888a671a112b7;hb=9fea38a41a34634d09c9337ac060b80bc3c8730f;hp=a56ed4a5cb18460fccd6b9fdee0a226affcbd4b5;hpb=8f4a9f51cb240261e612504322fa250adf184884;p=feisty_meow.git diff --git a/scripts/shunit/shunit2 b/scripts/shunit/shunit2 old mode 100644 new mode 100755 index a56ed4a5..0dd9acad --- 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