(testsuite) Moved tool_start() code to tool_init()

${tool}_start was called from within `config/default_exp', but this
proves to be error-prone, because DejaGnu isn't fully initialized at
that point, causing an error when calling one of the DejaGnu methods
pass/fail/unsupported/xfail/unresolved/untested:

    can't read "multipass_name": no such variable

The right way seems to be calling ${tool}_start() from
${tool}_init().
This commit is contained in:
Freddy Vulto 2010-11-05 21:11:57 +01:00
parent b7937bf2f0
commit 0367d0bf57
4 changed files with 18 additions and 18 deletions

View File

@ -19,9 +19,3 @@ expect_after {
}
}
}
# Call tool_start(), if available
if { [info procs "${tool}_start"] != "" } {
${tool}_start
}

View File

@ -6,6 +6,14 @@ proc completion_exit {} {
}
proc completion_init {test_file_name} {
# Call completion_start() only once
if {! [info exists ::BASH_VERSINFO]} {
completion_start
}
}
proc completion_start {} {
start_interactive_test
}

View File

@ -34,24 +34,14 @@ proc assert_bash_exec {{aCmd ""} {title ""} {prompt /@} {out -1}} {
]
]
if {$out == -1 && [string length $results] > 0} {
# Is DejaGnu fully initialized, i.e. is "fail" method available?
if {[info exists multipass_name]} {
fail "ERROR Unexpected output from bash command \"$title\""
}
send_user "ERROR Unexpected output from bash command \"$title\":\n$results"
fail "ERROR Unexpected output from bash command \"$title\""
}
set cmd "echo $?"
send "$cmd\r"
expect {
-ex "$cmd\r\n0\r\n$prompt" {}
$prompt {
# Is DejaGnu fully initialized, i.e. is "fail" method available?
if {[info exists multipass_name]} {
fail "ERROR executing bash command \"$title\""
}
send_user "ERROR executing bash command \"$title\""
}
$prompt {fail "ERROR executing bash command \"$title\""}
}
}

View File

@ -7,6 +7,14 @@ proc unit_exit {} {
}
proc unit_init {test_file_name} {
# Call unit_start() only once
if {! [info exists ::BASH_VERSINFO]} {
unit_start
}
}
proc unit_start {} {
start_interactive_test
}