compositor: Return a user-defined exit code
Currently, once we've reached our main's wl_display_run(), we always return ret=EXIT_SUCCESS when weston terminates through wl_display_terminate. This patch makes it possible to specify another return value by setting prior to terminating Weston. This is useful for automated tests that want to report test failures to the overlying testing infrastructure. Signed-off-by: Frederic Plourde <frederic.plourde@collabora.co.uk> [Pekka: fixed some tabs.] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
committed by
Pekka Paalanen
parent
ad7305ad74
commit
c336f06e70
@@ -4151,6 +4151,14 @@ weston_compositor_shutdown(struct weston_compositor *ec)
|
|||||||
weston_config_destroy(ec->config);
|
weston_config_destroy(ec->config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WL_EXPORT void
|
||||||
|
weston_compositor_exit_with_code(struct weston_compositor *compositor,
|
||||||
|
int exit_code)
|
||||||
|
{
|
||||||
|
compositor->exit_code = exit_code;
|
||||||
|
wl_display_terminate(compositor->wl_display);
|
||||||
|
}
|
||||||
|
|
||||||
WL_EXPORT void
|
WL_EXPORT void
|
||||||
weston_compositor_set_default_pointer_grab(struct weston_compositor *ec,
|
weston_compositor_set_default_pointer_grab(struct weston_compositor *ec,
|
||||||
const struct weston_pointer_grab_interface *interface)
|
const struct weston_pointer_grab_interface *interface)
|
||||||
@@ -4764,6 +4772,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
ec->idle_time = idle_time;
|
ec->idle_time = idle_time;
|
||||||
ec->default_pointer_grab = NULL;
|
ec->default_pointer_grab = NULL;
|
||||||
|
ec->exit_code = EXIT_SUCCESS;
|
||||||
|
|
||||||
for (i = 1; i < argc; i++)
|
for (i = 1; i < argc; i++)
|
||||||
weston_log("fatal: unhandled option: %s\n", argv[i]);
|
weston_log("fatal: unhandled option: %s\n", argv[i]);
|
||||||
@@ -4829,6 +4838,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
wl_display_run(display);
|
wl_display_run(display);
|
||||||
|
|
||||||
|
/* Allow for setting return exit code after
|
||||||
|
* wl_display_run returns normally. This is
|
||||||
|
* useful for devs/testers and automated tests
|
||||||
|
* that want to indicate failure status to
|
||||||
|
* testing infrastructure above
|
||||||
|
*/
|
||||||
|
ret = ec->exit_code;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
/* prevent further rendering while shutting down */
|
/* prevent further rendering while shutting down */
|
||||||
ec->state = WESTON_COMPOSITOR_OFFSCREEN;
|
ec->state = WESTON_COMPOSITOR_OFFSCREEN;
|
||||||
|
|||||||
@@ -664,6 +664,8 @@ struct weston_compositor {
|
|||||||
int32_t kb_repeat_delay;
|
int32_t kb_repeat_delay;
|
||||||
|
|
||||||
clockid_t presentation_clock;
|
clockid_t presentation_clock;
|
||||||
|
|
||||||
|
int exit_code;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct weston_buffer {
|
struct weston_buffer {
|
||||||
@@ -1264,6 +1266,9 @@ weston_compositor_set_presentation_clock_software(
|
|||||||
void
|
void
|
||||||
weston_compositor_shutdown(struct weston_compositor *ec);
|
weston_compositor_shutdown(struct weston_compositor *ec);
|
||||||
void
|
void
|
||||||
|
weston_compositor_exit_with_code(struct weston_compositor *compositor,
|
||||||
|
int exit_code);
|
||||||
|
void
|
||||||
weston_output_init_zoom(struct weston_output *output);
|
weston_output_init_zoom(struct weston_output *output);
|
||||||
void
|
void
|
||||||
weston_output_update_zoom(struct weston_output *output);
|
weston_output_update_zoom(struct weston_output *output);
|
||||||
|
|||||||
Reference in New Issue
Block a user