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>
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
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
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
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} ${!}"
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)
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
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
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
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
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
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
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"
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
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
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
}
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
}
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
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
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
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
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
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
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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
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"
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"
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"
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).
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
}
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
}
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
}
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
}
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"
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"
# 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
}
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"
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
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
- rm -f ${file_sync_after_first}
rm -f ${file_sync_before_last}
}
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
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
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
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
function run_ust
{
- $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+ $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT
}
function run_kernel
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."
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
# 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"
}
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
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
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
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
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
# MUST set TESTDIR before calling those functions
function run_app()
{
- $TESTAPP_BIN $NUM_EVENT
+ $TESTAPP_BIN -i $NUM_EVENT
ok $? "Application done"
}
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"
}
# MUST set TESTDIR before calling those functions
function run_app()
{
- $TESTAPP_BIN $NUM_EVENT
+ $TESTAPP_BIN -i $NUM_EVENT
ok $? "Application done"
}
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
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"
# MUST set TESTDIR before calling those functions
function run_app()
{
- $TESTAPP_BIN $NUM_EVENT
+ $TESTAPP_BIN -i $NUM_EVENT
ok $? "Application done"
}
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
# 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
*/
#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;
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++) {
}
end:
+ free(after_first_event_file_path);
+ free(before_last_event_file_path);
exit(!ret ? EXIT_SUCCESS : EXIT_FAILURE);
}