[Box Backup-commit] COMMIT r1543 - box/chris/merge/test/bbackupd
boxbackup-dev at fluffy.co.uk
boxbackup-dev at fluffy.co.uk
Sat Apr 21 20:13:35 BST 2007
Author: chris
Date: 2007-04-21 20:13:35 +0100 (Sat, 21 Apr 2007)
New Revision: 1543
Modified:
box/chris/merge/test/bbackupd/testbbackupd.cpp
Log:
Keep bbackupd pid in a global variable instead of a local one.
Stop bbackupd nicely with terminate_bbackupd() instead of killing it,
so that we get a memory leak report on Win32.
Stop bbackupd and bbstored at end of test if any tests fail.
(refs #3)
Modified: box/chris/merge/test/bbackupd/testbbackupd.cpp
===================================================================
--- box/chris/merge/test/bbackupd/testbbackupd.cpp 2007-04-21 18:58:27 UTC (rev 1542)
+++ box/chris/merge/test/bbackupd/testbbackupd.cpp 2007-04-21 19:13:35 UTC (rev 1543)
@@ -85,6 +85,7 @@
}
int bbstored_pid = 0;
+int bbackupd_pid = 0;
#ifdef HAVE_SYS_XATTR_H
bool readxattr_into_map(const char *filename, std::map<std::string,std::string> &rOutput)
@@ -1041,14 +1042,15 @@
}
#endif // PLATFORM_CLIB_FNS_INTERCEPTION_IMPOSSIBLE
- int pid = LaunchServer(BBACKUPD " testfiles/bbackupd.conf",
+ bbackupd_pid = LaunchServer(BBACKUPD " testfiles/bbackupd.conf",
"testfiles/bbackupd.pid");
- TEST_THAT(pid != -1 && pid != 0);
- if(pid > 0)
+
+ TEST_THAT(bbackupd_pid != -1 && bbackupd_pid != 0);
+
+ ::sleep(1);
+
+ if(bbackupd_pid > 0)
{
- ::sleep(1);
- TEST_THAT(ServerIsAlive(pid));
-
// First, check storage space handling -- wait for file to be uploaded
wait_for_backup_operation();
@@ -1797,18 +1799,16 @@
TEST_THAT(!TestFileExists("testfiles/notifyran.read-error.2"));
// Kill the daemon
- TEST_THAT(KillServer(pid));
- ::sleep(1);
- TEST_THAT(!ServerIsAlive(pid));
- TestRemoteProcessMemLeaks("bbackupd.memleaks");
+ terminate_bbackupd(bbackupd_pid);
// Start it again
- pid = LaunchServer(BBACKUPD " testfiles/bbackupd.conf",
+ bbackupd_pid = LaunchServer(BBACKUPD
+ " testfiles/bbackupd.conf",
"testfiles/bbackupd.pid");
- TEST_THAT(pid != -1 && pid != 0);
+ TEST_THAT(bbackupd_pid != -1 && bbackupd_pid != 0);
- if(pid != -1 && pid != 0)
+ if(bbackupd_pid != -1 && bbackupd_pid != 0)
{
// Wait and compare (a little bit longer than usual)
wait_for_backup_operation(
@@ -1821,10 +1821,7 @@
TestRemoteProcessMemLeaks("bbackupquery.memleaks");
// Kill it again
- TEST_THAT(KillServer(pid));
- ::sleep(1);
- TEST_THAT(!ServerIsAlive(pid));
- TestRemoteProcessMemLeaks("bbackupd.memleaks");
+ terminate_bbackupd(bbackupd_pid);
}
}
@@ -1871,7 +1868,12 @@
if(r != 0) return r;
r = test_bbackupd();
- if(r != 0) return r;
+ if(r != 0)
+ {
+ KillServer(bbackupd_pid);
+ KillServer(bbstored_pid);
+ return r;
+ }
test_kill_bbstored();
More information about the Boxbackup-commit
mailing list