diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common/Test.cpp | 13 | ||||
-rw-r--r-- | lib/common/Test.h | 4 |
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 |