diff mbox series

[4/4] testsuite/depmod: use defines for the rootfs/lib_modules

Message ID 20230206140449.574631-5-emil.l.velikov@gmail.com (mailing list archive)
State New, archived
Headers show
Series kmod: Various papercuts | expand

Commit Message

Emil Velikov Feb. 6, 2023, 2:04 p.m. UTC
From: Emil Velikov <emil.velikov@collabora.com>

The uname used across the tests is same, so drop "_ORDER" from the macro
name and use it throughout. Similarly - add respective LIB_MODULES
defines and use them in the tests.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
---
 testsuite/test-depmod.c | 50 ++++++++++++++++++++++-------------------
 1 file changed, 27 insertions(+), 23 deletions(-)
diff mbox series

Patch

diff --git a/testsuite/test-depmod.c b/testsuite/test-depmod.c
index 010f259..b333e7b 100644
--- a/testsuite/test-depmod.c
+++ b/testsuite/test-depmod.c
@@ -25,9 +25,9 @@ 
 
 #include "testsuite.h"
 
-#define MODULES_ORDER_UNAME "4.4.4"
+#define MODULES_UNAME "4.4.4"
 #define MODULES_ORDER_ROOTFS TESTSUITE_ROOTFS "test-depmod/modules-order-compressed"
