tests: gen-ust-events: use options instead of arguments
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 26 Aug 2019 18:22:06 +0000 (14:22 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 19 Dec 2019 23:54:08 +0000 (18:54 -0500)
Remove argument dependency and ease usage of features individually.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I25769754a1ab271cea9b9ff5519f37371fd877dc
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
35 files changed:
tests/destructive/metadata-regeneration
tests/perf/test_perf_raw.in
tests/regression/tools/crash/test_crash
tests/regression/tools/exclusion/test_exclusion
tests/regression/tools/live/test_lttng_ust
tests/regression/tools/live/test_ust
tests/regression/tools/live/test_ust_tracefile_count
tests/regression/tools/metadata/test_ust
tests/regression/tools/mi/test_mi
tests/regression/tools/notification/test_notification_multi_app
tests/regression/tools/notification/test_notification_ust
tests/regression/tools/notification/test_rotation
tests/regression/tools/regen-metadata/test_ust
tests/regression/tools/regen-statedump/test_ust
tests/regression/tools/relayd-grouping/test_ust
tests/regression/tools/rotation/test_ust
tests/regression/tools/snapshots/test_ust_streaming
tests/regression/tools/snapshots/ust_test
tests/regression/tools/streaming/test_high_throughput_limits
tests/regression/tools/streaming/test_ust
tests/regression/tools/tracefile-limits/test_tracefile_count
tests/regression/tools/tracefile-limits/test_tracefile_size
tests/regression/tools/wildcard/test_event_wildcard
tests/regression/ust/before-after/test_before_after
tests/regression/ust/blocking/test_blocking
tests/regression/ust/buffers-pid/test_buffers_pid
tests/regression/ust/clock-override/test_clock_override
tests/regression/ust/getcpu-override/test_getcpu_override
tests/regression/ust/namespaces/test_ns_contexts
tests/regression/ust/nprocesses/test_nprocesses
tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush
tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush
tests/regression/ust/test_event_perf
tests/stress/launch_ust_app
tests/utils/testapp/gen-ust-events/gen-ust-events.c

index 729634f87d2b974f25760eb84d79cebe966beb7e..de0d3dec0212088d50b00527e19199961f344d38 100755 (executable)
@@ -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
 
index 9fab2cd796f97393444b41be720015ccff26d5e6..671dcc423e4645c25d42dab79642f749959d68e6 100644 (file)
@@ -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
 
index ad03bf404863a1d603f709ff1567de725737854a..8a7bccae51cb342dab2bd2e484d0141e4fb78df1 100755 (executable)
@@ -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
index 949cd41df1459db3f3898ed1aeca49f6d2d2c178..fae072ca8bb871c6f0798d37c23c79ba806b1bc2 100755 (executable)
@@ -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
index 830fc7830c66579d4212858a259fb311dff21d46..65c96956f74758b4b7b3a6b21aff06c25c09b03d 100755 (executable)
@@ -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
 
index 0384a706f32b4bc8a6aaf4ee078c9b6bd97cff29..2c35665b1170671a5c4b126a5a7fa92c51ea4769 100755 (executable)
@@ -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
index 6da368fc6cc786052b64ed678071b842bdc09f3c..77a925c610817b374142295367513a18fa1541db 100755 (executable)
@@ -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
index 529b0a21153265198a7043e7643217c54acafbbe..72d9b19b185e2c8446636574fe642c3a4a61d70e 100755 (executable)
@@ -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
 
index ba0febf4281237ed09f907e0a943b1dc3002cb45..124deae01a3f6e036ff8e2c7587d1463a55eb834 100755 (executable)
@@ -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
index 600b0f69c256f64ce43a2214f4cd8eade3862b32..752f4d6de73e1fba346c5c02b139adf02f4e287e 100755 (executable)
@@ -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
 }
index 82f79a8e6ad56c030a49fdce365596272fab683e..9461896415213d01837b3a34d7365becc362e4b2 100755 (executable)
@@ -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
 }
index 250f1b3f631770b97c364ec3c3087ccbd1babe69..6bd1a58213073a232cb6146ec0309dc594997dac 100755 (executable)
@@ -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
index f1b967505222e01bd2576546124b50d7953fd09e..ddd77262fe8a3b4fa892a547018cda1dc357e1b9 100755 (executable)
@@ -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
 
