Description:
mysql-test-run.pl with --stress option does not work on Windows boxes and on *nix boxes with non-default configuration.
mysql-test-run in stress mode calls run_stress_test() subroutine from lib/mtr_stress.pl.
run_stress_test calls mtr_run with mysql-stress-test.pl as the first parameter, and with a bunch of arguments; mtr_run calls spawn_impl in the same fashion, and spawn_impl calls exec with path to mysql-stress-test.pl as a pathname and with an array of arguments.
Thus, mysql-stress-test.pl is called via exec() as an executable, not as an argument (script name) for perl.
One general problem is that construction
exec( "<perl script pathname>", @args" )
does not work on Windows when @args is not empty, while construction
exec( "perl", ( "<perl script pathname>", @args )
does.
It happens even if .pl extension are associated with perl interpreter, etc.
Checked with ActivePerl build 1004 and Strawberry Perl 5.10.0, so it is not single-version-related.
Besides that, there are some more specific cases when such call of mysql-stress-test does not work.
Examples:
- (*nix) if /usr/bin/perl exists, but does not support threads -- this is now the case on our Solaris test boxes, where Perl with threads has different location;
- (Windows, even in case of empty @args) If .pl extension is not associated with perl interpreter;
- (*nix) if /usr/bin/perl, which is given in #!, does not exist;
- (*nix) if mysql-stress-test.pl does not have execution permissions on whatever reason;
etc.
How to repeat:
In a system with at least one pre-condition from the list above (depending on which error you want to reproduce);
- cd to <mysql-basedir>/mysql-test;
- make sure that the folder contains mysql-stress-test.pl (see bug:41546);
- run perl ./mysql-test-run.pl with some stress parameters, e.g. taken from bug:35322.
In case of not supported threads or non-existing perl on *nix systems, there will be a corresponding error message. In case of the Windows problem, no visible errors are produced -- stdout will contain only "Starting stress testing" and immediately "Stopping All Servers".
Suggested fix:
A simple fix is to call exec with 'perl' (without absolute path) as the 1st argument, and pass the script name as the first element of the args array. This will eliminate some problems and will allow a user to influence the execution by setting correct PATH.
A more complicated solution could be taking path to perl as an option, and pre-configuring it on per-system basis for auto-testing according to our common configurations of Solaris, Linux and Windows boxes.