case CLD_DUMPED:
fprintf(stderr, "Client '%s' was killed by signal %d\n",
ci->name, status.si_status);
- ci->exit_code = status.si_status;
+ ci->kill_code = status.si_status;
break;
case CLD_EXITED:
if (status.si_status != EXIT_SUCCESS)
wl_display_run(d->wl_display);
}
+/* If signum is 0, expect a successful client exit, otherwise
+ * expect the client to have been killed by that signal. */
void
-display_destroy(struct display *d)
+display_destroy_expect_signal(struct display *d, int signum)
{
struct client_info *cl, *next;
int failed = 0;
wl_list_for_each_safe(cl, next, &d->clients, link) {
assert(cl->wl_client == NULL);
- if (cl->exit_code != 0) {
+ if (signum != 0 && cl->kill_code != signum) {
+ ++failed;
+ fprintf(stderr,
+ "Client '%s' failed, expecting signal %d, "
+ "got %d\n",
+ cl->name, signum, cl->kill_code);
+ }
+ else if (signum == 0 &&
+ (cl->kill_code != 0 || cl->exit_code != 0)) {
++failed;
fprintf(stderr, "Client '%s' failed\n", cl->name);
}
}
}
+void
+display_destroy(struct display *d)
+{
+ display_destroy_expect_signal(d, 0);
+}
+
/*
* --- Client helper functions ---
*/
int pipe;
pid_t pid;
int exit_code;
+ int kill_code;
struct wl_list link;
void *data; /* for arbitrary use */
*/
struct display *display_create(void);
void display_destroy(struct display *d);
+void display_destroy_expect_signal(struct display *d, int signum);
void display_run(struct display *d);
/* This function posts the display_resumed event to all waiting clients,