From 2c16b0b5c88367fe398d4a973f1c8255ddc36b56 Mon Sep 17 00:00:00 2001 From: Robert Foss Date: Wed, 7 Dec 2016 15:07:50 -0500 Subject: lib/sw_sync: Add igt_require_sw_sync to enable skipping on no sw_sync support Add igt_require_sw_sync to provide tests to skip if sw_sync support isn't available on the host machine. Signed-off-by: Robert Foss Reviewed-by: Tomeu Vizoso --- lib/sw_sync.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/sw_sync.c') diff --git a/lib/sw_sync.c b/lib/sw_sync.c index aa8feefe..276dc795 100644 --- a/lib/sw_sync.c +++ b/lib/sw_sync.c @@ -212,3 +212,17 @@ int sync_fence_count_status(int fd, int status) return count; } + +static bool kernel_has_sw_sync(void) +{ + char buf[128]; + + igt_ignore_warn(system("/sbin/modprobe -s r sw_sync")); + + return kernel_sw_sync_path(buf, sizeof(buf)); +} + +void igt_require_sw_sync(void) +{ + igt_require(kernel_has_sw_sync()); +} -- cgit v1.2.3