From: Mathieu Desnoyers Date: Wed, 20 Apr 2016 15:20:00 +0000 (-0400) Subject: tests: test ust snapshot with discard buffers X-Git-Tag: v2.9.0-rc1~119 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ae779dd69a75dafa1d38bfb7c8de9279257106ba;p=lttng-tools.git tests: test ust snapshot with discard buffers Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- diff --git a/tests/regression/tools/snapshots/ust_test b/tests/regression/tools/snapshots/ust_test index f65906f11..287ee24bf 100755 --- a/tests/regression/tools/snapshots/ust_test +++ b/tests/regression/tools/snapshots/ust_test @@ -25,11 +25,9 @@ CHANNEL_NAME="snapchan" 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) @@ -66,6 +64,14 @@ function start_test_app() 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" @@ -122,10 +128,37 @@ function enable_mmap_overwrite_subbuf_ust_channel () 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 @@ -155,6 +188,9 @@ function test_ust_list_output () 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 @@ -179,8 +215,100 @@ function test_ust_local_snapshot () 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) @@ -232,6 +360,8 @@ function test_ust_local_snapshot_max_size () 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" @@ -259,6 +389,8 @@ function test_ust_local_snapshot_large_metadata () function enable_channel_per_uid_mmap_overwrite() { + NR_ITER=2000000 + NR_USEC_WAIT=100 sess_name=$1 channel_name=$2 @@ -294,6 +426,9 @@ function test_ust_per_uid_local_snapshot () 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 @@ -319,6 +454,9 @@ function test_ust_per_uid_local_snapshot_post_mortem () 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 @@ -351,14 +489,16 @@ plan_tests $NUM_TESTS 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