mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-30836 MTR Cygwin fix
Cygwin is more Unix-oriented. It does not treat \n as \r\n in regexps (fixed by \R), it supplies Unix-style paths (fixed by mixed_path()). It does some cleanup on paths when running exe, so it will be different in exe output (like with $exe_mysqld, comparing basename() is enough). Cygwin installation 1. Just install latest perl version (only base package) and patchutils from cygwin-setup; 2. Don't forget to add c:\cygwin64\bin into system path before any other perl flavors; 3. There is path-style conflict (see below), you must replace c:\cygwin64\bin\sh.exe with the wrapper. Run MTR with --cygwin-subshell-fix=do for that. Make sure you are running Cygwin perl for the option to work. 4. Restart buildbot via net stop buildbot; net start buildbot Path-style conflict of Cygwin-ish Perl Some exe paths are passed to mysqltest which are executed by a native call. This requires native-style paths (\-style). These exe paths also executed by Perl itself. Either by MTR itself which is not so critical, but also by tests' --perl blocks which is impossible to change. And if Perl detects shell-expansion or uses pipe command it passess this exe path to /bin/sh which is Cygwin-compiled bash that cannot work with \-style (or at least in -c processing). Thus we require \-style on some parts of MTR execution and /-style on another parts. The examples of tests which cover these different parts are: main.mysqlbinlog_row_compressed \ main.sp_trans_log That could be great to force Perl to use something different from /bin/sh, but unfortunately /bin/sh is compiled-in into binary. So the only solution left is to overwrite /bin/sh with some wrapper script which passes the command to cmd.exe instead of bash.
This commit is contained in:
committed by
Daniel Black
parent
4ed583031a
commit
640cd404af
@ -343,7 +343,7 @@ $| = 1; # Automatically flush STDOUT
|
||||
main();
|
||||
|
||||
sub main {
|
||||
$ENV{MTR_PERL}=$^X;
|
||||
$ENV{MTR_PERL}= mixed_path($^X);
|
||||
|
||||
# Default, verbosity on
|
||||
report_option('verbose', 0);
|
||||
@ -1758,11 +1758,12 @@ sub collect_mysqld_features {
|
||||
# to simplify the parsing, we'll merge all nicely formatted --help texts
|
||||
$list =~ s/\n {22}(\S)/ $1/g;
|
||||
|
||||
my @list= split '\n', $list;
|
||||
my @list= split '\R', $list;
|
||||
|
||||
$mysql_version_id= 0;
|
||||
my $exe= basename($exe_mysqld);
|
||||
while (defined(my $line = shift @list)){
|
||||
if ($line =~ /^\Q$exe_mysqld\E\s+Ver\s(\d+)\.(\d+)\.(\d+)(\S*)/ ) {
|
||||
if ($line =~ /\W\Q$exe\E\s+Ver\s(\d+)\.(\d+)\.(\d+)(\S*)/ ) {
|
||||
$mysql_version_id= $1*10000 + $2*100 + $3;
|
||||
mtr_report("MariaDB Version $1.$2.$3$4");
|
||||
last;
|
||||
@ -1786,7 +1787,7 @@ sub collect_mysqld_features {
|
||||
next;
|
||||
}
|
||||
|
||||
last if /^$/; # then goes a list of variables, it ends with an empty line
|
||||
last if /^\r?$/; # then goes a list of variables, it ends with an empty line
|
||||
|
||||
# Put a variable into hash
|
||||
/^([\S]+)[ \t]+(.*?)\r?$/ or die "Could not parse mysqld --help: $_\n";
|
||||
@ -1817,7 +1818,7 @@ sub collect_mysqld_features_from_running_server ()
|
||||
|
||||
my $list = `$cmd` or
|
||||
mtr_error("Could not connect to extern server using command: '$cmd'");
|
||||
foreach my $line (split('\n', $list ))
|
||||
foreach my $line (split('\R', $list ))
|
||||
{
|
||||
# Put variables into hash
|
||||
if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ )
|
||||
@ -2939,7 +2940,7 @@ sub initialize_servers {
|
||||
#
|
||||
sub sql_to_bootstrap {
|
||||
my ($sql) = @_;
|
||||
my @lines= split(/\n/, $sql);
|
||||
my @lines= split(/\R/, $sql);
|
||||
my $result= "\n";
|
||||
my $delimiter= ';';
|
||||
|
||||
|
Reference in New Issue
Block a user