local sess_name=$1
local channel_name=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-uid -u $channel_name -s $sess_name >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-uid -u $channel_name -s $sess_name --switch-timer 1000000 >/dev/null 2>&1
+ ok $? "Enable channel $channel_name per UID for session $sess_name"
+}
+
+function enable_channel_per_pid()
+{
+ local sess_name=$1
+ local channel_name=$2
+
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-pid -u $channel_name -s $sess_name --switch-timer 1000000 >/dev/null 2>&1
ok $? "Enable channel $channel_name per UID for session $sess_name"
}
done
}
+function validate_trace()
+{
+ local out
+
+ out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l)
+ if [ $out -eq 0 ]; then
+ fail "Trace validation"
+ diag "No event(s) found. We are supposed to have at least one."
+ out=1
+ else
+ pass "Trace validation"
+ diag "Found $out event(s). Coherent."
+ out=0
+ fi
+
+ return $out
+}
+
test_after_app_pid() {
local out
# BEFORE application is spawned
create_lttng_session $SESSION_NAME $TRACE_PATH
enable_metadata_per_pid $SESSION_NAME
- enable_ust_lttng_channel $SESSION_NAME "channel0"
+ enable_channel_per_pid $SESSION_NAME "channel0"
enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
start_lttng_tracing $SESSION_NAME
$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
ok $? "Start application to trace"
+ # At least hit one event
+ sleep 2
+ validate_trace
+ out=$?
+
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
- trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH
-
- return $?
+ return $out
}
test_before_app_pid() {
# BEFORE application is spawned
create_lttng_session $SESSION_NAME $TRACE_PATH
enable_metadata_per_pid $SESSION_NAME
- enable_ust_lttng_channel $SESSION_NAME "channel0"
+ enable_channel_per_pid $SESSION_NAME "channel0"
enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
start_lttng_tracing $SESSION_NAME
# At least hit one event
sleep 2
+ validate_trace
+ out=$?
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
- out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l)
- if [ $out -eq 0 ]; then
- fail "Trace validation"
- diag "No event(s) found. We are supposed to have at least one."
- out=1
- else
- pass "Trace validation"
- diag "Found $out event(s). Coherent."
- out=0
- fi
-
wait_apps
return $out
$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
ok $? "Start application to trace"
+ # At least hit one event
+ sleep 2
+ validate_trace
+ out=$?
+
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
- trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH
-
- return $?
+ return $out
}
test_before_app_uid() {
# At least hit one event
sleep 2
+ validate_trace
+ out=$?
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
- out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l)
- if [ $out -eq 0 ]; then
- fail "Trace validation"
- diag "No event(s) found. We are supposed to have at least one."
- out=1
- else
- pass "Trace validation"
- diag "Found $out event(s). Coherent."
- out=0
- fi
-
wait_apps
return $out