public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Arkadiusz Hiler via igt-dev <igt-dev@lists.freedesktop.org>
To: igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>
Subject: [igt-dev] [PATCH i-g-t] igt_command_line.sh: Abort if run as root
Date: Tue, 12 Feb 2019 15:53:17 +0200	[thread overview]
Message-ID: <20190212135317.14057-1-arkadiusz.hiler@intel.com> (raw)

`ninja test` invokes igt_command_line.sh for each test binary to check
the behavior of some of the switches. One of the verified things is that
the test exists with non-zero status when requesting invalid subtest.

`--run-subtest` results in igt_fixtures being executed - this fiddles
with the device and sysfs knobs.

Let's exit early, if we are root, to save people form unintentional
side-effects and strange failures.

Cc: Petri Latvala <petri.latvala@intel.com>
Cc: Andi Shyti <andi.shyti@intel.com>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
---
 tests/igt_command_line.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/igt_command_line.sh b/tests/igt_command_line.sh
index e05ec34c..408d965f 100755
--- a/tests/igt_command_line.sh
+++ b/tests/igt_command_line.sh
@@ -100,6 +100,10 @@ check_test ()
 	./$test --run-subtest invalid-subtest > /dev/null 2>&1 && fail $test
 }
 
+if [ "$EUID" -eq 0 ]; then
+    fail "Don't run $0 as root. It executes igt_fixture blocks."
+fi
+
 TESTLISTFILE="$tests_dir/test-list.txt"
 if [ ! -r "$TESTLISTFILE" ]; then
 	tests_dir="tests"
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

             reply	other threads:[~2019-02-12 13:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-12 13:53 Arkadiusz Hiler via igt-dev [this message]
2019-02-12 14:14 ` [igt-dev] [PATCH i-g-t] igt_command_line.sh: Abort if run as root Daniel Vetter
2019-02-12 14:37 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-02-12 16:58 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-02-12 23:58 ` [igt-dev] [PATCH i-g-t] " Andi Shyti via igt-dev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190212135317.14057-1-arkadiusz.hiler@intel.com \
    --to=igt-dev@lists.freedesktop.org \
    --cc=arkadiusz.hiler@intel.com \
    --cc=petri.latvala@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox