[Box Backup-commit] COMMIT r3555 - in box/trunk: infrastructure test/backupstore test/bbackupd

subversion at boxbackup.org subversion at boxbackup.org
Mon May 4 19:56:30 BST 2015


Author: chris
Date: 2015-05-04 18:56:29 +0000 (Mon, 04 May 2015)
New Revision: 3555

Modified:
   box/trunk/infrastructure/makebuildenv.pl.in
   box/trunk/test/backupstore/testbackupstore.cpp
   box/trunk/test/bbackupd/testbbackupd.cpp
Log:
Fix system exit codes from tests, so we can use them in the shell.

I needed reliable exit codes to run the tests in a loop to catch an
intermittent failure.

Modified: box/trunk/infrastructure/makebuildenv.pl.in
===================================================================
--- box/trunk/infrastructure/makebuildenv.pl.in	2015-04-15 22:03:00 UTC (rev 3554)
+++ box/trunk/infrastructure/makebuildenv.pl.in	2015-05-04 18:56:29 UTC (rev 3555)
@@ -465,7 +465,7 @@
 				close FL;
 			}
 
-			print TESTFILE "$runcmd\n";
+			print TESTFILE "$runcmd\nexit_status=\$?\n";
 
 			if (-d "$module/testfiles")
 			{
@@ -474,6 +474,7 @@
 __E
 			}
 
+			print TESTFILE "exit \$exit_status\n";
 			close TESTFILE;
 		}
 		

Modified: box/trunk/test/backupstore/testbackupstore.cpp
===================================================================
--- box/trunk/test/backupstore/testbackupstore.cpp	2015-04-15 22:03:00 UTC (rev 3554)
+++ box/trunk/test/backupstore/testbackupstore.cpp	2015-05-04 18:56:29 UTC (rev 3555)
@@ -239,8 +239,12 @@
 	TEST_THAT(DIR_NUM == SkipEntries(e, FlagsMustBeSet, FlagsNotToBeSet));
 }
 
+int num_tests_selected = 0;
+
 //! Simplifies calling setUp() with the current function name in each test.
-#define SETUP() if (!setUp(__FUNCTION__)) return true; // skip this test
+#define SETUP() \
+	if (!setUp(__FUNCTION__)) return true; \
+	num_tests_selected++;
 
 //! Checks account for errors and shuts down daemons at end of every test.
 bool teardown_test_backupstore()
@@ -3111,6 +3115,9 @@
 	TEST_THAT(test_multiple_uploads());
 	TEST_THAT(test_housekeeping_deletes_files());
 
-	return (failures == 0);
+	TEST_LINE(num_tests_selected > 0, "No tests matched the patterns "
+		"specified on the command line");
+
+	return (failures == 0 && num_tests_selected > 0) ? 0 : 1;
 }
 

Modified: box/trunk/test/bbackupd/testbbackupd.cpp
===================================================================
--- box/trunk/test/bbackupd/testbbackupd.cpp	2015-04-15 22:03:00 UTC (rev 3554)
+++ box/trunk/test/bbackupd/testbbackupd.cpp	2015-05-04 18:56:29 UTC (rev 3555)
@@ -4295,5 +4295,5 @@
 		"specified on the command line");
 	TEST_THAT(kill_running_daemons());
 
-	return (failures == 0 && num_tests_selected > 0);
+	return (failures == 0 && num_tests_selected > 0) ? 0 : 1;
 }




More information about the Boxbackup-commit mailing list