summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2021-02-12 01:45:24 -0800
committerLucas De Marchi <lucas.demarchi@intel.com>2021-02-15 11:53:43 -0800
commitd8b31c34a6b487123ee935762bbd3c7046607249 (patch)
treefe643083124f85292bc4c5c7a49e1cbdcc7f15ac
parentb77251f08d3c1acc28f1f453da5e3971d50e0bc2 (diff)
downloadkmod-d8b31c34a6b487123ee935762bbd3c7046607249.tar.gz
kmod-d8b31c34a6b487123ee935762bbd3c7046607249.tar.bz2
kmod-d8b31c34a6b487123ee935762bbd3c7046607249.zip
test-modprobe: share single function for kcmdline tests
-rw-r--r--testsuite/test-modprobe.c95
1 files changed, 10 insertions, 85 deletions
diff --git a/testsuite/test-modprobe.c b/testsuite/test-modprobe.c
index dbc54f3..0255f1a 100644
--- a/testsuite/test-modprobe.c
+++ b/testsuite/test-modprobe.c
@@ -213,7 +213,7 @@ DEFINE_TEST(modprobe_install_cmd_loop,
.modules_loaded = "mod-loop-b,mod-loop-a",
);
-static noreturn int modprobe_param_kcmdline(const struct test *t)
+static noreturn int modprobe_param_kcmdline_show_deps(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
const char *const args[] = {
@@ -225,7 +225,7 @@ static noreturn int modprobe_param_kcmdline(const struct test *t)
test_spawn_prog(progname, args);
exit(EXIT_FAILURE);
}
-DEFINE_TEST(modprobe_param_kcmdline,
+DEFINE_TEST(modprobe_param_kcmdline_show_deps,
.description = "check if params from kcmdline are passed to (f)init_module call",
.config = {
[TC_UNAME_R] = "4.4.4",
@@ -237,7 +237,7 @@ DEFINE_TEST(modprobe_param_kcmdline,
.modules_loaded = "",
);
-static noreturn int modprobe_param_kcmdline2(const struct test *t)
+static noreturn int modprobe_param_kcmdline(const struct test *t)
{
const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
const char *const args[] = {
@@ -249,7 +249,7 @@ static noreturn int modprobe_param_kcmdline2(const struct test *t)
test_spawn_prog(progname, args);
exit(EXIT_FAILURE);
}
-DEFINE_TEST(modprobe_param_kcmdline2,
+DEFINE_TEST_WITH_FUNC(modprobe_param_kcmdline2, modprobe_param_kcmdline,
.description = "check if params with no value are parsed correctly from kcmdline",
.config = {
[TC_UNAME_R] = "4.4.4",
@@ -261,19 +261,7 @@ DEFINE_TEST(modprobe_param_kcmdline2,
.modules_loaded = "",
);
-static noreturn int modprobe_param_kcmdline3(const struct test *t)
-{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
- const char *const args[] = {
- progname,
- "-c",
- NULL,
- };
-
- test_spawn_prog(progname, args);
- exit(EXIT_FAILURE);
-}
-DEFINE_TEST(modprobe_param_kcmdline3,
+DEFINE_TEST_WITH_FUNC(modprobe_param_kcmdline3, modprobe_param_kcmdline,
.description = "check if unrelated strings in kcmdline are correctly ignored",
.config = {
[TC_UNAME_R] = "4.4.4",
@@ -285,19 +273,7 @@ DEFINE_TEST(modprobe_param_kcmdline3,
.modules_loaded = "",
);
-static noreturn int modprobe_param_kcmdline4(const struct test *t)
-{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
- const char *const args[] = {
- progname,
- "-c",
- NULL,
- };
-
- test_spawn_prog(progname, args);
- exit(EXIT_FAILURE);
-}
-DEFINE_TEST(modprobe_param_kcmdline4,
+DEFINE_TEST_WITH_FUNC(modprobe_param_kcmdline4, modprobe_param_kcmdline,
.description = "check if unrelated strings in kcmdline are correctly ignored",
.config = {
[TC_UNAME_R] = "4.4.4",
@@ -309,19 +285,7 @@ DEFINE_TEST(modprobe_param_kcmdline4,
.modules_loaded = "",
);
-static noreturn int modprobe_param_kcmdline5(const struct test *t)
-{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
- const char *const args[] = {
- progname,
- "-c",
- NULL,
- };
-
- test_spawn_prog(progname, args);
- exit(EXIT_FAILURE);
-}
-DEFINE_TEST(modprobe_param_kcmdline5,
+DEFINE_TEST_WITH_FUNC(modprobe_param_kcmdline5, modprobe_param_kcmdline,
.description = "check if params with spaces are parsed correctly from kcmdline",
.config = {
[TC_UNAME_R] = "4.4.4",
@@ -333,20 +297,7 @@ DEFINE_TEST(modprobe_param_kcmdline5,
.modules_loaded = "",
);
-
-static noreturn int modprobe_param_kcmdline6(const struct test *t)
-{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
- const char *const args[] = {
- progname,
- "-c",
- NULL,
- };
-
- test_spawn_prog(progname, args);
- exit(EXIT_FAILURE);
-}
-DEFINE_TEST(modprobe_param_kcmdline6,
+DEFINE_TEST_WITH_FUNC(modprobe_param_kcmdline6, modprobe_param_kcmdline,
.description = "check if dots on other parts of kcmdline don't confuse our parser",
.config = {
[TC_UNAME_R] = "4.4.4",
@@ -358,20 +309,7 @@ DEFINE_TEST(modprobe_param_kcmdline6,
.modules_loaded = "",
);
-
-static noreturn int modprobe_param_kcmdline7(const struct test *t)
-{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
- const char *const args[] = {
- progname,
- "-c",
- NULL,
- };
-
- test_spawn_prog(progname, args);
- exit(EXIT_FAILURE);
-}
-DEFINE_TEST(modprobe_param_kcmdline7,
+DEFINE_TEST_WITH_FUNC(modprobe_param_kcmdline7, modprobe_param_kcmdline,
.description = "check if dots on other parts of kcmdline don't confuse our parser",
.config = {
[TC_UNAME_R] = "4.4.4",
@@ -383,20 +321,7 @@ DEFINE_TEST(modprobe_param_kcmdline7,
.modules_loaded = "",
);
-
-static noreturn int modprobe_param_kcmdline8(const struct test *t)
-{
- const char *progname = ABS_TOP_BUILDDIR "/tools/modprobe";
- const char *const args[] = {
- progname,
- "-c",
- NULL,
- };
-
- test_spawn_prog(progname, args);
- exit(EXIT_FAILURE);
-}
-DEFINE_TEST(modprobe_param_kcmdline8,
+DEFINE_TEST_WITH_FUNC(modprobe_param_kcmdline8, modprobe_param_kcmdline,
.description = "check if dots on other parts of kcmdline don't confuse our parser",
.config = {
[TC_UNAME_R] = "4.4.4",