[Intel-gfx] [PATCH 04/34] drm: Add some kselftests for the DRM range manager (struct drm_mm)

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Tue Dec 13 09:58:54 UTC 2016


On ma, 2016-12-12 at 11:53 +0000, Chris Wilson wrote:
> First we introduce a smattering of infrastructure for writing selftests.
> The idea is that we have a test module that exercises a particular
> portion of the exported API, and that module provides a set of tests
> that can either be run as an ensemble via kselftest or individually via
> an igt harness (in this case igt/drm_mm). To accommodate selecting
> individual tests, we export a boolean parameter to control selection of
> each test - that is hidden inside a bunch of reusable boilerplate macros
> to keep writing the tests simple.
> 
> Testcase: igt/drm_mm
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Acked-by: Christian König <christian.koenig at amd.com>

<SNIP>

> @@ -48,6 +48,19 @@ config DRM_DEBUG_MM
>  
>  	  If in doubt, say "N".
>  
> +config DRM_DEBUG_MM_SELFTEST
> +	tristate "kselftests for DRM range manager (struct drm_mm)"
> +	depends on DRM
> +	depends on DEBUG_KERNEL
> +	default n
> +	help
> +	  This option provides a kernel module that can be used to test
> +	  the DRM range manager (drm_mm) and its API. This option is not
> +	  useful for distributions or general kernels, but only for kernel
> +	  developers working on DRM and associated drivers.
> +
> +	  Say N if you are unsure

"If in doubt" is rather de-facto, at least add a period at the end.

> +++ b/drivers/gpu/drm/selftests/test-drm_mm.c
> @@ -0,0 +1,47 @@
> +/*
> + * Test cases for the drm_mm range manager
> + */
> +
> +#define pr_fmt(fmt) "drm_mm: " fmt
> +
> +#include <linux/module.h>
> +#include <linux/slab.h>
> +#include <linux/random.h>
> +#include <linux/vmalloc.h>
> +
> +#include <drm/drm_mm.h>
> +
> +#define TESTS "drm_mm_selftests.h"
> +#include "drm_selftest.h"
> +
> +static unsigned int random_seed = 0x12345678;

This could be build time, depending on the intended use.

Other than the reversed listing of tests (just for a module_param,
where the kerneldoc doesn't make any promises), can't nag of anything.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the Intel-gfx mailing list