From f0bf92f224dd9637bb22a16991eb8ffb8d3434ad Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Tue, 19 May 2020 11:16:15 -0600 Subject: [PATCH] Improve XML with testrun data too, escape stuff that chokes XML --- lib/framework.exp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/framework.exp b/lib/framework.exp index e6ce197..c8b002d 100644 --- a/lib/framework.exp +++ b/lib/framework.exp @@ -56,6 +56,11 @@ proc open_logs { } { global sum_file global xml_file global xml + global build_triplet + global host_triplet + global target_triplet + global logname + global tool if { $tool eq "" } { set tool testrun @@ -68,6 +73,14 @@ proc open_logs { } { xml_output "" insertdtd xml_output "" + xml_output " " + xml_output " [timestamp -format %c]" + xml_output " $host_triplet " + xml_output " $build_triplet" + xml_output " $target_triplet" + xml_output " $tool" + xml_output " $logname" + xml_output " " } catch "file delete -force -- $outdir/$tool.log" log_file -a $outdir/$tool.log @@ -84,6 +97,14 @@ proc close_logs { } { global sum_file global xml global xml_file + global build_triplet + global host_triplet + global target_triplet + global logname + global tool + if {![info exists build_triplet]} { + set build_triplet $host_triplet + } if { $xml } { xml_output "" @@ -382,6 +403,9 @@ proc xml_tag { tag body } { # .. and then the corresponding XML escape lappend escapes &#x[format %x $i]\; } + set body [string map {' ' } $body] + set body [string map {` ' } $body] + puts "FOXME: $body" return <$tag>[string map $escapes $body] } @@ -684,11 +708,11 @@ proc record_test { type message args } { set output "" set output "expect_out(buffer)" xml_output " " - xml_output " [xml_tag input [string trimright [lindex $rio 0]]]" + xml_output " [xml_tag name $message]" xml_output " [xml_tag output [string trimright [lindex $rio 1]]]" xml_output " [xml_tag result $type]" - xml_output " [xml_tag name $message]" xml_output " [xml_tag prms_id $prms_id]" + xml_output " [xml_tag input [string trimright [lindex $rio 0]]]" xml_output " " }