Skip to content

Commit f776fa9

Browse files
DmitriyKarpovskiy1an3l
authored andcommitted
MDEV-24135: Print warnings in XML, save test retries in XML, save the combinations in XML, replace the special symbols in the XML comment
1 parent 68e0def commit f776fa9

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

mysql-test/lib/mtr_report.pm

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -497,23 +497,21 @@ sub mtr_report_stats ($$$$) {
497497
$test_time = sprintf("%.3f", $test->{timer} / 1000);
498498
$test->{'name'} =~ s/$current_suite\.//;
499499

500-
my $test_result;
501-
502-
# if a test case has to be retried it should have the result MTR_RES_FAILED in jUnit XML
503-
if ($test->{'retries'} > 0) {
504-
$test_result = "MTR_RES_FAILED";
500+
my $combinations;
501+
if (defined($test->{combinations})){
502+
$combinations = join ',', sort @{$test->{combinations}};
505503
} else {
506-
$test_result = $test->{'result'};
504+
$combinations = "";
507505
}
508506

509-
$xml_report .= qq(\t\t<testcase assertions="" classname="$current_suite" name="$test->{'name'}" status="$test_result" time="$test_time");
507+
$xml_report .= qq(\t\t<testcase assertions="" classname="$current_suite" name="$test->{'name'}" ).
508+
qq(status="$test->{'result'}" time="$test_time" combinations="$combinations");
510509

511-
my $comment = $test->{'comment'};
512-
$comment =~ s/[\"]//g;
510+
my $comment= replace_special_symbols($test->{'comment'});
513511

514-
# if a test case has to be retried it should have the result MTR_RES_FAILED in jUnit XML
515-
if ($test->{'result'} eq "MTR_RES_FAILED" || $test->{'retries'} > 0) {
512+
if ($test->{'result'} eq "MTR_RES_FAILED") {
516513
my $logcontents = $test->{'logfile-failed'} || $test->{'logfile'};
514+
$logcontents= $logcontents.$test->{'warnings'}."\n";
517515
# remove any double ] that would end the cdata
518516
$logcontents =~ s/]]/\x{fffd}/g;
519517
# replace wide characters that aren't allowed in XML 1.0
@@ -576,6 +574,16 @@ sub mtr_print_line () {
576574
print '-' x 74 . "\n";
577575
}
578576

577+
sub replace_special_symbols($) {
578+
my $text= shift;
579+
$text =~ s/&/&#38;/g;
580+
$text =~ s/'/&#39;/g;
581+
$text =~ s/"/&#34;/g;
582+
$text =~ s/</&lt;/g;
583+
$text =~ s/>/&gt;/g;
584+
return $text;
585+
}
586+
579587

580588
sub mtr_print_thick_line {
581589
my $char= shift || '=';

mysql-test/mysql-test-run.pl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -888,9 +888,13 @@ ($$$)
888888

889889
rename $log_file_name, $log_file_name.".failed";
890890
}
891-
delete($result->{result});
892-
$result->{retries}= $retries+1;
893-
$result->write_test($sock, 'TESTCASE');
891+
{
892+
local @$result{'retries', 'result'};
893+
delete $result->{result};
894+
$result->{retries}= $retries+1;
895+
$result->write_test($sock, 'TESTCASE');
896+
}
897+
push(@$completed, $result);
894898
next;
895899
}
896900
}

0 commit comments

Comments
 (0)