From: Tom Yu Date: Fri, 28 Aug 2009 21:36:28 +0000 (+0000) Subject: use perror instead of error in kadm5 test suite X-Git-Tag: krb5-1.8-alpha1~371 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a4b333ca9f44ca095955aaed5b24b04be9b699bc;p=krb5.git use perror instead of error in kadm5 test suite Use "perror" instead of "error" to ensure that framework error conditions actually cause "make check" to report failure. ticket: 6553 target_version: 1.7.1 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22648 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/kadm5/unit-test/config/unix.exp b/src/lib/kadm5/unit-test/config/unix.exp index f14f1263b..0bbd72dad 100644 --- a/src/lib/kadm5/unit-test/config/unix.exp +++ b/src/lib/kadm5/unit-test/config/unix.exp @@ -131,85 +131,85 @@ proc api_start {} { 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 diff --git a/src/lib/kadm5/unit-test/lib/lib.t b/src/lib/kadm5/unit-test/lib/lib.t index 232542c68..9537fc36a 100644 --- a/src/lib/kadm5/unit-test/lib/lib.t +++ b/src/lib/kadm5/unit-test/lib/lib.t @@ -22,7 +22,7 @@ proc lib_start_api {} { $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" @@ -40,7 +40,7 @@ proc cmd {command} { 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 } } @@ -52,7 +52,7 @@ proc tcl_cmd {command} { 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 } } @@ -69,7 +69,7 @@ proc one_line_succeed_test {command} { -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 } } @@ -85,7 +85,7 @@ proc one_line_fail_test {command code} { -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 } } @@ -100,7 +100,7 @@ proc one_line_fail_test_nochk {command} { 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 } } @@ -111,7 +111,7 @@ proc resync {} { 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 } } } @@ -247,7 +247,7 @@ proc kinit { princ pass {opts ""} } { # 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 @@ -283,20 +283,20 @@ proc create_principal_with_keysalts {name keysalts} { 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