linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michał Winiarski" <michal.winiarski@intel.com>
To: <dri-devel@lists.freedesktop.org>, <linux-kselftest@vger.kernel.org>
Cc: "Brendan Higgins" <brendanhiggins@google.com>,
	"Daniel Latypov" <dlatypov@google.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"David Airlie" <airlied@linux.ie>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Petri Latvala" <petri.latvala@intel.com>,
	"Arkadiusz Hiler" <arek@hiler.eu>,
	"Michał Winiarski" <michal.winiarski@intel.com>
Subject: [RFC 09/10] drm: selftests: Convert to KUnit
Date: Tue, 18 Jan 2022 00:22:58 +0100	[thread overview]
Message-ID: <20220117232259.180459-10-michal.winiarski@intel.com> (raw)
In-Reply-To: <20220117232259.180459-1-michal.winiarski@intel.com>

Now that all tests were converted, remove the content that's no longer
used and rename the directory to "test".

Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
---
 drivers/gpu/drm/Kconfig                       |  17 ---
 drivers/gpu/drm/Makefile                      |   2 +-
 drivers/gpu/drm/i915/Kconfig.debug            |   1 -
 drivers/gpu/drm/selftests/drm_selftest.c      | 109 ------------------
 drivers/gpu/drm/selftests/drm_selftest.h      |  41 -------
 drivers/gpu/drm/{selftests => test}/Makefile  |   0
 .../test-drm_cmdline_parser.c                 |   0
 .../test-drm_damage_helper.c                  |   0
 .../test-drm_dp_mst_helper.c                  |   0
 .../drm/{selftests => test}/test-drm_format.c |   0
 .../test-drm_framebuffer.c                    |   0
 .../gpu/drm/{selftests => test}/test-drm_mm.c |   0
 .../test-drm_plane_helper.c                   |   0
 .../drm/{selftests => test}/test-drm_rect.c   |   0
 14 files changed, 1 insertion(+), 169 deletions(-)
 delete mode 100644 drivers/gpu/drm/selftests/drm_selftest.c
 delete mode 100644 drivers/gpu/drm/selftests/drm_selftest.h
 rename drivers/gpu/drm/{selftests => test}/Makefile (100%)
 rename drivers/gpu/drm/{selftests => test}/test-drm_cmdline_parser.c (100%)
 rename drivers/gpu/drm/{selftests => test}/test-drm_damage_helper.c (100%)
 rename drivers/gpu/drm/{selftests => test}/test-drm_dp_mst_helper.c (100%)
 rename drivers/gpu/drm/{selftests => test}/test-drm_format.c (100%)
 rename drivers/gpu/drm/{selftests => test}/test-drm_framebuffer.c (100%)
 rename drivers/gpu/drm/{selftests => test}/test-drm_mm.c (100%)
 rename drivers/gpu/drm/{selftests => test}/test-drm_plane_helper.c (100%)
 rename drivers/gpu/drm/{selftests => test}/test-drm_rect.c (100%)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index c567324c96b9..7b18540a1b8a 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -63,23 +63,6 @@ config DRM_DEBUG_MM
 
 	  If in doubt, say "N".
 
-config DRM_DEBUG_SELFTEST
-	tristate "kselftests for DRM"
-	depends on DRM
-	depends on DEBUG_KERNEL
-	select PRIME_NUMBERS
-	select DRM_LIB_RANDOM
-	select DRM_KMS_HELPER
-	select DRM_EXPORT_FOR_TESTS if m
-	default n
-	help
-	  This option provides kernel modules that can be used to run
-	  various selftests on parts of the DRM api. This option is not
-	  useful for distributions or general kernels, but only for kernel
-	  developers working on DRM and associated drivers.
-
-	  If in doubt, say "N".
-
 config DRM_KUNIT_TEST
 	bool "DRM tests" if !KUNIT_ALL_TESTS
 	depends on DRM=y && KUNIT=y
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 550800e81836..6fe8143c43e7 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -65,7 +65,7 @@ drm_kms_helper-$(CONFIG_DRM_DP_AUX_CHARDEV) += drm_dp_aux_dev.o
 drm_kms_helper-$(CONFIG_DRM_DP_CEC) += drm_dp_cec.o
 
 obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
-obj-y += selftests/
+obj-y += test/
 
 obj-$(CONFIG_DRM)	+= drm.o
 obj-$(CONFIG_DRM_MIPI_DBI) += drm_mipi_dbi.o
