summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-07-25 19:17:37 +0000
committerChris Wilson <chris+github@qwirx.com>2015-07-25 19:17:37 +0000
commitc8b85e5be8ab0e58bd4f946dec4683a376df4381 (patch)
tree0bcb4a69545564c84a98c61c6857c80f271bf8e6 /lib
parentde7046406341c59c9c8c57b79fce99bdc123c794 (diff)
Move load_config_file to Test.cpp to allow reuse.
Diffstat (limited to 'lib')
-rw-r--r--lib/common/Test.cpp13
-rw-r--r--lib/common/Test.h4
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/common/Test.cpp b/lib/common/Test.cpp
index ba99d496..9385d8c3 100644
--- a/lib/common/Test.cpp
+++ b/lib/common/Test.cpp
@@ -512,3 +512,16 @@ void safe_sleep(int seconds)
{
ShortSleep(SecondsToBoxTime(seconds), true);
}
+
+std::auto_ptr<Configuration> load_config_file(const std::string& config_file,
+ const ConfigurationVerify& verify)
+{
+ std::string errs;
+ std::auto_ptr<Configuration> config(
+ Configuration::LoadAndVerify(config_file, &verify, errs));
+ TEST_EQUAL_LINE(0, errs.size(), "Failed to load configuration file: " + config_file +
+ ": " + errs);
+ TEST_EQUAL_OR(0, errs.size(), config.reset());
+ return config;
+}
+
diff --git a/lib/common/Test.h b/lib/common/Test.h
index a69fdae8..f6bbb49d 100644
--- a/lib/common/Test.h
+++ b/lib/common/Test.h
@@ -14,6 +14,8 @@
#include <list>
#include <map>
+#include "Configuration.h"
+
#ifdef WIN32
#define BBACKUPCTL "..\\..\\bin\\bbackupctl\\bbackupctl.exe"
#define BBACKUPD "..\\..\\bin\\bbackupd\\bbackupd.exe"
@@ -236,5 +238,7 @@ void terminate_bbackupd(int pid);
// Wait a given number of seconds for something to complete
void wait_for_operation(int seconds, const char* message);
void safe_sleep(int seconds);
+std::auto_ptr<Configuration> load_config_file(const std::string& config_file,
+ const ConfigurationVerify& verify);
#endif // TEST__H