Skip to content

Commit 95fa7bc

Browse files
committed
MDEV-22273 jUnit patch: xml test result differs from MTR output in case if retry
1 parent dc2a858 commit 95fa7bc

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

mysql-test/lib/mtr_report.pm

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,12 +472,15 @@ sub mtr_report_stats ($$$$) {
472472
my $comment = $test->{'comment'};
473473
$comment =~ s/[\"]//g;
474474

475-
if ($test->{'result'} eq "MTR_RES_FAILED") {
476-
$xml_report .= qq(>\n\t\t\t<failure message="" type="$test->{'result'}">\n<![CDATA[$test->{'logfile'}]]>\n\t\t\t</failure>\n\t\t</testcase>\n);
475+
# if a test case has to be retried it should have the result MTR_RES_FAILED in jUnit XML
476+
if ($test->{'result'} eq "MTR_RES_FAILED" || $test->{'retries'}) {
477+
my $logcontents = $test->{'logfile-failed'} || $test->{'logfile'};
478+
479+
$xml_report .= qq(>\n\t\t\t<failure message="" type="MTR_RES_FAILED">\n<![CDATA[$logcontents]]>\n\t\t\t</failure>\n\t\t</testcase>\n);
477480
} elsif ($test->{'result'} eq "MTR_RES_SKIPPED" && $test->{'disable'}) {
478-
$xml_report .= qq(>\n\t\t\t<disabled message="$comment" type="$test->{'result'}"/>\n\t\t</testcase>\n);
481+
$xml_report .= qq(>\n\t\t\t<disabled message="$comment" type="MTR_RES_SKIPPED"/>\n\t\t</testcase>\n);
479482
} elsif ($test->{'result'} eq "MTR_RES_SKIPPED") {
480-
$xml_report .= qq(>\n\t\t\t<skipped message="$comment" type="$test->{'result'}"/>\n\t\t</testcase>\n);
483+
$xml_report .= qq(>\n\t\t\t<skipped message="$comment" type="MTR_RES_SKIPPED"/>\n\t\t</testcase>\n);
481484
} else {
482485
$xml_report .= " />\n";
483486
}

mysql-test/mysql-test-run.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,7 @@ ($$$)
769769
if ( $result->is_failed() ) {
770770
my $worker_logdir= $result->{savedir};
771771
my $log_file_name=dirname($worker_logdir)."/".$result->{shortname}.".log";
772+
$result->{'logfile-failed'} = mtr_lastlinesfromfile($log_file_name, 20);
772773
rename $log_file_name,$log_file_name.".failed";
773774
}
774775
delete($result->{result});

0 commit comments

Comments
 (0)