Unverified Commit 9eb11f52 authored by Maíra Canal's avatar Maíra Canal Committed by Javier Martinez Canillas
Browse files

drm: selftest: convert drm_framebuffer selftest to KUnit



Considering the current adoption of the KUnit framework, convert the
DRM framebuffer selftest to the KUnit API.

Tested-by: default avatarDavid Gow <davidgow@google.com>
Acked-by: default avatarDaniel Latypov <dlatypov@google.com>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Signed-off-by: default avatarMaíra Canal <maira.canal@usp.br>
Signed-off-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220708203052.236290-8-maira.canal@usp.br
parent 848b3c0b
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
test-drm_modeset-y := test-drm_modeset_common.o test-drm_framebuffer.o

obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm_modeset.o \
				    test-drm_buddy.o
obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm_buddy.o
+0 −9
Original line number Diff line number Diff line
/* 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_selftests_helper
 */
selftest(check_drm_framebuffer_create, igt_check_drm_framebuffer_create)
+0 −32
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * Common file for modeset selftests.
 */

#include <linux/module.h>

#include "test-drm_modeset_common.h"

#define TESTS "drm_modeset_selftests.h"
#include "drm_selftest.h"

#include "drm_selftest.c"

static int __init test_drm_modeset_init(void)
{
	int err;

	err = run_selftests(selftests, ARRAY_SIZE(selftests), NULL);

	return err > 0 ? 0 : err;
}

static void __exit test_drm_modeset_exit(void)
{
}

module_init(test_drm_modeset_init);
module_exit(test_drm_modeset_exit);

MODULE_AUTHOR("Intel Corporation");
MODULE_LICENSE("GPL");
+0 −21
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */

#ifndef __TEST_DRM_MODESET_COMMON_H__
#define __TEST_DRM_MODESET_COMMON_H__

#include <linux/errno.h>
#include <linux/printk.h>

#define FAIL(test, msg, ...) \
	do { \
		if (test) { \
			pr_err("%s/%u: " msg, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
			return -EINVAL; \
		} \
	} while (0)

#define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n")

int igt_check_drm_framebuffer_create(void *ignored);

#endif
+1 −1
Original line number Diff line number Diff line
@@ -2,4 +2,4 @@

obj-$(CONFIG_DRM_KUNIT_TEST) += drm_format_helper_test.o drm_damage_helper_test.o \
	drm_cmdline_parser_test.o drm_rect_test.o drm_format_test.o drm_plane_helper_test.o \
	drm_dp_mst_helper_test.o
	drm_dp_mst_helper_test.o drm_framebuffer_test.o
Loading