Skip to content

Commit

Permalink
[RGT] Refactor Windows-specific checks into their own test
Browse files Browse the repository at this point in the history
This allows using GTEST_SKIP() to identify un-executed tests.

Found by the Rotten Green Tests project.
  • Loading branch information
pogo59 committed Feb 11, 2022
1 parent d2495b6 commit a0ac6a9
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions llvm/unittests/Support/CommandLineTest.cpp
Expand Up @@ -743,21 +743,24 @@ TEST(CommandLineTest, ArgumentLimit) {
EXPECT_FALSE(llvm::sys::commandLineFitsWithinSystemLimits("cl", args.data()));
std::string args2(256, 'a');
EXPECT_TRUE(llvm::sys::commandLineFitsWithinSystemLimits("cl", args2.data()));
if (Triple(sys::getProcessTriple()).isOSWindows()) {
// We use 32000 as a limit for command line length. Program name ('cl'),
// separating spaces and termination null character occupy 5 symbols.
std::string long_arg(32000 - 5, 'b');
EXPECT_TRUE(
llvm::sys::commandLineFitsWithinSystemLimits("cl", long_arg.data()));
long_arg += 'b';
EXPECT_FALSE(
llvm::sys::commandLineFitsWithinSystemLimits("cl", long_arg.data()));
}
}

TEST(CommandLineTest, ArgumentLimitWindows) {
if (!Triple(sys::getProcessTriple()).isOSWindows())
GTEST_SKIP();
// We use 32000 as a limit for command line length. Program name ('cl'),
// separating spaces and termination null character occupy 5 symbols.
std::string long_arg(32000 - 5, 'b');
EXPECT_TRUE(
llvm::sys::commandLineFitsWithinSystemLimits("cl", long_arg.data()));
long_arg += 'b';
EXPECT_FALSE(
llvm::sys::commandLineFitsWithinSystemLimits("cl", long_arg.data()));
}

TEST(CommandLineTest, ResponseFileWindows) {
if (!Triple(sys::getProcessTriple()).isOSWindows())
return;
GTEST_SKIP();

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

0 comments on commit a0ac6a9

Please sign in to comment.