Browse Source

Buffer test results in case the pruning callback aborts the test

master
Jacob Bachmeyer 4 years ago
parent
commit
d747eee6ec
  1. 4
      ChangeLog
  2. 31
      lib/dg.exp

4
ChangeLog

@ -2,6 +2,10 @@
PR58065 PR58065
* lib/dg.exp (dg-test): Store results of analyzing messages in a
list, then report them to the framework after giving the pruning
callback an opportunity to skip the test case.
* testsuite/runtest.libs/dg.test: Add tests for skipping tests * testsuite/runtest.libs/dg.test: Add tests for skipping tests
based on special result codes from mock-dg-prune. based on special result codes from mock-dg-prune.
(mock-dg-test): Add directive for output text. (mock-dg-test): Add directive for output text.

31
lib/dg.exp

@ -698,6 +698,7 @@ proc dg-test { args } {
set comp_output [lindex $results 0] set comp_output [lindex $results 0]
set output_file [lindex $results 1] set output_file [lindex $results 1]
# Store an analysis of the messages produced.
foreach i ${dg-messages} { foreach i ${dg-messages} {
verbose "Scanning for message: $i" 4 verbose "Scanning for message: $i" 4
@ -720,28 +721,36 @@ proc dg-test { args } {
scan $line ${dg-linenum-format} line scan $line ${dg-linenum-format} line
switch -- [lindex $i 1] { switch -- [lindex $i 1] {
"ERROR" { "ERROR" {
$ok "$name $comment (test for errors, line $line)" lappend scan_results $ok \
"$name $comment (test for errors, line $line)"
} }
"XERROR" { "XERROR" {
x$ok "$name $comment (test for errors, line $line)" lappend scan_results x$ok \
"$name $comment (test for errors, line $line)"
} }
"WARNING" { "WARNING" {
$ok "$name $comment (test for warnings, line $line)" lappend scan_results $ok \
"$name $comment (test for warnings, line $line)"
} }
"XWARNING" { "XWARNING" {
x$ok "$name $comment (test for warnings, line $line)" lappend scan_results x$ok \
"$name $comment (test for warnings, line $line)"
} }
"BOGUS" { "BOGUS" {
$uhoh "$name $comment (test for bogus messages, line $line)" lappend scan_results $uhoh \
"$name $comment (test for bogus messages, line $line)"
} }
"XBOGUS" { "XBOGUS" {
x$uhoh "$name $comment (test for bogus messages, line $line)" lappend scan_results x$uhoh \
"$name $comment (test for bogus messages, line $line)"
} }
"BUILD" { "BUILD" {
$uhoh "$name $comment (test for build failure, line $line)" lappend scan_results $uhoh \
"$name $comment (test for build failure, line $line)"
} }
"XBUILD" { "XBUILD" {
x$uhoh "$name $comment (test for build failure, line $line)" lappend scan_results x$uhoh \
"$name $comment (test for build failure, line $line)"
} }
"EXEC" { } "EXEC" { }
"XEXEC" { } "XEXEC" { }
@ -772,6 +781,12 @@ proc dg-test { args } {
} }
} }
# Report the results of the message analysis.
if { [info exists scan_results] } {
foreach { result message } $scan_results { $result $message }
unset scan_results
}
# See if someone forgot to delete the extra lines. # See if someone forgot to delete the extra lines.
regsub -all "\n+" $comp_output "\n" comp_output regsub -all "\n+" $comp_output "\n" comp_output
regsub "^\n+" $comp_output "" comp_output regsub "^\n+" $comp_output "" comp_output

Loading…
Cancel
Save