queue-test: WEXITSTATUS() is undefined if WIFEXITED() is false
authorKristian Høgsberg <krh@bitplanet.net>
Fri, 8 Feb 2013 16:38:59 +0000 (11:38 -0500)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 14 Feb 2013 19:24:01 +0000 (14:24 -0500)
If a child process dies from a signal, WIFEXITED() returns false and
WEXITSTATUS() isn't well-defined.  In this case, if the client segfaults,
the status is 134 and WEXITSTATUS(134) is EXIT_SUCCESS, so we mask the error.

tests/queue-test.c

index 681ac24..3abb71f 100644 (file)
@@ -212,7 +212,7 @@ sigchld_handler(int signal_number, void *data)
        int status;
 
        waitpid(-1, &status, 0);
-       display->child_exit_status = WEXITSTATUS(status);
+       display->child_exit_status = status;
 
        wl_display_terminate(display->display);
 
@@ -282,5 +282,6 @@ TEST(queue)
        wl_event_source_remove(signal_source);
        wl_display_destroy(display.display);
 
-       assert(display.child_exit_status == EXIT_SUCCESS);
+       assert(WIFEXITED(display.child_exit_status) &&
+              WEXITSTATUS(display.child_exit_status) == EXIT_SUCCESS);
 }