]> git.ozlabs.org Git - ccan-lca-2011.git/blobdiff - ccan/oserver/test/run.c
lca2011: simpler testing by not having oserver_serve exit.
[ccan-lca-2011.git] / ccan / oserver / test / run.c
index dc6031b9de547e715a4e6f54c80389afcc62fc4c..ee3959ec10ce888b5281bad6e61b6f326240d9a4 100644 (file)
 int main(void)
 {
        int fd;
-       int status;
        char buf[200];
        const char *input;
 
        /* This is how many tests you plan to run */
-       plan_tests(4 * 6);
+       plan_tests(3 * 6);
 
        foreach_ptr(input,
                    "This is a test\n",
@@ -31,13 +30,7 @@ int main(void)
                write(fd, input, strlen(input));
                lseek(fd, 0, SEEK_SET);
 
-               if (fork() == 0)
-                       oserver_serve(fd);
-
-               wait(&status);
-
-               ok1(WIFEXITED(status));
-               ok1(WEXITSTATUS(status) == 0);
+               ok1(oserver_serve(fd));
 
                lseek(fd, 0, SEEK_SET);
                buf[read(fd, buf, sizeof(buf)-1)] = '\0';