index b01d419faa7e014a662ec1eafd6379d3aa698544..b722315ac4cdfc65545b627a76ae95242673ac5c 100755 (executable)
@@ -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
 
index 6c7eb98e59ebd8149ed3d2703cbc9fc19620585e..85d7197e6633e562d52e9139d8d3eb212aff87cc 100755 (executable)
@@ -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"
index 696baeceeee382743e2656d9b91c25dccddc9da8..d5ded6703f9e057feaacd21657d0eda28c8b4807 100755 (executable)
@@ -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
 }
index eecd0253bd6fe56cfa16ef3c65eaa193f05331de..03c244bc1b31f596d49539fab95a3522271e999f 100755 (executable)
@@ -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"
index aa9d4763e6c762419cf678f77e5c7db68eba4cf1..60f6e8dac4e76c9990208c4f99054828b2001ebc 100755 (executable)
@@ -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"
index 1bcf35328691e7807a51523374bab2a097f40b9d..be1c1a4ba5a2130e86bb19fe5015f976d6511c88 100755 (executable)
@@ -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
 }
 
index ba3f44275a4e1bac5c5e66e192c34b1c0d7017a2..2d5d0ca5b07352d4538453be2f8c952d270df927 100755 (executable)
@@ -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
index 6ada8580f0c575f29927ea4219733201bdca5fa0..e446d3f3ef3ed4076a718e8abfec5739c8ee8dc0 100755 (executable)
@@ -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
 
index 3dddbe6131eb385f4784d21b42a6f81398829297..de263bbfb7d7f12a8842a1ce3e77ff6ca7bdda9f 100755 (executable)
@@ -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
 
index 61ea67a72b3eb8b27ff600d773cd554e188c6fb2..d0116722e386ff4cea53918da7f5aeed7532c5fd 100755 (executable)
@@ -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
index 45ef48fc366c82fc9934f7a8e5834020db00bdc9..237e21b916bb5567c489faa2dcb36fc874738a3f 100755 (executable)
@@ -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
index b1c3f2d09d86a9449db2f5a011a61c1f781dd76d..a19de08d868c5eee809fba43e98f2692c36337f2 100755 (executable)
@@ -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"
 }
 
index 94e6fe45f3a85b94f60202aea4e660b8be025d18..2ca4a02979adbd0ceea0dfb48b670b0c870d8c00 100755 (executable)
@@ -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
 
index d63ec8bcb573d1695fb0f3faaec3bd264133b4a6..ce5d9687a0a259fc1a40db201df0b08aa43d9fb9 100755 (executable)
@@ -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"
 }
 
index 72010581e83aa251451ba4ffeee8db32c11d97f9..d4066e4aaea7fef10a895061b39dc0459b7e5e95 100755 (executable)
@@ -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"
 }
 
index 91852a05fb7c9e0e250ceeb16f8357d1bc009bfc..62187cf3430e735e9049c5b9249ca6adc9f2abb1 100755 (executable)
@@ -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"
 }
 
index 7677cc6ccdff724094fe2b0145ae1e41bd7659e1..8b64e621a7365bca7fe6def99cec704a697b3fe5 100755 (executable)
@@ -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
 
index ea6b93838cc8da145746d32203efaffeaf821f28..bfc3b2091de8bb158914e5a8c596f4753dc7dfe3 100755 (executable)
@@ -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"
index e404564e8412385d0ea179dc1b35ec85db7cf018..3e1750d0691022837ea90740afa5e2c3bdf04544 100755 (executable)
@@ -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"
 }
 
index 9b1dea3ebb89b3a31060fe1aaafc927f13cdb3e6..237d45621057d3e0928ac167fd15d3e5d2673d76 100755 (executable)
@@ -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
 
index 2bb8e4f66f783134136d994658810df631b110fd..9442ee22ccb18554f048387a7e6b565b6cbb37d7 100755 (executable)
@@ -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
index 1ce34423b330ab14cccf50597b2fa1d0e469148c..364545d5279e3fda785e566cf02115a3ccaccd9e 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #define _LGPL_SOURCE
+#include <getopt.h>
 #include <assert.h>
 #include <arpa/inet.h>
 #include <fcntl.h>
 #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);
 }
This page took 0.069192 seconds and 4 git commands to generate.