[Box Backup-commit] COMMIT r3311 - box/trunk/lib/backupstore
subversion at boxbackup.org
subversion at boxbackup.org
Wed Apr 9 23:15:04 BST 2014
Author: chris
Date: 2014-04-09 23:15:04 +0100 (Wed, 09 Apr 2014)
New Revision: 3311
Modified:
box/trunk/lib/backupstore/StoreTestUtils.cpp
box/trunk/lib/backupstore/StoreTestUtils.h
Log:
Add a utility to check account for errors, expecting that there are some.
Returns the number of errors found and fixed.
Modified: box/trunk/lib/backupstore/StoreTestUtils.cpp
===================================================================
--- box/trunk/lib/backupstore/StoreTestUtils.cpp 2014-04-09 22:15:01 UTC (rev 3310)
+++ box/trunk/lib/backupstore/StoreTestUtils.cpp 2014-04-09 22:15:04 UTC (rev 3311)
@@ -202,25 +202,26 @@
Dirs == usage->GetBlocksInDirectories());
}
+int check_account_for_errors(Log::Level log_level)
+{
+ 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;
-
- {
- 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");
-
+ int errors_fixed = check_account_for_errors(log_level);
+ TEST_EQUAL(0, errors_fixed);
return (errors_fixed == 0);
}
Modified: box/trunk/lib/backupstore/StoreTestUtils.h
===================================================================
--- box/trunk/lib/backupstore/StoreTestUtils.h 2014-04-09 22:15:01 UTC (rev 3310)
+++ box/trunk/lib/backupstore/StoreTestUtils.h 2014-04-09 22:15:04 UTC (rev 3311)
@@ -51,6 +51,9 @@
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);
More information about the Boxbackup-commit
mailing list