Add a test configuration running cryfs in foreground

This commit is contained in:
Sebastian Messmer 2015-10-29 20:00:59 +01:00
parent f42eefbc6b
commit c572e7f353

View File

@ -6,7 +6,6 @@
// - mountdir exists but is missing permissions
// - TODO when else is libfuse failing? What requirements are there for the mountdir?)
//TODO Test what happens if basedir == mountdir
//TODO Test all stuff (basedir missing, not readable, not writeable, not accessible, ...) also with "-f" foreground flag.
namespace bf = boost::filesystem;
@ -17,6 +16,7 @@ using std::vector;
struct TestConfig {
bool externalConfigfile;
bool logIsNotStderr;
bool runningInForeground;
};
//Tests what happens if cryfs is run in the wrong environment, i.e. with a base directory that doesn't exist or similar
@ -48,14 +48,21 @@ public:
result.push_back("--logfile");
result.push_back(logfile.path().c_str());
}
if (GetParam().runningInForeground) {
result.push_back("-f");
}
return result;
}
};
INSTANTIATE_TEST_CASE_P(DefaultParams, CliTest_WrongEnvironment, Values(TestConfig({false, false})));
INSTANTIATE_TEST_CASE_P(ExternalConfigfile, CliTest_WrongEnvironment, Values(TestConfig({true, false})));
INSTANTIATE_TEST_CASE_P(LogIsNotStderr, CliTest_WrongEnvironment, Values(TestConfig({false, true})));
INSTANTIATE_TEST_CASE_P(ExternalConfigfile_LogIsNotStderr, CliTest_WrongEnvironment, Values(TestConfig({true, true})));
INSTANTIATE_TEST_CASE_P(DefaultParams, CliTest_WrongEnvironment, Values(TestConfig({false, false, false})));
INSTANTIATE_TEST_CASE_P(ExternalConfigfile, CliTest_WrongEnvironment, Values(TestConfig({true, false, false})));
INSTANTIATE_TEST_CASE_P(LogIsNotStderr, CliTest_WrongEnvironment, Values(TestConfig({false, true, false})));
INSTANTIATE_TEST_CASE_P(ExternalConfigfile_LogIsNotStderr, CliTest_WrongEnvironment, Values(TestConfig({true, true, false})));
INSTANTIATE_TEST_CASE_P(RunningInForeground, CliTest_WrongEnvironment, Values(TestConfig({false, false, true})));
INSTANTIATE_TEST_CASE_P(RunningInForeground_ExternalConfigfile, CliTest_WrongEnvironment, Values(TestConfig({true, false, true})));
INSTANTIATE_TEST_CASE_P(RunningInForeground_LogIsNotStderr, CliTest_WrongEnvironment, Values(TestConfig({false, true, true})));
INSTANTIATE_TEST_CASE_P(RunningInForeground_ExternalConfigfile_LogIsNotStderr, CliTest_WrongEnvironment, Values(TestConfig({true, true, true})));
//Counter-Test. Test that it doesn't fail if we call it without an error condition.
TEST_P(CliTest_WrongEnvironment, NoErrorCondition) {
@ -75,7 +82,7 @@ TEST_P(CliTest_WrongEnvironment, BaseDir_NoReadPermission) {
}
TEST_P(CliTest_WrongEnvironment, BaseDir_NoWritePermission) {
RemoveReadPermission(basedir);
RemoveWritePermission(basedir);
Test_Run_Error("Error: Base directory not writeable");
}