From f0d43d3d8e0c7fcb01ba1550466517d047fd6e76 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Wed, 28 Mar 2018 13:56:27 -0400 Subject: [PATCH] Tests: consolidate session creation with a uri parameter in utils.sh MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Introduce a new create_lttng_session_uri test helper. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- tests/destructive/metadata-regeneration | 11 ++--------- tests/regression/tools/health/test_health.sh | 8 -------- tests/regression/tools/health/test_thread_ok | 8 -------- .../tools/regen-metadata/test_kernel | 10 +--------- tests/regression/tools/regen-metadata/test_ust | 18 ++---------------- tests/regression/tools/rotation/test_kernel | 12 ++---------- tests/regression/tools/rotation/test_ust | 16 ++++------------ tests/regression/tools/streaming/test_kernel | 12 ++---------- tests/regression/tools/streaming/test_ust | 12 ++---------- .../test_multi_sessions_per_uid_5app_streaming | 11 +---------- ...sessions_per_uid_5app_streaming_kill_relayd | 11 +---------- tests/utils/utils.sh | 9 +++++++++ 12 files changed, 26 insertions(+), 112 deletions(-) diff --git a/tests/destructive/metadata-regeneration b/tests/destructive/metadata-regeneration index d4e632a11..729634f87 100755 --- a/tests/destructive/metadata-regeneration +++ b/tests/destructive/metadata-regeneration @@ -48,13 +48,6 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -function lttng_create_session_uri -{ - # Create session with default path - $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME -U net://localhost >/dev/null 2>&1 - ok $? "Create session with default path" -} - function validate_trace_date { local test_date=$1 @@ -103,7 +96,7 @@ function test_kernel_streaming () { diag "Test kernel streaming with metadata regeneration" date "+%Y-%m-%d %H:%M" -s "$DATE1 $HOUR" >/dev/null - lttng_create_session_uri + create_lttng_session_uri $SESSION_NAME net://localhost lttng_enable_kernel_event $SESSION_NAME $KERNEL_EVENT_NAME start_lttng_tracing_ok $SESSION_NAME echo -n "100" > /proc/lttng-test-filter-event @@ -167,7 +160,7 @@ function test_ust_streaming () diag "Test UST streaming with metadata regeneration" date "+%Y-%m-%d %H:%M" -s "$DATE1 $HOUR" >/dev/null - lttng_create_session_uri + create_lttng_session_uri $SESSION_NAME net://localhost enable_ust_lttng_event_ok $SESSION_NAME $UST_EVENT_NAME $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} /dev/null 2>&1 & diff --git a/tests/regression/tools/health/test_health.sh b/tests/regression/tools/health/test_health.sh index 39f5b874e..5fd0a7304 100644 --- a/tests/regression/tools/health/test_health.sh +++ b/tests/regression/tools/health/test_health.sh @@ -25,14 +25,6 @@ SLEEP_TIME=30 source $TESTDIR/utils/utils.sh -function lttng_create_session_uri -{ - # Create session with default path - $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME \ - -U net://localhost >/dev/null 2>&1 - ok $? "Create session with default path" -} - function report_errors { test_thread_error_string="$1" diff --git a/tests/regression/tools/health/test_thread_ok b/tests/regression/tools/health/test_thread_ok index ae4596ad7..7cb845b22 100755 --- a/tests/regression/tools/health/test_thread_ok +++ b/tests/regression/tools/health/test_thread_ok @@ -31,14 +31,6 @@ SLEEP_TIME=30 source $TESTDIR/utils/utils.sh -function lttng_create_session_uri -{ - # Create session with default path - $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME \ - -U net://localhost >/dev/null 2>&1 - ok $? "Create session with default path" -} - function report_errors { # Report health errors diff --git a/tests/regression/tools/regen-metadata/test_kernel b/tests/regression/tools/regen-metadata/test_kernel index 1849b9cd0..5e14527f7 100755 --- a/tests/regression/tools/regen-metadata/test_kernel +++ b/tests/regression/tools/regen-metadata/test_kernel @@ -28,18 +28,10 @@ NUM_TESTS=18 source $TESTDIR/utils/utils.sh -function lttng_create_session_uri -{ - # Create session with default path - $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME -U net://localhost >/dev/null 2>&1 - - ok $? "Create session $SESSION_NAME" -} - function test_kernel_streaming () { diag "Test kernel streaming with metadata regeneration" - lttng_create_session_uri + create_lttng_session_uri $SESSION_NAME net://localhost lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME start_lttng_tracing_ok $SESSION_NAME echo -n "100" > /proc/lttng-test-filter-event diff --git a/tests/regression/tools/regen-metadata/test_ust b/tests/regression/tools/regen-metadata/test_ust index b7f1af1d8..bba2d8700 100755 --- a/tests/regression/tools/regen-metadata/test_ust +++ b/tests/regression/tools/regen-metadata/test_ust @@ -37,20 +37,6 @@ if [ ! -x "$TESTAPP_BIN" ]; then BAIL_OUT "No UST events binary detected." fi -function lttng_create_session_uri -{ - # Create session with default path - $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME -U net://localhost >/dev/null 2>&1 - ok $? "Create session with default path" -} - -function lttng_create_session_uri_live -{ - # Create session with default path - $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live -U net://localhost >/dev/null 2>&1 - ok $? "Create live session" -} - function enable_channel_per_pid() { sess_name=$1 @@ -68,7 +54,7 @@ function test_ust_streaming () local file_sync_before_last=$(mktemp -u) diag "Test UST streaming with metadata regeneration" - lttng_create_session_uri + create_lttng_session_uri $SESSION_NAME net://localhost enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} /dev/null 2>&1 & @@ -162,7 +148,7 @@ function test_ust_live () local file_sync_before_last=$(mktemp -u) diag "Test UST live with metadata regeneration (expect failure)" - lttng_create_session_uri_live $SESSION_NAME $TRACE_PATH + create_lttng_session_uri $SESSION_NAME net://localhost --live enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} /dev/null 2>&1 & diff --git a/tests/regression/tools/rotation/test_kernel b/tests/regression/tools/rotation/test_kernel index 0d72f9eae..6f5647f37 100755 --- a/tests/regression/tools/rotation/test_kernel +++ b/tests/regression/tools/rotation/test_kernel @@ -29,14 +29,6 @@ NUM_TESTS=68 source $TESTDIR/utils/utils.sh source $CURDIR/rotate_utils.sh -function lttng_create_session_uri -{ - # Create session with default path - $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME -U net://localhost >/dev/null 2>&1 - - ok $? "Create session $SESSION_NAME" -} - function rotate_kernel_test () { local_path=$1 @@ -72,7 +64,7 @@ function rotate_kernel_test () function test_kernel_streaming () { diag "Test kernel streaming with session rotation" - lttng_create_session_uri + create_lttng_session_uri $SESSION_NAME net://localhost rotate_kernel_test "${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*" clean_path $TRACE_PATH } @@ -99,7 +91,7 @@ function test_kernel_local_timer () function test_kernel_streaming_timer () { diag "Test kernel remote with session rotation timer" - lttng_create_session_uri + create_lttng_session_uri $SESSION_NAME net://localhost lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME lttng_enable_rotation_timer_ok $SESSION_NAME 500ms start_lttng_tracing_ok $SESSION_NAME diff --git a/tests/regression/tools/rotation/test_ust b/tests/regression/tools/rotation/test_ust index 924b04e5c..9c4f923b8 100755 --- a/tests/regression/tools/rotation/test_ust +++ b/tests/regression/tools/rotation/test_ust @@ -46,14 +46,6 @@ function enable_channel_per_pid () enable_ust_lttng_channel_ok $sess_name $channel_name --buffers-pid } -function lttng_create_session_uri () -{ - # Create session with default path - $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME -U net://localhost >/dev/null 2>&1 - - ok $? "Create session $SESSION_NAME" -} - # MUST set TESTDIR before calling those functions function rotate_ust_test () @@ -90,7 +82,7 @@ function rotate_ust_test () function test_ust_streaming_uid () { diag "Test UST streaming with session rotation per UID" - lttng_create_session_uri + create_lttng_session_uri $SESSION_NAME net://localhost enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME rotate_ust_test "${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*" "ust/uid/*/*/" 0 @@ -110,7 +102,7 @@ function test_ust_local_uid () function test_ust_streaming_pid () { diag "Test UST streaming with session rotation per PID" - lttng_create_session_uri + create_lttng_session_uri $SESSION_NAME net://localhost enable_channel_per_pid $SESSION_NAME "channel0" enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME "channel0" @@ -146,7 +138,7 @@ function test_ust_local_timer_uid () function test_ust_streaming_timer_uid () { diag "Test ust remote with session rotation timer per-uid" - lttng_create_session_uri + create_lttng_session_uri $SESSION_NAME net://localhost enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME lttng_enable_rotation_timer_ok $SESSION_NAME 500ms start_lttng_tracing_ok $SESSION_NAME @@ -175,7 +167,7 @@ function test_ust_local_timer_pid () function test_ust_streaming_timer_pid () { diag "Test ust remote with session rotation timer per-pid" - lttng_create_session_uri + create_lttng_session_uri $SESSION_NAME net://localhost enable_channel_per_pid $SESSION_NAME "channel0" enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME "channel0" lttng_enable_rotation_timer_ok $SESSION_NAME 500ms diff --git a/tests/regression/tools/streaming/test_kernel b/tests/regression/tools/streaming/test_kernel index 6bb23d9f5..a2289e053 100755 --- a/tests/regression/tools/streaming/test_kernel +++ b/tests/regression/tools/streaming/test_kernel @@ -28,18 +28,10 @@ NUM_TESTS=10 source $TESTDIR/utils/utils.sh -function lttng_create_session_uri -{ - # Create session with default path - $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME -U net://localhost >/dev/null 2>&1 - - ok $? "Create session $SESSION_NAME" -} - function test_kernel_before_start () { diag "Test kernel streaming with event enable BEFORE start" - lttng_create_session_uri + create_lttng_session_uri $SESSION_NAME net://localhost lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME start_lttng_tracing_ok $SESSION_NAME # Give a second @@ -53,7 +45,7 @@ function test_kernel_before_start () function test_kernel_after_start () { diag "Test kernel streaming with event enable AFTER start" - lttng_create_session_uri + create_lttng_session_uri $SESSION_NAME net://localhost start_lttng_tracing_ok $SESSION_NAME lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME # Give a second diff --git a/tests/regression/tools/streaming/test_ust b/tests/regression/tools/streaming/test_ust index a5d5b5e92..3d43ee1b4 100755 --- a/tests/regression/tools/streaming/test_ust +++ b/tests/regression/tools/streaming/test_ust @@ -37,14 +37,6 @@ if [ ! -x "$TESTAPP_BIN" ]; then BAIL_OUT "No UST events binary detected." fi -function lttng_create_session_uri -{ - # Create session with default path - $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME -U net://localhost >/dev/null 2>&1 - ok $? "Create session with default path" -} - - # MUST set TESTDIR before calling those functions function test_ust_before_start () @@ -53,7 +45,7 @@ function test_ust_before_start () local file_sync_before_last=$(mktemp -u) diag "Test UST streaming BEFORE tracing starts" - lttng_create_session_uri + create_lttng_session_uri $SESSION_NAME net://localhost enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME # Run 5 times with a 1 second delay @@ -77,7 +69,7 @@ function test_ust_after_start () local file_sync_after_first=$(mktemp -u) diag "Test UST streaming AFTER tracing starts" - lttng_create_session_uri + create_lttng_session_uri $SESSION_NAME net://localhost enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME start_lttng_tracing_ok $SESSION_NAME diff --git a/tests/stress/test_multi_sessions_per_uid_5app_streaming b/tests/stress/test_multi_sessions_per_uid_5app_streaming index 3d3558224..637624f66 100755 --- a/tests/stress/test_multi_sessions_per_uid_5app_streaming +++ b/tests/stress/test_multi_sessions_per_uid_5app_streaming @@ -40,15 +40,6 @@ function enable_channel_per_uid() ok $? "Enable channel $channel_name per UID for session $sess_name" } -function lttng_create_session_uri -{ - local name=$1 - - # Create session with default path - $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $name -U net://localhost >/dev/null 2>&1 - ok $? "Create session on net://localhost" -} - function check_sessiond() { if [ -z "$(pgrep --full lt-lttng-sessiond)" ]; then @@ -111,7 +102,7 @@ test_stress() { for b in $(seq 1 $NR_LOOP); do for a in $(seq 1 $NR_SESSION); do - lttng_create_session_uri $SESSION_NAME-$a + create_lttng_session_uri $SESSION_NAME-$a net://localhost check_sessiond check_relayd enable_channel_per_uid $SESSION_NAME-$a $CHANNEL_NAME diff --git a/tests/stress/test_multi_sessions_per_uid_5app_streaming_kill_relayd b/tests/stress/test_multi_sessions_per_uid_5app_streaming_kill_relayd index 0f6e49a9f..00778f83a 100755 --- a/tests/stress/test_multi_sessions_per_uid_5app_streaming_kill_relayd +++ b/tests/stress/test_multi_sessions_per_uid_5app_streaming_kill_relayd @@ -41,15 +41,6 @@ function enable_channel_per_uid() ok $? "Enable channel $channel_name per UID for session $sess_name" } -function lttng_create_session_uri -{ - local name=$1 - - # Create session with default path - $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $name -U net://localhost >/dev/null 2>&1 - ok $? "Create session on net://localhost" -} - function check_sessiond() { if [ -z "$(pgrep --full lt-lttng-sessiond)" ]; then @@ -113,7 +104,7 @@ test_stress() { for b in $(seq 1 $NR_LOOP); do for a in $(seq 1 $NR_SESSION); do - lttng_create_session_uri $SESSION_NAME-$a + create_lttng_session_uri $SESSION_NAME-$a net://localhost check_sessiond check_relayd enable_channel_per_uid $SESSION_NAME-$a $CHANNEL_NAME diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 92ed7b354..c0d32aae5 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -723,6 +723,15 @@ function create_lttng_session_no_output () ok $? "Create session $sess_name in no-output mode" } +function create_lttng_session_uri () { + local sess_name=$1 + local uri=$2 + local opts="${@:3}" + + $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name -U $uri $opts 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST + ok $? "Create session $sess_name with uri:$uri and opts: $opts" +} + function create_lttng_session () { local withtap=$1 -- 2.34.1