From: Jonathan Rajotte Date: Wed, 11 Dec 2019 20:58:58 +0000 (-0500) Subject: Fix: tests: metadata presence on relayd is not deterministic X-Git-Tag: v2.12.0-rc1~172 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=a648b489f7a1f8ab2505c4139ba14a6442d08675;p=lttng-tools.git Fix: tests: metadata presence on relayd is not deterministic There is no synchronization point guaranteeing the presence of metadata on lttng-relayd side when the live metadata request is done. It must be present at some point in the future but might not be at the moment we perform the request. Add a retry phase to this step. It must succeed in the future. Not sure how this test was never marked as flaky. Signed-off-by: Jonathan Rajotte Change-Id: I033005c6a228013e699c74d8e8faafcb3272dd98 Signed-off-by: Jérémie Galarneau --- diff --git a/tests/regression/tools/live/live_test.c b/tests/regression/tools/live/live_test.c index 8a884ab6b..217c72af4 100644 --- a/tests/regression/tools/live/live_test.c +++ b/tests/regression/tools/live/live_test.c @@ -399,6 +399,7 @@ int get_metadata(void) rq.stream_id = htobe64(session->streams[metadata_stream_id].id); +retry: ret_len = lttng_live_send(control_sock, &cmd, sizeof(cmd)); if (ret_len < 0) { diag("Error sending cmd"); @@ -423,8 +424,8 @@ int get_metadata(void) break; case LTTNG_VIEWER_NO_NEW_METADATA: diag("Got LTTNG_VIEWER_NO_NEW_METADATA:"); - ret = 0; - goto end; + usleep(50); + goto retry; case LTTNG_VIEWER_METADATA_ERR: diag("Got LTTNG_VIEWER_METADATA_ERR:"); goto error; @@ -454,7 +455,7 @@ int get_metadata(void) } free(data); ret = len; -end: + return ret; error_free_data: