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

View File

@ -12,6 +12,23 @@ proc run_log { wait_for_re timeout_value } {
set output_spawn_id $qemu_spawn_id set output_spawn_id $qemu_spawn_id
wait_for_output $wait_for_re $timeout_value $qemu_spawn_id set kernel_msg [run_boot_string]
return true;
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
} }

View File

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