List:Commits« Previous MessageNext Message »
From:Serge Kozlov Date:October 27 2010 10:03am
Subject:bzr commit into mysql-next-mr branch (Serge.Kozlov:3185) Bug#56573
View as plain text  
#At file:///home/ksm/oracle/repo/bug56573/mysql-next-mr-wl2540-commit/ based on revid:andrei.elkin@stripped

 3185 Serge Kozlov	2010-10-27
      Bug#56573. Adding binlog checksum testing for binlog,rpl suites. For reduce turnaround times only 10% of randomly chosen tests runs from these suites  in PB2 per push.

    added:
      mysql-test/suite/rpl/extension/README.checksum
      mysql-test/suite/rpl/extension/checksum.pl
    modified:
      mysql-test/collections/mysql-next-mr.push
=== modified file 'mysql-test/collections/mysql-next-mr.push'
--- a/mysql-test/collections/mysql-next-mr.push	2010-06-23 10:58:24 +0000
+++ b/mysql-test/collections/mysql-next-mr.push	2010-10-27 10:03:05 +0000
@@ -3,3 +3,4 @@ perl mysql-test-run.pl --timer --force -
 perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded       --vardir=var-emebbed        --embedded                                    --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
 perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row               --mysqld=--binlog-format=row    --suite=rpl,binlog --skip-test-list=collections/disabled-per-push.list
 perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1        --vardir=var-funcs_1                                                      --suite=funcs_1
+perl suite/rpl/extension/checksum.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_checksum --vardir=var-rpl_binlog_checksum --suite=rpl,binlog

=== added file 'mysql-test/suite/rpl/extension/README.checksum'
--- a/mysql-test/suite/rpl/extension/README.checksum	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/extension/README.checksum	2010-10-27 10:03:05 +0000
@@ -0,0 +1,23 @@
+Binlog checksum testing
+=======================
+
+1. How it works.
+The script copies a <suite> to directory <suite>_checksum, 
+collects test case names for t/ directory (except tests from
+disabled def), randomly choose 90% of tests and add them 
+to disabled.def.
+It means that mtr will run only 10% of random tests from each 
+suite.
+At end the script run mtr:
+./mysql-test-run.pl --suite=aaa_checksum,bbb_checksum \
+    --mysqld=--binlog-checksum=CRC32 arg1 ... argN
+
+aaa,bbb 	- suite names from --suite option
+arg1,argN	- other command-line arguments of checksum.pl
+
+2. The options:
+
+--suite=suite1,suite2.  Mandatory option. The list of suites for 
+    binlog checksum testing.
+
+--percent=N, where N is 1..99. Percent of running tests. 

