]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite: fix usage of reserved names
authorJohn Spencer <maillist-kmod@barfooze.de>
Mon, 26 Aug 2013 23:38:11 +0000 (01:38 +0200)
committerLucas De Marchi <lucas.demarchi@intel.com>
Thu, 29 Aug 2013 04:22:20 +0000 (01:22 -0300)
stdout and stderr are names reserved for the implementation
and musl uses them rightfully as macro - and the expansion
causes (of course) unexpected results.

rename the struct members stdout to out and stderr
to err, to be 1) compliant 2) cause compilation to
succeed.

fixes build with musl libc.

testsuite/test-alias.c
testsuite/test-loaded.c
testsuite/test-modinfo.c
testsuite/test-modprobe.c
testsuite/test-new-module.c
testsuite/testsuite.c
testsuite/testsuite.h

index 5e21573b8f63c5fbd84c5c140ae7eb803ae21ffb..4d1d8d36e4d1e76857e22390adcb7118f4ef1b9f 100644 (file)
@@ -64,7 +64,7 @@ static DEFINE_TEST(alias_1,
        },
        .need_spawn = true,
        .output = {
-               .stdout = TESTSUITE_ROOTFS "test-alias/correct.txt",
+               .out = TESTSUITE_ROOTFS "test-alias/correct.txt",
        });
 
 static const struct test *tests[] = {
index 33865cb4d442be1e9b43fafca426f45b6cb3bcf3..4b50813668b3deed490aea791213b77f9f4c5259 100644 (file)
@@ -85,7 +85,7 @@ static DEFINE_TEST(loaded_1,
        },
        .need_spawn = true,
        .output = {
-               .stdout = TESTSUITE_ROOTFS "test-loaded/correct.txt",
+               .out = TESTSUITE_ROOTFS "test-loaded/correct.txt",
        });
 
 static const struct test *tests[] = {
index c5934ea79ba72312bd0582a493b0acd3d0336e77..e372310a0b7a001194b10b65777e22522926d7c5 100644 (file)
@@ -46,7 +46,7 @@ static DEFINE_TEST(modinfo_jonsmodules,
                [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modinfo/",
        },
        .output = {
-               .stdout = TESTSUITE_ROOTFS "test-modinfo/correct.txt",
+               .out = TESTSUITE_ROOTFS "test-modinfo/correct.txt",
        });
 
 static const struct test *tests[] = {
index f0131e3fe89fc645e55b417dd96f79d810e76132..0ae03a639dbb2e1e712c53edc94d48888f7bc36e 100644 (file)
@@ -45,7 +45,7 @@ static DEFINE_TEST(modprobe_show_depends,
                [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/show-depends",
        },
        .output = {
-               .stdout = TESTSUITE_ROOTFS "test-modprobe/show-depends/correct.txt",
+               .out = TESTSUITE_ROOTFS "test-modprobe/show-depends/correct.txt",
        });
 
 static __noreturn int modprobe_show_depends2(const struct test *t)
@@ -67,7 +67,7 @@ static DEFINE_TEST(modprobe_show_depends2,
                [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/show-depends",
        },
        .output = {
-               .stdout = TESTSUITE_ROOTFS "test-modprobe/show-depends/correct-psmouse.txt",
+               .out = TESTSUITE_ROOTFS "test-modprobe/show-depends/correct-psmouse.txt",
        });
 
 
@@ -90,7 +90,7 @@ static DEFINE_TEST(modprobe_show_alias_to_none,
                [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/alias-to-none",
        },
        .output = {
-               .stdout = TESTSUITE_ROOTFS "test-modprobe/show-depends/correct-psmouse.txt",
+               .out = TESTSUITE_ROOTFS "test-modprobe/show-depends/correct-psmouse.txt",
        });
 
 
@@ -177,7 +177,7 @@ static DEFINE_TEST(modprobe_param_kcmdline,
                [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline",
        },
        .output = {
-               .stdout = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline/correct.txt",
+               .out = TESTSUITE_ROOTFS "test-modprobe/module-param-kcmdline/correct.txt",
        });
 
 
index 240480eafcd63327e6d8d0aee951bf94cf73555e..0892507f4679ea50e69e8253fd7d0f9228fde8fe 100644 (file)
@@ -67,7 +67,7 @@ static DEFINE_TEST(from_name,
        },
        .need_spawn = true,
        .output = {
-               .stdout = TESTSUITE_ROOTFS "test-new-module/from_name/correct.txt",
+               .out = TESTSUITE_ROOTFS "test-new-module/from_name/correct.txt",
        });
 
 static int from_alias(const struct test *t)
@@ -112,7 +112,7 @@ static DEFINE_TEST(from_alias,
        },
        .need_spawn = true,
        .output = {
-               .stdout = TESTSUITE_ROOTFS "test-new-module/from_alias/correct.txt",
+               .out = TESTSUITE_ROOTFS "test-new-module/from_alias/correct.txt",
        });
 
 static const struct test *tests[] = {
index 6d85d7fc9e0a2921227f06c6f4e8fc90d922a9f1..9877a64cd52827030777046e20c01d9f8e1254ac 100644 (file)
@@ -223,7 +223,7 @@ static inline int test_run_child(const struct test *t, int fdout[2],
        test_export_environ(t);
 
        /* Close read-fds and redirect std{out,err} to the write-fds */
-       if (t->output.stdout != NULL) {
+       if (t->output.out != NULL) {
                close(fdout[0]);
                if (dup2(fdout[1], STDOUT_FILENO) < 0) {
                        ERR("could not redirect stdout to pipe: %m\n");
@@ -231,10 +231,10 @@ static inline int test_run_child(const struct test *t, int fdout[2],
                }
        }
 
-       if (t->output.stderr != NULL) {
+       if (t->output.err != NULL) {
                close(fderr[0]);
                if (dup2(fderr[1], STDERR_FILENO) < 0) {
-                       ERR("could not redirect stdout to pipe: %m\n");
+                       ERR("could not redirect stderr to pipe: %m\n");
                        exit(EXIT_FAILURE);
                }
        }
@@ -282,12 +282,12 @@ static inline bool test_run_parent_check_outputs(const struct test *t,
                return false;
        }
 
-       if (t->output.stdout != NULL) {
-               fd_matchout = open(t->output.stdout, O_RDONLY);
+       if (t->output.out != NULL) {
+               fd_matchout = open(t->output.out, O_RDONLY);
                if (fd_matchout < 0) {
                        err = -errno;
                        ERR("could not open %s for read: %m\n",
-                                                       t->output.stdout);
+                                                       t->output.out);
                        goto out;
                }
                memset(&ep_outpipe, 0, sizeof(struct epoll_event));
@@ -301,12 +301,12 @@ static inline bool test_run_parent_check_outputs(const struct test *t,
        } else
                fdout = -1;
 
-       if (t->output.stderr != NULL) {
-               fd_matcherr = open(t->output.stderr, O_RDONLY);
+       if (t->output.err != NULL) {
+               fd_matcherr = open(t->output.err, O_RDONLY);
                if (fd_matcherr < 0) {
                        err = -errno;
                        ERR("could not open %s for read: %m\n",
-                                       t->output.stderr);
+                                       t->output.err);
                        goto out;
 
                }
@@ -536,9 +536,9 @@ static inline int test_run_parent(const struct test *t, int fdout[2],
        bool matchout;
 
        /* Close write-fds */
-       if (t->output.stdout != NULL)
+       if (t->output.out != NULL)
                close(fdout[1]);
-       if (t->output.stderr != NULL)
+       if (t->output.err != NULL)
                close(fderr[1]);
        close(fdmonitor[1]);
 
@@ -549,9 +549,9 @@ static inline int test_run_parent(const struct test *t, int fdout[2],
         * break pipe on the other end: either child already closed or we want
         * to stop it
         */
-       if (t->output.stdout != NULL)
+       if (t->output.out != NULL)
                close(fdout[0]);
-       if (t->output.stderr != NULL)
+       if (t->output.err != NULL)
                close(fderr[0]);
        close(fdmonitor[0]);
 
@@ -650,14 +650,14 @@ int test_run(const struct test *t)
        if (t->need_spawn && oneshot)
                test_run_spawned(t);
 
-       if (t->output.stdout != NULL) {
+       if (t->output.out != NULL) {
                if (pipe(fdout) != 0) {
                        ERR("could not create out pipe for %s\n", t->name);
                        return EXIT_FAILURE;
                }
        }
 
-       if (t->output.stderr != NULL) {
+       if (t->output.err != NULL) {
                if (pipe(fderr) != 0) {
                        ERR("could not create err pipe for %s\n", t->name);
                        return EXIT_FAILURE;
index 329d4a1476899d5c35f7e072655b38e07d839ecb..e4f3ecfac8492ac1558be8495fa4288a6104d38b 100644 (file)
@@ -82,9 +82,9 @@ struct test {
        const char *description;
        struct {
                /* File with correct stdout */
-               const char *stdout;
+               const char *out;
                /* File with correct stderr */
-               const char *stderr;
+               const char *err;
 
                /*
                 * Vector with pair of files