drm/selftests: Move i915 buddy selftests into drm
- move i915 buddy selftests into drm selftests folder - add Makefile and Kconfig support - add sanitycheck testcase Prerequisites - These series of selftests patches are created on top of drm buddy series - Enable kselftests for DRM as a module in .config Signed-off-by: Arunpravin <Arunpravin.PaneerSelvam@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Acked-by: Matthew Auld <matthew.auld@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220222174845.2175-1-Arunpravin.PaneerSelvam@amd.com Signed-off-by: Christian König <christian.koenig@amd.com>
This commit is contained in:
		
							parent
							
								
									8ab62eda17
								
							
						
					
					
						commit
						3d515ba9ea
					
				| @ -71,6 +71,7 @@ config DRM_DEBUG_SELFTEST | ||||
| 	select DRM_DP_HELPER | ||||
| 	select DRM_LIB_RANDOM | ||||
| 	select DRM_KMS_HELPER | ||||
| 	select DRM_BUDDY | ||||
| 	select DRM_EXPORT_FOR_TESTS if m | ||||
| 	default n | ||||
| 	help | ||||
|  | ||||
| @ -4,4 +4,5 @@ test-drm_modeset-y := test-drm_modeset_common.o test-drm_plane_helper.o \ | ||||
| 		      test-drm_damage_helper.o test-drm_dp_mst_helper.o \
 | ||||
| 		      test-drm_rect.o | ||||
| 
 | ||||
| obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm_modeset.o test-drm_cmdline_parser.o | ||||
| obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm_modeset.o test-drm_cmdline_parser.o \
 | ||||
| 				    test-drm_buddy.o | ||||
|  | ||||
							
								
								
									
										9
									
								
								drivers/gpu/drm/selftests/drm_buddy_selftests.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								drivers/gpu/drm/selftests/drm_buddy_selftests.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,9 @@ | ||||
| /* SPDX-License-Identifier: GPL-2.0 */ | ||||
| /* List each unit test as selftest(name, function)
 | ||||
|  * | ||||
|  * The name is used as both an enum and expanded as igt__name to create | ||||
|  * a module parameter. It must be unique and legal for a C identifier. | ||||
|  * | ||||
|  * Tests are executed in order by igt/drm_buddy | ||||
|  */ | ||||
| selftest(sanitycheck, igt_sanitycheck) /* keep first (selfcheck for igt) */ | ||||
							
								
								
									
										49
									
								
								drivers/gpu/drm/selftests/test-drm_buddy.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								drivers/gpu/drm/selftests/test-drm_buddy.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,49 @@ | ||||
| // SPDX-License-Identifier: MIT
 | ||||
| /*
 | ||||
|  * Copyright © 2019 Intel Corporation | ||||
|  */ | ||||
| 
 | ||||
| #define pr_fmt(fmt) "drm_buddy: " fmt | ||||
| 
 | ||||
| #include <linux/module.h> | ||||
| 
 | ||||
| #include <drm/drm_buddy.h> | ||||
| 
 | ||||
| #include "../lib/drm_random.h" | ||||
| 
 | ||||
| #define TESTS "drm_buddy_selftests.h" | ||||
| #include "drm_selftest.h" | ||||
| 
 | ||||
| static unsigned int random_seed; | ||||
| 
 | ||||
| static int igt_sanitycheck(void *ignored) | ||||
| { | ||||
| 	pr_info("%s - ok!\n", __func__); | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| #include "drm_selftest.c" | ||||
| 
 | ||||
| static int __init test_drm_buddy_init(void) | ||||
| { | ||||
| 	int err; | ||||
| 
 | ||||
| 	while (!random_seed) | ||||
| 		random_seed = get_random_int(); | ||||
| 
 | ||||
| 	pr_info("Testing DRM buddy manager (struct drm_buddy), with random_seed=0x%x\n", | ||||
| 		random_seed); | ||||
| 	err = run_selftests(selftests, ARRAY_SIZE(selftests), NULL); | ||||
| 
 | ||||
| 	return err > 0 ? 0 : err; | ||||
| } | ||||
| 
 | ||||
| static void __exit test_drm_buddy_exit(void) | ||||
| { | ||||
| } | ||||
| 
 | ||||
| module_init(test_drm_buddy_init); | ||||
| module_exit(test_drm_buddy_exit); | ||||
| 
 | ||||
| MODULE_AUTHOR("Intel Corporation"); | ||||
| MODULE_LICENSE("GPL"); | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user