diff options
author | David Hendricks <david.hendricks@gmail.com> | 2017-09-16 13:01:13 -0700 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2018-02-16 22:40:20 +0000 |
commit | bb90fb55d0bd09ad2865ed791641f1fcf778f0eb (patch) | |
tree | 6a5ae87ed019651bdbc43f6418d30d3a69bc8d4d /util/board_status | |
parent | 0dcfb592205cfc8216c7cfd5f60f77b240b2bd4e (diff) |
board_status: Make board_status more friendly for local usage
board_status.sh was originally written for use cases where the DUT
is remote, i.e. accessed via serial port or SSH. This lead to some
issues when attempting to run the script on the DUT itself.
This patch attempts to handle the local use case more gracefully.
sudo is used when running the cbmem command, and the '-c' option
can be used to set cbmem path in case it's not in the default path
used by sudo.
Change-Id: I62957678ccae65fc46fd6ddf5ae92983d36cffad
Signed-off-by: David Hendricks <david.hendricks@gmail.com>
Reviewed-on: https://review.coreboot.org/21566
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'util/board_status')
-rwxr-xr-x | util/board_status/board_status.sh | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/util/board_status/board_status.sh b/util/board_status/board_status.sh index dc821049da..ca7e2c7fbe 100755 --- a/util/board_status/board_status.sh +++ b/util/board_status/board_status.sh @@ -363,7 +363,9 @@ else cbmem_cmd="cbmem" fi -if [ -z "$SERIAL_DEVICE" ]; then +if [ -n "$SERIAL_DEVICE" ]; then + get_serial_bootlog "$SERIAL_DEVICE" "$SERIAL_PORT_SPEED" "${tmpdir}/${results}/coreboot_console.txt" +elif [ -n "$REMOTE_HOST" ]; then echo "Verifying that CBMEM is available on remote device" test_cmd $REMOTE "$cbmem_cmd" echo "Getting coreboot boot log" @@ -374,7 +376,27 @@ if [ -z "$SERIAL_DEVICE" ]; then echo "Getting remote dmesg" cmd $REMOTE dmesg "${tmpdir}/${results}/kernel_log.txt" else - get_serial_bootlog "$SERIAL_DEVICE" "$SERIAL_PORT_SPEED" "${tmpdir}/${results}/coreboot_console.txt" + echo "Verifying that CBMEM is available" + if [ $(id -u) -ne 0 ]; then + sudo command -v "$cbmem_cmd" >/dev/null + if [ $? -ne 0 ]; then + echo "Failed to run $cbmem_cmd using sudo. Check \$PATH or use -c" \ + "to specify path to cbmem binary." + exit $EXIT_FAILURE + else + cbmem_cmd="sudo $cbmem_cmd" + fi + else + test_cmd $LOCAL "$cbmem_cmd" + fi + + echo "Getting coreboot boot log" + cmd $LOCAL "$cbmem_cmd -c" "${tmpdir}/${results}/coreboot_console.txt" + echo "Getting timestamp data" + cmd_nonfatal $LOCAL "$cbmem_cmd -t" "${tmpdir}/${results}/coreboot_timestamps.txt" + + echo "Getting local dmesg" + cmd $LOCAL dmesg "${tmpdir}/${results}/kernel_log.txt" fi # |