aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorJacob Bachmeyer <jcb@gnu.org>2022-10-04 20:40:17 -0500
committerJacob Bachmeyer <jcb@gnu.org>2022-10-04 20:40:17 -0500
commitae2a87b9147553380cfdef903d089fd6a094b859 (patch)
tree2ae7d60b2fddbb4b4c3e0b46bcf43d59c4b05167 /testsuite
parente4657c2eda87611f0be9cea062c1cc5875c3597a (diff)
downloaddejagnu-ae2a87b9147553380cfdef903d089fd6a094b859.zip
dejagnu-ae2a87b9147553380cfdef903d089fd6a094b859.tar.gz
dejagnu-ae2a87b9147553380cfdef903d089fd6a094b859.tar.bz2
Add lib/dg.exp unit tests for skipping files by callback
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/runtest.libs/dg.test32
1 files changed, 31 insertions, 1 deletions
diff --git a/testsuite/runtest.libs/dg.test b/testsuite/runtest.libs/dg.test
index c9fff87..bdfc0b1 100644
--- a/testsuite/runtest.libs/dg.test
+++ b/testsuite/runtest.libs/dg.test
@@ -44,10 +44,11 @@ proc mock-dg-test { prog what flags } {
while { [gets $chan line] >= 0 } {
incr linum
- if { [regexp -- {^%([EW])\s+([^\r\n{}]*)} $line -> item text] } {
+ if { [regexp -- {^%([EWO])\s+([^\r\n{}]*)} $line -> item text] } {
switch -- $item {
E { append output "$prog:$linum: error: $text\n" }
W { append output "$prog:$linum: warning: $text\n" }
+ O { append output "$text\n" }
}
}
}
@@ -62,6 +63,10 @@ proc mock-dg-prune { target output } {
puts "target: $target"
puts "output:\n$output"
puts ">>> output pruning callback"
+ if { [regexp -- {--(unresolved|unsupported|untested): (.*)--} $output \
+ -> what why] } {
+ return "::${what}::${why}"
+ }
return $output
}
@@ -168,6 +173,11 @@ create_mock_file dg-test-vfs \
#E bogus error
}
+foreach {result} { unresolved unsupported untested } {
+ create_mock_file dg-test-vfs "dg/pskip-${result}" \
+ "#test file for dg.exp\n%O --${result}: skip by prune--\n"
+}
+
dg-test-1 eval {proc send_log { text } { puts $text }}
dg-test-1 eval dg-init
@@ -251,6 +261,26 @@ eval_tests dg-test-1 {
}
}
}
+foreach {result} { unresolved unsupported untested } {
+ set check_calls {
+ pass ! {} fail ! {} xpass ! {} xfail ! {} kpass ! {} kfail ! {}
+ }
+ switch -- $result {
+ unresolved {
+ lappend check_calls unresolved C 1 unsupported ! {} untested ! {}
+ }
+ unsupported {
+ lappend check_calls unresolved ! {} unsupported C 1 untested ! {}
+ }
+ untested {
+ lappend check_calls unresolved ! {} unsupported ! {} untested C 1
+ }
+ }
+ lappend check_calls $result 0 { 1 {.*skip by prune.*} }
+ test_proc_with_mocks "test with dg/pskip-${result}" dg-test-1 \
+ [list dg-runtest dg/pskip-${result} "" ""] \
+ check_calls $check_calls
+}
dg-test-1 eval dg-finish