aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/CommandLineTest.cpp
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2022-02-11 10:42:38 -0800
committerPaul Robinson <paul.robinson@sony.com>2022-02-11 10:47:04 -0800
commita0ac6a92125cf6e2fb89daf92be293b28d497c38 (patch)
treeee9abdd35ba99520f466078a44388ba90f311aec /llvm/unittests/Support/CommandLineTest.cpp
parentd2495b69f29d26561181402ca51ee16ab6c96ec2 (diff)
downloadllvm-a0ac6a92125cf6e2fb89daf92be293b28d497c38.zip
llvm-a0ac6a92125cf6e2fb89daf92be293b28d497c38.tar.gz
llvm-a0ac6a92125cf6e2fb89daf92be293b28d497c38.tar.bz2
[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.
Diffstat (limited to 'llvm/unittests/Support/CommandLineTest.cpp')
-rw-r--r--llvm/unittests/Support/CommandLineTest.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp
index 2e007bf..9a7f4f3 100644
--- a/llvm/unittests/Support/CommandLineTest.cpp
+++ b/llvm/unittests/Support/CommandLineTest.cpp
@@ -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);