aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/CommandLineTest.cpp
diff options
context:
space:
mode:
authorYuanfang Chen <yuanfang.chen@sony.com>2022-04-05 12:47:09 -0700
committerYuanfang Chen <yuanfang.chen@sony.com>2022-04-05 18:19:20 -0700
commitc32f8f34614d89dbe4978b71b6e2a6da17b1b0d4 (patch)
treea8db5a24cdacad9e3e42490b2d2348b6d84b1c39 /llvm/unittests/Support/CommandLineTest.cpp
parent175b9af484f483c3423ab2f78db5de7e25b64c31 (diff)
downloadllvm-c32f8f34614d89dbe4978b71b6e2a6da17b1b0d4.zip
llvm-c32f8f34614d89dbe4978b71b6e2a6da17b1b0d4.tar.gz
llvm-c32f8f34614d89dbe4978b71b6e2a6da17b1b0d4.tar.bz2
[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.
Diffstat (limited to 'llvm/unittests/Support/CommandLineTest.cpp')
-rw-r--r--llvm/unittests/Support/CommandLineTest.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp
index e68761e..dd02d92 100644
--- a/llvm/unittests/Support/CommandLineTest.cpp
+++ b/llvm/unittests/Support/CommandLineTest.cpp
@@ -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.";
}