[Intel-gfx] [PATCH 16/16] drm/i915: Add selftests for object allocation, phys
Chris Wilson
chris at chris-wilson.co.uk
Sat Dec 17 13:55:34 UTC 2016
On Tue, Dec 13, 2016 at 05:10:46PM +0000, Tvrtko Ursulin wrote:
> >+int i915_gem_object_selftests(void)
> >+{
> >+ static const struct i915_subtest tests[] = {
> >+ SUBTEST(igt_gem_object),
> >+ SUBTEST(igt_phys_object),
> >+ };
> >+
> >+ return i915_subtests(tests, NULL);
> >+}
> >+#endif
>
> Would it be worth shunting these "if
> IS_ENABLED(CONFIG_DRM_I915_SELFTEST)" blocks into separate files and
> include them from the parent?
>
> Like in this case:
>
> #include "i915_gem_selftests.c"
>
> Or even:
>
> #include "selftests/i915_gem.c"
>
> If the include is at the end of the file it should always work. It
> will be more manageable as the tests grow I think.
I like the idea of moving the test code under selftests/. It does make
it more difficult, but not terribly so, to read both chunks (oh, the
pain of having to have two panes!). I still like having the include
under the ifdef guard to make it clear to the reader of the *primary*
code that what follows is auxiliary. You can judge for yourself
shortly...
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list