diff options
author | Björn Gustavsson <[email protected]> | 2011-09-08 11:44:21 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2011-09-08 11:44:21 +0200 |
commit | a192de2308734a5b2cdb4adc859bdb65da6dfb3e (patch) | |
tree | 2a4ef523611ca512d6d2d5580516e19b40d78d2c | |
parent | 22dae863060e0d66fa268f6d1cd4d6f084b850ab (diff) | |
parent | 12ebe3823b01be256b0834956bc2e117129b32e4 (diff) | |
download | otp-a192de2308734a5b2cdb4adc859bdb65da6dfb3e.tar.gz otp-a192de2308734a5b2cdb4adc859bdb65da6dfb3e.tar.bz2 otp-a192de2308734a5b2cdb4adc859bdb65da6dfb3e.zip |
Merge branch 'bjorn/erts/fix-erlc_SUITE-arg_overflow' into dev
* bjorn/erts/fix-erlc_SUITE-arg_overflow:
erlc_SUITE: Fix arg_overflow/1 test case
-rw-r--r-- | erts/test/erlc_SUITE.erl | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/erts/test/erlc_SUITE.erl b/erts/test/erlc_SUITE.erl index 62e0e6813d..2b5cb11f02 100644 --- a/erts/test/erlc_SUITE.erl +++ b/erts/test/erlc_SUITE.erl @@ -213,13 +213,34 @@ deep_cwd_1(PrivDir) -> arg_overflow(Config) when is_list(Config) -> ?line {SrcDir, _OutDir, Cmd} = get_cmd(Config), ?line FileName = filename:join(SrcDir, "erl_test_ok.erl"), - ?line Args = lists:flatten([ ["-D", integer_to_list(N), "=1 "] || - N <- lists:seq(1,10000) ]), + %% Each -D option will be expanded to three arguments when + %% invoking 'erl'. + ?line NumDOptions = num_d_options(), + ?line Args = lists:flatten([ ["-D", integer_to_list(N, 36), "=1 "] || + N <- lists:seq(1, NumDOptions) ]), ?line run(Config, Cmd, FileName, Args, ["Warning: function foo/0 is unused\$", "_OK_"]), ok. +num_d_options() -> + case {os:type(),os:version()} of + {{win32,_},_} -> + %% The maximum size of a command line in the command + %% shell on Windows is 8191 characters. + %% Each -D option is expanded to "@dv NN 1", i.e. + %% 8 characters. (Numbers up to 1295 can be expressed + %% as two 36-base digits.) + 1000; + {{unix,linux},Version} when Version < {2,6,23} -> + %% On some older 64-bit versions of Linux, the maximum number + %% of arguments is 16383. + %% See: http://www.in-ulm.de/~mascheck/various/argmax/ + 5440; + {_,_} -> + 12000 + end. + erlc() -> case os:find_executable("erlc") of false -> |