mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-19 05:37:54 +00:00
parent
e9f4e6b37d
commit
3593c7fb4d
@ -119,42 +119,9 @@ proc build_boot_image {binaries} {
|
||||
|
||||
|
||||
proc run_genode_until {{wait_for_re forever} {timeout_value 0}} {
|
||||
# run qemu if no AMT information are found
|
||||
if {![info exists ::env(AMT_TEST_MACHINE_IP)] ||
|
||||
![info exists ::env(AMT_TEST_MACHINE_PWD)] } {
|
||||
if {[is_amt_available]} {
|
||||
spawn_amt $wait_for_re $timeout_value;
|
||||
} else {
|
||||
spawn_qemu $wait_for_re $timeout_value;
|
||||
return
|
||||
}
|
||||
|
||||
#
|
||||
# amttool expects in the environment variable AMT_PASSWORD the password
|
||||
#
|
||||
set ::env(AMT_PASSWORD) $::env(AMT_TEST_MACHINE_PWD)
|
||||
|
||||
#
|
||||
# reset the box
|
||||
#
|
||||
spawn amttool $::env(AMT_TEST_MACHINE_IP) reset
|
||||
set timeout 10
|
||||
expect {
|
||||
"host" { send "y\r" }
|
||||
eof { puts stderr "Error: amttool died unexpectedly"; exit -4 }
|
||||
timeout { puts stderr "Error: amttool timed out"; exit -5 }
|
||||
}
|
||||
sleep 5
|
||||
|
||||
#
|
||||
# grab output
|
||||
#
|
||||
set amtterm "amtterm -u admin -p $::env(AMT_TEST_MACHINE_PWD) -v $::env(AMT_TEST_MACHINE_IP)"
|
||||
set timeout [expr $timeout_value + 30]
|
||||
set pid [eval "spawn $amtterm"]
|
||||
if {$wait_for_re == "forever"} { interact $pid }
|
||||
expect {
|
||||
-re $wait_for_re { }
|
||||
eof { puts stderr "Error: amtterm died unexpectedly"; exit -3 }
|
||||
timeout { puts stderr "Error: Test execution timed out"; exit -2 }
|
||||
}
|
||||
global output
|
||||
set output $expect_out(buffer)
|
||||
}
|
||||
|
92
tool/run
92
tool/run
@ -471,6 +471,98 @@ proc spawn_qemu { wait_for_re timeout_value } {
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# Check whether AMT support is available
|
||||
#
|
||||
proc is_amt_available { } {
|
||||
if {![have_spec x86]} { return false }
|
||||
|
||||
if {[info exists ::env(AMT_TEST_MACHINE_IP)] &&
|
||||
[info exists ::env(AMT_TEST_MACHINE_PWD)] &&
|
||||
[have_installed amtterm] &&
|
||||
[have_installed amttool]} {
|
||||
return true;
|
||||
}
|
||||
puts "No support for Intel's AMT detected."
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
##
|
||||
# Execute scenario using Intel's AMT
|
||||
#
|
||||
proc spawn_amt { wait_for_re timeout_value } {
|
||||
if {![is_amt_available]} {
|
||||
return }
|
||||
|
||||
#
|
||||
# amttool expects in the environment variable AMT_PASSWORD the password
|
||||
#
|
||||
set ::env(AMT_PASSWORD) $::env(AMT_TEST_MACHINE_PWD)
|
||||
|
||||
#
|
||||
# reset the box
|
||||
#
|
||||
set timeout 10
|
||||
set exit_result 1
|
||||
|
||||
while { $exit_result != 0 } {
|
||||
set time_start [ clock seconds ]
|
||||
spawn amttool $::env(AMT_TEST_MACHINE_IP) reset
|
||||
expect {
|
||||
"host" { send "y\r"; }
|
||||
eof { puts "Error: amttool died unexpectedly"; exit -4 }
|
||||
timeout { puts "Error: amttool timed out"; exit -5 }
|
||||
}
|
||||
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]
|
||||
}
|
||||
sleep 5
|
||||
|
||||
#
|
||||
# grab output
|
||||
#
|
||||
set amtterm "amtterm -u admin -p $::env(AMT_TEST_MACHINE_PWD) -v $::env(AMT_TEST_MACHINE_IP)"
|
||||
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 ]
|
||||
set pid [eval "spawn $amtterm"]
|
||||
expect {
|
||||
-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)
|
||||
}
|
||||
|
||||
##
|
||||
# Determine terminal program
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user