-#define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS "/lib/modules/" MODULES_ORDER_UNAME
+#define MODULES_ORDER_LIB_MODULES MODULES_ORDER_ROOTFS "/lib/modules/" MODULES_UNAME
 static noreturn int depmod_modules_order_for_compressed(const struct test *t)
 {
 	const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -43,7 +43,7 @@  static noreturn int depmod_modules_order_for_compressed(const struct test *t)
 DEFINE_TEST(depmod_modules_order_for_compressed,
 	.description = "check if depmod let aliases in right order when using compressed modules",
 	.config = {
-		[TC_UNAME_R] = MODULES_ORDER_UNAME,
+		[TC_UNAME_R] = MODULES_UNAME,
 		[TC_ROOTFS] = MODULES_ORDER_ROOTFS,
 	},
 	.output = {
@@ -54,10 +54,9 @@  DEFINE_TEST(depmod_modules_order_for_compressed,
 		},
 	});
 
-#define MODULES_OUTDIR_UNAME "4.4.4"
 #define MODULES_OUTDIR_ROOTFS TESTSUITE_ROOTFS "test-depmod/modules-outdir"
-#define MODULES_OUTDIR_LIB_MODULES_OUTPUT MODULES_OUTDIR_ROOTFS "/outdir/lib/modules/" MODULES_OUTDIR_UNAME
-#define MODULES_OUTDIR_LIB_MODULES_INPUT MODULES_OUTDIR_ROOTFS "/lib/modules/" MODULES_OUTDIR_UNAME
+#define MODULES_OUTDIR_LIB_MODULES_OUTPUT MODULES_OUTDIR_ROOTFS "/outdir/lib/modules/" MODULES_UNAME
+#define MODULES_OUTDIR_LIB_MODULES_INPUT MODULES_OUTDIR_ROOTFS "/lib/modules/" MODULES_UNAME
 static noreturn int depmod_modules_outdir(const struct test *t)
 {
 	const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -74,7 +73,7 @@  static noreturn int depmod_modules_outdir(const struct test *t)
 DEFINE_TEST(depmod_modules_outdir,
 	.description = "check if depmod honours the outdir option",
 	.config = {
-		[TC_UNAME_R] = MODULES_OUTDIR_UNAME,
+		[TC_UNAME_R] = MODULES_UNAME,
 		[TC_ROOTFS] = MODULES_OUTDIR_ROOTFS,
 	},
 	.output = {
@@ -86,6 +85,7 @@  DEFINE_TEST(depmod_modules_outdir,
 	});
 
 #define SEARCH_ORDER_SIMPLE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-simple"
+#define SEARCH_ORDER_SIMPLE_LIB_MODULES SEARCH_ORDER_SIMPLE_ROOTFS "/lib/modules/" MODULES_UNAME
 static noreturn int depmod_search_order_simple(const struct test *t)
 {
 	const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -103,18 +103,19 @@  DEFINE_TEST(depmod_search_order_simple,
 #endif
 	.description = "check if depmod honor search order in config",
 	.config = {
-		[TC_UNAME_R] = "4.4.4",
+		[TC_UNAME_R] = MODULES_UNAME,
 		[TC_ROOTFS] = SEARCH_ORDER_SIMPLE_ROOTFS,
 	},
 	.output = {
 		.files = (const struct keyval[]) {
-			{ SEARCH_ORDER_SIMPLE_ROOTFS "/lib/modules/4.4.4/correct-modules.dep",
-			  SEARCH_ORDER_SIMPLE_ROOTFS "/lib/modules/4.4.4/modules.dep" },
+			{ SEARCH_ORDER_SIMPLE_LIB_MODULES "/correct-modules.dep",
+			  SEARCH_ORDER_SIMPLE_LIB_MODULES "/modules.dep" },
 			{ }
 		},
 	});
 
 #define SEARCH_ORDER_SAME_PREFIX_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-same-prefix"
+#define SEARCH_ORDER_SAME_PREFIX_LIB_MODULES SEARCH_ORDER_SAME_PREFIX_ROOTFS "/lib/modules/" MODULES_UNAME
 static noreturn int depmod_search_order_same_prefix(const struct test *t)
 {
 	const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -132,13 +133,13 @@  DEFINE_TEST(depmod_search_order_same_prefix,
 #endif
 	.description = "check if depmod honor search order in config with same prefix",
 	.config = {
-		[TC_UNAME_R] = "4.4.4",
+		[TC_UNAME_R] = MODULES_UNAME,
 		[TC_ROOTFS] = SEARCH_ORDER_SAME_PREFIX_ROOTFS,
 	},
 	.output = {
 		.files = (const struct keyval[]) {
-			{ SEARCH_ORDER_SAME_PREFIX_ROOTFS "/lib/modules/4.4.4/correct-modules.dep",
-			  SEARCH_ORDER_SAME_PREFIX_ROOTFS "/lib/modules/4.4.4/modules.dep" },
+			{ SEARCH_ORDER_SAME_PREFIX_LIB_MODULES "/correct-modules.dep",
+			  SEARCH_ORDER_SAME_PREFIX_LIB_MODULES "/modules.dep" },
 			{ }
 		},
 	});
@@ -158,7 +159,7 @@  static noreturn int depmod_detect_loop(const struct test *t)
 DEFINE_TEST(depmod_detect_loop,
 	.description = "check if depmod detects module loops correctly",
 	.config = {
-		[TC_UNAME_R] = "4.4.4",
+		[TC_UNAME_R] = MODULES_UNAME,
 		[TC_ROOTFS] = DETECT_LOOP_ROOTFS,
 	},
 	.expected_fail = true,
@@ -167,6 +168,7 @@  DEFINE_TEST(depmod_detect_loop,
 	});
 
 #define SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-external-first"
+#define SEARCH_ORDER_EXTERNAL_FIRST_LIB_MODULES SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS "/lib/modules/" MODULES_UNAME
 static noreturn int depmod_search_order_external_first(const struct test *t)
 {
 	const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -184,18 +186,19 @@  DEFINE_TEST(depmod_search_order_external_first,
 #endif
 	.description = "check if depmod honor external keyword with higher priority",
 	.config = {
-		[TC_UNAME_R] = "4.4.4",
+		[TC_UNAME_R] = MODULES_UNAME,
 		[TC_ROOTFS] = SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS,
 	},
 	.output = {
 		.files = (const struct keyval[]) {
-			{ SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS "/lib/modules/4.4.4/correct-modules.dep",
-			  SEARCH_ORDER_EXTERNAL_FIRST_ROOTFS "/lib/modules/4.4.4/modules.dep" },
+			{ SEARCH_ORDER_EXTERNAL_FIRST_LIB_MODULES "/correct-modules.dep",
+			  SEARCH_ORDER_EXTERNAL_FIRST_LIB_MODULES "/modules.dep" },
 			{ }
 		},
 	});
 
 #define SEARCH_ORDER_EXTERNAL_LAST_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-external-last"
+#define SEARCH_ORDER_EXTERNAL_LAST_LIB_MODULES SEARCH_ORDER_EXTERNAL_LAST_ROOTFS "/lib/modules/" MODULES_UNAME
 static noreturn int depmod_search_order_external_last(const struct test *t)
 {
 	const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -213,18 +216,19 @@  DEFINE_TEST(depmod_search_order_external_last,
 #endif
 	.description = "check if depmod honor external keyword with lower priority",
 	.config = {
-		[TC_UNAME_R] = "4.4.4",
+		[TC_UNAME_R] = MODULES_UNAME,
 		[TC_ROOTFS] = SEARCH_ORDER_EXTERNAL_LAST_ROOTFS,
 	},
 	.output = {
 		.files = (const struct keyval[]) {
-			{ SEARCH_ORDER_EXTERNAL_LAST_ROOTFS "/lib/modules/4.4.4/correct-modules.dep",
-			  SEARCH_ORDER_EXTERNAL_LAST_ROOTFS "/lib/modules/4.4.4/modules.dep" },
+			{ SEARCH_ORDER_EXTERNAL_LAST_LIB_MODULES "/correct-modules.dep",
+			  SEARCH_ORDER_EXTERNAL_LAST_LIB_MODULES "/modules.dep" },
 			{ }
 		},
 	});
 
 #define SEARCH_ORDER_OVERRIDE_ROOTFS TESTSUITE_ROOTFS "test-depmod/search-order-override"
+#define SEARCH_ORDER_OVERRIDE_LIB_MODULES SEARCH_ORDER_OVERRIDE_ROOTFS "/lib/modules/" MODULES_UNAME
 static noreturn int depmod_search_order_override(const struct test *t)
 {
 	const char *progname = ABS_TOP_BUILDDIR "/tools/depmod";
@@ -242,13 +246,13 @@  DEFINE_TEST(depmod_search_order_override,
 #endif
 	.description = "check if depmod honor override keyword",
 	.config = {
-		[TC_UNAME_R] = "4.4.4",
+		[TC_UNAME_R] = MODULES_UNAME,
 		[TC_ROOTFS] = SEARCH_ORDER_OVERRIDE_ROOTFS,
 	},
 	.output = {
 		.files = (const struct keyval[]) {
-			{ SEARCH_ORDER_OVERRIDE_ROOTFS "/lib/modules/4.4.4/correct-modules.dep",
-			  SEARCH_ORDER_OVERRIDE_ROOTFS "/lib/modules/4.4.4/modules.dep" },
+			{ SEARCH_ORDER_OVERRIDE_LIB_MODULES "/correct-modules.dep",
+			  SEARCH_ORDER_OVERRIDE_LIB_MODULES "/modules.dep" },
 			{ }
 		},
 	});