2015-01-08 21:08:48 +00:00
|
|
|
##
|
|
|
|
# Get output of the target machine via Intel AMT's SoL feature
|
|
|
|
#
|
2015-09-08 06:31:37 +00:00
|
|
|
# \param --amt-host network address of target machine
|
2015-01-08 21:08:48 +00:00
|
|
|
# \param --amt-password AMT password for target machine
|
2015-08-27 22:21:52 +00:00
|
|
|
# \param --amt-filter Sanitize output by piping it through a filter
|
2015-01-08 21:08:48 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
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 ""]
|
|
|
|
}
|
|
|
|
|
2015-08-27 22:21:52 +00:00
|
|
|
proc log_amt_filter { } {
|
|
|
|
return [get_cmd_arg_first --log-amt-filter ""]
|
|
|
|
}
|
2015-01-08 21:08:48 +00:00
|
|
|
|
2016-08-24 08:59:37 +00:00
|
|
|
proc log_amt_timeout { } {
|
|
|
|
return [get_cmd_arg_first --log-amt-timeout "30"]
|
|
|
|
}
|
|
|
|
|
2015-01-08 21:08:48 +00:00
|
|
|
##
|
|
|
|
# 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
|
|
|
|
}
|
|
|
|
|
2017-02-09 11:01:33 +00:00
|
|
|
set amt_tool [get_cmd_arg --amt-tool "wsman"]
|
|
|
|
|
2016-02-03 17:20:43 +00:00
|
|
|
# Check that SOL is correctly configured if wsman is available
|
2017-02-09 11:01:33 +00:00
|
|
|
if {[have_installed wsman] && $amt_tool=="wsman" } {
|
|
|
|
puts "Test for working AMT SOL redirection service ..."
|
2018-10-01 09:50:47 +00:00
|
|
|
set redir_state [exec wsman get http://intel.com/wbem/wscim/1/amt-schema/1/AMT_RedirectionService -h [log_amt_host] -P 16992 -u admin -p [log_amt_password]]
|
2016-02-03 17:20:43 +00:00
|
|
|
set redir_state [regexp -inline {ListenerEnabled.*ListenerEnabled} $redir_state]
|
|
|
|
|
|
|
|
if {![regexp {ListenerEnabled>true} $redir_state]} {
|
|
|
|
puts " Warning: AMT_RedirectionService listener is disabled - serial output will not be available"
|
|
|
|
puts " Use wsman to enable the listener service, e.g.:"
|
2018-10-01 09:50:47 +00:00
|
|
|
puts " wsman put http://intel.com/wbem/wscim/1/amt-schema/1/AMT_RedirectionService -h [log_amt_host] -P 16992 -u admin -p <your-intel-me-amt-password> -k ListenerEnabled=true"
|
2016-02-03 17:20:43 +00:00
|
|
|
puts ""
|
|
|
|
}
|
2017-02-09 11:01:33 +00:00
|
|
|
} else {
|
|
|
|
puts " Warning: could not check AMT SOL redirection service because of missing wsman tool, --amt-tool==$amt_tool"
|
2016-02-03 17:20:43 +00:00
|
|
|
}
|
|
|
|
|
2015-12-01 11:10:27 +00:00
|
|
|
#
|
2016-02-03 17:20:43 +00:00
|
|
|
# password via environment variable for amtterm will not show up in logs
|
2015-12-01 11:10:27 +00:00
|
|
|
#
|
|
|
|
set ::env(AMT_PASSWORD) [log_amt_password]
|
|
|
|
|
2015-01-08 21:08:48 +00:00
|
|
|
#
|
|
|
|
# grab output
|
|
|
|
#
|
2015-12-01 11:10:27 +00:00
|
|
|
set amt_cmd "amtterm -u admin -v [log_amt_host]"
|
2015-08-27 22:21:52 +00:00
|
|
|
if {[get_cmd_switch --log-amt-filter]} {
|
|
|
|
set amt_cmd "$amt_cmd | [log_amt_filter]"
|
|
|
|
}
|
|
|
|
|
2015-01-08 21:08:48 +00:00
|
|
|
if {$wait_for_re == "forever"} {
|
|
|
|
set timeout -1
|
|
|
|
} else {
|
2016-08-24 08:59:37 +00:00
|
|
|
set timeout [expr $timeout_value + [log_amt_timeout]]
|
2015-01-08 21:08:48 +00:00
|
|
|
}
|
|
|
|
set exit_result 1
|
|
|
|
|
2015-08-27 22:21:52 +00:00
|
|
|
spawn /bin/sh -c "$amt_cmd"
|
2015-10-26 14:02:14 +00:00
|
|
|
set output_spawn_id $spawn_id
|
2019-10-24 12:47:32 +00:00
|
|
|
fconfigure $output_spawn_id -translation { crlf lf }
|
2015-10-26 14:02:14 +00:00
|
|
|
|
|
|
|
set kernel_msg [run_boot_string]
|
|
|
|
|
|
|
|
expect {
|
|
|
|
-i $output_spawn_id $kernel_msg { }
|
|
|
|
eof {
|
|
|
|
puts stderr "Aborting, received EOF"
|
|
|
|
return false
|
2015-01-08 21:08:48 +00:00
|
|
|
}
|
2015-10-26 14:02:14 +00:00
|
|
|
timeout {
|
|
|
|
puts stderr "Boot process timed out"
|
|
|
|
close
|
|
|
|
return false
|
2015-01-08 21:08:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-26 14:02:14 +00:00
|
|
|
wait_for_output $wait_for_re $timeout_value $output_spawn_id
|
2015-01-08 21:08:48 +00:00
|
|
|
return true
|
|
|
|
}
|