[Intel-gfx] [PATCH i-g-t] tests/gem_guc_loading: Adding simple GuC loading test

Chris Wilson chris at chris-wilson.co.uk
Tue Jan 5 13:10:05 PST 2016


On Tue, Jan 05, 2016 at 05:17:07PM +0100, Lukasz Fiedorowicz wrote:
> +static void open_guc_status(void)
> +{
> +	guc_status_fd = igt_debugfs_open("i915_guc_load_status", O_RDONLY);
> +	igt_assert_f(guc_status_fd >= 0, "Can't open i915_guc_load_status\n");

igt_require(). So that the test doesn't explode if the kernel changes.

> +
> +static enum guc_status get_guc_status(void)
> +{
> +	char buf[LOAD_STATUS_BUF_SIZE];
> +
> +	FILE *fp = fdopen(guc_status_fd, "r");

If you just wanted the FILE*, use igt_debugfs_fopen.

> +	igt_assert_f(fp != NULL, "Can't open i915_guc_load_status file\n");
> +
> +	while (fgets(buf, LOAD_STATUS_BUF_SIZE, fp))
> +		if ((strstr(buf, "\tload: SUCCESS\n")))
> +			return GUC_ENABLED;

Testing FILE* leak handling?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list