From: Chris Koeritz Date: Fri, 11 May 2012 20:02:31 +0000 (-0400) Subject: added hours and minutes version of run time. X-Git-Tag: 2.140.90~1348^2 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=4db21103d93decfe3d1d9723f687566a32d7ec63;p=feisty_meow.git added hours and minutes version of run time. --- diff --git a/scripts/shunit/example_shunit_test.sh b/scripts/shunit/example_shunit_test.sh index cc6c1bb3..e33b9c38 100755 --- a/scripts/shunit/example_shunit_test.sh +++ b/scripts/shunit/example_shunit_test.sh @@ -19,11 +19,14 @@ oneTimeSetUp() testOneThing() { - echo "got to test case. sleeping for a bit..." + echo "got to primary test case." zero=0 assertEquals "zero should be equal to 0" 0 $zero - sleep 23 - echo "woke up. passed tautological test." + echo "passed tautological test." + sleep_time=83 + echo "$(date): now sleeping for $sleep_time seconds." + sleep $sleep_time + echo "$(date): woke up." } oneTimeTearDown() diff --git a/scripts/shunit/shunit2 b/scripts/shunit/shunit2 index 71a3d8c1..c8144896 100755 --- a/scripts/shunit/shunit2 +++ b/scripts/shunit/shunit2 @@ -862,7 +862,12 @@ _shunit_generateReport() _shunit_msg_="${_shunit_msg_})" fi - echo "Suite ran for $(($suite_end - $suite_start)) seconds." + 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 "Suite ran for $duration_s total seconds [$duration_h:$duration_m hh:mm]" echo echo "$(date): ${_shunit_msg_}" __shunit_reportGenerated=${SHUNIT_TRUE}