set pid [spawn $API]
expect {
-re "$prompt$" {}
- eof { error "EOF starting API" }
- timeout { error "Timeout starting API" }
+ eof { perror "EOF starting API" }
+ timeout { perror "Timeout starting API" }
}
if {! [info exists env(TCLUTIL)]} {
- error "TCLUTIL environment variable isn't set"
+ perror "TCLUTIL environment variable isn't set"
}
# tcl 8.4 for some reason screws up autodetection of output
# EOL translation. Work around it for now.
send "if { \[info commands fconfigure\] ne \"\" } { fconfigure stdout -translation lf }\n"
expect {
-re "$prompt$" {}
- eof { error "EOF starting API" }
- timeout { error "Timeout starting API" }
+ eof { perror "EOF starting API" }
+ timeout { perror "Timeout starting API" }
}
send "source $env(TCLUTIL)\n"
expect {
-re "$prompt$" {}
- eof { error "EOF starting API" }
- timeout { error "Timeout starting API" }
+ eof { perror "EOF starting API" }
+ timeout { perror "Timeout starting API" }
}
send "set current_struct_version \[expr \$KADM5_STRUCT_VERSION &~ \$KADM5_STRUCT_VERSION_MASK\]\n"
expect {
-re "$prompt$" {}
- eof { error "EOF setting API varibles"}
- timeout { error "timeout setting API varibles"}
+ eof { perror "EOF setting API varibles"}
+ timeout { perror "timeout setting API varibles"}
}
send "set current_api_version \[expr \$KADM5_API_VERSION_2 &~ \$KADM5_API_VERSION_MASK\]\n"
expect {
-re "$prompt$" {}
- eof { error "EOF setting API varibles"}
- timeout { error "timeout setting API varibles"}
+ eof { perror "EOF setting API varibles"}
+ timeout { perror "timeout setting API varibles"}
}
send "set bad_struct_version_mask \[expr 0x65432100 | \$current_struct_version\]\n"
expect {
-re "$prompt$" {}
- eof { error "EOF setting API varibles"}
- timeout { error "timeout setting API varibles"}
+ eof { perror "EOF setting API varibles"}
+ timeout { perror "timeout setting API varibles"}
}
send "set bad_api_version_mask \[expr 0x65432100 | \$current_api_version\]\n"
expect {
-re "$prompt$" {}
- eof { error "EOF setting API varibles"}
- timeout { error "timeout setting API varibles"}
+ eof { perror "EOF setting API varibles"}
+ timeout { perror "timeout setting API varibles"}
}
send "set no_api_version_mask \$current_api_version\n"
expect {
-re "$prompt$" {}
- eof { error "EOF setting API varibles"}
- timeout { error "timeout setting API varibles"}
+ eof { perror "EOF setting API varibles"}
+ timeout { perror "timeout setting API varibles"}
}
send "set no_struct_version_mask \$current_struct_version\n"
expect {
-re "$prompt$" {}
- eof { error "EOF setting API varibles"}
- timeout { error "timeout setting API varibles"}
+ eof { perror "EOF setting API varibles"}
+ timeout { perror "timeout setting API varibles"}
}
send "set old_api_version \[expr \$KADM5_API_VERSION_MASK | 0x00\]\n"
expect {
-re "$prompt$" {}
- eof { error "EOF setting API varibles"}
- timeout { error "timeout setting API varibles"}
+ eof { perror "EOF setting API varibles"}
+ timeout { perror "timeout setting API varibles"}
}
send "set old_struct_version \[expr \$KADM5_STRUCT_VERSION_MASK | 0x00\]\n"
expect {
-re "$prompt$" {}
- eof { error "EOF setting API varibles"}
- timeout { error "timeout setting API varibles"}
+ eof { perror "EOF setting API varibles"}
+ timeout { perror "timeout setting API varibles"}
}
send "set new_api_version \[expr \$KADM5_API_VERSION_MASK | 0xca\]\n"
expect {
-re "$prompt$" {}
- eof { error "EOF setting API varibles"}
- timeout { error "timeout setting API varibles"}
+ eof { perror "EOF setting API varibles"}
+ timeout { perror "timeout setting API varibles"}
}
send "set new_struct_version \[expr \$KADM5_STRUCT_VERSION_MASK | 0xca\]\n"
expect {
-re "$prompt$" {}
- eof { error "EOF setting API varibles"}
- timeout { error "timeout setting API varibles"}
+ eof { perror "EOF setting API varibles"}
+ timeout { perror "timeout setting API varibles"}
}
set api_pid $pid
$KADM5_STRUCT_VERSION $KADM5_API_VERSION_2 \
lib_handle
}]} {
- error "$test: unexpected failure in init"
+ perror "$test: unexpected failure in init"
return
}
verbose "+++ restarted api ($lib_pid) for lib"
expect {
-re "OK .*$prompt$" { return 1 }
-re "ERROR .*$prompt$" { return 0 }
- "wrong # args" { error "$test: wrong number args"; return 0 }
+ "wrong # args" { perror "$test: wrong number args"; return 0 }
timeout { fail "$test: timeout"; return 0 }
eof { fail "$test: eof"; api_exit; lib_start_api; return 0 }
}
send "[string trim $command]\n"
expect {
-re "$prompt$" { return 1}
- "wrong # args" { error "$test: wrong number args"; return 0 }
+ "wrong # args" { perror "$test: wrong number args"; return 0 }
timeout { error_and_restart "timeout" }
eof { api_exit; lib_start_api; return 0 }
}
-re "ERROR .*$prompt$" {
fail "$test: $expect_out(buffer)"; return 0
}
- "wrong # args" { error "$test: wrong number args"; return 0 }
+ "wrong # args" { perror "$test: wrong number args"; return 0 }
timeout { fail "$test: timeout"; return 0 }
eof { fail "$test: eof"; api_exit; lib_start_api; return 0 }
}
-re "ERROR .*$code.*$prompt$" { pass "$test"; return 1 }
-re "ERROR .*$prompt$" { fail "$test: bad failure"; return 0 }
-re "OK .*$prompt$" { fail "$test: bad success"; return 0 }
- "wrong # args" { error "$test: wrong number args"; return 0 }
+ "wrong # args" { perror "$test: wrong number args"; return 0 }
timeout { fail "$test: timeout"; return 0 }
eof { fail "$test: eof"; api_exit; lib_start_api; return 0 }
}
expect {
-re "ERROR .*$prompt$" { pass "$test:"; return 1 }
-re "OK .*$prompt$" { fail "$test: bad success"; return 0 }
- "wrong # args" { error "$test: wrong number args"; return 0 }
+ "wrong # args" { perror "$test: wrong number args"; return 0 }
timeout { fail "$test: timeout"; return 0 }
eof { fail "$test: eof"; api_exit; lib_start_api; return 0 }
}
expect {
-re "$prompt$" {}
- "wrong # args" { error "$test: wrong number args"; return 0 }
+ "wrong # args" { perror "$test: wrong number args"; return 0 }
eof { api_exit; lib_start_api }
}
}
# the parent, which is us, to read pending data.
expect {
- "when initializing cache" { error "kinit failed: $expect_out(buffer)" }
+ "when initializing cache" { perror "kinit failed: $expect_out(buffer)" }
eof {}
}
wait
spawn $kadmin_local -e "$keysalts"
expect {
"kadmin.local:" {}
- default { error "waiting for kadmin.local prompt"; return 1}
+ default { perror "waiting for kadmin.local prompt"; return 1}
}
send "ank -pw \"$name\" \"$name\"\n"
expect {
-re "Principal \"$name.*\" created." {}
"kadmin.local:" {
- error "expecting principal created message";
+ perror "expecting principal created message";
return 1
}
- default { error "waiting for principal created message"; return 1 }
+ default { perror "waiting for principal created message"; return 1 }
}
expect {
"kadmin.local:" {}
- default { error "waiting for kadmin.local prompt"; return 1 }
+ default { perror "waiting for kadmin.local prompt"; return 1 }
}
close
wait