Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] i915/hangman: Skip if disabled by the kernel
Date: Thu, 10 Jan 2019 09:19:12 +0000	[thread overview]
Message-ID: <20190110091912.10893-1-chris@chris-wilson.co.uk> (raw)

Some kernels may have to disable error capture for some hardware or by
it being configured out. Since it is conditionally available, asserting
it exists is not an actual requirement. For hardware where we are unable
to provide error state capture, skip.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/hangman.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/tests/i915/hangman.c b/tests/i915/hangman.c
index 6ddae4912..4035f7384 100644
--- a/tests/i915/hangman.c
+++ b/tests/i915/hangman.c
@@ -42,13 +42,16 @@
 static int device = -1;
 static int sysfs = -1;
 
-static void test_sysfs_error_exists(void)
+static bool has_error_state(int dir)
 {
-	char *error;
+	int fd;
 
-	error = igt_sysfs_get(sysfs, "error");
-	igt_assert(error);
-	free(error);
+	fd = openat(dir, "error", O_RDONLY);
+	if (fd < 0)
+		return false;
+
+	close(fd);
+	return true;
 }
 
 static void assert_entry(const char *s, bool expect)
@@ -256,12 +259,12 @@ igt_main
 
 		device = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(device);
+
 		sysfs = igt_sysfs_open(device, &idx);
 		igt_assert(sysfs != -1);
-	}
 
-	igt_subtest("error-state-sysfs-entry")
-		test_sysfs_error_exists();
+		igt_require(has_error_state(sysfs));
+	}
 
 	igt_subtest("error-state-basic")
 		test_error_state_basic();
-- 
2.20.1

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

             reply	other threads:[~2019-01-10  9:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-10  9:19 Chris Wilson [this message]
2019-01-10  9:43 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/hangman: Skip if disabled by the kernel Patchwork
2019-01-10 12:27 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-01-10 22:11 ` [igt-dev] [PATCH i-g-t] " Antonio Argenziano

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=20190110091912.10893-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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