diff --git a/drivers/gpu/drm/i915/Kconfig.debug b/drivers/gpu/drm/i915/Kconfig.debug
index e7fd3e76f8a2..425189f55d37 100644
--- a/drivers/gpu/drm/i915/Kconfig.debug
+++ b/drivers/gpu/drm/i915/Kconfig.debug
@@ -38,7 +38,6 @@ config DRM_I915_DEBUG
 	select DRM_VGEM # used by igt/prime_vgem (dmabuf interop checks)
 	select DRM_DEBUG_MM if DRM=y
 	select DRM_EXPORT_FOR_TESTS if m
-	select DRM_DEBUG_SELFTEST
 	select DMABUF_SELFTESTS
 	select SW_SYNC # signaling validation framework (igt/syncobj*)
 	select DRM_I915_WERROR
diff --git a/drivers/gpu/drm/selftests/drm_selftest.c b/drivers/gpu/drm/selftests/drm_selftest.c
deleted file mode 100644
index e29ed9faef5b..000000000000
--- a/drivers/gpu/drm/selftests/drm_selftest.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright © 2016 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#include <linux/compiler.h>
-
-#define selftest(name, func) __idx_##name,
-enum {
-#include TESTS
-};
-#undef selftest
-
-#define selftest(n, f) [__idx_##n] = { .name = #n, .func = f },
-static struct drm_selftest {
-	bool enabled;
-	const char *name;
-	int (*func)(void *);
-} selftests[] = {
-#include TESTS
-};
-#undef selftest
-
-/* Embed the line number into the parameter name so that we can order tests */
-#define param(n) __PASTE(igt__, __PASTE(__PASTE(__LINE__, __), n))
-#define selftest_0(n, func, id) \
-module_param_named(id, selftests[__idx_##n].enabled, bool, 0400);
-#define selftest(n, func) selftest_0(n, func, param(n))
-#include TESTS
-#undef selftest
-
-static void set_default_test_all(struct drm_selftest *st, unsigned long count)
-{
-	unsigned long i;
-
-	for (i = 0; i < count; i++)
-		if (st[i].enabled)
-			return;
-
-	for (i = 0; i < count; i++)
-		st[i].enabled = true;
-}
-
-static int run_selftests(struct drm_selftest *st,
-			 unsigned long count,
-			 void *data)
-{
-	int err = 0;
-
-	set_default_test_all(st, count);
-
-	/* Tests are listed in natural order in drm_*_selftests.h */
-	for (; count--; st++) {
-		if (!st->enabled)
-			continue;
-
-		pr_debug("drm: Running %s\n", st->name);
-		err = st->func(data);
-		if (err)
-			break;
-	}
-
-	if (WARN(err > 0 || err == -ENOTTY,
-		 "%s returned %d, conflicting with selftest's magic values!\n",
-		 st->name, err))
-		err = -1;
-
-	rcu_barrier();
-	return err;
-}
-
-static int __maybe_unused
-__drm_subtests(const char *caller,
-	       const struct drm_subtest *st,
-	       int count,
-	       void *data)
-{
-	int err;
-
-	for (; count--; st++) {
-		pr_debug("Running %s/%s\n", caller, st->name);
-		err = st->func(data);
-		if (err) {
-			pr_err("%s: %s failed with error %d\n",
-			       caller, st->name, err);
-			return err;
-		}
-	}
-
-	return 0;
-}
diff --git a/drivers/gpu/drm/selftests/drm_selftest.h b/drivers/gpu/drm/selftests/drm_selftest.h
deleted file mode 100644
index c784ec02ff53..000000000000
--- a/drivers/gpu/drm/selftests/drm_selftest.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright © 2016 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef __DRM_SELFTEST_H__
-#define __DRM_SELFTEST_H__
-
-struct drm_subtest {
-	int (*func)(void *data);
-	const char *name;
-};
-
-static int __drm_subtests(const char *caller,
-			  const struct drm_subtest *st,
-			  int count,
-			  void *data);
-#define drm_subtests(T, data) \
-	__drm_subtests(__func__, T, ARRAY_SIZE(T), data)
-
-#define SUBTEST(x) { x, #x }
-
-#endif /* __DRM_SELFTEST_H__ */
diff --git a/drivers/gpu/drm/selftests/Makefile b/drivers/gpu/drm/test/Makefile
similarity index 100%
rename from drivers/gpu/drm/selftests/Makefile
rename to drivers/gpu/drm/test/Makefile
diff --git a/drivers/gpu/drm/selftests/test-drm_cmdline_parser.c b/drivers/gpu/drm/test/test-drm_cmdline_parser.c
similarity index 100%
rename from drivers/gpu/drm/selftests/test-drm_cmdline_parser.c
rename to drivers/gpu/drm/test/test-drm_cmdline_parser.c
diff --git a/drivers/gpu/drm/selftests/test-drm_damage_helper.c b/drivers/gpu/drm/test/test-drm_damage_helper.c
similarity index 100%
rename from drivers/gpu/drm/selftests/test-drm_damage_helper.c
rename to drivers/gpu/drm/test/test-drm_damage_helper.c
diff --git a/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c b/drivers/gpu/drm/test/test-drm_dp_mst_helper.c
similarity index 100%
rename from drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
rename to drivers/gpu/drm/test/test-drm_dp_mst_helper.c
diff --git a/drivers/gpu/drm/selftests/test-drm_format.c b/drivers/gpu/drm/test/test-drm_format.c
similarity index 100%
rename from drivers/gpu/drm/selftests/test-drm_format.c
rename to drivers/gpu/drm/test/test-drm_format.c
diff --git a/drivers/gpu/drm/selftests/test-drm_framebuffer.c b/drivers/gpu/drm/test/test-drm_framebuffer.c
similarity index 100%
rename from drivers/gpu/drm/selftests/test-drm_framebuffer.c
rename to drivers/gpu/drm/test/test-drm_framebuffer.c
diff --git a/drivers/gpu/drm/selftests/test-drm_mm.c b/drivers/gpu/drm/test/test-drm_mm.c
similarity index 100%
rename from drivers/gpu/drm/selftests/test-drm_mm.c
rename to drivers/gpu/drm/test/test-drm_mm.c
diff --git a/drivers/gpu/drm/selftests/test-drm_plane_helper.c b/drivers/gpu/drm/test/test-drm_plane_helper.c
similarity index 100%
rename from drivers/gpu/drm/selftests/test-drm_plane_helper.c
rename to drivers/gpu/drm/test/test-drm_plane_helper.c
diff --git a/drivers/gpu/drm/selftests/test-drm_rect.c b/drivers/gpu/drm/test/test-drm_rect.c
similarity index 100%
rename from drivers/gpu/drm/selftests/test-drm_rect.c
rename to drivers/gpu/drm/test/test-drm_rect.c
-- 
2.34.1


  parent reply	other threads:[~2022-01-17 23:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17 23:22 [RFC 00/10] drm: selftests: Convert to KUnit Michał Winiarski
2022-01-17 23:22 ` [RFC 01/10] drm: test-drm_cmdline_parser: " Michał Winiarski
2022-01-17 23:22 ` [RFC 02/10] drm: test-drm_plane_helper: " Michał Winiarski
2022-01-17 23:22 ` [RFC 03/10] drm: test-drm_format: " Michał Winiarski
2022-01-17 23:22 ` [RFC 04/10] drm: test-drm_framebuffer: " Michał Winiarski
2022-01-17 23:22 ` [RFC 05/10] drm: test-drm_damage_helper: " Michał Winiarski
2022-01-17 23:22 ` [RFC 06/10] drm: test-drm_dp_mst_helper: " Michał Winiarski
2022-01-19  0:28   ` Daniel Latypov
2022-01-21  0:48     ` Michał Winiarski
2022-01-21  1:00       ` Daniel Latypov
2022-01-17 23:22 ` [RFC 07/10] drm: test-drm_rect: " Michał Winiarski
2022-01-17 23:22 ` Michał Winiarski [this message]
2022-01-17 23:22 ` [RFC 10/10] drm: test: Simplify testing on UML with kunit.py Michał Winiarski
2022-01-18 23:58 ` [RFC 00/10] drm: selftests: Convert to KUnit Daniel Latypov
2022-01-20 22:20   ` Michał Winiarski
2022-01-21  0:20     ` Daniel Latypov
2022-01-19 16:11 ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220117232259.180459-10-michal.winiarski@intel.com \
    --to=michal.winiarski@intel.com \
    --cc=airlied@linux.ie \
    --cc=arek@hiler.eu \
    --cc=brendanhiggins@google.com \
    --cc=daniel@ffwll.ch \
    --cc=dlatypov@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=petri.latvala@intel.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).