[Intel-gfx] [PATCH i-g-t 3/4 v4] tests/drv_module_reload: Convert sh script to C version.

Chris Wilson chris at chris-wilson.co.uk
Fri Oct 28 09:48:33 UTC 2016


On Fri, Oct 28, 2016 at 12:31:28PM +0300, Marius Vlad wrote:
> +	igt_subtest_group {
> +		int fd;
> +
> +		igt_fixture
> +			fd = __drm_open_driver(DRIVER_INTEL);
> +
> +		igt_subtest_group {
> +			igt_subtest("basic-gem-info")
> +				if ((err = gem_info(fd)))
> +					igt_fail(err);
> +			igt_subtest_group
> +				if ((err = gem_exec_store(fd)))
> +					igt_fail(err);

This is a misinterpretation of the existing test. These are not
subtests, but a sanity check that reload() works. A call to
gem_exec_store() can just whither away, it doesn't reveal much about the
general sanity of the driver, but a quick call to an ioctl such as
gem_info() is enough to be sure the driver is there (i.e. the module load
worked as adverticed) and not hung upon load.

One more thing about gem_info(), to be used in process it needs to be
something like:

/* Check the driver load completed by seeing if it responds to an ioctl
 * correctly. We pick an ioctl that calls i915_mutex_interruptible()
 * first (before failing on the invalid arg) so that we can inspect its
 * driver error detection (-EIO if already wedged, or -EINTR if stuck).
 */
void i915_gem_sanitycheck(void)
{
	struct set_cacheing arg = {};
	int fd, err;

	fd = __drm_driver_open(DRIVER_INTEL);
	igt_set_timeout(1, "module reload failed");

	err = 0;
	if (ioctl(fd, SET_CACHEING, &arg))
		err = -errno;

	igt_set_timeout(0, NULL);
	close(fd);

	igt_assert_eq(err, -ENOENT);

}
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list