From de775f3a15daebcf191562fa0984f49497b76fd0 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Mon, 26 Nov 2018 11:08:24 +0100 Subject: tests: close(fd) without igt_fixture considered harmful Some tests assume that close on an unopened fd is fine, except it's not just unopened but actually stack garbage. There's a good chance we end up running close(0), which wreaks the testcase enumeration. Fix this. Reviewed-by: Jani Nikula Not sure there's a better way to catch this than git grep plus lots of manual auditing ... The unit tests only catch it by accident (x86 works fine, I hit it in one testcase only cross-building to aarch64). v2: Note that gem_pread_after_blit uses heap memory, so is actually guaranteed to run close(0). Noticed by Jani. Reviewed-by: Jani Nikula Signed-off-by: Daniel Vetter --- tests/i915/gem_tiled_fence_blits.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/i915/gem_tiled_fence_blits.c') diff --git a/tests/i915/gem_tiled_fence_blits.c b/tests/i915/gem_tiled_fence_blits.c index c02e35a5..2453bcc0 100644 --- a/tests/i915/gem_tiled_fence_blits.c +++ b/tests/i915/gem_tiled_fence_blits.c @@ -230,5 +230,6 @@ igt_main run_test(fd, count); } - close(fd); + igt_fixture + close(fd); } -- cgit v1.2.3