[igt-dev] [PATCH i-g-t] i915/gem_ctx_exec: Restore i915.enable_hangcheck before failing

Chris Wilson
2019-10-24T23:29:16Z

If the test fails, don't abort leaving the global i915.enable_hangcheck
still disabled as that may affect later tests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
tests/i915/gem_ctx_exec.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/tests/i915/gem_ctx_exec.c b/tests/i915/gem_ctx_exec.c
index 92e899869..1e14bef62 100644
--- a/tests/i915/gem_ctx_exec.c
+++ b/tests/i915/gem_ctx_exec.c
@@ -209,6 +209,7 @@ static void nohangcheck_hostile(int i915)
igt_spin_t *spin;
uint32_t ctx;
int dir;
+ int err;

/*
* Even if the user disables hangcheck during their context,
@@ -225,12 +226,18 @@ static void nohangcheck_hostile(int i915)
spin = igt_spin_new(i915, ctx, .flags = IGT_SPIN_NO_PREEMPTION);
gem_context_destroy(i915, ctx);

- igt_assert_eq(gem_wait(i915, spin->handle, &timeout), 0);
-
- igt_require(__enable_hangcheck(dir, true));
+ err = gem_wait(i915, spin->handle, &timeout);
+ if (err)
+ igt_debugfs_dump(i915, "i915_engine_info");

igt_spin_free(i915, spin);
+
+ igt_require(__enable_hangcheck(dir, true));
gem_quiescent_gpu(i915);
+
+ igt_assert_f(err == 0,
+ "Hostile unpreemptable context was not cancelled immediately upon closure\n");
+
close(dir);
}

--
2.24.0.rc0