[Intel-xe] [igt-dev] [PATCH i-g-t v2 16/17] lib/kunit: Strip "_test" or "_kunit" suffix from subtest names

Mauro Carvalho Chehab mauro.chehab at linux.intel.com
Fri Sep 15 11:42:13 UTC 2023


On Fri,  8 Sep 2023 14:32:50 +0200
Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com> wrote:

> If a user (an IGT test) doesn't provide a subtest name when calling
> igt_kunit() then we now use the requested kernel module name as IGT
> subtest name.  Since names of kunit test modules usually end with a
> "_test" or "_kunit" suffix, those parts of the names don't carry any
> useful information.  Strip those suffixes from IGT subtest names.

LGTM.

Reviewed-by: Mauro Carvalho Chehab <mchehab at kernel.org>

> 
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
> ---
>  lib/igt_kmod.c | 26 ++++++++++++++++++++++----
>  tests/drm_mm.c | 42 +++++++++++++++++++++---------------------
>  2 files changed, 43 insertions(+), 25 deletions(-)
> 
> diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
> index 46a6f81e73..ddd5499f5e 100644
> --- a/lib/igt_kmod.c
> +++ b/lib/igt_kmod.c
> @@ -944,8 +944,29 @@ void igt_kunit(const char *module_name, const char *name, const char *opts)
>  	if (igt_ktest_init(&tst, module_name) != 0)
>  		return;
>  
> -	igt_fixture
> +	/*
> +	 * If the caller (an IGT test) provides no subtest name then we
> +	 * take the module name, drop the trailing "_test" or "_kunit"
> +	 * suffix, if any, and use the result as our IGT subtest name.
> +	 */
> +	if (!name) {
> +		name = strdup(module_name);
> +		if (name) {
> +			char *suffix = strstr(name, "_test");
> +
> +			if (!suffix)
> +				suffix = strstr(name, "_kunit");
> +
> +			if (suffix)
> +				*suffix = '\0';
> +		}
> +	}
> +
> +	igt_fixture {
> +		igt_require(name);
> +
>  		igt_require(igt_ktest_begin(&tst) == 0);
> +	}
>  
>  	/*
>  	 * We need to use igt_subtest here, as otherwise it may crash with:
> @@ -954,9 +975,6 @@ void igt_kunit(const char *module_name, const char *name, const char *opts)
>  	 * proper namespace for dynamic subtests, with is required for CI
>  	 * and for documentation.
>  	 */
> -	if (name == NULL)
> -		name = module_name;
> -
>  	igt_subtest_with_dynamic(name)
>  		__igt_kunit(&tst, opts);
>  
> diff --git a/tests/drm_mm.c b/tests/drm_mm.c
> index 9a8b3f3fcb..e6ba224745 100644
> --- a/tests/drm_mm.c
> +++ b/tests/drm_mm.c
> @@ -29,123 +29,123 @@
>   * Feature: mapping
>   * Run type: FULL
>   *
> - * SUBTEST: drm_mm_test
> + * SUBTEST: drm_mm
>   *
> - * SUBTEST: drm_mm_test at align
> + * SUBTEST: drm_mm at align
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at align32
> + * SUBTEST: drm_mm at align32
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at align64
> + * SUBTEST: drm_mm at align64
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at bottomup
> + * SUBTEST: drm_mm at bottomup
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at color
> + * SUBTEST: drm_mm at color
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at color_evict
> + * SUBTEST: drm_mm at color_evict
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at color_evict_range
> + * SUBTEST: drm_mm at color_evict_range
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at debug
> + * SUBTEST: drm_mm at debug
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at evict
> + * SUBTEST: drm_mm at evict
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at evict_range
> + * SUBTEST: drm_mm at evict_range
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at frag
> + * SUBTEST: drm_mm at frag
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at highest
> + * SUBTEST: drm_mm at highest
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at init
> + * SUBTEST: drm_mm at init
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at insert
> + * SUBTEST: drm_mm at insert
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at insert_range
> + * SUBTEST: drm_mm at insert_range
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at lowest
> + * SUBTEST: drm_mm at lowest
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at replace
> + * SUBTEST: drm_mm at replace
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at reserve
> + * SUBTEST: drm_mm at reserve
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at sanitycheck
> + * SUBTEST: drm_mm at sanitycheck
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt
>   * Test category: GEM_Legacy
>   *
> - * SUBTEST: drm_mm_test at topdown
> + * SUBTEST: drm_mm at topdown
>   * Category: Infrastructure
>   * Description: drm_mm range manager SW validation
>   * Functionality: DRM memory mangemnt


More information about the Intel-xe mailing list