added hours and minutes version of run time.
authorChris Koeritz <fred@gruntose.com>
Fri, 11 May 2012 20:02:31 +0000 (16:02 -0400)
committerChris Koeritz <fred@gruntose.com>
Fri, 11 May 2012 20:02:31 +0000 (16:02 -0400)
scripts/shunit/example_shunit_test.sh
scripts/shunit/shunit2

index cc6c1bb3d2cdf6bfd7dbf645738398c7fc165653..e33b9c3881f954f41cf42d6bf86abf165d9cac13 100755 (executable)
@@ -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()
index 71a3d8c1c7ed3c20b32aa3d054ec59645561784f..c8144896c4552dd26834916921a54ce687a4f0b0 100755 (executable)
@@ -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}