tests: run-tests: Do not use sudo if already root
Among other things, sudo can disrupt environment variables that a caller provides. Signed-off-by: Brian Norris <briannorris@chromium.org>
This commit is contained in:
parent
4dbba548ae
commit
4b0bf0ec6e
1 changed files with 7 additions and 1 deletions
|
@ -122,7 +122,13 @@ if ! ./start.sh $VM $VALGRIND $TRACE channels=$NUM_CH; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo ./run-tests.py -D --logdir "$LOGDIR" $TRACE_ARGS -q $DB $RUN_TEST_ARGS || errors=1
|
# Only use sudo if not already root.
|
||||||
|
if [ "$(id -u)" != 0 ]; then
|
||||||
|
SUDO=sudo
|
||||||
|
else
|
||||||
|
SUDO=
|
||||||
|
fi
|
||||||
|
${SUDO} ./run-tests.py -D --logdir "$LOGDIR" $TRACE_ARGS -q $DB $RUN_TEST_ARGS || errors=1
|
||||||
|
|
||||||
./stop.sh
|
./stop.sh
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue