aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorDan Kegel <dank@kegel.com>2020-06-03 11:52:55 -0700
committerDan Kegel <dank@kegel.com>2020-06-05 14:15:32 -0700
commit33ef3786227cc47f06a60a4882765f5468f2ce67 (patch)
treea814e4686a01bb1c99ee3f5a1933ea06b8383cd1 /test cases
parent10e6a989ba337e931ad7abae8d960ee9dc0a0b1d (diff)
downloadmeson-33ef3786227cc47f06a60a4882765f5468f2ce67.zip
meson-33ef3786227cc47f06a60a4882765f5468f2ce67.tar.gz
meson-33ef3786227cc47f06a60a4882765f5468f2ce67.tar.bz2
test cases/common/234: get limit right on linux, generate fewer files
Diffstat (limited to 'test cases')
-rw-r--r--test cases/common/234 very long commmand line/meson.build27
1 files changed, 25 insertions, 2 deletions
diff --git a/test cases/common/234 very long commmand line/meson.build b/test cases/common/234 very long commmand line/meson.build
index 7a316e1..fe47b5e 100644
--- a/test cases/common/234 very long commmand line/meson.build
+++ b/test cases/common/234 very long commmand line/meson.build
@@ -1,6 +1,29 @@
project('very long command lines', 'c')
-seq = run_command('seq.py', '1', '256').stdout().strip().split('\n')
+# Get the current system's commandline length limit.
+if build_machine.system() == 'windows'
+ # Various limits on windows:
+ # cmd.exe: 8kb
+ # CreateProcess: 32kb
+ limit = 32767
+elif build_machine.system() == 'cygwin'
+ # cygwin-to-win32: see above
+ # cygwin-to-cygwin: no limit?
+ # Cygwin is slow, so only test it lightly here.
+ limit = 8192
+else
+ # ninja passes whole line as a single argument, for which
+ # the limit is 128k as of Linux 2.6.23. See MAX_ARG_STRLEN.
+ # BSD seems similar, see https://www.in-ulm.de/~mascheck/various/argmax
+ limit = 131072
+endif
+# Now exceed that limit, but not so far that the test takes too long.
+name = 'ALongFilenameMuchLongerThanIsNormallySeenAndReallyHardToReadThroughToTheEndAMooseOnceBitMySisterSheNowWorksAtLLamaFreshFarmsThisHasToBeSoLongThatWeExceed128KBWithoutCompilingTooManyFiles'
+namelen = 187
+nfiles = 50 + limit / namelen
+message('Expected link commandline length is approximately ' + '@0@'.format((nfiles * (namelen+28))))
+
+seq = run_command('seq.py', '1', '@0@'.format(nfiles)).stdout().strip().split('\n')
sources = []
codegen = find_program('codegen.py')
@@ -8,7 +31,7 @@ codegen = find_program('codegen.py')
foreach i : seq
sources += custom_target('codegen' + i,
command: [codegen, i, '@OUTPUT@'],
- output: 'test' + i + '.c')
+ output: name + i + '.c')
endforeach
shared_library('sharedlib', sources)