diff --git a/test/backupstore/testbackupstore.cpp b/test/backupstore/testbackupstore.cpp index 786afb127..6f1d1d142 100644 --- a/test/backupstore/testbackupstore.cpp +++ b/test/backupstore/testbackupstore.cpp @@ -219,7 +219,9 @@ bool setup_test_backupstore_specialised(const std::string& spec_name, #define SETUP_TEST_BACKUPSTORE_SPECIALISED(name, control) \ SETUP_SPECIALISED(name); \ - TEST_THAT_OR(setup_test_backupstore_specialised(name, control), FAIL); + TEST_THAT_OR(setup_test_backupstore_specialised(name, control), FAIL); \ + try \ + { // left open for TEARDOWN_TEST_BACKUPSTORE_SPECIALISED() //! Checks account for errors and shuts down daemons at end of every test. bool teardown_test_backupstore() @@ -258,13 +260,25 @@ bool teardown_test_backupstore_specialised(const std::string& spec_name, } #define TEARDOWN_TEST_BACKUPSTORE_SPECIALISED(name, control) \ - if (ServerIsAlive(bbstored_pid)) \ - StopServer(); \ - if(control.GetCurrentFileSystem() != NULL) \ + if (ServerIsAlive(bbstored_pid)) \ + StopServer(); \ + if(control.GetCurrentFileSystem() != NULL) \ + { \ + control.GetCurrentFileSystem()->ReleaseLock(); \ + } \ + TEST_THAT_OR(teardown_test_backupstore_specialised(name, control), FAIL); \ + } \ + catch (BoxException &e) \ { \ - control.GetCurrentFileSystem()->ReleaseLock(); \ + if (ServerIsAlive(bbstored_pid)) \ + StopServer(); \ + if(control.GetCurrentFileSystem() != NULL) \ + { \ + control.GetCurrentFileSystem()->ReleaseLock(); \ + } \ + TEST_THAT_OR(teardown_test_backupstore_specialised(name, control), FAIL); \ + throw; \ } \ - TEST_THAT_OR(teardown_test_backupstore_specialised(name, control), FAIL); \ TEARDOWN(); // Nice random data for testing written files