[Swift-commit] r4690 - trunk/tests

achavez at ci.uchicago.edu achavez at ci.uchicago.edu
Fri Jun 24 14:16:50 CDT 2011


Author: achavez
Date: 2011-06-24 14:16:50 -0500 (Fri, 24 Jun 2011)
New Revision: 4690

Modified:
   trunk/tests/suite.sh
Log:
HTML enhanced, it shows the amount of time it took to run each swift script, when a helper script is not present, it fills the gap with a NP, Not Present, Flag.

Modified: trunk/tests/suite.sh
===================================================================
--- trunk/tests/suite.sh	2011-06-24 18:51:26 UTC (rev 4689)
+++ trunk/tests/suite.sh	2011-06-24 19:16:50 UTC (rev 4690)
@@ -31,6 +31,8 @@
 SKIP_CHECKOUT=0
 ALWAYS_EXITONFAILURE=0
 VERBOSE=0
+TOTAL_TIME=0
+INDIVIDUAL_TEST_TIME=0
 # The directory in which to start:
 TOPDIR=$PWD
 
@@ -334,14 +336,14 @@
 # Create either HTML or plain text report.
 # $TEXTREPORT monitor whether the report will be plain text or HTML
 output_report() {
+
 	TYPE=$1
+	LABEL="$2"  # Text on link to output
+	CMD=$3    # Command issued (td title)
+	RESULT=$4 # Passed or Failed
+
 	if [ $TEXTREPORT == 1 ]; then
 		if [ "$TYPE" == "test" ]; then
-
-			LABEL="$2"  # Text on link to output
-			CMD=$3    # Command issued (td title)
-			RESULT=$4 # Passed or Failed
-
 			if [ "$RESULT" == "Passed" ]; then
 				printf %-10.10s "success">>$REPORT
 			else
@@ -357,11 +359,6 @@
 		fi
 	else
 		if [ "$TYPE" == "test" ]; then
-
-	    	LABEL="$2"  # Text on link to output
-	    	CMD=$3    # Command issued (td title)
-	    	RESULT=$4 # Passed or Failed
-
 	    	# WIDTH=$( width "$LABEL" )
 	    	if [ "$RESULT" == "Passed" ]; then
 	      		html_td class "success" width 25 title "$CMD"
@@ -373,7 +370,6 @@
 	      		html_a_href $TEST_LOG $LABEL
 	    	fi
 	    	html_~td
-
 	  	elif [ "$TYPE" == "package" ]; then
 	    	BINPACKAGE=$2
 	  	else
@@ -397,7 +393,7 @@
 	  printf "\n">>$REPORT
   else
 	  html_tr group
-	  html_th 3
+	  html_th 4
 	  html "$G"
 	  html_~th
 	  html_~tr
@@ -437,6 +433,9 @@
 		html_~tr
 		html_~table
 		html_~td
+   	        html_td align left
+   	        html "Execution Time: $INDIVIDUAL_TEST_TIME seconds"
+   	        html_~td
 		html_~tr
 	fi
 }
@@ -641,12 +640,11 @@
   rm killed_test > /dev/null 2>&1 && sleep 5
   verbose "killing monitor: $MONITOR_PID..."
   kill $MONITOR_PID
+  
   INDIVIDUAL_TEST_TIME=$(( STOP-START ))
-
+  TOTAL_TIME=$(( INDIVIDUAL_TEST_TIME+TOTAL_TIME ))
   echo "TOOK (seconds): $INDIVIDUAL_TEST_TIME"
-
   RESULT=$( result )
-  NOPASO="Failed"
 
 #Verifies the value of $RESULT, if the test was successful
 #increases $TESTSPASSED by 1, if the test Failed
@@ -692,6 +690,10 @@
   TEST_SHOULD_FAIL=0
   if [ -x $GROUP/$SETUPSCRIPT ]; then
     script_exec $GROUP/$SETUPSCRIPT "S"
+  else
+   html_td class "neutral" width 25
+   html "NP"
+   html_~td
   fi
 
   CDM=
@@ -715,11 +717,19 @@
   TEST_SHOULD_FAIL=0
   if [ -x $GROUP/$CHECKSCRIPT ]; then
     script_exec $GROUP/$CHECKSCRIPT "√"
+  else
+   html_td class "neutral" width 25
+   html "NP"
+   html_~td
   fi
