drm/selftest: Refactor test-drm_plane_helper
authorAlexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Fri, 19 Oct 2018 10:57:51 +0000 (11:57 +0100)
committerAlexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Mon, 22 Oct 2018 09:30:50 +0000 (10:30 +0100)
The idea is to split test implementations in different compilation
units, but have one single place where we define the list of tests,
in this case(drm_modeset_selftests.h).

Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181019105752.17741-9-alexandru-cosmin.gheorghe@arm.com
drivers/gpu/drm/selftests/drm_modeset_selftests.h [new file with mode: 0644]
drivers/gpu/drm/selftests/drm_plane_helper_selftests.h [deleted file]
drivers/gpu/drm/selftests/test-drm_modeset_common.c
drivers/gpu/drm/selftests/test-drm_modeset_common.h
drivers/gpu/drm/selftests/test-drm_plane_helper.c

diff --git a/drivers/gpu/drm/selftests/drm_modeset_selftests.h b/drivers/gpu/drm/selftests/drm_modeset_selftests.h
new file mode 100644 (file)
index 0000000..9771290
--- /dev/null
@@ -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_selftests_helper
+ */
+selftest(check_plane_state, igt_check_plane_state)
diff --git a/drivers/gpu/drm/selftests/drm_plane_helper_selftests.h b/drivers/gpu/drm/selftests/drm_plane_helper_selftests.h
deleted file mode 100644 (file)
index 9771290..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/* 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_plane_state, igt_check_plane_state)
index fad5209043f157fba0b86c81932c5cdbb3aa0d98..2a7f93774006a8577f1ca74b4b0cd5d6d91d8bf4 100644 (file)
@@ -7,9 +7,18 @@
 
 #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)
 {
-       return test_drm_plane_helper();
+       int err;
+
+       err = run_selftests(selftests, ARRAY_SIZE(selftests), NULL);
+
+       return err > 0 ? 0 : err;
 }
 
 static void __exit test_drm_modeset_exit(void)
index bdeba264661f1616ff2fdd9e2d7556a77228dcac..b0065a2eb067eeff80705e91a3dbc573d62c04af 100644 (file)
@@ -13,6 +13,6 @@
 
 #define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n")
 
-int test_drm_plane_helper(void);
+int igt_check_plane_state(void *ignored);
 
 #endif
index 0dad2f812a272c0ba7cbdce5c942294ef7ff8d08..0a9553f517968df803a6026c6bd0516d4bffb83c 100644 (file)
@@ -11,9 +11,6 @@
 
 #include "test-drm_modeset_common.h"
 
-#define TESTS "drm_plane_helper_selftests.h"
-#include "drm_selftest.h"
-
 static void set_src(struct drm_plane_state *plane_state,
                    unsigned src_x, unsigned src_y,
                    unsigned src_w, unsigned src_h)
@@ -76,7 +73,7 @@ static bool check_crtc_eq(struct drm_plane_state *plane_state,
        return true;
 }
 
-static int igt_check_plane_state(void *ignored)
+int igt_check_plane_state(void *ignored)
 {
        int ret;
 
@@ -220,17 +217,3 @@ static int igt_check_plane_state(void *ignored)
 
        return 0;
 }
-
-#include "drm_selftest.c"
-
-/**
- * test_drm_plane_helper - Run drm plane helper selftests.
- */
-int test_drm_plane_helper(void)
-{
-       int err;
-
-       err = run_selftests(selftests, ARRAY_SIZE(selftests), NULL);
-
-       return err > 0 ? 0 : err;
-}