normalized perms on all files, to avoid relying on any stored executable bits in...
[feisty_meow.git] / scripts / shunit / shunit2
old mode 100755 (executable)
new mode 100644 (file)
index a56ed4a..e9afb3d
@@ -862,6 +862,21 @@ _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
+  # we keep duration_s for later printing.
+  duration_s=$(($suite_end - $suite_start))
+  # calculate full minutes count based on seconds.
+  duration_m=$(($duration_s / 60))
+  # calculate how many hours that is.
+  duration_h=$(($duration_m / 60))
+  # fix the minutes since we chopped those hours out.
+  duration_m=$(($duration_m - $duration_h * 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 +1056,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 +1081,8 @@ _shunit_execSuite
 # execute the oneTimeTearDown function (if it exists)
 oneTimeTearDown
 
+suite_end=$(date +%s)
+
 # generate the report
 _shunit_generateReport