From 33ef3786227cc47f06a60a4882765f5468f2ce67 Mon Sep 17 00:00:00 2001 From: Dan Kegel Date: Wed, 3 Jun 2020 11:52:55 -0700 Subject: [PATCH] test cases/common/234: get limit right on linux, generate fewer files --- .../234 very long commmand line/meson.build | 27 +++++++++++++++++-- 1 file 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 7a316e192..fe47b5e77 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)