run: try to detect reboots of platform

This commit is contained in:
Alexander Boettcher 2015-10-26 15:02:14 +01:00 committed by Christian Helmuth
parent 6d0936ca98
commit 115a605658
3 changed files with 39 additions and 22 deletions

View File

@ -41,30 +41,24 @@ proc run_log { wait_for_re timeout_value } {
}
set exit_result 1
while { $exit_result != 0 } {
set time_start [ clock seconds ]
eval spawn $amtterm
set output_spawn_id $spawn_id
expect {
-i $output_spawn_id -re $wait_for_re { break }
eof { continue }
timeout { puts "Error: Test execution timed out"; exit -2 }
eval spawn $amtterm
set output_spawn_id $spawn_id
set kernel_msg [run_boot_string]
expect {
-i $output_spawn_id $kernel_msg { }
eof {
puts stderr "Aborting, received EOF"
return false
}
catch wait result
set time_end [ clock seconds ]
if {[expr $time_end - $time_start] <= 1} {
incr timeout -1
} else {
incr timeout [expr -1 * ($time_end - $time_start)]
timeout {
puts stderr "Boot process timed out"
close
return false
}
if {$timeout < 0} {
set timeout 0
}
set exit_result [lindex $result 3]
}
global output
set output $expect_out(buffer)
wait_for_output $wait_for_re $timeout_value $output_spawn_id
return true
}

View File

@ -12,6 +12,23 @@ proc run_log { wait_for_re timeout_value } {
set output_spawn_id $qemu_spawn_id
set kernel_msg [run_boot_string]
set timeout $timeout_value
expect {
-i $output_spawn_id $kernel_msg { }
eof {
puts stderr "Aborting, received EOF"
return false
}
timeout {
puts stderr "Boot process timed out"
close
return false
}
}
wait_for_output $wait_for_re $timeout_value $qemu_spawn_id
return true;
return true
}

View File

@ -475,7 +475,13 @@ proc wait_for_output { wait_for_re timeout_value running_spawn_id } {
set timeout $timeout_value
}
set platform_msg [run_boot_string]
if {$platform_msg eq ""} {
set platform_msg "undefined platform command startup string sequence"
}
expect {
-i $running_spawn_id $platform_msg { puts stderr "Error: platform rebooted unexpectedly"; exit -4 }
-i $running_spawn_id -re $wait_for_re { }
eof { puts stderr "Error: Spawned process died unexpectedly"; exit -3 }
timeout { puts stderr "Error: Test execution timed out"; exit -2 }