run-robot.sh: correct invalid variable execution
Commit 384d741 attempted to clean up some issues reported by shellcheck
and ended up causing this script to fail execution. The previous
variable expansion was non-obvious and warned by shellcheck. Replaced
with an 'eval' call which seems to behave correctly and not be warned.
Tested:
Confirmed correct execution and error codes from the below executions.
```
ROBOT_TEST_CMD="echo this should pass && echo this also" \
./scripts/run-reboot.sh
ROBOT_TEST_CMD="echo this should pass && echo this also && false" \
./scripts/run-robot.sh
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ic4cb55c929511353d3e055d5238c0bcd520a4641
diff --git a/scripts/run-robot.sh b/scripts/run-robot.sh
index aad4bfd..56adb96 100755
--- a/scripts/run-robot.sh
+++ b/scripts/run-robot.sh
@@ -1,4 +1,4 @@
-#!/bin/bash -x
+#!/bin/bash -ex
# Extract and run the OpenBMC robot test suite
#
# The robot test results will be copied to ${HOME}
@@ -18,8 +18,6 @@
# we don't want to fail on bad rc since robot tests may fail
-set -e
-
MACHINE=${MACHINE:-"qemu"}
ROBOT_CODE_HOME=${ROBOT_CODE_HOME:-/tmp/$(whoami)/${RANDOM}/obmc-robot/}
ROBOT_TEST_CMD=${ROBOT_TEST_CMD:-"python3 -m robot\
@@ -36,8 +34,7 @@
chmod ugo+rw -R "${ROBOT_CODE_HOME}"/*
# Execute the CI tests
-# shellcheck disable=SC2091 # intentionally executing ROBOT_TEST_CMD.
-$($ROBOT_TEST_CMD)
+eval "${ROBOT_TEST_CMD}"
cp "${ROBOT_CODE_HOME}"/*.xml "${HOME}/"
cp "${ROBOT_CODE_HOME}"/*.html "${HOME}/"