Skip to content

Commit a0ac6a9

Browse files
committed
[RGT] Refactor Windows-specific checks into their own test
This allows using GTEST_SKIP() to identify un-executed tests. Found by the Rotten Green Tests project.
1 parent d2495b6 commit a0ac6a9

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

llvm/unittests/Support/CommandLineTest.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -743,21 +743,24 @@ TEST(CommandLineTest, ArgumentLimit) {
743743
EXPECT_FALSE(llvm::sys::commandLineFitsWithinSystemLimits("cl", args.data()));
744744
std::string args2(256, 'a');
745745
EXPECT_TRUE(llvm::sys::commandLineFitsWithinSystemLimits("cl", args2.data()));
746-
if (Triple(sys::getProcessTriple()).isOSWindows()) {
747-
// We use 32000 as a limit for command line length. Program name ('cl'),
748-
// separating spaces and termination null character occupy 5 symbols.
749-
std::string long_arg(32000 - 5, 'b');
750-
EXPECT_TRUE(
751-
llvm::sys::commandLineFitsWithinSystemLimits("cl", long_arg.data()));
752-
long_arg += 'b';
753-
EXPECT_FALSE(
754-
llvm::sys::commandLineFitsWithinSystemLimits("cl", long_arg.data()));
755-
}
746+
}
747+
748+
TEST(CommandLineTest, ArgumentLimitWindows) {
749+
if (!Triple(sys::getProcessTriple()).isOSWindows())
750+
GTEST_SKIP();
751+
// We use 32000 as a limit for command line length. Program name ('cl'),
752+
// separating spaces and termination null character occupy 5 symbols.
753+
std::string long_arg(32000 - 5, 'b');
754+
EXPECT_TRUE(
755+
llvm::sys::commandLineFitsWithinSystemLimits("cl", long_arg.data()));
756+
long_arg += 'b';
757+
EXPECT_FALSE(
758+
llvm::sys::commandLineFitsWithinSystemLimits("cl", long_arg.data()));
756759
}
757760

758761
TEST(CommandLineTest, ResponseFileWindows) {
759762
if (!Triple(sys::getProcessTriple()).isOSWindows())
760-
return;
763+
GTEST_SKIP();
761764

762765
StackOption<std::string, cl::list<std::string>> InputFilenames(
763766
cl::Positional, cl::desc("<input files>"), cl::ZeroOrMore);

0 commit comments

Comments
 (0)