1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00
mysql-test/lib/mtr_cases.pl:
  Auto merged
mysql-test/lib/mtr_misc.pl:
  Auto merged
This commit is contained in:
unknown
2006-03-09 00:40:52 +01:00
3 changed files with 92 additions and 11 deletions

View File

@ -155,11 +155,24 @@ sub collect_test_cases ($) {
if ( $::opt_reorder )
{
@$cases = sort {
if ( $a->{'master_restart'} and $b->{'master_restart'} or
! $a->{'master_restart'} and ! $b->{'master_restart'} )
if ( ! $a->{'master_restart'} and ! $b->{'master_restart'} )
{
return $a->{'name'} cmp $b->{'name'};
}
if ( $a->{'master_restart'} and $b->{'master_restart'} )
{
my $cmp= mtr_cmp_opts($a->{'master_opt'}, $b->{'master_opt'});
if ( $cmp == 0 )
{
return $a->{'name'} cmp $b->{'name'};
}
else
{
return $cmp;
}
}
if ( $a->{'master_restart'} )
{
return 1; # Is greater

View File

@ -13,6 +13,9 @@ sub mtr_add_arg ($$@);
sub mtr_path_exists(@);
sub mtr_script_exists(@);
sub mtr_exe_exists(@);
sub mtr_copy_dir($$);
sub mtr_same_opts($$);
sub mtr_cmp_opts($$);
##############################################################################
#
@ -108,5 +111,44 @@ sub mtr_exe_exists (@) {
}
}
sub mtr_copy_dir($$) {
my $srcdir= shift;
my $dstdir= shift;
# Create destination directory
mkpath($dstdir);
find(\&mtr_copy_one_file, $dstdir);
}
sub mtr_copy_one_file {
print $File::Find::name, "\n";
}
sub mtr_same_opts ($$) {
my $l1= shift;
my $l2= shift;
return mtr_cmp_opts($l1,$l2) == 0;
}
sub mtr_cmp_opts ($$) {
my $l1= shift;
my $l2= shift;
my @l1= @$l1;
my @l2= @$l2;
return -1 if @l1 < @l2;
return 1 if @l1 > @l2;
while ( @l1 ) # Same length
{
my $e1= shift @l1;
my $e2= shift @l2;
my $cmp= ($e1 cmp $e2);
return $cmp if $cmp != 0;
}
return 0; # They are the same
}
1;