Commits

Karl Rupp committed caf8109

Nightly Summary: Added time taken to each of the tests in the dashboard.

This should allow us to quickly spot tests which take a suspiciously long time to complete (even though the results may be fine).

Comments (0)

Files changed (1)

src/contrib/nightlysummary/runhtml.sh

   then
     echo "<tr><th>Test</th><th>Warnings</th><th>Errors</th></tr>" >> $OUTFILE
   else
-    echo "<tr><th>Test</th><th>Possible Problems</th></tr>" >> $OUTFILE
+    echo "<tr><th>Test</th><th>Possible Problems</th><th>Exec Time</th></tr>" >> $OUTFILE
   fi
 
   for f in `ls $LOGDIR/${2}_${BRANCH}*.log`
       possible_problems=`grep -i "Possible problem" $f | wc -l`
       if [ "$possible_problems" -gt "0" ]
       then
-	    echo "</td><td class=\"yellow\">$possible_problems</td></tr>" >> $OUTFILE
+	    echo "</td><td class=\"yellow\">$possible_problems</td>" >> $OUTFILE
       else
-	    echo "</td><td class=\"green\">$possible_problems</td></tr>" >> $OUTFILE
+	    echo "</td><td class=\"green\">$possible_problems</td>" >> $OUTFILE
+      fi
+
+      # Parse start and end time stamps from log file and convert to seconds since begin of that day
+      starttime_sec=`grep "TESTMODE" $f | sed 's/.* \([0-9]*[0-9]\):\([0-9][0-9]\):\([0-9][0-9]\).*/\3/'`
+      starttime_min=`grep "TESTMODE" $f | sed 's/.* \([0-9]*[0-9]\):\([0-9][0-9]\):\([0-9][0-9]\).*/\2/'`
+      starttime_hour=`grep "TESTMODE" $f | sed 's/.* \([0-9]*[0-9]\):\([0-9][0-9]\):\([0-9][0-9]\).*/\1/'`
+      starttime=$(($((10#$starttime_sec))+$((10#$starttime_min))*60+$((10#$starttime_hour))*3600))
+
+      endtime_sec=`grep "Finished Build on" $f | sed 's/.* \([0-9]*[0-9]\):\([0-9][0-9]\):\([0-9][0-9]\).*/\3/'`
+      endtime_min=`grep "Finished Build on" $f | sed 's/.* \([0-9]*[0-9]\):\([0-9][0-9]\):\([0-9][0-9]\).*/\2/'`
+      endtime_hour=`grep "Finished Build on" $f | sed 's/.* \([0-9]*[0-9]\):\([0-9][0-9]\):\([0-9][0-9]\).*/\1/'`
+      endtime=$(($((10#$endtime_sec))+$((10#$endtime_min))*60+$((10#$endtime_hour))*3600))
+
+      # Take into account that test might run over midnight or noon
+      if [ $((starttime)) -gt $((endtime)) ]
+      then
+        if [ $starttime_hour -lt 13 ]   # check for 12 or 24 hour format
+        then
+          endtime=$((endtime+12*3600))
+        else
+          endtime=$((endtime+24*3600))
+        fi
+      fi
+
+      # Compute time taken and print output of the form HH:MM:SS
+      timetaken=$((endtime - starttime))
+      timetaken_hour=`printf '%02d' $((timetaken / 3600))`
+      timetaken_min=`printf '%02d' $(((timetaken - timetaken_hour * 3600) / 60))`
+      timetaken_sec=`printf '%02d' $((timetaken - timetaken_hour * 3600 - timetaken_min * 60))`
+
+      if [ $timetaken -gt 1800 ]  #Consider everything longer than 30 minutes to be a lengthy test
+      then
+	    echo "</td><td class=\"yellow\">$timetaken_hour:$timetaken_min:$timetaken_sec</td></tr>" >> $OUTFILE
+      else
+	    echo "</td><td class=\"green\">$timetaken_hour:$timetaken_min:$timetaken_sec</td></tr>" >> $OUTFILE
       fi
     fi
   done