aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/CommandLineTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/Support/CommandLineTest.cpp')
-rw-r--r--llvm/unittests/Support/CommandLineTest.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp
index e1b706e..e8c2cef 100644
--- a/llvm/unittests/Support/CommandLineTest.cpp
+++ b/llvm/unittests/Support/CommandLineTest.cpp
@@ -763,6 +763,18 @@ TEST(CommandLineTest, DefaultOptions) {
TEST(CommandLineTest, ArgumentLimit) {
std::string args(32 * 4096, 'a');
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, ResponseFileWindows) {