[igt-dev] [PATCH i-g-t 1/2] run-tests.sh: allow to run without sudo
Arkadiusz Hiler
arkadiusz.hiler at intel.com
Tue Mar 13 11:48:13 UTC 2018
On Mon, Feb 26, 2018 at 10:50:29AM -0800, Lucas De Marchi wrote:
> If the script is already running as root, it doens't need to be
> executed through sudo. This also moves the calls to exec piglit to a
> common function.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
> ---
> scripts/run-tests.sh | 22 ++++++++++++++++++----
> 1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh
> index a98e06ce..92c5578c 100755
> --- a/scripts/run-tests.sh
> +++ b/scripts/run-tests.sh
> @@ -44,6 +44,20 @@ function download_piglit {
> git clone git://anongit.freedesktop.org/piglit "$ROOT/piglit"
> }
>
> +function run_piglit # as-root <args>
> +{
> + local need_root=$1
> + shift
> + local env sudo
> +
> + if [ $need_root -a $EUID -ne 0 ]; then
I think this should be [ "$need_root" -ne 0 -a "$EUID" -ne 0 ]
> + sudo="sudo"
> + env="IGT_TEST_ROOT=\"$IGT_TEST_ROOT\" IGT_CONFIG_PATH=\"$IGT_CONFIG_PATH\""
> + fi
> +
> + $sudo $env $PIGLIT "$@"
> +}
> +
> function print_help {
> echo "Usage: run-tests.sh [options]"
> echo "Available options:"
> @@ -111,18 +125,18 @@ if [ ! -x "$PIGLIT" ]; then
> fi
>
> if [ "x$LIST_TESTS" != "x" ]; then
> - IGT_TEST_ROOT="$IGT_TEST_ROOT" IGT_CONFIG_PATH="$IGT_CONFIG_PATH" "$PIGLIT" print-cmd --format "{name}" igt
> + run_piglit 0 print-cmd --format "{name}" igt
> exit
> fi
There were no CI results because build failed with:
+ ./scripts/run-tests.sh -l
sudo: no tty present and no askpass program specified
Which seems to be caused by the condition mentioned above.
--
Cheers,
Arek
More information about the igt-dev
mailing list