diff mbox

[i-g-t] tests/vgem_basic: Retry the initial module unload in unload test

Message ID 1476789921-3391-1-git-send-email-petri.latvala@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Petri Latvala Oct. 18, 2016, 11:25 a.m. UTC
If executed too soon after prime_vgem tests, the vgem unload test
fails due to its execbuffers still being handled in the kernel. Retry
the unload three times with sleeps before reporting a skip.

When tested on HSW, one 1s sleep wasn't enough, 3s was.

Signed-off-by: Petri Latvala <petri.latvala@intel.com>
CC: Chris Wilson <chris@chris-wilson.co.uk>
CC: Jari Tahvanainen <jari.tahvanainen@intel.com>
CC: Daniel Vetter <daniel@ffwll.ch>
---

With this change, we can leave vgem_basic@unload last in the CI
testlist, and thus still catch actual unload problems.

tests/vgem_basic.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/tests/vgem_basic.c b/tests/vgem_basic.c
index 5b54a4a..7f0750d 100644
--- a/tests/vgem_basic.c
+++ b/tests/vgem_basic.c
@@ -296,10 +296,15 @@  static int module_unload(void)
 static void test_unload(void)
 {
 	struct vgem_bo bo;
-	int vgem, dmabuf;
+	int vgem, dmabuf, unloaded, retry = 3;
 	uint32_t *ptr;
 
-	igt_require(module_unload() == 0);
+	while ((unloaded = module_unload()) && retry-- > 0) {
+		/* Sleep for a moment to let previous users finish */
+		sleep(1);
+	}
+
+	igt_require(unloaded == 0);
 
 	vgem = __drm_open_driver(DRIVER_VGEM);
 	igt_assert(vgem != -1);