run: extend genode_until_run by a spawn id

genode_until_run can be called now with a spawn id to able to reattach to a
spawned process (amt, serial output). Run scripts can now call genode_until_run
multiple times.
This commit is contained in:
Alexander Boettcher 2013-04-08 10:43:05 +02:00 committed by Norman Feske
parent 267239147a
commit 2a761c7fea
9 changed files with 157 additions and 29 deletions

View File

@ -83,6 +83,24 @@ proc build_boot_image {binaries} {
}
proc run_genode_until {{wait_for_re forever} {timeout_value 0}} {
spawn_qemu $wait_for_re $timeout_value }
proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id -1}} {
#
# If a running_spawn_id is specified, wait for the expected output
#
if {$running_spawn_id != -1} {
wait_for_output $wait_for_re $timeout_value $running_spawn_id
return
}
#
# Try to use one of the supported backends for running the scripts
#
if {[is_qemu_available]} {
spawn_qemu $wait_for_re $timeout_value
return
}
global run_target
puts stderr "Error: Can't execute automatically on target '$run_target'"
exit -1
}

View File

@ -172,10 +172,28 @@ proc build_boot_image {binaries} {
}
proc run_genode_until {{wait_for_re forever} {timeout_value 0}} {
if {[is_amt_available]} {
spawn_amt $wait_for_re $timeout_value;
} else {
spawn_qemu $wait_for_re $timeout_value;
proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id -1}} {
#
# If a running_spawn_id is specified, wait for the expected output
#
if {$running_spawn_id != -1} {
wait_for_output $wait_for_re $timeout_value $running_spawn_id
return
}
#
# Try to use one of the supported backends for running the scripts
#
if {[is_amt_available]} {
spawn_amt $wait_for_re $timeout_value
return
}
if {[is_qemu_available]} {
spawn_qemu $wait_for_re $timeout_value
return
}
global run_target
puts stderr "Error: Can't execute automatically on target '$run_target'"
exit -1
}

View File

@ -278,10 +278,24 @@ proc build_boot_image {binaries} {
}
proc run_genode_until {{wait_for_re forever} {timeout_value 0}} {
proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id -1}} {
#
# If a running_spawn_id is specified, wait for the expected output
#
if {$running_spawn_id != -1} {
wait_for_output $wait_for_re $timeout_value $running_spawn_id
return
}
#
# Try to use one of the supported backends for running the scripts
#
if {[is_amt_available]} {
spawn_amt $wait_for_re $timeout_value;
} else {
spawn_qemu $wait_for_re $timeout_value;
spawn_amt $wait_for_re $timeout_value
return
}
if {[is_qemu_available]} {
spawn_qemu $wait_for_re $timeout_value
return
}
}

View File

@ -204,7 +204,26 @@ proc build_boot_image {binaries} {
}
proc run_genode_until {{wait_for_re forever} {timeout_value 0}} {
proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id -1}} {
#
# If a running_spawn_id is specified, wait for the expected output
#
if {$running_spawn_id != -1} {
wait_for_output $wait_for_re $timeout_value $running_spawn_id
return
}
#
# Try to use one of the supported backends for running the scripts
#
# if {[is_amt_available]} {
# spawn_amt $wait_for_re $timeout_value
# return
# }
# if {[is_qemu_available]} {
# spawn_qemu $wait_for_re $timeout_value
# return
# }
if {[target] == "qemu"} { spawn_qemu $wait_for_re $timeout_value
} else {

View File

@ -26,7 +26,15 @@ proc build_boot_image {binaries} {
}
proc run_genode_until {{wait_for_re forever} {timeout_value 0}} {
proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id -1}} {
#
# If a running_spawn_id is specified, wait for the expected output
#
if {$running_spawn_id != -1} {
wait_for_output $wait_for_re $timeout_value $running_spawn_id
return
}
global output
set timeout $timeout_value
set orig_pwd [pwd]

View File

@ -118,10 +118,24 @@ proc build_boot_image {binaries} {
}
proc run_genode_until {{wait_for_re forever} {timeout_value 0}} {
proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id -1}} {
#
# If a running_spawn_id is specified, wait for the expected output
#
if {$running_spawn_id != -1} {
wait_for_output $wait_for_re $timeout_value $running_spawn_id
return
}
#
# Try to use one of the supported backends for running the scripts
#
if {[is_amt_available]} {
spawn_amt $wait_for_re $timeout_value;
} else {
spawn_qemu $wait_for_re $timeout_value;
spawn_amt $wait_for_re $timeout_value
return
}
if {[is_qemu_available]} {
spawn_qemu $wait_for_re $timeout_value
return
}
}

View File

@ -235,10 +235,28 @@ proc build_boot_image {binaries} {
}
proc run_genode_until {{wait_for_re forever} {timeout_value 0}} {
if {[is_amt_available]} {
spawn_amt $wait_for_re $timeout_value;
} else {
spawn_qemu $wait_for_re $timeout_value;
proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id -1}} {
#
# If a running_spawn_id is specified, wait for the expected output
#
if {$running_spawn_id != -1} {
wait_for_output $wait_for_re $timeout_value $running_spawn_id
return
}
#
# Try to use one of the supported backends for running the scripts
#
if {[is_amt_available]} {
spawn_amt $wait_for_re $timeout_value
return
}
if {[is_qemu_available]} {
spawn_qemu $wait_for_re $timeout_value
return
}
global run_target
puts stderr "Error: Can't execute automatically on target '$run_target'"
exit -1
}

View File

@ -151,10 +151,28 @@ proc build_boot_image {binaries} {
}
proc run_genode_until {{wait_for_re forever} {timeout_value 0}} {
if {[is_amt_available]} {
spawn_amt $wait_for_re $timeout_value;
} else {
spawn_qemu $wait_for_re $timeout_value;
proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id -1}} {
#
# If a running_spawn_id is specified, wait for the expected output
#
if {$running_spawn_id != -1} {
wait_for_output $wait_for_re $timeout_value $running_spawn_id
return
}
#
# Try to use one of the supported backends for running the scripts
#
if {[is_amt_available]} {
spawn_amt $wait_for_re $timeout_value
return
}
if {[is_qemu_available]} {
spawn_qemu $wait_for_re $timeout_value
return
}
global run_target
puts stderr "Error: Can't execute automatically on target '$run_target'"
exit -1
}

View File

@ -111,6 +111,7 @@ proc build_boot_image {binaries} { }
#
# \param wait_for_re regular expression that matches the test completion
# \param timeout_value timeout in seconds
# \param spawn_id spawn_id of a already running and spawned process
# \global output contains the core output (modified)
#
# If the function is called without any argument, Genode is executed in
@ -122,7 +123,7 @@ proc build_boot_image {binaries} { }
# This function must be implemented by the platform-specific test environment.
# If not implemented, the program exits with the error code -3.
#
proc run_genode_until {{wait_for_re forever} {timeout_value 0}} {
proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id -1}} {
puts stderr "Error: 'run_genode_until' is not implemented for this platform"
exit -3
}
@ -420,7 +421,7 @@ proc wait_for_output { wait_for_re timeout_value running_spawn_id } {
expect {
-i $running_spawn_id -re $wait_for_re { }
eof { puts stderr "Error: Qemu died unexpectedly"; exit -3 }
eof { puts stderr "Error: Spawned process died unexpectedly"; exit -3 }
timeout { puts stderr "Error: Test execution timed out"; exit -2 }
}
set output $expect_out(buffer)