[unittests] fix intermittent SupportTests failures
by invoking `SupportTests --gtest_shuffle=1`. `HideUnrelatedOptions`/`HideUnrelatedOptionsMulti` failed due to other tests calling `cl::ResetCommandLineParser()` which causes default options to be removed. `ExitOnError` would hang due to the threading environment. Renaming it as `*Deathtest` is the recommended practice by GTest docs.
This commit is contained in:
parent
175b9af484
commit
c32f8f3461
|
@ -391,7 +391,8 @@ TEST(CommandLineTest, HideUnrelatedOptions) {
|
||||||
|
|
||||||
StringMap<cl::Option *> &Map =
|
StringMap<cl::Option *> &Map =
|
||||||
cl::getRegisteredOptions(*cl::TopLevelSubCommand);
|
cl::getRegisteredOptions(*cl::TopLevelSubCommand);
|
||||||
ASSERT_EQ(cl::NotHidden, Map["help"]->getOptionHiddenFlag())
|
ASSERT_TRUE(Map.count("help") == (size_t)0 ||
|
||||||
|
cl::NotHidden == Map["help"]->getOptionHiddenFlag())
|
||||||
<< "Hid default option that should be visable.";
|
<< "Hid default option that should be visable.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +417,8 @@ TEST(CommandLineTest, HideUnrelatedOptionsMulti) {
|
||||||
|
|
||||||
StringMap<cl::Option *> &Map =
|
StringMap<cl::Option *> &Map =
|
||||||
cl::getRegisteredOptions(*cl::TopLevelSubCommand);
|
cl::getRegisteredOptions(*cl::TopLevelSubCommand);
|
||||||
ASSERT_EQ(cl::NotHidden, Map["help"]->getOptionHiddenFlag())
|
ASSERT_TRUE(Map.count("help") == (size_t)0 ||
|
||||||
|
cl::NotHidden == Map["help"]->getOptionHiddenFlag())
|
||||||
<< "Hid default option that should be visable.";
|
<< "Hid default option that should be visable.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -474,7 +474,7 @@ TEST(Error, createStringError) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that the ExitOnError utility works as expected.
|
// Test that the ExitOnError utility works as expected.
|
||||||
TEST(Error, ExitOnError) {
|
TEST(ErrorDeathTest, ExitOnError) {
|
||||||
ExitOnError ExitOnErr;
|
ExitOnError ExitOnErr;
|
||||||
ExitOnErr.setBanner("Error in tool:");
|
ExitOnErr.setBanner("Error in tool:");
|
||||||
ExitOnErr.setExitCodeMapper([](const Error &E) {
|
ExitOnErr.setExitCodeMapper([](const Error &E) {
|
||||||
|
|
Loading…
Reference in a new issue