[m-rev.] diff: fix minor bug in tools/run_all_tests_from_cron

Simon Taylor stayl at cs.mu.OZ.AU
Thu Aug 23 15:35:12 AEST 2001


Estimated hours taken: 0.25

tools/run_all_tests_from_cron:
	Fix the subject line of the mail message on machines which
	have sh, not bash. sh executes compound commands with redirection
	in a sub-shell. The test status was collected within such a command.

Index: run_all_tests_from_cron
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/run_all_tests_from_cron,v
retrieving revision 1.34
diff -u -u -r1.34 run_all_tests_from_cron
--- run_all_tests_from_cron	2001/08/21 17:55:24	1.34
+++ run_all_tests_from_cron	2001/08/23 05:33:40
@@ -120,10 +120,22 @@
 
 tmpfile=/tmp/run_test$$
 trap 'rm -f $tmpfile $tmpscript; exit 1' 1 2 3 13 15
-{
+
+# We can't just fold this into the case statement below because sh
+# (but not bash) executes compound commands with redirection in a
+# sub-shell, and we need the value of $test_status in the subject
+# for the mail below.
 if nice -5 sh $tmpscript $HOST $ARCH $FULLARCH $BRANCH $C_COMPILER \
 		> $logfile 2>&1
 then
+	test_status="succeeded"
+else
+	test_status="FAILED"
+fi
+
+{
+case "$test_status" in
+    succeeded)
 	fgrep '**' $logfile > $logfile.errs
 	if [ -s $logfile.errs ]; then
 		echo "test passed (with some errors supressed/ignored)"
@@ -149,8 +161,8 @@
 		size mercury_compile
 		echo
 	} >> $tm_dir/logs/sizes
-	test_status="succeeded"
-else
+	;;
+    FAILED)
 	fgrep '**' $logfile > $logfile.errs
 	echo test FAILED
 	echo log file in $logfile
@@ -158,8 +170,8 @@
 	echo
 	echo last 20 lines of log file:
 	tail -20 $logfile
-	test_status="FAILED"
-fi
+	;;
+esac
 } > $tmpfile 2>&1
 
 # NB we can't just pipe into `mail', because `mail' times out while
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list