diff options
author | Chris Wilson <chris+github@qwirx.com> | 2014-10-31 22:09:28 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2014-10-31 22:09:28 +0000 |
commit | d95ae43d507af4f02749f1dd99500f3220253002 (patch) | |
tree | fd3191adbfe99c46c6952a663e210aefdc083239 /test/bbackupd/testbbackupd.cpp | |
parent | 487f1138b257b3083917a097e510a5577222b408 (diff) |
Refactor StartClient and StopClient out of testbbackupd.
Use them in testbackupstorefix to reduce code duplication.
Diffstat (limited to 'test/bbackupd/testbbackupd.cpp')
-rw-r--r-- | test/bbackupd/testbbackupd.cpp | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/test/bbackupd/testbbackupd.cpp b/test/bbackupd/testbbackupd.cpp index 12080fb5..19cd8a2f 100644 --- a/test/bbackupd/testbbackupd.cpp +++ b/test/bbackupd/testbbackupd.cpp @@ -107,46 +107,6 @@ void wait_for_backup_operation(const char* message) wait_for_operation(TIME_TO_WAIT_FOR_BACKUP_OPERATION, message); } -int bbackupd_pid = 0; - -bool StartClient(const std::string& bbackupd_conf_file = "testfiles/bbackupd.conf") -{ - TEST_THAT_OR(bbackupd_pid == 0, FAIL); - - std::string cmd = BBACKUPD " " + bbackupd_args + " " + bbackupd_conf_file; - bbackupd_pid = LaunchServer(cmd.c_str(), "testfiles/bbackupd.pid"); - - TEST_THAT_OR(bbackupd_pid != -1 && bbackupd_pid != 0, FAIL); - ::sleep(1); - TEST_THAT_OR(ServerIsAlive(bbackupd_pid), FAIL); - - return true; -} - -bool StopClient(bool wait_for_process = false) -{ - TEST_THAT_OR(bbackupd_pid != 0, FAIL); - TEST_THAT_OR(ServerIsAlive(bbackupd_pid), FAIL); - TEST_THAT_OR(KillServer(bbackupd_pid, wait_for_process), FAIL); - ::sleep(1); - - TEST_THAT_OR(!ServerIsAlive(bbackupd_pid), FAIL); - bbackupd_pid = 0; - - #ifdef WIN32 - int unlink_result = unlink("testfiles/bbackupd.pid"); - TEST_EQUAL_LINE(0, unlink_result, "unlink testfiles/bbackupd.pid"); - if(unlink_result != 0) - { - FAIL; - } - #else - TestRemoteProcessMemLeaks("bbackupd.memleaks"); - #endif - - return true; -} - #ifdef HAVE_SYS_XATTR_H bool readxattr_into_map(const char *filename, std::map<std::string,std::string> &rOutput) { |