summaryrefslogtreecommitdiff
path: root/mysql-test/lib
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-12-01 14:55:46 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-12-01 14:55:46 +0200
commit81ab9ea63f5d3ad4909bb75552008d6b035a371b (patch)
tree6e65113d85d36c9f488da15540ddd601e7641fee /mysql-test/lib
parentc537576495e1e651bf3dc63e5a569fcddd9fbec8 (diff)
parente6b3e38d62d13206ae982fc7b740d5d8024b207a (diff)
downloadmariadb-git-81ab9ea63f5d3ad4909bb75552008d6b035a371b.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'mysql-test/lib')
-rw-r--r--mysql-test/lib/mtr_report.pm10
1 files changed, 7 insertions, 3 deletions
diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm
index 32250802815..473b21441e2 100644
--- a/mysql-test/lib/mtr_report.pm
+++ b/mysql-test/lib/mtr_report.pm
@@ -514,6 +514,10 @@ sub mtr_report_stats ($$$$) {
# 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) {
my $logcontents = $test->{'logfile-failed'} || $test->{'logfile'};
+ # remove any double ] that would end the cdata
+ $logcontents =~ s/]]/\x{fffd}/g;
+ # replace wide characters that aren't allowed in XML 1.0
+ $logcontents =~ s/[\x00-\x08\x0B\x0C\x0E-\x1F]/\x{fffd}/g;
$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);
} elsif ($test->{'result'} eq "MTR_RES_SKIPPED" && $test->{'disable'}) {
@@ -530,9 +534,9 @@ sub mtr_report_stats ($$$$) {
# save to file
my $xml_file = $::opt_xml_report;
- open XML_FILE, ">", $xml_file or die "Cannot create file $xml_file: $!";
- print XML_FILE $xml_report;
- close XML_FILE;
+ open (my $XML_UFILE, '>:encoding(UTF-8)', $xml_file) or die 'Cannot create file $xml_file: $!';
+ print $XML_UFILE $xml_report;
+ close $XML_UFILE or warn "File close failed!";
}
if (@$extra_warnings)