TESTAPP_PATH="$TESTDIR/utils/testapp"
TESTAPP_NAME="gen-ust-events"
TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
-NR_ITER=2000000
-NR_USEC_WAIT=100
APPS_PID=
-NUM_TESTS=76
+NUM_TESTS=100
TRACE_PATH=$(mktemp -d)
rm -f $tmp_file
}
+function wait_test_apps()
+{
+ diag "Waiting for $TESTAPP_NAME"
+ for p in ${APPS_PID}; do
+ wait ${p} 2>/dev/null
+ done
+}
+
function stop_test_apps()
{
diag "Stopping $TESTAPP_NAME"
ok $? "Enable channel $channel_name for session $sess_name with subbuf size $subbuf_size"
}
+function enable_mmap_small_discard_ust_channel ()
+{
+ local sess_name=$1
+ local chan_name=$2
+
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name \
+ $chan_name -u --output mmap --discard \
+ --subbuf-size $(getconf PAGE_SIZE) --num-subbuf 2 \
+ > /dev/null 2>&1
+
+ ok $? "Enable channel $channel_name for session $sess_name with small discard buffers"
+}
+
+function enable_mmap_small_overwrite_ust_channel ()
+{
+ local sess_name=$1
+ local chan_name=$2
+
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name \
+ $chan_name -u --output mmap --overwrite \
+ --subbuf-size $(getconf PAGE_SIZE) --num-subbuf 2 \
+ > /dev/null 2>&1
+
+ ok $? "Enable channel $channel_name for session $sess_name with small discard buffers"
+}
function test_ust_list_output ()
{
output_names=("randomname" "somesnapshot")
+ NR_ITER=2000000
+ NR_USEC_WAIT=100
diag "Test UST snapshot output listing"
create_lttng_session_no_output $SESSION_NAME
function test_ust_local_snapshot ()
{
+ NR_ITER=2000000
+ NR_USEC_WAIT=100
+
diag "Test local UST snapshots"
create_lttng_session_no_output $SESSION_NAME
enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
stop_test_apps
}
+function test_ust_local_snapshot_small_discard_buffers ()
+{
+ NR_ITER=10000
+ NR_USEC_WAIT=0
+ OLDCPUSET=$(taskset -p $$)
+
+ diag "Test local UST snapshots with small discard buffers"
+ taskset -p 0x1 $$ 1>/dev/null 2>&1 # CPU 0 only
+ create_lttng_session_no_output $SESSION_NAME
+ enable_mmap_small_discard_ust_channel $SESSION_NAME $CHANNEL_NAME
+ enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
+ start_lttng_tracing_ok $SESSION_NAME
+ lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH
+
+ # Run test apps, wait for them to complete.
+ start_test_app
+ wait_test_apps
+
+ # Take first snapshot, remember first line.
+ lttng_snapshot_record $SESSION_NAME
+ FIRST_LINE="$(trace_first_line $TRACE_PATH/)"
+ diag "First line (1st snapshot): $FIRST_LINE"
+ rm -rf $TRACE_PATH/
+
+ # Run test apps, wait for them to complete.
+ start_test_app
+ wait_test_apps
+
+ # Take second snapshot, remember first line.
+ lttng_snapshot_record $SESSION_NAME
+ FIRST_LINE_2="$(trace_first_line $TRACE_PATH/)"
+ diag "First line (2nd snapshot): $FIRST_LINE_2"
+ rm -rf $TRACE_PATH/
+
+ if [ x"$FIRST_LINE" != x"$FIRST_LINE_2" ]; then
+ fail "First snapshot event do not match."
+ else
+ pass "First snapshot event match."
+ fi
+
+ stop_lttng_tracing_ok $SESSION_NAME
+ destroy_lttng_session_ok $SESSION_NAME
+ taskset -p $OLDCPUSET $$ 1>/dev/null 2>&1
+}
+
+function test_ust_local_snapshot_small_overwrite_buffers ()
+{
+ NR_ITER=10000
+ NR_USEC_WAIT=0
+ OLDCPUSET=$(taskset -p $$)
+
+ diag "Test local UST snapshots with small overwrite buffers"
+ taskset -p 0x1 $$ 1>/dev/null 2>&1 # CPU 0 only
+ create_lttng_session_no_output $SESSION_NAME
+ enable_mmap_small_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
+ enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
+ start_lttng_tracing_ok $SESSION_NAME
+ lttng_snapshot_add_output_ok $SESSION_NAME $TRACE_PATH
+
+ # Run test apps, wait for them to complete.
+ start_test_app
+ wait_test_apps
+
+ # Take first snapshot, remember first line.
+ lttng_snapshot_record $SESSION_NAME
+ FIRST_LINE="$(trace_first_line $TRACE_PATH/)"
+ diag "First line (1st snapshot): $FIRST_LINE"
+ rm -rf $TRACE_PATH/
+
+ # Run test apps, wait for them to complete.
+ start_test_app
+ wait_test_apps
+
+ # Take second snapshot, remember first line.
+ lttng_snapshot_record $SESSION_NAME
+ FIRST_LINE_2="$(trace_first_line $TRACE_PATH/)"
+ diag "First line (2nd snapshot): $FIRST_LINE_2"
+ rm -rf $TRACE_PATH/
+
+ if [ x"$FIRST_LINE" != x"$FIRST_LINE_2" ]; then
+ pass "First snapshot event do not match."
+ else
+ fail "First snapshot event match."
+ fi
+
+ stop_lttng_tracing_ok $SESSION_NAME
+ destroy_lttng_session_ok $SESSION_NAME
+ taskset -p $OLDCPUSET $$ 1>/dev/null 2>&1
+}
+
function test_ust_local_snapshot_max_size ()
{
+ NR_ITER=2000000
+ NR_USEC_WAIT=100
page_size=`getconf PAGE_SIZE`
num_cpus=$(conf_proc_count)
function test_ust_local_snapshot_large_metadata ()
{
+ NR_ITER=2000000
+ NR_USEC_WAIT=100
LM_EVENT="tp:tptest1,tp:tptest2,tp:tptest3,tp:tptest4,tp:tptest5"
LM_PATH="$TESTDIR/utils/testapp"
LM_NAME="gen-ust-nevents"
function enable_channel_per_uid_mmap_overwrite()
{
+ NR_ITER=2000000
+ NR_USEC_WAIT=100
sess_name=$1
channel_name=$2
function test_ust_per_uid_local_snapshot_post_mortem ()
{
+ NR_ITER=2000000
+ NR_USEC_WAIT=100
+
diag "Test local UST snapshots post-mortem"
create_lttng_session_no_output $SESSION_NAME
enable_channel_per_uid_mmap_overwrite $SESSION_NAME $CHANNEL_NAME
function test_ust_local_snapshots ()
{
+ NR_ITER=2000000
+ NR_USEC_WAIT=100
+
diag "Test $NR_SNAPSHOT local UST snapshots"
create_lttng_session_no_output $SESSION_NAME
enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
print_test_banner "$TEST_DESC"
start_lttng_sessiond
-
tests=( test_ust_list_output
test_ust_local_snapshot
test_ust_local_snapshot_max_size
test_ust_per_uid_local_snapshot
test_ust_per_uid_local_snapshot_post_mortem
test_ust_local_snapshot_large_metadata
- test_ust_local_snapshots)
+ test_ust_local_snapshots
+ test_ust_local_snapshot_small_discard_buffers
+ test_ust_local_snapshot_small_overwrite_buffers
+)
for fct_test in ${tests[@]};
do