diff --git a/tests/regression/tools/snapshots/test_kernel_streaming b/tests/regression/tools/snapshots/test_kernel_streaming index 06e0a5c4a6..ee413f7738 100755 --- a/tests/regression/tools/snapshots/test_kernel_streaming +++ b/tests/regression/tools/snapshots/test_kernel_streaming @@ -28,21 +28,6 @@ NUM_TESTS=36 source $TESTDIR/utils/utils.sh -function snapshot_add_output () -{ - local sess_name=$1 - local trace_path=$2 - local name=$3 - local extra_opt="" - - if [ ! -z $name ]; then - extra_opt="-n $name" - fi - - $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot add-output -s $sess_name $extra_opt $trace_path >/dev/null 2>&1 - ok $? "Added snapshot output $trace_path" -} - # Test a snapshot using a default name for the output destination. function test_kernel_default_name_with_del() { @@ -51,7 +36,7 @@ function test_kernel_default_name_with_del() enable_lttng_mmap_overwrite_kernel_channel $SESSION_NAME $CHANNEL_NAME lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - snapshot_add_output $SESSION_NAME "net://localhost" + lttng_snapshot_add_output_ok $SESSION_NAME "net://localhost" lttng_snapshot_record $SESSION_NAME # Validate test @@ -61,7 +46,7 @@ function test_kernel_default_name_with_del() fi lttng_snapshot_del_output_ok $SESSION_NAME 1 - snapshot_add_output $SESSION_NAME "net://localhost" + lttng_snapshot_add_output_ok $SESSION_NAME "net://localhost" lttng_snapshot_record $SESSION_NAME # Validate test with the next ID since a del output was done prior. @@ -84,7 +69,7 @@ function test_kernel_default_name() enable_lttng_mmap_overwrite_kernel_channel $SESSION_NAME $CHANNEL_NAME lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - snapshot_add_output $SESSION_NAME "net://localhost" + lttng_snapshot_add_output_ok $SESSION_NAME "net://localhost" lttng_snapshot_record $SESSION_NAME stop_lttng_tracing_ok $SESSION_NAME destroy_lttng_session_ok $SESSION_NAME @@ -106,7 +91,7 @@ function test_kernel_custom_name() enable_lttng_mmap_overwrite_kernel_channel $SESSION_NAME $CHANNEL_NAME lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - snapshot_add_output $SESSION_NAME "net://localhost" $name + lttng_snapshot_add_output_ok $SESSION_NAME "net://localhost" $name lttng_snapshot_record $SESSION_NAME stop_lttng_tracing_ok $SESSION_NAME destroy_lttng_session_ok $SESSION_NAME diff --git a/tests/regression/tools/snapshots/test_ust_streaming b/tests/regression/tools/snapshots/test_ust_streaming index c97813e40e..e818b52e01 100755 --- a/tests/regression/tools/snapshots/test_ust_streaming +++ b/tests/regression/tools/snapshots/test_ust_streaming @@ -39,21 +39,6 @@ if [ ! -x "$TESTAPP_BIN" ]; then BAIL_OUT "No UST events binary detected." fi -function snapshot_add_output () -{ - local sess_name=$1 - local trace_path=$2 - local name=$3 - local extra_opt="" - - if [ ! -z $name ]; then - extra_opt="-n $name" - fi - - $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot add-output -s $sess_name $extra_opt $trace_path >/dev/null 2>&1 - ok $? "Added snapshot output $trace_path" -} - # Start trace application and return once one event has been hit. function start_test_app() { @@ -95,7 +80,7 @@ function test_ust_default_name_with_del() start_test_app - snapshot_add_output $SESSION_NAME "net://localhost" + lttng_snapshot_add_output_ok $SESSION_NAME "net://localhost" lttng_snapshot_record $SESSION_NAME # Validate test @@ -107,7 +92,7 @@ function test_ust_default_name_with_del() fi lttng_snapshot_del_output_ok $SESSION_NAME 1 - snapshot_add_output $SESSION_NAME "net://localhost" + lttng_snapshot_add_output_ok $SESSION_NAME "net://localhost" lttng_snapshot_record $SESSION_NAME # Validate test with the next ID since a del output was done prior. @@ -136,7 +121,7 @@ function test_ust_default_name() start_test_app - snapshot_add_output $SESSION_NAME "net://localhost" + lttng_snapshot_add_output_ok $SESSION_NAME "net://localhost" lttng_snapshot_record $SESSION_NAME stop_lttng_tracing_ok $SESSION_NAME destroy_lttng_session_ok $SESSION_NAME @@ -159,7 +144,7 @@ function test_ust_default_name_custom_uri() start_test_app - snapshot_add_output $SESSION_NAME "-C tcp://localhost:5342 -D tcp://localhost:5343" + lttng_snapshot_add_output_ok $SESSION_NAME "-C tcp://localhost:5342 -D tcp://localhost:5343" lttng_snapshot_record $SESSION_NAME stop_lttng_tracing_ok $SESSION_NAME destroy_lttng_session_ok $SESSION_NAME @@ -186,7 +171,7 @@ function test_ust_custom_name() start_test_app - snapshot_add_output $SESSION_NAME "net://localhost" $name + lttng_snapshot_add_output_ok $SESSION_NAME "net://localhost" $name lttng_snapshot_record $SESSION_NAME stop_lttng_tracing_ok $SESSION_NAME destroy_lttng_session_ok $SESSION_NAME diff --git a/tests/regression/tools/snapshots/ust_test b/tests/regression/tools/snapshots/ust_test index 1e01eb21e2..21617be515 100755 --- a/tests/regression/tools/snapshots/ust_test +++ b/tests/regression/tools/snapshots/ust_test @@ -81,39 +81,6 @@ function stop_test_apps() APPS_PID= } -function snapshot_add_output () -{ - local sess_name=$1 - local trace_path=$2 - local name=$3 - local max_size=$4 - local extra_opt="" - - if [ ! -z $name ]; then - extra_opt+=" -n $name " - fi - - if [ ! -z $max_size ]; then - extra_opt+=" -m $max_size " - fi - - $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot add-output \ - -s $sess_name $extra_opt $trace_path > /dev/null 2>&1 - - ok $? "Added snapshot output $trace_path ($extra_opt)" -} - -function snapshot_del_output () -{ - local sess_name=$1 - local name=$2 - - $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot del-output \ - -s $sess_name $name > /dev/null 2>&1 - - ok $? "Deleted snapshot output named $name" -} - function enable_mmap_overwrite_subbuf_ust_channel () { local sess_name=$1 @@ -164,15 +131,15 @@ function test_ust_list_output () start_lttng_tracing_ok $SESSION_NAME - snapshot_add_output $SESSION_NAME "file://$TRACE_PATH" ${output_names[0]} + lttng_snapshot_add_output_ok $SESSION_NAME "file://$TRACE_PATH" ${output_names[0]} $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot list-output \ -s $SESSION_NAME 2>&1 | grep ${output_names[0]} > /dev/null ok $? "Snapshot named ${output_names[0]} present in list-output listing" - snapshot_del_output $SESSION_NAME ${output_names[0]} + lttng_snapshot_del_output_ok $SESSION_NAME ${output_names[0]} - snapshot_add_output $SESSION_NAME "file://$TRACE_PATH" ${output_names[1]} + lttng_snapshot_add_output_ok $SESSION_NAME "file://$TRACE_PATH" ${output_names[1]} $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot list-output \ -s $SESSION_NAME 2>&1 | grep ${output_names[1]} > /dev/null @@ -306,6 +273,7 @@ function test_ust_local_snapshot_max_size () { NR_ITER=-1 NR_USEC_WAIT=100 + snapshot_name="max_size_snap" page_size=`getconf PAGE_SIZE` num_cpus=$(conf_proc_count) @@ -323,7 +291,7 @@ function test_ust_local_snapshot_max_size () enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - snapshot_add_output $SESSION_NAME "file://$TRACE_PATH" "" $max_size + lttng_snapshot_add_output_ok $SESSION_NAME "file://$TRACE_PATH" $snapshot_name $max_size # Returns once the application has at least fired ONE tracepoint. start_test_app diff --git a/tests/regression/tools/streaming/test_high_throughput_limits b/tests/regression/tools/streaming/test_high_throughput_limits index f3930ed557..820c67339c 100755 --- a/tests/regression/tools/streaming/test_high_throughput_limits +++ b/tests/regression/tools/streaming/test_high_throughput_limits @@ -92,6 +92,7 @@ function snapshot_add_output $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot add-output -s $sess_name $extra_opt $trace_path >/dev/null 2>&1 ok $? "Added snapshot output $trace_path" } + function reset_bw_limit { tc qdisc del dev $DEFAULT_IF root >/dev/null 2>&1 @@ -237,7 +238,7 @@ function test_low_data_socket_bandwidth_snapshot enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME run_apps 1 10000 - snapshot_add_output $SESSION_NAME $NETWORK_URI + lttng_snapshot_add_output_ok $SESSION_NAME $NETWORK_URI lttng_snapshot_record $SESSION_NAME # Validate that the trace is readable diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 94b3a3c45f..1519c1604c 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -1235,14 +1235,26 @@ function lttng_snapshot_add_output () local expected_to_fail=$1 local sess_name=$2 local trace_path=$3 + local name=$4 + local max_size=$5 + local extra_opt="" - $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot add-output -s $sess_name file://$trace_path 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST + if [ ! -z $name ]; then + extra_opt+=" -n $name" + fi + + if [ ! -z $max_size ]; then + extra_opt+=" -m $max_size" + fi + + $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot add-output \ + -s $sess_name $extra_opt $trace_path 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST ret=$? if [[ $expected_to_fail -eq 1 ]]; then test "$ret" -ne "0" - ok $? "Added snapshot output file://$trace_path failed as expected" + ok $? "Added snapshot output $trace_path failed as expected" else - ok $ret "Added snapshot output file://$trace_path" + ok $ret "Added snapshot output $trace_path ($extra_opt)" fi }