=== added file 'mysql-test/suite/rpl/extension/checksum.pl'
--- a/mysql-test/suite/rpl/extension/checksum.pl	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/extension/checksum.pl	2010-10-27 10:03:05 +0000
@@ -0,0 +1,164 @@
+#!/usr/bin/perl
+
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+use File::Basename;
+use File::Copy qw(copy);
+use File::Spec qw(catdir);
+use File::Path;
+use IO::File;
+use strict;
+
+# Constants and variables with default values
+my $suites;
+my $suffix = "_checksum";
+my $percent_random_test = 10;
+my $mtr_script;
+my @mtr_argv;
+my @mtr_suites;
+
+# Check some arguments
+foreach my $arg ( @ARGV )
+{
+    if ($arg =~ m/\-\-suite\=(.+)/i)
+    {
+        $suites = $1;
+    }
+    elsif ($arg =~ m/\-\-percent\=(\d{1,2})/i)
+    {
+	$percent_random_test= $1;
+    }
+    else
+    {
+	push(@mtr_argv, $arg);
+    }
+    
+}
+if (! defined( $suites ) )
+{
+    die("The script requires --suite argument");
+}
+
+print "#################################################################\n";
+print "# Binlog checksum testing\n";
+print "# Run randomly $percent_random_test\% of tests from following suites: $suites\n";
+print "#################################################################\n";
+
+# Set extension directory
+my $ext_dir= dirname(File::Spec->rel2abs($0));
+# Set mysql-test directory
+my $mysql_test_dir= $ext_dir;
+$mysql_test_dir =~ s/(\/|\\)suite(\/|\\)rpl(\/|\\)extension$//;
+
+# Main loop
+foreach my $src_suite (split(",", $suites))
+{
+    $src_suite=~ s/ //g;
+    my $dest_suite= $src_suite . $suffix;
+    push( @mtr_suites, $dest_suite);
+    print "Creating suite $dest_suite\n";
+    # *** Set platform-independent pathes ***
+    # Set source directory of suite
+    my $src_suite_dir = File::Spec->catdir($mysql_test_dir, "suite", $src_suite);
+    # Set destination directory of suite
+    my $dest_suite_dir = File::Spec->catdir($mysql_test_dir, "suite", $dest_suite);
+    print "Copying files\n\tfrom '$src_suite_dir'\n\tto '$dest_suite_dir'\n";
+    dircopy($src_suite_dir, $dest_suite_dir);
+    my $test_case_dir= File::Spec->catdir($dest_suite_dir, "t");
+    # Read disabled.def
+    my %disabled = ();
+    print "Read disabled.def\n";
+    my $fh = new IO::File File::Spec->catdir($test_case_dir, "disabled.def"), "r";
+    if ( defined $fh ) 
+    {
+	my @lines = <$fh>;
+	undef $fh;
+	foreach my $line ( @lines )
+	{
+	    if ($line =~ m/^([a-zA-Z0-9_]+).+\:.+/i)
+	    {
+		$disabled{$1}= 1;
+	    }
+	}
+    }
+    # Read test case list
+    my %tests = ();
+    print "Generate test case list\n";
+    opendir my ($dh), $test_case_dir or die "Could not open dir '$test_case_dir': $!";
+    for my $entry (readdir $dh) 
+    {
+	if ( $entry =~ m/^([a-zA-Z0-9_]+)\.test$/i )
+	{
+	    my $test= $1;
+	    if ( ! defined( $disabled{$test}) )
+	    {
+		$tests{$test}= 1;
+	    }
+	}
+    }
+    closedir($dh);
+    # 
+    my @excluded = ();
+    my $excluded_test= int((((100 - $percent_random_test)/100) * scalar( keys %tests )));
+    while  ( $excluded_test > 0 )
+    {
+	my @cases = keys %tests;
+	my $test = $cases[int(rand(scalar(@cases)))];
+	push ( @excluded, $test . "\t\t: Excluded for $dest_suite\n" );
+	delete $tests{$test};		
+	$excluded_test--;
+    }
+    my $fh = new IO::File File::Spec->catdir($test_case_dir, "disabled.def"), O_WRONLY|O_APPEND;
+    if (defined $fh) {
+	print $fh join ("", sort @excluded);
+	undef $fh;
+    }
+    print "\t" . join("\n\t", sort keys %tests) . "\n";
+    
+}
+
+# Set path to mtr with arguments
+my $mtr_script = "perl " . File::Spec->catdir($mysql_test_dir, "mysql-test-run.pl") . 
+    " --suite=" . join(",", @mtr_suites) . " " . 
+    " --mysqld=--binlog-checksum=CRC32 " . 
+    join (" ", @mtr_argv);
+
+print "Run $mtr_script\n";
+system( $mtr_script );
+
+sub dircopy
+{
+    my ($from_dir, $to_dir)= @_;
+    mkdir $to_dir if (! -e $to_dir);
+    opendir my($dh), $from_dir or die "Could not open dir '$from_dir': $!";
+    for my $entry (readdir $dh) 
+    {
+	next if $entry =~ /^(\.|\.\.)$/;
+        my $source = File::Spec->catdir($from_dir, $entry);
+        my $destination = File::Spec->catdir($to_dir, $entry);
+        if (-d $source) 
+        {
+    	    mkdir $destination or die "mkdir '$destination' failed: $!" if not -e $destination;
+            dircopy($source, $destination);
+        } 
+        else 
+        {
+    	    copy($source, $destination) or die "copy '$source' to '$destination' failed: $!";
+        }
+    }
+    closedir $dh;
+    return;                                                                                                  
+}


Attachment: [text/bzr-bundle] bzr/serge.kozlov@sun.com-20101027100305-xsgw7af17vdr82uy.bundle
Thread
bzr commit into mysql-next-mr branch (Serge.Kozlov:3185) Bug#56573Serge Kozlov27 Oct