Fix death tests in multithreading context

This commit is contained in:
Sebastian Meßmer 2015-10-16 04:06:00 +02:00
parent 20612fb245
commit bb90bb19ba
3 changed files with 13 additions and 9 deletions

View File

@ -7,6 +7,7 @@ using namespace cryfs::program_options;
using std::pair;
using std::vector;
using std::cerr;
using std::endl;
using std::string;
Parser::Parser(int argc, char *argv[]) :_options(_argsToVector(argc, argv)) {}
@ -81,6 +82,6 @@ void Parser::_addPositionalOptionForBaseDir(po::options_description *desc, po::p
cerr << "Usage: cryfs --config configFile [other options] rootDir mountPoint [-- [FUSE Mount Options]]\n";
po::options_description desc;
_addAllowedOptions(&desc);
cerr << desc << "\n";
cerr << desc << endl;
exit(1);
}

View File

@ -7,7 +7,7 @@
namespace cryfs {
namespace program_options {
class ProgramOptions {
class ProgramOptions final {
public:
ProgramOptions(const std::string &baseDir, const std::string &mountDir, const std::string &configFile, bool foreground, const std::vector<char *> &fuseOptions);
~ProgramOptions();

View File

@ -12,35 +12,38 @@ public:
}
};
TEST_F(ProgramOptionsParserTest, MissingAllOptions) {
class ProgramOptionsParserDeathTest: public ProgramOptionsParserTest {};
TEST_F(ProgramOptionsParserDeathTest, MissingAllOptions) {
EXPECT_DEATH(
parse({"./myExecutable"}),
"Usage:"
parse({"./myExecutable"}),
"Usage:"
);
std::cout << "exited" << std::endl;
}
TEST_F(ProgramOptionsParserTest, MissingDir) {
TEST_F(ProgramOptionsParserDeathTest, MissingDir) {
EXPECT_DEATH(
parse({"./myExecutable", "/home/user/baseDir"}),
"Usage:"
);
}
TEST_F(ProgramOptionsParserTest, ConfigFileMissing) {
TEST_F(ProgramOptionsParserDeathTest, ConfigFileMissing) {
EXPECT_DEATH(
parse({"./myExecutable", "/home/user/baseDir", "/home/user/mountDir"}),
"Usage:"
);
}
TEST_F(ProgramOptionsParserTest, HelpLongOption) {
TEST_F(ProgramOptionsParserDeathTest, HelpLongOption) {
EXPECT_DEATH(
parse({"./myExecutable", "--help"}),
"Usage:"
);
}
TEST_F(ProgramOptionsParserTest, HelpShortOption) {
TEST_F(ProgramOptionsParserDeathTest, HelpShortOption) {
EXPECT_DEATH(
parse({"./myExecutable", "-h"}),
"Usage:"