aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Kevin Ballard <kevin@sb.org>2014-09-19 16:22:37 -0700
committerGravatar Kevin Ballard <kevin@sb.org>2014-09-19 16:22:37 -0700
commit51c2005ea281f3464fdfcdc000011a09d04506c5 (patch)
tree0cffad4dfe528ec34030419354b4311c61a1478a /tests
parent510ff6a6895acb72f16593fdf1de77872e72844d (diff)
Tweak interactive debug output
Diffstat (limited to 'tests')
-rw-r--r--tests/interactive.expect.rc26
-rw-r--r--tests/interactive.fish4
2 files changed, 25 insertions, 5 deletions
diff --git a/tests/interactive.expect.rc b/tests/interactive.expect.rc
index 02161107..eb014935 100644
--- a/tests/interactive.expect.rc
+++ b/tests/interactive.expect.rc
@@ -57,6 +57,7 @@ proc expect_prompt {args} {
}
set prompt_action ""
set expargs {}
+ set debugpats {}
set nounmatched no
set matchidx 0
set matched(any) no
@@ -68,6 +69,7 @@ proc expect_prompt {args} {
set state "action"
}
"action" {
+ lappend debugpats [lindex $expargs end]
lappend expargs [subst -nocommands {
log_debug "matched extra pattern to expect_prompt: [quote \$expect_out(0,string)]"
if {!\$matched($matchidx)} {
@@ -93,6 +95,7 @@ proc expect_prompt {args} {
-gl -
-re -
-ex {
+ lappend debugpats $arg
set state "pat"
}
-i -
@@ -108,7 +111,7 @@ proc expect_prompt {args} {
error "BUG: unknown expect flag in expect_prompt"
}
default {
- set state "pat"
+ set state "action"
}
}
if {$keep} {
@@ -134,8 +137,8 @@ proc expect_prompt {args} {
}
}
}
- if {[llength $expargs] > 0} {
- log_info "expecting prompt $prompt_counter + patterns"
+ if {[llength $debugpats] > 0} {
+ log_info "expecting prompt $prompt_counter + \[$debugpats]"
} else {
log_info "expecting prompt $prompt_counter"
}
@@ -153,7 +156,6 @@ proc trace_expect {cmd args} {
switch [lindex $args end] {
enter {
log_debug "entering expect"
- log_debug "command: $cmd"
uplevel {set expect_out(buffer) {}}
}
leave {
@@ -195,6 +197,22 @@ proc trace_spawn {cmd args} {
}
eof {
log_debug "eof; buffer=[quote $expect_out(buffer)]"
+ # even though we're about to abort, we want to wait so we can get the status
+ # note: it's possible that fish could have closed its end and then hung, and
+ # expect doesn't provide any way to set a timeout for wait. But I think that's
+ # an acceptable risk.
+ puts stderr "eof; waiting on child process to exit"
+ set status [wait]
+ if {[lindex $status 2] == -1} {
+ # operating system error
+ puts stderr "error: OS error code [lindex $status 3]"
+ } else {
+ set msg "process [lindex $status 0] exited with status [lindex $status 3]"
+ if {[llength $status] > 4} {
+ append msg " ([lrange $status 4 end])"
+ }
+ puts stderr $msg
+ }
abort "eof"
}
}
diff --git a/tests/interactive.fish b/tests/interactive.fish
index b550dc9e..7596d4ba 100644
--- a/tests/interactive.fish
+++ b/tests/interactive.fish
@@ -32,9 +32,11 @@ for i in *.expect
diff -u $i.tmp.err $i.err
end
- if test $tmp_status != (cat $i.status)
+ set -l exp_status (cat $i.status)[1]
+ if test $tmp_status != $exp_status
set res fail
echo "Exit status differs for file $i."
+ echo "Expected $exp_status, got $tmp_status."
end
if test $res = ok