run: modularize run tool
This commit is contained in:
committed by
Christian Helmuth
parent
febca1b827
commit
c706b1c0a7
70
tool/run/log/amt
Normal file
70
tool/run/log/amt
Normal file
@@ -0,0 +1,70 @@
|
||||
##
|
||||
# Get output of the target machine via Intel AMT's SoL feature
|
||||
#
|
||||
# \param --amt-host IP address of target machine
|
||||
# \param --amt-password AMT password for target machine
|
||||
#
|
||||
|
||||
source [genode_dir]/tool/run/log.inc
|
||||
source [genode_dir]/tool/run/amt.inc
|
||||
|
||||
|
||||
proc log_amt_host { } {
|
||||
return [get_cmd_arg_first --log-amt-host ""]
|
||||
}
|
||||
|
||||
|
||||
proc log_amt_password { } {
|
||||
return [get_cmd_arg_first --log-amt-password ""]
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# Log output of the test machine using Intel's AMT
|
||||
#
|
||||
proc run_log { wait_for_re timeout_value } {
|
||||
global output_spawn_id
|
||||
|
||||
if {![is_amt_available [log_amt_host] [log_amt_password]]} {
|
||||
set exit_result 1
|
||||
return false
|
||||
}
|
||||
|
||||
#
|
||||
# grab output
|
||||
#
|
||||
set amtterm "amtterm -u admin -p [log_amt_password] -v [log_amt_host]"
|
||||
if {$wait_for_re == "forever"} {
|
||||
set timeout -1
|
||||
} else {
|
||||
set timeout [expr $timeout_value + 30]
|
||||
}
|
||||
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 }
|
||||
}
|
||||
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)]
|
||||
}
|
||||
if {$timeout < 0} {
|
||||
set timeout 0
|
||||
}
|
||||
set exit_result [lindex $result 3]
|
||||
}
|
||||
|
||||
global output
|
||||
set output $expect_out(buffer)
|
||||
|
||||
return true
|
||||
}
|
||||
11
tool/run/log/linux
Normal file
11
tool/run/log/linux
Normal file
@@ -0,0 +1,11 @@
|
||||
source [genode_dir]/tool/run/log.inc
|
||||
|
||||
proc run_log { wait_for_re timeout_value } {
|
||||
global linux_spawn_id
|
||||
global output_spawn_id
|
||||
|
||||
set output_spawn_id $linux_spawn_id
|
||||
|
||||
wait_for_output $wait_for_re $timeout_value $linux_spawn_id
|
||||
return true
|
||||
}
|
||||
17
tool/run/log/qemu
Normal file
17
tool/run/log/qemu
Normal file
@@ -0,0 +1,17 @@
|
||||
##
|
||||
# Capture the output of a scenario executed via Qemu
|
||||
#
|
||||
|
||||
source [genode_dir]/tool/run/log.inc
|
||||
source [genode_dir]/tool/run/qemu.inc
|
||||
|
||||
|
||||
proc run_log { wait_for_re timeout_value } {
|
||||
global qemu_spawn_id
|
||||
global output_spawn_id
|
||||
|
||||
set output_spawn_id $qemu_spawn_id
|
||||
|
||||
wait_for_output $wait_for_re $timeout_value $qemu_spawn_id
|
||||
return true;
|
||||
}
|
||||
42
tool/run/log/serial
Normal file
42
tool/run/log/serial
Normal file
@@ -0,0 +1,42 @@
|
||||
##
|
||||
# Get the output of the target machine via serial connection
|
||||
#
|
||||
# \param --log-serial-cmd Cmd that is executed to capture the output
|
||||
#
|
||||
|
||||
source [genode_dir]/tool/run/log.inc
|
||||
|
||||
|
||||
set default_serial_cmd "picocom -b 115200 /dev/ttyUSB0"
|
||||
|
||||
|
||||
proc log_serial_cmd { } {
|
||||
global default_serial_cmd
|
||||
return [get_cmd_arg --log-serial-cmd $default_serial_cmd]
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# Log output of the test machine via serial device
|
||||
#
|
||||
proc run_log { wait_for_re timeout_value } {
|
||||
global output_spawn_id
|
||||
|
||||
set timeout 210
|
||||
while {true} {
|
||||
eval spawn [log_serial_cmd]
|
||||
set output_spawn_id $spawn_id
|
||||
expect {
|
||||
"Genode \[0-9]\[0-9]\.\[0-9]\[0-9]" {
|
||||
wait_for_output $wait_for_re $timeout_value $output_spawn_id;
|
||||
return true;
|
||||
}
|
||||
eof { continue; }
|
||||
timeout {
|
||||
puts stderr "Boot process timed out";
|
||||
close;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user