[Box Backup-commit] COMMIT r1967 - box/chris/general/test/bbackupd
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Sat, 8 Dec 2007 22:40:47 +0000 (UTC)
Author: chris
Date: 2007-12-08 22:40:47 +0000 (Sat, 08 Dec 2007)
New Revision: 1967
Modified:
box/chris/general/test/bbackupd/testbbackupd.cpp
Log:
Pass bbackupd_args to the internal daemon (spaces are NOT supported).
Stop early if a keepalive test fails, for debugging.
(merges [1928] [1929])
Modified: box/chris/general/test/bbackupd/testbbackupd.cpp
===================================================================
--- box/chris/general/test/bbackupd/testbbackupd.cpp 2007-12-08 22:37:56 UTC (rev 1966)
+++ box/chris/general/test/bbackupd/testbbackupd.cpp 2007-12-08 22:40:47 UTC (rev 1967)
@@ -604,8 +604,23 @@
// ensure that no child processes end up running tests!
int own_pid = getpid();
+ // this is a quick hack to allow passing some options to the daemon
+ const char* argv[] = {
+ "dummy",
+ bbackupd_args.c_str(),
+ };
+
BackupDaemon daemon;
- int result = daemon.Main("testfiles/bbackupd.conf");
+ int result;
+
+ if (bbackupd_args.size() > 0)
+ {
+ result = daemon.Main("testfiles/bbackupd.conf", 2, argv);
+ }
+ else
+ {
+ result = daemon.Main("testfiles/bbackupd.conf", 1, argv);
+ }
TEST_THAT(result == 0);
if (result != 0)
@@ -862,6 +877,7 @@
// should mean that no keepalives were sent,
// because diff was immediately aborted
// before any matching blocks could be found.
+
intercept_setup_delay("testfiles/TestDir1/spacetest/f1",
0, 4000, SYS_read, 1);
pid = start_internal_daemon();
@@ -915,6 +931,12 @@
TEST_EQUAL(comp, sub, line);
}
+ if (failures > 0)
+ {
+ // stop early to make debugging easier
+ return 1;
+ }
+
intercept_setup_delay("testfiles/TestDir1/spacetest/f1",
0, 1000, SYS_read, 3);
pid = start_internal_daemon();
@@ -986,6 +1008,12 @@
TEST_LINE(comp2 != sub, line);
}
+ if (failures > 0)
+ {
+ // stop early to make debugging easier
+ return 1;
+ }
+
intercept_setup_readdir_hook("testfiles/TestDir1/spacetest/d1",
readdir_test_hook_1);
@@ -1058,6 +1086,12 @@
TEST_EQUAL("Receive IsAlive()", line, line);
}
+ if (failures > 0)
+ {
+ // stop early to make debugging easier
+ return 1;
+ }
+
TEST_THAT(unlink(touchfile.c_str()) == 0);
// restore timers for rest of tests