diff options
author | Chris Wilson <chris+github@qwirx.com> | 2014-04-09 22:15:04 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2014-04-09 22:15:04 +0000 |
commit | a33620130b6cdff94a387d414a665199dec8813d (patch) | |
tree | 7f4a7faac7c141bf1651bf552fd9b5648407db0b /lib/backupstore | |
parent | 9bb4c01ba28370ef07a43df27834ab02ffbd7dc4 (diff) |
Add a utility to check account for errors, expecting that there are some.
Returns the number of errors found and fixed.
Diffstat (limited to 'lib/backupstore')
-rw-r--r-- | lib/backupstore/StoreTestUtils.cpp | 35 | ||||
-rw-r--r-- | lib/backupstore/StoreTestUtils.h | 3 |
2 files changed, 21 insertions, 17 deletions
diff --git a/lib/backupstore/StoreTestUtils.cpp b/lib/backupstore/StoreTestUtils.cpp index e5b05e9c..a5dbc28f 100644 --- a/lib/backupstore/StoreTestUtils.cpp +++ b/lib/backupstore/StoreTestUtils.cpp @@ -202,25 +202,26 @@ bool check_num_blocks(BackupProtocolCallable& Client, int Current, int Old, Dirs == usage->GetBlocksInDirectories()); } -bool check_account(Log::Level log_level) +int check_account_for_errors(Log::Level log_level) { - int errors_fixed; - - { - Logging::Guard guard(log_level); - Logging::Tagger tag("check fix", true); - Logging::ShowTagOnConsole show; - std::string errs; - std::auto_ptr<Configuration> config( - Configuration::LoadAndVerify("testfiles/bbstored.conf", - &BackupConfigFileVerify, errs)); - BackupStoreAccountsControl control(*config); - errors_fixed = control.CheckAccount(0x01234567, - true, // FixErrors - false); // Quiet - } - TEST_EQUAL_LINE(0, errors_fixed, "store errors found and fixed"); + Logging::Guard guard(log_level); + Logging::Tagger tag("check fix", true); + Logging::ShowTagOnConsole show; + std::string errs; + std::auto_ptr<Configuration> config( + Configuration::LoadAndVerify("testfiles/bbstored.conf", + &BackupConfigFileVerify, errs)); + BackupStoreAccountsControl control(*config); + int errors_fixed = control.CheckAccount(0x01234567, + true, // FixErrors + false); // Quiet + return errors_fixed; +} +bool check_account(Log::Level log_level) +{ + int errors_fixed = check_account_for_errors(log_level); + TEST_EQUAL(0, errors_fixed); return (errors_fixed == 0); } diff --git a/lib/backupstore/StoreTestUtils.h b/lib/backupstore/StoreTestUtils.h index d8655e63..f65ae3df 100644 --- a/lib/backupstore/StoreTestUtils.h +++ b/lib/backupstore/StoreTestUtils.h @@ -51,6 +51,9 @@ bool check_num_files(int files, int old, int deleted, int dirs); bool check_num_blocks(BackupProtocolCallable& Client, int Current, int Old, int Deleted, int Dirs, int Total); +//! Checks an account for errors, returning the number of errors found and fixed. +int check_account_for_errors(Log::Level log_level = Log::WARNING); + //! Checks an account for errors, returning true if it's OK, for use in assertions. bool check_account(Log::Level log_level = Log::WARNING); |