Merge pull request #175 from tplavcic/3.0-jenkins-test

Add prove2junit.pl script to parse mysql test results into format jenkins can understand
This commit is contained in:
Tomislav Plavcic
2017-03-09 16:23:23 +01:00
committed by GitHub
2 changed files with 27 additions and 2 deletions

25
sandbox/prove2junit.pl Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env perl
use strict;
use warnings;
my $file = $ARGV[0];
my $testcase = "";
my $error_collect = "";
my $error_print = "";
if (not defined $file) {
die "Need filename as parameter!\n";
}
open (my $info, $file) or die "Could not open $file: $!";
print "<testsuite name=\"PT MySQL Test\">\n";
while(my $line = <$info>) {
if ($line =~ /^(t\/\S+).* (\.*) (skipped:) (.*)$/) { print "<testcase name=\"$1\"><skipped/><system-out>Skip reason:<![CDATA[ $4 ]]></system-out></testcase>\n"; }
elsif ($line =~ /^ok (\d+) - (.*)$/) { print "<testcase name=\"$testcase - test $1\"><system-out>Test description:<![CDATA[ $2 ]]></system-out></testcase>\n"; }
elsif ($line =~ /^not ok (\d+) - (.*)$/) { print "<testcase name=\"$testcase - test $1\"><failure/><system-out>Test description:<![CDATA[ $2 ]]></system-out><system-err><![CDATA[ $error_print ]]></system-err></testcase>\n"; }
elsif ($line =~ /^(t\/\S+).* (\.*) $/) { $testcase = "$1"; $error_print = $error_collect; $error_collect = ""; }
elsif ($line !~ /^ok$/ && $line !~ /^\d+..\d+$/) { $error_collect = $error_collect . $line; }
}
print "</testsuite>\n"

View File

@@ -165,7 +165,7 @@ else {
}
$master_dbh->do("USE pt_osc");
$master_dbh->do("TRUNCATE TABLE t");
$master_dbh->do("LOAD DATA INFILE '$trunk/t/pt-online-schema-change/samples/basic_no_fks.data' INTO TABLE t");
$master_dbh->do("LOAD DATA LOCAL INFILE '$trunk/t/pt-online-schema-change/samples/basic_no_fks.data' INTO TABLE t");
$master_dbh->do("ANALYZE TABLE t");
$sb->wait_for_slaves();
@@ -215,7 +215,7 @@ is(
$master_dbh->do("USE pt_osc");
$master_dbh->do("TRUNCATE TABLE t");
$master_dbh->do("LOAD DATA INFILE '$trunk/t/pt-online-schema-change/samples/basic_no_fks.data' INTO TABLE t");
$master_dbh->do("LOAD DATA LOCAL INFILE '$trunk/t/pt-online-schema-change/samples/basic_no_fks.data' INTO TABLE t");
$master_dbh->do("ANALYZE TABLE t");
$sb->wait_for_slaves();