ntel-gpu-tools/tests/gem_alive.c
Chris Wilson a29f28eba9 igt/drv_module_reload: Check more carefully for a live driver
As drm_open_any() now quietly fails if there is no driver, this
nullifies the effectiviness of using gem_exec_nop as the test for a good
reload. Combine with gem_alive (and guarantee that gem_alive can detect
a dead driver, putting lie to

commit 032f30cb38bb03562ee7fde19cd278b1d8ac31a9
Author: Thomas Wood <thomas.wood@intel.com>
Date:   Tue Jan 13 13:33:57 2015 +0000

    lib: remove unnecessary checks on the drm_open_any return value

) first.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88573
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-01-19 09:47:03 +00:00

36 lines
519 B
C

#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <i915_drm.h>
#include "drmtest.h"
int main(void)
{
struct drm_i915_gem_sw_finish arg = { 0 };
int fd;
signal(SIGALRM, SIG_IGN);
fd = __drm_open_any();
if (fd < 0)
return IGT_EXIT_SKIP;
alarm(1);
if (ioctl(fd, DRM_IOCTL_I915_GEM_SW_FINISH, &arg) == 0)
return IGT_EXIT_SKIP;
switch (errno) {
case ENOENT:
return 0;
case EIO:
return 1;
case EINTR:
return 2;
default:
return 3;
}
}