diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2019-01-10 09:16:26 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-01-10 23:28:47 +0000 |
commit | 93f0ad4b835e56dd02f2b7520433e015f28bb571 (patch) | |
tree | d8c81337bdf6e987dd47606ba89299f63d4be5ec /tests | |
parent | 4cd3da7e32d4ad7efe3d1abd2f03e4e133309e87 (diff) |
i915/hangman: Skip if disabled by the kernel
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>
Acked-by: Antonio Argenziano <antonio.argenziano@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/i915/hangman.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/i915/hangman.c b/tests/i915/hangman.c index 6ddae491..4035f738 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(); |