From 85c6640795354d94e7f0203740bacf7251656136 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 16 Apr 2013 16:03:16 +0200 Subject: [PATCH] run: add support to specify 'serial' via RUN_OPT If the target machine is connected locally one may specify "serial" as target in the RUN_OPT variable to get the test output. Used for panda and arndale on foc and hw. --- base-foc/run/env | 8 ++++++++ base-hw/run/env | 7 +++++-- tool/run | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/base-foc/run/env b/base-foc/run/env index f33b4e245..f1671a55f 100644 --- a/base-foc/run/env +++ b/base-foc/run/env @@ -298,4 +298,12 @@ proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id spawn_qemu $wait_for_re $timeout_value return } + if {[is_serial_available]} { + spawn_serial $wait_for_re $timeout_value + return + } + + global run_target + puts stderr "Error: Can't execute automatically on target '$run_target'" + exit -1 } diff --git a/base-hw/run/env b/base-hw/run/env index 0763de349..2bdd3dbbd 100644 --- a/base-hw/run/env +++ b/base-hw/run/env @@ -200,8 +200,6 @@ proc build_boot_image {binaries} { proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id -1}} { - global run_target - # # If a running_spawn_id is specified, wait for the expected output # @@ -217,7 +215,12 @@ proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id spawn_qemu $wait_for_re $timeout_value return } + if {[is_serial_available]} { + spawn_serial $wait_for_re $timeout_value + return + } + global run_target puts stderr "Error: Can't execute automatically on target '$run_target'" exit -1 } diff --git a/tool/run b/tool/run index 09f19d0d9..164d726cc 100755 --- a/tool/run +++ b/tool/run @@ -486,6 +486,7 @@ proc spawn_qemu { wait_for_re timeout_value } { wait_for_output $wait_for_re $timeout_value $qemu_spawn_id } + ## # Check whether Qemu support is available # @@ -501,6 +502,7 @@ proc is_qemu_available { } { return true } + ## # Check whether AMT support is available # @@ -520,6 +522,18 @@ proc is_amt_available { } { } +## +# Check whether output is expected via a local attached serial device +# +proc is_serial_available { } { + global run_target + + if {![regexp "serial" $run_target]} { return false } + + return true +} + + ## # Execute scenario using Intel's AMT # @@ -596,6 +610,25 @@ proc spawn_amt { wait_for_re timeout_value} { set output $expect_out(buffer) } + +## +# Execute scenario expecting output via serial device +# +proc spawn_serial { wait_for_re timeout_value} { + global spawn_id + + if {$wait_for_re != "forever"} { + set timeout_value [expr $timeout_value + 30] + } + + set serial_dev [get_cmd_arg --serial-dev "/dev/ttyUSB0"] + + spawn picocom -b 115200 $serial_dev + set serial_spawn_id $spawn_id + wait_for_output $wait_for_re $timeout_value $serial_spawn_id +} + + ## # Determine terminal program #