From 67c93c15b77fa2089110ade9d493b17df6e90fc2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 9 Jul 2020 11:44:47 -0400 Subject: [PATCH 1/1] Fix: tests: interrupting get_next_notification causes test to fail MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Attaching a debugger to the `notification` test application causes tests to fail when the application is waiting for a notification as the function will return an `INTERRUPTED` status code. Signed-off-by: Jérémie Galarneau Change-Id: I4ac9ac13d02a96366791e81746e53bb5dde94885 --- .../tools/notification/notification.c | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/regression/tools/notification/notification.c b/tests/regression/tools/notification/notification.c index 535a71fce..364d41895 100644 --- a/tests/regression/tools/notification/notification.c +++ b/tests/regression/tools/notification/notification.c @@ -601,7 +601,9 @@ void test_notification_channel(const char *session_name, const char *channel_nam lttng_start_tracing(session_name); /* Wait for high notification */ - nc_status = lttng_notification_channel_get_next_notification(notification_channel, ¬ification); + do { + nc_status = lttng_notification_channel_get_next_notification(notification_channel, ¬ification); + } while (nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED); ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK && notification && lttng_condition_get_type(lttng_notification_get_condition(notification)) == LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH, @@ -625,7 +627,9 @@ void test_notification_channel(const char *session_name, const char *channel_nam nc_status = lttng_notification_channel_subscribe(notification_channel, low_condition); ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK, "subscribe with pending notification"); - nc_status = lttng_notification_channel_get_next_notification(notification_channel, ¬ification); + do { + nc_status = lttng_notification_channel_get_next_notification(notification_channel, ¬ification); + } while (nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED); ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK && notification && lttng_condition_get_type(lttng_notification_get_condition(notification)) == LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW, @@ -638,7 +642,9 @@ void test_notification_channel(const char *session_name, const char *channel_nam resume_application(); lttng_start_tracing(session_name); - nc_status = lttng_notification_channel_get_next_notification(notification_channel, ¬ification); + do { + nc_status = lttng_notification_channel_get_next_notification(notification_channel, ¬ification); + } while (nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED); ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK && notification && lttng_condition_get_type(lttng_notification_get_condition(notification)) == LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH, "High notification received after intermediary communication"); @@ -650,7 +656,9 @@ void test_notification_channel(const char *session_name, const char *channel_nam resume_consumer(argv); wait_data_pending(session_name); - nc_status = lttng_notification_channel_get_next_notification(notification_channel, ¬ification); + do { + nc_status = lttng_notification_channel_get_next_notification(notification_channel, ¬ification); + } while (nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED); ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK && notification && lttng_condition_get_type(lttng_notification_get_condition(notification)) == LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW, "Low notification received after re-subscription"); @@ -662,7 +670,9 @@ void test_notification_channel(const char *session_name, const char *channel_nam /* Stop consumer to force a high notification */ lttng_start_tracing(session_name); - nc_status = lttng_notification_channel_get_next_notification(notification_channel, ¬ification); + do { + nc_status = lttng_notification_channel_get_next_notification(notification_channel, ¬ification); + } while (nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_INTERRUPTED); ok(nc_status == LTTNG_NOTIFICATION_CHANNEL_STATUS_OK && notification && lttng_condition_get_type(lttng_notification_get_condition(notification)) == LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH, "High notification"); -- 2.34.1