Define some functions to reduce duplication in testbbackupd.

Merged back changes from the test refactor branch to reduce diffs.

Fix wrong setting of log level in compare() function.

We want to only show errors if we expect mismatches, and show warnings if we
didn't expect mismatches. I had it the other way around before.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3376 9c52e268-1103-0410-960d-c6a436f6b474
Simplify code with macros, update comments and fix whitespace.

Hopefully all of these changes are inconsequential.

Merged back changes from the test refactor branch to reduce diffs.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3377 9c52e268-1103-0410-960d-c6a436f6b474
Backport Timers::Cleanup that's safe to use in test cleanup.

Allows it not to throw an exception if timers weren't initialised when
cleanup was requested. Normally we want an exception thrown, but not while
we're cleaning up a test that might have failed with timers uninitialised.

More timers fixes after cleanup no-exception option.

Merged back changes from the test refactor branch to reduce diffs.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3378 9c52e268-1103-0410-960d-c6a436f6b474
Define setup and teardown functions and macros, and use them.

Merged back changes from the test refactor branch to reduce diffs.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3379 9c52e268-1103-0410-960d-c6a436f6b474
Changed many uses of BackupProtocolClient to BackupProtocolCallable.

Makes way for more use of local protocol objects and protocol subclasses.

Merged back changes from the test refactor branch to reduce diffs.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3380 9c52e268-1103-0410-960d-c6a436f6b474
More use of functions to simplify testbbackupd.

Merged back changes from the test refactor branch to reduce diffs.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3381 9c52e268-1103-0410-960d-c6a436f6b474
Allow access to BackupDaemon's BackupClientContext for tests.

The std::auto_ptr is now returned unclosed. If the caller of RunSyncNow()
does nothing with the return value, then it will be released, closing the
connection. However the caller can save the std::auto_ptr locally and
poke around in it if necessary. This interface is designed for tests only!

Merged back changes from the test refactor branch to reduce diffs.

Fix failure to record client store marker, after BackupClientContext refactor.

This caused the daemon not to abort safely if the CSM changed under our feet,
meaning that our cached data is invalid.

Fix for earlier patch to allow tests to access the BackupClientContext after
backup completes, because a new CSM wasn't generated in time for bbackupd to
record it, because the connection wasn't closed yet.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3382 9c52e268-1103-0410-960d-c6a436f6b474
Add support for all logging options in test executables.

Merged back changes from the test refactor branch to reduce diffs.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3383 9c52e268-1103-0410-960d-c6a436f6b474
Refactor FileStream exception throwing.

Avoid duplicate reporting, and include a message in the exceptions thrown.

Merged back changes from the test refactor branch to reduce diffs.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3384 9c52e268-1103-0410-960d-c6a436f6b474
Refactor Timer reschedule to avoid second scan over timer list.

Merged back changes from the test refactor branch to reduce diffs.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3385 9c52e268-1103-0410-960d-c6a436f6b474
Add EstimatedBytesToUpload to NotifyFileUploadingPatch.

Merged back changes from the test refactor branch to reduce diffs.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3386 9c52e268-1103-0410-960d-c6a436f6b474
Split test_multiple_uploads in two.

Merged back changes from the test refactor branch to reduce diffs.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3387 9c52e268-1103-0410-960d-c6a436f6b474
Catch exceptions while executing store commands, and return an error message.

This will allow the client to eventually have more information about what went
wrong on the server, if the server admin agrees, and makes test debugging easier.

Backport some additional testbackupstore tests from the test refactor branch.

Merged back changes from the test refactor branch to reduce diffs.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3388 9c52e268-1103-0410-960d-c6a436f6b474
Allow changing exclude lists when reconfiguring BackupDaemon.

Some tests need to do this. I don't think it happens in normal use,
because the daemon's response to HUP takes a different path, I think.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3389 9c52e268-1103-0410-960d-c6a436f6b474
Handle raidfile versioning better on low time accuracy systems.

We simulate a 1 second accuracy clock in DEBUG mode on all systems, to help
catch corner cases in tests. This now applies to both RAID and non-RAID files.

We always add file size to the version number to help detect changes,
especially in such cases. In RELEASE builds, we use as much accuracy from the
clock as we can get, as well as file size.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3390 9c52e268-1103-0410-960d-c6a436f6b474
Add the new object ID to NotifyFileUploaded messages.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3391 9c52e268-1103-0410-960d-c6a436f6b474
Reinstate the -o and -d options to bbackupquery list.

Accidentally removed by the previous change to enhance sorting of list output.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3392 9c52e268-1103-0410-960d-c6a436f6b474
Improve directory cache messages in BackupStoreContext.

May help to debug issues with directory cache invalidation in future.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3393 9c52e268-1103-0410-960d-c6a436f6b474
Fix tests broken by changing working directory.

Store the current working directory at the beginning of the first test, and
restore it at the beginning of every subsequent test.

Improve cleanup after tests: delete and recreate the bbackupd state directory.

Remove check for reference counts and account errors from tearDown, because
they are too hard to retrofit to testbbackupd, and already copied into
testbackupstore tearDown.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3394 9c52e268-1103-0410-960d-c6a436f6b474
Fix error in BufferedStream::StreamDataLeft.

StreamDataLeft() incorrectly returned false when there was still data
buffered, which made IOStream::CopyStreamTo stop copying early, resulting
in incomplete files when copying data out of a BufferedStream. This meant
that tests involving a local protocol, where a BufferedStream was copied
directly to a RaidFile, resulted in corrupted files that would not verify.

git-svn-id: https://www.boxbackup.org/svn/box/trunk@3395 9c52e268-1103-0410-960d-c6a436f6b474