From: Mathieu Desnoyers Date: Mon, 26 Aug 2019 18:22:06 +0000 (-0400) Subject: tests: gen-ust-events: use options instead of arguments X-Git-Tag: v2.12.0-rc1~117 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6c4a91d639747f260ab46decebc50998ef063712;p=lttng-tools.git tests: gen-ust-events: use options instead of arguments Remove argument dependency and ease usage of features individually. Signed-off-by: Mathieu Desnoyers Signed-off-by: Jonathan Rajotte Change-Id: I25769754a1ab271cea9b9ff5519f37371fd877dc Signed-off-by: Jérémie Galarneau --- diff --git a/tests/destructive/metadata-regeneration b/tests/destructive/metadata-regeneration index 729634f87..de0d3dec0 100755 --- a/tests/destructive/metadata-regeneration +++ b/tests/destructive/metadata-regeneration @@ -127,7 +127,9 @@ function test_ust_local () create_lttng_session_ok $SESSION_NAME $TRACE_PATH enable_ust_lttng_event_ok $SESSION_NAME $UST_EVENT_NAME - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} /dev/null 2>&1 & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \ + --sync-after-first-event ${file_sync_after_first} \ + --sync-before-last-event ${file_sync_before_last} /dev/null 2>&1 & start_lttng_tracing_ok $SESSION_NAME @@ -163,7 +165,9 @@ function test_ust_streaming () create_lttng_session_uri $SESSION_NAME net://localhost enable_ust_lttng_event_ok $SESSION_NAME $UST_EVENT_NAME - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} /dev/null 2>&1 & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \ + --sync-after-first-event ${file_sync_after_first} \ + --sync-before-last-event ${file_sync_before_last} /dev/null 2>&1 & start_lttng_tracing_ok $SESSION_NAME diff --git a/tests/perf/test_perf_raw.in b/tests/perf/test_perf_raw.in index 9fab2cd79..671dcc423 100644 --- a/tests/perf/test_perf_raw.in +++ b/tests/perf/test_perf_raw.in @@ -69,7 +69,7 @@ function test_ust_raw() start_lttng_tracing_ok - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1 + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT >/dev/null 2>&1 stop_lttng_tracing_ok diff --git a/tests/regression/tools/crash/test_crash b/tests/regression/tools/crash/test_crash index ad03bf404..8a7bccae5 100755 --- a/tests/regression/tools/crash/test_crash +++ b/tests/regression/tools/crash/test_crash @@ -50,7 +50,7 @@ function start_test_app() local tmp_file=$(mktemp -u) # Start application with a temporary file. - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT $tmp_file & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event $tmp_file & ret=$? LAST_APP_PID="${!}" APPS_PID="${APPS_PID} ${!}" @@ -238,7 +238,7 @@ function test_lttng_crash() start_lttng_tracing_ok $session_name # Generate 10 events - $TESTAPP_BIN 10 0 + $TESTAPP_BIN -i 10 -w 0 stop_lttng_tracing_ok crash_recup_count=$($LTTNG_CRASH $shm_path | wc -l) @@ -276,7 +276,7 @@ function test_lttng_crash_extraction() start_lttng_tracing_ok $session_name # Generate 10 events - $TESTAPP_BIN 10 0 + $TESTAPP_BIN -i 10 -w 0 stop_lttng_tracing_ok $LTTNG_CRASH -x $extraction_path $shm_path @@ -372,7 +372,7 @@ function test_lttng_crash_extraction_sigkill() start_lttng_tracing_ok $session_name # Generate 10 events - $TESTAPP_BIN 10 0 + $TESTAPP_BIN -i 10 -w 0 sigstop_lttng_sessiond sigstop_lttng_consumerd diff --git a/tests/regression/tools/exclusion/test_exclusion b/tests/regression/tools/exclusion/test_exclusion index 949cd41df..fae072ca8 100755 --- a/tests/regression/tools/exclusion/test_exclusion +++ b/tests/regression/tools/exclusion/test_exclusion @@ -40,7 +40,7 @@ function enable_ust_lttng_all_event_exclusion() function run_apps { - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT >/dev/null 2>&1 } function test_exclusion diff --git a/tests/regression/tools/live/test_lttng_ust b/tests/regression/tools/live/test_lttng_ust index 830fc7830..65c96956f 100755 --- a/tests/regression/tools/live/test_lttng_ust +++ b/tests/regression/tools/live/test_lttng_ust @@ -74,7 +74,7 @@ start_lttng_relayd "-o $TRACE_PATH" setup_live_tracing # Run app in background -$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1 +$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT >/dev/null 2>&1 clean_live_tracing diff --git a/tests/regression/tools/live/test_ust b/tests/regression/tools/live/test_ust index 0384a706f..2c35665b1 100755 --- a/tests/regression/tools/live/test_ust +++ b/tests/regression/tools/live/test_ust @@ -63,7 +63,7 @@ start_lttng_relayd_notap "-o $TRACE_PATH" setup_live_tracing # Run app in background -$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} >/dev/null 2>&1 +$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event ${file_sync_after_first} >/dev/null 2>&1 while [ ! -f "${file_sync_after_first}" ]; do sleep 0.5 diff --git a/tests/regression/tools/live/test_ust_tracefile_count b/tests/regression/tools/live/test_ust_tracefile_count index 6da368fc6..77a925c61 100755 --- a/tests/regression/tools/live/test_ust_tracefile_count +++ b/tests/regression/tools/live/test_ust_tracefile_count @@ -64,7 +64,7 @@ start_lttng_relayd_notap "-o $TRACE_PATH" setup_live_tracing # Run app in background -$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} >/dev/null 2>&1 +$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event ${file_sync_after_first} >/dev/null 2>&1 while [ ! -f "${file_sync_after_first}" ]; do sleep 0.5 diff --git a/tests/regression/tools/metadata/test_ust b/tests/regression/tools/metadata/test_ust index 529b0a211..72d9b19b1 100755 --- a/tests/regression/tools/metadata/test_ust +++ b/tests/regression/tools/metadata/test_ust @@ -58,7 +58,7 @@ function test_per_uid () enable_ust_lttng_event_ok "$session_name" $EVENT_NAME start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER + $TESTAPP_BIN -i $NR_ITER stop_lttng_tracing_ok "$session_name" destroy_lttng_session_ok "$session_name" @@ -150,7 +150,7 @@ function test_per_pid () enable_ust_lttng_event_ok "$session_name" $EVENT_NAME channel start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN "$NR_ITER" "$NR_USEC_WAIT" & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT & testapp_pid=$! wait $testapp_pid diff --git a/tests/regression/tools/mi/test_mi b/tests/regression/tools/mi/test_mi index ba0febf42..124deae01 100755 --- a/tests/regression/tools/mi/test_mi +++ b/tests/regression/tools/mi/test_mi @@ -544,7 +544,9 @@ function test_list_ust_event () OUTPUT_DEST=$OUTPUT_DIR/$OUTPUT_FILE #Begin testing - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} & 2>/dev/null + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \ + --sync-after-first-event ${file_sync_after_first} \ + --sync-before-last-event ${file_sync_before_last} & 2>/dev/null while [ ! -f "${file_sync_after_first}" ]; do sleep 0.5 diff --git a/tests/regression/tools/notification/test_notification_multi_app b/tests/regression/tools/notification/test_notification_multi_app index 600b0f69c..752f4d6de 100755 --- a/tests/regression/tools/notification/test_notification_multi_app +++ b/tests/regression/tools/notification/test_notification_multi_app @@ -97,7 +97,7 @@ function ust_event_generator if [[ -f $state_file ]]; then rm $state_file 2> /dev/null fi - taskset -c 0 $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT > /dev/null 2>&1 + taskset -c 0 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT > /dev/null 2>&1 fi done } diff --git a/tests/regression/tools/notification/test_notification_ust b/tests/regression/tools/notification/test_notification_ust index 82f79a8e6..946189641 100755 --- a/tests/regression/tools/notification/test_notification_ust +++ b/tests/regression/tools/notification/test_notification_ust @@ -65,7 +65,7 @@ function ust_event_generator if [[ -f $state_file ]]; then rm -rf $state_file 2> /dev/null fi - taskset -c 0 $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT > /dev/null 2>&1 + taskset -c 0 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT > /dev/null 2>&1 fi done } diff --git a/tests/regression/tools/notification/test_rotation b/tests/regression/tools/notification/test_rotation index 250f1b3f6..6bd1a5821 100755 --- a/tests/regression/tools/notification/test_rotation +++ b/tests/regression/tools/notification/test_rotation @@ -47,7 +47,7 @@ enable_ust_lttng_event_notap $SESSION_NAME $EVENT_NAME $CHANNEL_NAME start_lttng_tracing_notap $SESSION_NAME -$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT $FILE_SYNC_AFTER_FIRST_EVENT & +$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event $FILE_SYNC_AFTER_FIRST_EVENT & APP_PID=$! while [ ! -f "${FILE_SYNC_AFTER_FIRST_EVENT}" ]; do sleep 0.5 diff --git a/tests/regression/tools/regen-metadata/test_ust b/tests/regression/tools/regen-metadata/test_ust index f1b967505..ddd77262f 100755 --- a/tests/regression/tools/regen-metadata/test_ust +++ b/tests/regression/tools/regen-metadata/test_ust @@ -56,7 +56,9 @@ function test_ust_streaming () create_lttng_session_uri $SESSION_NAME net://localhost enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} /dev/null 2>&1 & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \ + --sync-after-first-event ${file_sync_after_first} \ + --sync-before-last-event ${file_sync_before_last} >/dev/null 2>&1 & start_lttng_tracing_ok $SESSION_NAME @@ -87,7 +89,9 @@ function test_ust_local () create_lttng_session_ok $SESSION_NAME $TRACE_PATH enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} /dev/null 2>&1 & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \ + --sync-after-first-event ${file_sync_after_first} \ + --sync-before-last-event ${file_sync_before_last} > /dev/null 2>&1 & start_lttng_tracing_ok $SESSION_NAME @@ -119,7 +123,9 @@ function test_ust_pid () enable_channel_per_pid $SESSION_NAME "channel0" enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME "channel0" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} /dev/null 2>&1 & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \ + --sync-after-first-event ${file_sync_after_first} \ + --sync-before-last-event ${file_sync_before_last} >/dev/null 2>&1 & start_lttng_tracing_ok $SESSION_NAME @@ -150,7 +156,9 @@ function test_ust_live () create_lttng_session_uri $SESSION_NAME net://localhost --live enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} /dev/null 2>&1 & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \ + --sync-after-first-event ${file_sync_after_first} \ + --sync-before-last-event ${file_sync_before_last} >/dev/null 2>&1 & start_lttng_tracing_ok $SESSION_NAME diff --git a/tests/regression/tools/regen-statedump/test_ust b/tests/regression/tools/regen-statedump/test_ust index b01d419fa..b722315ac 100755 --- a/tests/regression/tools/regen-statedump/test_ust +++ b/tests/regression/tools/regen-statedump/test_ust @@ -45,7 +45,9 @@ function test_ust_local () create_lttng_session_ok $SESSION_NAME $TRACE_PATH enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} /dev/null 2>&1 & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \ + --sync-after-first-event ${file_sync_after_first} \ + --sync-before-last-event ${file_sync_before_last} >/dev/null 2>&1 & start_lttng_tracing_ok $SESSION_NAME diff --git a/tests/regression/tools/relayd-grouping/test_ust b/tests/regression/tools/relayd-grouping/test_ust index 6c7eb98e5..85d7197e6 100755 --- a/tests/regression/tools/relayd-grouping/test_ust +++ b/tests/regression/tools/relayd-grouping/test_ust @@ -87,7 +87,7 @@ function test_ust_uid_live () enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME" start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT stop_lttng_tracing_ok "$session_name" destroy_lttng_session_ok "$session_name" @@ -126,7 +126,7 @@ function test_ust_pid_live () enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME" start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT stop_lttng_tracing_ok "$session_name" destroy_lttng_session_ok "$session_name" @@ -166,7 +166,7 @@ function test_ust_uid_live_custom_output () enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME" start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT stop_lttng_tracing_ok "$session_name" destroy_lttng_session_ok "$session_name" @@ -205,7 +205,7 @@ function test_ust_uid_streaming () enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME" start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT stop_lttng_tracing_ok "$session_name" destroy_lttng_session_ok "$session_name" @@ -244,7 +244,7 @@ function test_ust_pid_streaming () enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME" start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT stop_lttng_tracing_ok "$session_name" destroy_lttng_session_ok "$session_name" @@ -284,7 +284,7 @@ function test_ust_uid_streaming_custom_output () enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME" start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT stop_lttng_tracing_ok "$session_name" destroy_lttng_session_ok "$session_name" @@ -323,7 +323,7 @@ function test_ust_uid_streaming_rotate () enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME" start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT rotate_session_ok "$session_name" stop_lttng_tracing_ok "$session_name" @@ -364,7 +364,7 @@ function test_ust_uid_streaming_rotate_custom_output () enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME" start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT rotate_session_ok "$session_name" @@ -405,7 +405,7 @@ function test_ust_pid_streaming_rotate () enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME" start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT rotate_session_ok "$session_name" stop_lttng_tracing_ok "$session_name" @@ -445,7 +445,7 @@ function test_ust_uid_streaming_snapshot () enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME" start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT lttng_snapshot_record "$session_name" stop_lttng_tracing_ok "$session_name" @@ -491,7 +491,9 @@ function test_ust_pid_streaming_snapshot () enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME" start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT "$file_sync_after_first" "$file_sync_before_last" /dev/null 2>&1 & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \ + --sync-after-first-event "$file_sync_after_first" \ + --sync-before-last-event "$file_sync_before_last" 2>&1 & while [ ! -f "${file_sync_after_first}" ]; do sleep 0.5 @@ -542,7 +544,7 @@ function test_ust_uid_streaming_snapshot_add_output_default_name () enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME" start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT lttng_snapshot_add_output_ok "$session_name" "net://localhost" lttng_snapshot_record "$session_name" @@ -585,7 +587,7 @@ function test_ust_uid_streaming_snapshot_add_output_custom_name () enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME" start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT lttng_snapshot_add_output_ok "$session_name" "net://localhost" "-n $snapshot_name" lttng_snapshot_record "$session_name" @@ -631,7 +633,7 @@ function test_ust_uid_streaming_snapshot_add_output_custom_name_custom_output () enable_ust_lttng_event_ok "$session_name" "$EVENT_NAME" "$CHANNEL_NAME" start_lttng_tracing_ok "$session_name" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT lttng_snapshot_add_output_ok "$session_name" "net://localhost/$custom_output" "-n $snapshot_name" lttng_snapshot_record "$session_name" diff --git a/tests/regression/tools/rotation/test_ust b/tests/regression/tools/rotation/test_ust index 696baecee..d5ded6703 100755 --- a/tests/regression/tools/rotation/test_ust +++ b/tests/regression/tools/rotation/test_ust @@ -55,10 +55,10 @@ function rotate_ust_test () start_lttng_tracing_ok $SESSION_NAME today=$(date +%Y%m%d) - $TESTAPP_BIN 10 $NR_USEC_WAIT /dev/null 2>&1 + $TESTAPP_BIN -i 10 -w $NR_USEC_WAIT > /dev/null 2>&1 rotate_session_ok $SESSION_NAME - $TESTAPP_BIN 20 $NR_USEC_WAIT /dev/null 2>&1 + $TESTAPP_BIN -i 20 -w $NR_USEC_WAIT > /dev/null 2>&1 stop_lttng_tracing_ok $SESSION_NAME # Third chunk contains no event (rotate after stop). @@ -115,7 +115,7 @@ function test_ust_local_timer_uid () lttng_enable_rotation_timer_ok $SESSION_NAME 500ms start_lttng_tracing_ok $SESSION_NAME # We just want the app to register, no event generated - $TESTAPP_BIN 0 0 /dev/null 2>&1 + $TESTAPP_BIN -i 0 -w 0 > /dev/null 2>&1 rotate_timer_test "${TRACE_PATH}/archives" 0 } @@ -128,7 +128,7 @@ function test_ust_streaming_timer_uid () lttng_enable_rotation_timer_ok $SESSION_NAME 500ms start_lttng_tracing_ok $SESSION_NAME # We just want the app to register, no event generated - $TESTAPP_BIN 0 0 /dev/null 2>&1 + $TESTAPP_BIN -i 0 -w 0 > /dev/null 2>&1 rotate_timer_test "${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*/archives" 0 } @@ -142,7 +142,7 @@ function test_ust_local_timer_pid () lttng_enable_rotation_timer_ok $SESSION_NAME 500ms start_lttng_tracing_ok $SESSION_NAME # We just want the app to register, no event generated - $TESTAPP_BIN 0 0 /dev/null 2>&1 + $TESTAPP_BIN -i 0 -w 0 > /dev/null 2>&1 rotate_timer_test "${TRACE_PATH}/archives" 1 } @@ -156,7 +156,7 @@ function test_ust_streaming_timer_pid () lttng_enable_rotation_timer_ok $SESSION_NAME 500ms start_lttng_tracing_ok $SESSION_NAME # We just want the app to register, no event generated - $TESTAPP_BIN 0 0 /dev/null 2>&1 + $TESTAPP_BIN -i 0 -w 0 > /dev/null 2>&1 rotate_timer_test "${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*/archives" 1 } diff --git a/tests/regression/tools/snapshots/test_ust_streaming b/tests/regression/tools/snapshots/test_ust_streaming index eecd0253b..03c244bc1 100755 --- a/tests/regression/tools/snapshots/test_ust_streaming +++ b/tests/regression/tools/snapshots/test_ust_streaming @@ -60,7 +60,7 @@ function start_test_app() local tmp_file=$(mktemp -u) # Start application with a temporary file. - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT $tmp_file & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event $tmp_file & ret=$? APPS_PID="${APPS_PID} ${!}" ok $ret "Start application to trace" diff --git a/tests/regression/tools/snapshots/ust_test b/tests/regression/tools/snapshots/ust_test index aa9d4763e..60f6e8dac 100755 --- a/tests/regression/tools/snapshots/ust_test +++ b/tests/regression/tools/snapshots/ust_test @@ -49,7 +49,7 @@ function start_test_app() local tmp_file=$(mktemp -u) # Start application with a temporary file. - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT $tmp_file & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event $tmp_file & ret=$? APPS_PID="${APPS_PID} ${!}" ok $ret "Start application to trace" diff --git a/tests/regression/tools/streaming/test_high_throughput_limits b/tests/regression/tools/streaming/test_high_throughput_limits index 1bcf35328..be1c1a4ba 100755 --- a/tests/regression/tools/streaming/test_high_throughput_limits +++ b/tests/regression/tools/streaming/test_high_throughput_limits @@ -116,7 +116,7 @@ function run_apps # due to very slow communication between the consumer and relayd making # the status reply from the consumer quite slow thus delaying the # registration done message. - LTTNG_UST_REGISTER_TIMEOUT=-1 $TESTAPP_BIN $NR_ITER & >/dev/null 2>&1 + LTTNG_UST_REGISTER_TIMEOUT=-1 $TESTAPP_BIN -i $NR_ITER & >/dev/null 2>&1 done } diff --git a/tests/regression/tools/streaming/test_ust b/tests/regression/tools/streaming/test_ust index ba3f44275..2d5d0ca5b 100755 --- a/tests/regression/tools/streaming/test_ust +++ b/tests/regression/tools/streaming/test_ust @@ -40,7 +40,6 @@ fi function test_ust_before_start () { - local file_sync_after_first=$(mktemp -u) local file_sync_before_last=$(mktemp -u) diag "Test UST streaming BEFORE tracing starts" @@ -48,7 +47,7 @@ function test_ust_before_start () enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME # Run 5 times with a 1 second delay - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} /dev/null 2>&1 & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-before-last-event ${file_sync_before_last} > /dev/null 2>&1 & start_lttng_tracing_ok $SESSION_NAME @@ -59,7 +58,6 @@ function test_ust_before_start () stop_lttng_tracing_ok $SESSION_NAME destroy_lttng_session_ok $SESSION_NAME - rm -f ${file_sync_after_first} rm -f ${file_sync_before_last} } @@ -73,7 +71,8 @@ function test_ust_after_start () start_lttng_tracing_ok $SESSION_NAME # Run 5 times with a 1 second delay - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} >/dev/null 2>&1 + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \ + --sync-after-first-event ${file_sync_after_first} >/dev/null 2>&1 while [ ! -f "${file_sync_after_first}" ]; do sleep 0.5 diff --git a/tests/regression/tools/tracefile-limits/test_tracefile_count b/tests/regression/tools/tracefile-limits/test_tracefile_count index 6ada8580f..e446d3f3e 100755 --- a/tests/regression/tools/tracefile-limits/test_tracefile_count +++ b/tests/regression/tools/tracefile-limits/test_tracefile_count @@ -119,7 +119,7 @@ function test_tracefile_count_limit () start_lttng_tracing_ok $session_name - $TESTAPP_BIN $num_iter >/dev/null 2>&1 + $TESTAPP_BIN -i $num_iter >/dev/null 2>&1 stop_lttng_tracing_ok $session_name diff --git a/tests/regression/tools/tracefile-limits/test_tracefile_size b/tests/regression/tools/tracefile-limits/test_tracefile_size index 3dddbe613..de263bbfb 100755 --- a/tests/regression/tools/tracefile-limits/test_tracefile_size +++ b/tests/regression/tools/tracefile-limits/test_tracefile_size @@ -113,7 +113,7 @@ function test_tracefile_size_limit () start_lttng_tracing_ok $session_name - $TESTAPP_BIN $NR_ITER >/dev/null 2>&1 + $TESTAPP_BIN -i $NR_ITER >/dev/null 2>&1 stop_lttng_tracing_ok $session_name @@ -152,7 +152,7 @@ function test_tracefile_size_limit_pagesize () start_lttng_tracing_ok $session_name - $TESTAPP_BIN $NR_ITER >/dev/null 2>&1 + $TESTAPP_BIN -i $NR_ITER >/dev/null 2>&1 stop_lttng_tracing_ok $session_name diff --git a/tests/regression/tools/wildcard/test_event_wildcard b/tests/regression/tools/wildcard/test_event_wildcard index 61ea67a72..d0116722e 100755 --- a/tests/regression/tools/wildcard/test_event_wildcard +++ b/tests/regression/tools/wildcard/test_event_wildcard @@ -34,7 +34,7 @@ source $TESTDIR/utils/utils.sh function run_ust { - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT } function run_kernel diff --git a/tests/regression/ust/before-after/test_before_after b/tests/regression/ust/before-after/test_before_after index 45ef48fc3..237e21b91 100755 --- a/tests/regression/ust/before-after/test_before_after +++ b/tests/regression/ust/before-after/test_before_after @@ -42,7 +42,7 @@ function test_before_apps() enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME start_lttng_tracing_ok $SESSION_NAME - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT & wait ok $? "Traced application stopped." @@ -63,7 +63,9 @@ function test_after_apps() create_lttng_session_ok $SESSION_NAME $TRACE_PATH enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \ + --sync-after-first-event ${file_sync_after_first} \ + --sync-before-last-event ${file_sync_before_last} & ok $? "Application started in background." start_lttng_tracing_ok $SESSION_NAME diff --git a/tests/regression/ust/blocking/test_blocking b/tests/regression/ust/blocking/test_blocking index b1c3f2d09..a19de08d8 100755 --- a/tests/regression/ust/blocking/test_blocking +++ b/tests/regression/ust/blocking/test_blocking @@ -35,7 +35,7 @@ source $TESTDIR/utils/utils.sh # Run app on CPU 0 to ensure we only write in a single ring buffer. function run_app() { - taskset 0x00000001 $TESTAPP_BIN $NUM_EVENT + taskset 0x00000001 $TESTAPP_BIN -i $NUM_EVENT ok $? "Application done" } diff --git a/tests/regression/ust/buffers-pid/test_buffers_pid b/tests/regression/ust/buffers-pid/test_buffers_pid index 94e6fe45f..2ca4a0297 100755 --- a/tests/regression/ust/buffers-pid/test_buffers_pid +++ b/tests/regression/ust/buffers-pid/test_buffers_pid @@ -58,7 +58,7 @@ test_after_multiple_apps() { start_lttng_tracing_ok $SESSION_NAME for i in `seq 1 5`; do - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1 & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT >/dev/null 2>&1 & ok $? "Start application $i for tracing" done wait @@ -80,7 +80,9 @@ test_before_multiple_apps() { diag "Start multiple applications BEFORE tracing is started" for i in `seq 1 5`; do - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first}_${i} ${file_sync_before_last}_${i} >/dev/null 2>&1 & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \ + --sync-after-first-event ${file_sync_after_first}_${i} \ + --sync-before-last-event ${file_sync_before_last}_${i} >/dev/null 2>&1 & ok $? "Start application $i for tracing" done @@ -131,7 +133,7 @@ test_after_app() { enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME "channel0" start_lttng_tracing_ok $SESSION_NAME - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT & ok $? "Start application to trace" wait @@ -156,7 +158,9 @@ test_before_app() { enable_channel_per_pid $SESSION_NAME "channel0" enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME "channel0" - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \ + --sync-after-first-event ${file_sync_after_first} \ + --sync-before-last-event ${file_sync_before_last} & ok $? "Start application to trace" start_lttng_tracing_ok $SESSION_NAME @@ -210,7 +214,7 @@ test_multiple_channels() { ok $? "Enable event $EVENT_NAME for session $SESSION_NAME in channel4" start_lttng_tracing_ok $SESSION_NAME - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT & ok $? "Start application to trace" wait diff --git a/tests/regression/ust/clock-override/test_clock_override b/tests/regression/ust/clock-override/test_clock_override index d63ec8bcb..ce5d9687a 100755 --- a/tests/regression/ust/clock-override/test_clock_override +++ b/tests/regression/ust/clock-override/test_clock_override @@ -52,7 +52,7 @@ source $TESTDIR/utils/utils.sh # MUST set TESTDIR before calling those functions function run_app() { - $TESTAPP_BIN $NUM_EVENT + $TESTAPP_BIN -i $NUM_EVENT ok $? "Application done" } diff --git a/tests/regression/ust/getcpu-override/test_getcpu_override b/tests/regression/ust/getcpu-override/test_getcpu_override index 72010581e..d4066e4aa 100755 --- a/tests/regression/ust/getcpu-override/test_getcpu_override +++ b/tests/regression/ust/getcpu-override/test_getcpu_override @@ -55,14 +55,14 @@ num_cpus=$(conf_proc_count) run_app() { diag "Launching app without getcpu-plugin wrapper" - $TESTAPP_BIN $NUM_EVENT $EVENT_WAIT_USEC + $TESTAPP_BIN -i $NUM_EVENT -w $EVENT_WAIT_USEC ok $? "Application without wrapper done" } run_getcpu_plugin_app() { diag "Launching app with getcpu-plugin wrapper" - $CURDIR/$TESTAPP_WRAPPER $TESTAPP_BIN $NUM_EVENT $EVENT_WAIT_USEC + $CURDIR/$TESTAPP_WRAPPER $TESTAPP_BIN -i $NUM_EVENT -w $EVENT_WAIT_USEC ok $? "Application with wrapper done" } diff --git a/tests/regression/ust/namespaces/test_ns_contexts b/tests/regression/ust/namespaces/test_ns_contexts index 91852a05f..62187cf34 100755 --- a/tests/regression/ust/namespaces/test_ns_contexts +++ b/tests/regression/ust/namespaces/test_ns_contexts @@ -35,7 +35,7 @@ source "$TESTDIR/utils/utils.sh" # MUST set TESTDIR before calling those functions function run_app() { - $TESTAPP_BIN $NUM_EVENT + $TESTAPP_BIN -i $NUM_EVENT ok $? "Application done" } diff --git a/tests/regression/ust/nprocesses/test_nprocesses b/tests/regression/ust/nprocesses/test_nprocesses index 7677cc6cc..8b64e621a 100755 --- a/tests/regression/ust/nprocesses/test_nprocesses +++ b/tests/regression/ust/nprocesses/test_nprocesses @@ -52,7 +52,9 @@ file_sync_before_last=$(mktemp -u) diag "Starting $NUM_PROCESS test applications" for i in `seq 1 $NUM_PROCESS` do - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} >/dev/null 2>&1 & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \ + --sync-after-first-event ${file_sync_after_first} \ + --sync-before-last-event ${file_sync_before_last} >/dev/null 2>&1 & APPS_PID="${APPS_PID} ${!}" done diff --git a/tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush b/tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush index ea6b93838..bfc3b2091 100755 --- a/tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush +++ b/tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush @@ -106,7 +106,7 @@ function check_app_tmp_file() function start_trace_app() { # Start application with a temporary file. - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT $APP_TMP_FILE & + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event $APP_TMP_FILE & ret=$? APPS_PID="${APPS_PID} ${!}" ok $ret "Start application to trace" diff --git a/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush b/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush index e404564e8..3e1750d06 100755 --- a/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush +++ b/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush @@ -41,7 +41,7 @@ source $TESTDIR/utils/utils.sh # MUST set TESTDIR before calling those functions function run_app() { - $TESTAPP_BIN $NUM_EVENT + $TESTAPP_BIN -i $NUM_EVENT ok $? "Application done" } diff --git a/tests/regression/ust/test_event_perf b/tests/regression/ust/test_event_perf index 9b1dea3eb..237d45621 100755 --- a/tests/regression/ust/test_event_perf +++ b/tests/regression/ust/test_event_perf @@ -113,7 +113,7 @@ function test_event_basic() if [ "$ret" != "4" ]; then start_lttng_tracing_ok - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1 + $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT >/dev/null 2>&1 stop_lttng_tracing_ok diff --git a/tests/stress/launch_ust_app b/tests/stress/launch_ust_app index 2bb8e4f66..9442ee22c 100755 --- a/tests/stress/launch_ust_app +++ b/tests/stress/launch_ust_app @@ -52,7 +52,7 @@ fi # Infinite loop. Spawns NR_APP apps for NR_USEC_WAIT doing NR_APP_LOOP. while :; do for j in `seq 1 $NR_APP`; do - $TESTAPP_BIN $NR_APP_LOOP $NR_USEC_WAIT >/dev/null 2>&1 & + $TESTAPP_BIN -i $NR_APP_LOOP -w $NR_USEC_WAIT >/dev/null 2>&1 & done # Wait before the next round of applications. sleep 3 diff --git a/tests/utils/testapp/gen-ust-events/gen-ust-events.c b/tests/utils/testapp/gen-ust-events/gen-ust-events.c index 1ce34423b..364545d52 100644 --- a/tests/utils/testapp/gen-ust-events/gen-ust-events.c +++ b/tests/utils/testapp/gen-ust-events/gen-ust-events.c @@ -16,6 +16,7 @@ */ #define _LGPL_SOURCE +#include #include #include #include @@ -37,9 +38,21 @@ #define TRACEPOINT_DEFINE #include "tp.h" +static struct option long_options[] = +{ + /* These options set a flag. */ + {"iter", required_argument, 0, 'i'}, + {"wait", required_argument, 0, 'w'}, + {"sync-after-first-event", required_argument, 0, 'a'}, + {"sync-before-last-event", required_argument, 0, 'b'}, + {0, 0, 0, 0} +}; + int main(int argc, char **argv) { unsigned int i, netint; + int option_index; + int option; long values[] = { 1, 2, 3 }; char text[10] = "test"; double dbl = 2.0; @@ -49,29 +62,40 @@ int main(int argc, char **argv) char *after_first_event_file_path = NULL; char *before_last_event_file_path = NULL; - if (set_signal_handler()) { - ret = -1; - goto end; - } - - if (argc >= 2) { - /* - * If nr_iter is negative, do an infinite tracing loop. - */ - nr_iter = atoi(argv[1]); + while ((option = getopt_long(argc, argv, "i:w:a:b:c:d:", + long_options, &option_index)) != -1) { + switch (option) { + case 'a': + after_first_event_file_path = strdup(optarg); + break; + case 'b': + before_last_event_file_path = strdup(optarg); + break; + case 'i': + nr_iter = atoi(optarg); + break; + case 'w': + nr_usec = atoi(optarg); + break; + case '?': + /* getopt_long already printed an error message. */ + break; + default: + ret = -1; + goto end; + } } - if (argc >= 3) { - /* By default, don't wait unless user specifies. */ - nr_usec = atoi(argv[2]); + if (optind != argc) { + fprintf(stderr, "Error: takes long options only.\n"); + ret = -1; + goto end; } - if (argc >= 4) { - after_first_event_file_path = argv[3]; - } - if (argc >= 5) { - before_last_event_file_path = argv[4]; + if (set_signal_handler()) { + ret = -1; + goto end; } for (i = 0; nr_iter < 0 || i < nr_iter; i++) { @@ -117,5 +141,7 @@ int main(int argc, char **argv) } end: + free(after_first_event_file_path); + free(before_last_event_file_path); exit(!ret ? EXIT_SUCCESS : EXIT_FAILURE); }