summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Karpovskiy <dmitriy.karpovskiy@fruct.org>2021-02-03 12:04:06 +0300
committerAnel <an3l@users.noreply.github.com>2021-04-12 21:34:37 +0200
commitf776fa96b4e04644155087a2c3919be13c1000a6 (patch)
tree46cf8b17de2323611cc2f8b26a227374e2557c71
parent68e0defc5be41e42f5f9d050a436a5f88277a586 (diff)
downloadmariadb-git-f776fa96b4e04644155087a2c3919be13c1000a6.tar.gz
MDEV-24135: Print warnings in XML, save test retries in XML, save the combinations in XML, replace the special symbols in the XML comment
-rw-r--r--mysql-test/lib/mtr_report.pm30
-rwxr-xr-xmysql-test/mysql-test-run.pl10
2 files changed, 26 insertions, 14 deletions
diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm
index 98ed77eea0f..8142b0a5cbb 100644
--- a/mysql-test/lib/mtr_report.pm
+++ b/mysql-test/lib/mtr_report.pm
@@ -497,23 +497,21 @@ sub mtr_report_stats ($$$$) {
$test_time = sprintf("%.3f", $test->{timer} / 1000);
$test->{'name'} =~ s/$current_suite\.//;
- my $test_result;
-
- # if a test case has to be retried it should have the result MTR_RES_FAILED in jUnit XML
- if ($test->{'retries'} > 0) {
- $test_result = "MTR_RES_FAILED";
+ my $combinations;
+ if (defined($test->{combinations})){
+ $combinations = join ',', sort @{$test->{combinations}};
} else {
- $test_result = $test->{'result'};
+ $combinations = "";
}
- $xml_report .= qq(\t\t<testcase assertions="" classname="$current_suite" name="$test->{'name'}" status="$test_result" time="$test_time");
+ $xml_report .= qq(\t\t<testcase assertions="" classname="$current_suite" name="$test->{'name'}" ).
+ qq(status="$test->{'result'}" time="$test_time" combinations="$combinations");
- my $comment = $test->{'comment'};
- $comment =~ s/[\"]//g;
+ my $comment= replace_special_symbols($test->{'comment'});
- # if a test case has to be retried it should have the result MTR_RES_FAILED in jUnit XML
- if ($test->{'result'} eq "MTR_RES_FAILED" || $test->{'retries'} > 0) {
+ if ($test->{'result'} eq "MTR_RES_FAILED") {
my $logcontents = $test->{'logfile-failed'} || $test->{'logfile'};
+ $logcontents= $logcontents.$test->{'warnings'}."\n";
# remove any double ] that would end the cdata
$logcontents =~ s/]]/\x{fffd}/g;
# replace wide characters that aren't allowed in XML 1.0
@@ -576,6 +574,16 @@ sub mtr_print_line () {
print '-' x 74 . "\n";
}
+sub replace_special_symbols($) {
+ my $text= shift;
+ $text =~ s/&/&#38;/g;
+ $text =~ s/'/&#39;/g;
+ $text =~ s/"/&#34;/g;
+ $text =~ s/</&lt;/g;
+ $text =~ s/>/&gt;/g;
+ return $text;
+}
+
sub mtr_print_thick_line {
my $char= shift || '=';
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index fd25c28dc06..5e46cfe8eff 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -888,9 +888,13 @@ sub run_test_server ($$$) {
rename $log_file_name, $log_file_name.".failed";
}
- delete($result->{result});
- $result->{retries}= $retries+1;
- $result->write_test($sock, 'TESTCASE');
+ {
+ local @$result{'retries', 'result'};
+ delete $result->{result};
+ $result->{retries}= $retries+1;
+ $result->write_test($sock, 'TESTCASE');
+ }
+ push(@$completed, $result);
next;
}
}