+
   if [ -x $GROUP/$CLEANSCRIPT ]; then
     script_exec $GROUP/$CLEANSCRIPT "C"
+  else
+   html_td class "neutral" width 25
+   html "NP"
+   html_~td
   fi
-  echo
 }
 
 # Execute shell test case w/ setup, check, clean
@@ -733,6 +743,10 @@
   TEST_SHOULD_FAIL=0
   if [ -x $GROUP/$SETUPSCRIPT ]; then
     script_exec $GROUP/$SETUPSCRIPT "S"
+  else
+   html_td class "neutral" width 25
+   html "NP"
+   html_~td
   fi
 
   (( TESTCOUNT++ ))
@@ -742,17 +756,34 @@
 
   if [ -x $GROUP/$SETUPSCRIPT ]; then
     script_exec $GROUP/$SETUPSCRIPT "S"
+  else
+   html_td class "neutral" width 25
+   html "NP"
+   html_~td
   fi
 
   if [ -x $GROUP/$SHELLSCRIPT ]; then
     script_exec $SHELLSCRIPT "X"
+  else
+   html_td class "neutral" width 25
+   html "NP"
+   html_~td
   fi
 
   if [ -x $GROUP/$CHECKSCRIPT ]; then
     script_exec $GROUP/$CHECKSCRIPT "√"
+  else
+   html_td class "neutral" width 25
+   html "NP"
+   html_~td
   fi
+
   if [ -x $GROUP/$CLEANSCRIPT ]; then
     script_exec $GROUP/$CLEANSCRIPT "C"
+  else
+   html_td class "neutral" width 25
+   html "NP"
+   html_~td
   fi
 }
 
@@ -881,25 +912,22 @@
 # Revision:001
 group_statistics(){
 	if [ $TEXTREPORT == 1 ]; then
-		printf "\n $TESTCOUNT Tests run\t$TESTSFAILED Tests failed\t$TESTSPASSED Tests succeeded. \n\n">>$REPORT
+		printf "\n $TESTCOUNT Tests run\t$TESTSFAILED Tests failed\t$TESTSPASSED Tests succeeded.\tTotal time: $TOTAL_TIME seconds \n\n">>$REPORT
 	else
-#		html_tr group
-#		html_td neutral
-#		html "$TESTCOUNT Tests run"
-#		html_~td
-#		html_td success
-#		html "$TESTSPASSED Tests succeeded"
-#		html_~td
-#		html_td failure
-#		html "$TESTSFAILED Tests failed"
-#		html_~td
-#		html_~tr
-		 printf "<tr class=\"group\">">>$HTML
-		 printf "<td class=\"neutral\"> $TESTCOUNT Tests run. </td>">>$HTML
-		 printf "<td class=\"success\"> $TESTSPASSED Tests succeeded. </td>">>$HTML
-  		 printf "<td class=\"failure\"> $TESTSFAILED Tests failed. </td>">>$HTML
-		 printf "</tr>">>$HTML
-		# printf "\n $TESTCOUNT Tests run\t$TESTSFAILED Tests failed\t$TESTSPASSED Tests succeeded. \n\n">>$HTML
+	 	 html_tr class "group"
+		 html_td class "neutral"
+	 	 html "$TESTCOUNT Tests run"
+		 html_~td
+		 html_td class "success"
+		 html "$TESTSPASSED Tests succeeded."
+		 html_~td
+		 html_td class "failure"
+		 html "$TESTSFAILED Tests failed."
+		 html_~td
+		 html_td class "neutral" align left
+		 html "Total Time: $TOTAL_TIME seconds"
+		 html_~td
+		 html_~tr
 	fi
 }
 
@@ -921,6 +949,7 @@
     TESTNAME=$( basename $TEST )
 
     echo -e "\nTest case: $TESTNAME"
+
     cp -v $GROUP/$TESTNAME .
     TESTLINK=$TESTNAME
     start_row
@@ -929,6 +958,9 @@
       (( $TESTCOUNT >= $NUMBER_OF_TESTS )) && return
       (( $SHUTDOWN )) && return
     done
+#     html_td align right width 50
+#     html $INDIVIDUAL_TEST_TIME
+#     html_~td
      end_row
   done
     group_statistics




More information about the Swift-commit mailing list