summaryrefslogtreecommitdiff
path: root/test/bbackupd
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-12-24 23:22:17 +0000
committerChris Wilson <chris+github@qwirx.com>2015-12-24 23:22:17 +0000
commit45943bd58e0d11eab967b3a15289c88121f33cf3 (patch)
treed8b2afeecef855aab9082c59ac175444c10b3356 /test/bbackupd
parentaa0b05629ee0f61cd5c6b7b473699758f848b5d2 (diff)
Replace shell implementation of test/bbackupd kill_running_daemons() with pure C++.
Allows it to work with Visual Studio and no Cygwin/MSYS shell.
Diffstat (limited to 'test/bbackupd')
-rw-r--r--test/bbackupd/testbbackupd.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/test/bbackupd/testbbackupd.cpp b/test/bbackupd/testbbackupd.cpp
index 4302fb69..759b3987 100644
--- a/test/bbackupd/testbbackupd.cpp
+++ b/test/bbackupd/testbbackupd.cpp
@@ -412,13 +412,19 @@ bool configure_bbackupd(BackupDaemon& bbackupd, const std::string& config_file)
bool kill_running_daemons()
{
- TEST_THAT_OR(::system("test ! -r testfiles/bbstored.pid || "
- "kill `cat testfiles/bbstored.pid`") == 0, FAIL);
- TEST_THAT_OR(::system("test ! -r testfiles/bbackupd.pid || "
- "kill `cat testfiles/bbackupd.pid`") == 0, FAIL);
- TEST_THAT_OR(::system("rm -f testfiles/bbackupd.pid "
- "testfiles/bbstored.pid") == 0, FAIL);
- return true;
+ bool success = true;
+
+ if(FileExists("testfiles/bbstored.pid"))
+ {
+ TEST_THAT_OR(KillServer("testfiles/bbstored.pid", true), success = false);
+ }
+
+ if(FileExists("testfiles/bbackupd.pid"))
+ {
+ TEST_THAT_OR(KillServer("testfiles/bbackupd.pid", true), success = false);
+ }
+
+ return success;
}
bool setup_test_bbackupd(BackupDaemon& bbackupd, bool do_unpack_files = true,