# untracking on an active app.
function prepare_ust_app
{
- TOUCH_BEFORE_LAST_PATH=$(mktemp --tmpdir -u tmp.${FUNCNAME[0]}_touch_before_last.XXXXXX)
- SYNC_BEFORE_LAST_PATH=$(mktemp --tmpdir -u tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX)
+ TOUCH_BEFORE_LAST_PATH=$(mktemp -u -t tmp.${FUNCNAME[0]}_touch_before_last.XXXXXX)
+ SYNC_BEFORE_LAST_PATH=$(mktemp -u -t tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX)
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
--sync-before-last-event-touch "$TOUCH_BEFORE_LAST_PATH" \
# Wait for the app to execute all the way to right before the last
# event.
while [ ! -f "${TOUCH_BEFORE_LAST_PATH}" ]; do
- sleep 0.5
+ sleep 0.01
done
}
function prepare_kernel_app
{
- WAIT_PATH=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_wait_path.XXXXXX")
+ WAIT_PATH=$(mktemp -u -t "tmp.${FUNCNAME[0]}_wait_path.XXXXXX")
"$TESTAPP_KERNEL_BIN" "$WAIT_PATH" $NR_ITER &
CHILD_PID=$!
diag "${FUNCNAME[0]} $*"
- trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
+ trace_path=$(mktemp -d -t tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
create_lttng_session_ok $SESSION_NAME "$trace_path"
trace_"$domain"_app
stop_lttng_tracing_ok
- destroy_lttng_session_ok $SESSION_NAME
+ destroy_lttng_session_ok $SESSION_NAME --no-wait
if [ "$expect_event" -eq 1 ]; then
trace_matches "$EVENT_NAME" $NR_ITER "$trace_path"
diag "${FUNCNAME[0]} $*"
- trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
+ trace_path=$(mktemp -d -t tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
create_lttng_session_ok $SESSION_NAME "$trace_path"
trace_"$domain"_app
stop_lttng_tracing_ok
- destroy_lttng_session_ok $SESSION_NAME
+ destroy_lttng_session_ok $SESSION_NAME --no-wait
if [ "$expect_event" -eq 1 ]; then
validate_trace "$EVENT_NAME" "$trace_path"
diag "${FUNCNAME[0]} $*"
- trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
+ trace_path=$(mktemp -d -t tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
create_lttng_session_ok $SESSION_NAME "$trace_path"
trace_"$domain"_app
stop_lttng_tracing_ok
- destroy_lttng_session_ok $SESSION_NAME
+ destroy_lttng_session_ok $SESSION_NAME --no-wait
if [ "$expect_event" -eq 1 ]; then
validate_trace "$EVENT_NAME" "$trace_path"
diag "${FUNCNAME[0]} $*"
- trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
+ trace_path=$(mktemp -d -t tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
create_lttng_session_ok $SESSION_NAME "$trace_path"
enable_"$domain"_lttng_event_ok $SESSION_NAME "$wildcard"
lttng_track_"$domain"_fail "${tracker}"
- destroy_lttng_session_ok $SESSION_NAME
+ destroy_lttng_session_ok $SESSION_NAME --no-wait
rm -rf "$trace_path"
}
diag "${FUNCNAME[0]} $*"
- trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
+ trace_path=$(mktemp -d -t tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
create_lttng_session_ok $SESSION_NAME "$trace_path"
trace_"$domain"_app
stop_lttng_tracing_ok
- destroy_lttng_session_ok $SESSION_NAME
+ destroy_lttng_session_ok $SESSION_NAME --no-wait
if [ "$expect_event" -eq 1 ]; then
trace_matches "$EVENT_NAME" $NR_ITER "$trace_path"
diag "${FUNCNAME[0]} $*"
- trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
+ trace_path=$(mktemp -d -t tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
create_lttng_session_ok $SESSION_NAME "$trace_path"
trace_"$domain"_app
stop_lttng_tracing_ok
- destroy_lttng_session_ok $SESSION_NAME
+ destroy_lttng_session_ok $SESSION_NAME --no-wait
if [ "$expect_event" -eq 1 ]; then
validate_trace "$EVENT_NAME" "$trace_path"
diag "${FUNCNAME[0]} $*"
- trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
+ trace_path=$(mktemp -d -t tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
create_lttng_session_ok $SESSION_NAME "$trace_path"
trace_"$domain"_app
stop_lttng_tracing_ok
- destroy_lttng_session_ok $SESSION_NAME
+ destroy_lttng_session_ok $SESSION_NAME --no-wait
if [ "$expect_event" -eq 1 ]; then
validate_trace "$EVENT_NAME" "$trace_path"
{
diag "${FUNCNAME[0]} $*"
- local trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
+ local trace_path=$(mktemp -d -t tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
create_lttng_session_ok $SESSION_NAME "$trace_path" "--snapshot"
lttng_snapshot_record $SESSION_NAME
stop_lttng_tracing_ok
- destroy_lttng_session_ok $SESSION_NAME
+ destroy_lttng_session_ok $SESSION_NAME --no-wait
snapshot_count=$(find "$trace_path" -name metadata | wc -l)
is "$snapshot_count" 0 "Number of snapshot is zero"
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
start_lttng_sessiond
diag "Test UST tracker"
test_event_tracker ust 1 "${EVENT_NAME}" "--pid --all" # backward compat
test_event_pid_tracker ust 1 "${EVENT_NAME}"
-if [ "$(id -u)" == "0" ]; then
- isroot=1
-else
- isroot=0
-fi
-
-skip $isroot "Root access is needed. Skipping all kernel tracker tests." $NUM_KERNEL_TESTS ||
+check_skip_kernel_test "$NUM_KERNEL_TESTS" "Skipping kernel tracker tests." ||
{
diag "Test kernel tracker"
test_event_tracker kernel 1 "${EVENT_NAME}" "--pid --all"
test_event_pid_tracker kernel 1 "${EVENT_NAME}"
+ # When using session destroy with '--no-wait', the quick
+ # exit at the end means that the lttng-test modules is
+ # still marked as being in use and 'modprobe --remove' fails.
+ #
+ # It is possible to work around the issue by not setting
+ # '--no-wait' on the last kernel test, but it seems like
+ # an easy detail to forget about.
+ #
+ # The sleep here gives the system a small amount of time to
+ # finish wrapping up the session that had the lttng-test kernel
+ # module loaded.
+ sleep 1
+
modprobe --remove lttng-test
ok $? "Unloading lttng-test module"
}