[Box Backup-commit] COMMIT r996 - box/trunk

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Thu Oct 12 23:18:33 BST 2006


Author: chris
Date: 2006-10-12 23:18:33 +0100 (Thu, 12 Oct 2006)
New Revision: 996

Modified:
   box/trunk/runtest.pl.in
Log:
 * Use strict and warnings for code safety.
 * Exit with status 2 on invalid usage.
 * Allow running multiple tests, comma separated.
 * Exit with status 2 if make fails for any test.
 * Exit with status 1 if any test fails.


Modified: box/trunk/runtest.pl.in
===================================================================
--- box/trunk/runtest.pl.in	2006-10-12 22:17:57 UTC (rev 995)
+++ box/trunk/runtest.pl.in	2006-10-12 22:18:33 UTC (rev 996)
@@ -1,11 +1,14 @@
 #!@PERL@
 
+use strict;
+use warnings;
+
 use lib 'infrastructure';
 use BoxPlatform;
 
 my ($test_name,$test_mode) = @ARGV;
 
-$test_mode = 'debug' if $test_mode eq '';
+$test_mode = 'debug' if not defined $test_mode or $test_mode eq '';
 
 if($test_name eq '' || ($test_mode ne 'debug' && $test_mode ne 'release'))
 {
@@ -17,15 +20,26 @@
 Mode defaults to debug.
 
 __E
-	exit(0);
+	exit(2);
 }
 
 my @results;
+my $exit_code = 0;
 
 if($test_name ne 'ALL')
 {
-	# run one test
-	runtest($test_name);
+	# run one or more specified test
+	if ($test_name =~ m/,/)
+	{
+		foreach my $test (split m/,/, $test_name)
+		{
+			runtest($test);
+		}
+	}
+	else
+	{
+		runtest($test_name);
+	}
 }
 else
 {
@@ -57,6 +71,8 @@
 # report results
 print "--------\n",join("\n", at results),"\n";
 
+exit $exit_code;
+
 sub runtest
 {
 	my ($t) = @_;
@@ -67,6 +83,7 @@
 	if($make_res != 0)
 	{
 		push @results,"$t: make failed";
+		$exit_code = 2;
 		return;
 	}
 	
@@ -82,8 +99,14 @@
 			$last = $_ if m/\w/;
 		}
 		close RESULTS;
+
 		chomp $last;
 		push @results,"$t: $last";
+
+		if ($last ne "PASSED") 
+		{ 
+			$exit_code = 1;
+		}
 	}
 	else
 	{




More information about the Boxbackup-commit mailing list