[Intel-gfx] [PATCH i-g-t 01/11] tests/perf: make stream_fd a global variable

Chris Wilson chris at chris-wilson.co.uk
Fri Aug 4 11:39:33 UTC 2017


Quoting Lionel Landwerlin (2017-08-04 12:20:30)
> When debugging unstable tests on new platforms we currently we don't
> cleanup everything well in between different tests. Since only a
> single OA stream fd can be opened at a time, having the stream_fd as a
> global variable helps us cleanup the state between tests.

We don't have constructors/destructors per-se, but we do have
igt_subtest_group which can contain fixtures to alloc/dealloc resources.

A more igt-esque approach would be

igt_subtest_group {
	int perf_fd = -1;

	igt_fixture {
		perf_fd = __perf_open();
	}

	igt_subtest
	... How ever many you want in the one group

	igt_fixture {
		__perf_close(perf_fd);
	}
}

Just my 2c. You can of course join the petition for more igt
infrastructure to make writing robust tests easier... :)
-Chris


More information about the Intel-gfx mailing list