tool: test result output of amtterm reset

"amtterm reset" returns 0 as exitcode even if the reset command failed.
So check explicitly the output of the command to detect the error case.
This commit is contained in:
Alexander Boettcher 2014-03-10 10:34:45 +01:00 committed by Norman Feske
parent f5be746894
commit e7f3e99aab
1 changed files with 10 additions and 0 deletions

View File

@ -595,6 +595,7 @@ proc spawn_amt { wait_for_re timeout_value } {
set exit_result 1
while { $exit_result != 0 } {
set try_again 0
set time_start [ clock seconds ]
spawn amttool $::env(AMT_TEST_MACHINE_IP) reset
expect {
@ -602,6 +603,11 @@ proc spawn_amt { wait_for_re timeout_value } {
eof { puts "Error: amttool died unexpectedly"; exit -4 }
timeout { puts "Error: amttool timed out"; exit -5 }
}
expect {
"result: pt_status: success" { break }
eof { set try_again 1 }
timeout { puts "Error: amttool timed out"; exit -6 }
}
catch wait result
set time_end [ clock seconds ]
if {[expr $time_end - $time_start] <= 1} {
@ -612,6 +618,10 @@ proc spawn_amt { wait_for_re timeout_value } {
if {$timeout < 0} {
set timeout 0
}
if {$try_again != 0 } {
continue
}
set exit_result [lindex $result 3]
}
sleep 5