Display elapsed time for each test/install.
authorTom Clegg <tom@curoverse.com>
Mon, 18 Aug 2014 14:48:19 +0000 (10:48 -0400)
committerTom Clegg <tom@curoverse.com>
Mon, 18 Aug 2014 14:48:19 +0000 (10:48 -0400)
jenkins/run-tests.sh

index 028f0a30aa60b9976e96a6cfc2c18709027e9d28..0d89dcff7b75f1883db3cc67f453df86b0454c18 100755 (executable)
@@ -66,16 +66,25 @@ done
 checkexit() {
     if [[ "$?" != "0" ]]; then
         title "!!!!!! $1 FAILED !!!!!!"
-        failures+=("$1")
+        failures+=("$1 (`timer`)")
     else
-        successes+=("$1")
+        successes+=("$1 (`timer`)")
     fi
 }
 
+timer_reset() {
+    t0=$SECONDS
+}
+
+timer() {
+    echo -n "$(($SECONDS - $t0))s"
+}
+
 do_test() {
     if [[ -z "${skip[$1]}" ]] && ( [[ -z "$only" ]] || [[ "$only" == "$1" ]] )
     then
         title "Running $1 tests"
+        timer_reset
         if [[ "$2" == "go" ]]
         then
             go test "git.curoverse.com/arvados.git/$1"
@@ -83,7 +92,7 @@ do_test() {
             "test_$1"
         fi
         checkexit "$1 tests"
-        title "End of $1 tests"
+        title "End of $1 tests (`timer`)"
     else
         title "Skipping $1 tests"
     fi
@@ -91,6 +100,7 @@ do_test() {
 
 do_install() {
     title "Running $1 install"
+    timer_reset
     if [[ "$2" == "go" ]]
     then
         go get -t "git.curoverse.com/arvados.git/$1"
@@ -98,7 +108,7 @@ do_install() {
         "install_$1"
     fi
     checkexit "$1 install"
-    title "End of $1 install"
+    title "End of $1 install (`timer`)"
 }
 
 title () {