From c4f75e82567f378437238b14c275a8f7d3ed0569 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Thu, 14 Feb 2019 14:33:51 -0500 Subject: [PATCH] Test: clear: take an additional snapshot after clear for per-pid Use the before-exit sync points of gen-ust-event to prevent the app from exiting and generate a single event to test that tracing functionality still works. Signed-off-by: Jonathan Rajotte --- tests/regression/tools/clear/test_ust | 30 +++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/regression/tools/clear/test_ust b/tests/regression/tools/clear/test_ust index ae3105c00..a20eaa9c5 100755 --- a/tests/regression/tools/clear/test_ust +++ b/tests/regression/tools/clear/test_ust @@ -25,7 +25,7 @@ TESTAPP_PATH="$TESTDIR/utils/testapp" TESTAPP_NAME="gen-ust-events" TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" -NUM_TESTS=69 +NUM_TESTS=74 TRACE_PATH=$(mktemp -d) @@ -145,6 +145,8 @@ function test_ust_local_snapshot_per_pid () local channel_name="channel0" local file_sync_before_last=$(mktemp -u) local file_sync_before_last_touch=$(mktemp -u) + local file_sync_before_exit=$(mktemp -u) + local file_sync_before_exit_touch=$(mktemp -u) create_lttng_session_ok $SESSION_NAME $TRACE_PATH "--snapshot" enable_ust_lttng_channel_ok $SESSION_NAME $channel_name --buffers-pid @@ -154,7 +156,9 @@ function test_ust_local_snapshot_per_pid () # Generate 10 events that will sit in the buffers. $TESTAPP_BIN -i 10 -w 0 \ --sync-before-last-event ${file_sync_before_last} \ - --sync-before-last-event-touch ${file_sync_before_last_touch} >/dev/null 2>&1 & + --sync-before-last-event-touch ${file_sync_before_last_touch} \ + --sync-before-exit ${file_sync_before_exit} \ + --sync-before-exit-touch ${file_sync_before_exit_touch} >/dev/null 2>&1 & # Continue only when there is only the last event remaining. while [ ! -f "${file_sync_before_last_touch}" ]; do @@ -177,12 +181,34 @@ function test_ust_local_snapshot_per_pid () stop_lttng_tracing_ok $SESSION_NAME validate_trace_empty $TRACE_PATH + # Validate that tracing still works and subsequent snapshots are valid. + # Clean the output path. + clean_path $TRACE_PATH + start_lttng_tracing_ok $SESSION_NAME + + # Continue over the last event. touch ${file_sync_before_last} + + # Wait for the before exit sync point. This ensure that we went over the + # last tracepoint. + while [ ! -f "${file_sync_before_exit_touch}" ]; do + sleep 0.5 + done + + # Make sure the snapshot contains the last event. + lttng_snapshot_record $SESSION_NAME + stop_lttng_tracing_ok $SESSION_NAME + validate_trace_count $EVENT_NAME $TRACE_PATH 1 + + # Release the application. + touch ${file_sync_before_exit} wait destroy_lttng_session_ok $SESSION_NAME rm -f ${file_sync_before_last} rm -f ${file_sync_before_last_touch} + rm -f ${file_sync_before_exit} + rm -f ${file_sync_before_exit_touch} } plan_tests $NUM_TESTS -- 2.34.1