[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:
Yuanfang Chen 2022-04-05 12:47:09 -07:00
parent 175b9af484
commit c32f8f3461
2 changed files with 5 additions and 3 deletions

View file

@ -391,7 +391,8 @@ TEST(CommandLineTest, HideUnrelatedOptions) {
StringMap<cl::Option *> &Map =
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.";
}
@ -416,7 +417,8 @@ TEST(CommandLineTest, HideUnrelatedOptionsMulti) {
StringMap<cl::Option *> &Map =
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.";
}

View file

@ -474,7 +474,7 @@ TEST(Error, createStringError) {
}
// Test that the ExitOnError utility works as expected.
TEST(Error, ExitOnError) {
TEST(ErrorDeathTest, ExitOnError) {
ExitOnError ExitOnErr;
ExitOnErr.setBanner("Error in tool:");
ExitOnErr.setExitCodeMapper([](const Error &E) {