X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Fregression%2Fust%2Fblocking%2Ftest_blocking;h=9b36af23f8e3818d2041297b63c37fc27a3df410;hb=8d5a3312b34841f1ecba2605acad3eaca79fd5e4;hp=261e0b8b3f3f40d72dbd96f18a163f077a5e51ec;hpb=de7e372efecc2cf51921f2ac5a657337e04a39d3;p=lttng-tools.git diff --git a/tests/regression/ust/blocking/test_blocking b/tests/regression/ust/blocking/test_blocking index 261e0b8b3..9b36af23f 100755 --- a/tests/regression/ust/blocking/test_blocking +++ b/tests/regression/ust/blocking/test_blocking @@ -1,32 +1,23 @@ #!/bin/bash # -# Copyright (C) - 2015 Jonathan Rajotte -# Copyright (C) - 2016 Mathieu Desnoyers +# Copyright (C) 2015 Jonathan Rajotte +# Copyright (C) 2016 Mathieu Desnoyers # -# This library is free software; you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free -# Software Foundation; version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -# details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this library; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# SPDX-License-Identifier: LGPL-2.1-only + TEST_DESC="UST - Blocking mode" CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../../.. SESSION_NAME="blocking" +CHANNEL_NAME="testchan" TESTAPP_PATH="$TESTDIR/utils/testapp" TESTAPP_NAME="gen-ust-events" TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" EVENT_NAME="tp:tptest" -NUM_TESTS=45 +NUM_TESTS=49 source $TESTDIR/utils/utils.sh @@ -34,17 +25,17 @@ source $TESTDIR/utils/utils.sh # Run app on CPU 0 to ensure we only write in a single ring buffer. function run_app() { - taskset 0x00000001 $TESTAPP_BIN $NUM_EVENT + taskset 0x00000001 $TESTAPP_BIN -i $NUM_EVENT ok $? "Application done" } function test_ust_implicit_no_blocking() { - NUM_EVENT=500000 + NUM_EVENT=5000000 diag "UST implicit non-blocking mode (default): will hang if fails" - # Test without the plugin start_lttng_sessiond + # session in no-output mode create_lttng_session_no_output $SESSION_NAME enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME" start_lttng_tracing_ok $SESSION_NAME @@ -56,17 +47,18 @@ function test_ust_implicit_no_blocking() ok 0 "Does not hang" } -function test_ust_explicit_no_blocking() +function test_ust_implicit_no_blocking_with_channel_blocking() { - NUM_EVENT=500000 - diag "UST explicit non-blocking mode: will hang if fails" + NUM_EVENT=5000000 + diag "UST implicit non-blocking mode (default) with blocking-timeout=inf channel: will hang if fails" - # Test without the plugin start_lttng_sessiond + # session in no-output mode create_lttng_session_no_output $SESSION_NAME - enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME" + enable_ust_lttng_channel_ok $SESSION_NAME $CHANNEL_NAME "--blocking-timeout=inf" + enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME" $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - LTTNG_UST_BLOCKING_RETRY_TIMEOUT=0 run_app + run_app stop_lttng_tracing_ok $SESSION_NAME destroy_lttng_session_ok $SESSION_NAME stop_lttng_sessiond @@ -77,14 +69,16 @@ function test_ust_explicit_no_blocking() function test_ust_timeout_no_blocking() { NUM_EVENT=12500 - diag "UST 1ms timeout retry mode: will hang if fails" + diag "UST 1ms timeout blocking mode: will hang if fails" start_lttng_sessiond + # session in no-output mode create_lttng_session_no_output $SESSION_NAME - enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME" + # blocking timeout 1ms + enable_ust_lttng_channel_ok $SESSION_NAME $CHANNEL_NAME "--blocking-timeout=1000" + enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME" $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - # retry timeout 1ms - LTTNG_UST_BLOCKING_RETRY_TIMEOUT=1 run_app + LTTNG_UST_ALLOW_BLOCKING=1 run_app stop_lttng_tracing_ok $SESSION_NAME destroy_lttng_session_ok $SESSION_NAME stop_lttng_sessiond @@ -94,15 +88,17 @@ function test_ust_timeout_no_blocking() function test_ust_snapshot_no_blocking() { - NUM_EVENT=500000 + NUM_EVENT=5000000 diag "UST blocking mode: don't block in snapshot mode" # Test without the plugin start_lttng_sessiond create_lttng_session_ok $SESSION_NAME $TRACE_PATH --snapshot - enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME" + # blocking timeout 1ms + enable_ust_lttng_channel_ok $SESSION_NAME $CHANNEL_NAME "--blocking-timeout=1000" + enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME" $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - LTTNG_UST_BLOCKING_RETRY_TIMEOUT=-1 run_app + LTTNG_UST_ALLOW_BLOCKING=1 run_app stop_lttng_tracing_ok $SESSION_NAME destroy_lttng_session_ok $SESSION_NAME stop_lttng_sessiond @@ -112,21 +108,22 @@ function test_ust_snapshot_no_blocking() function test_ust_blocking_no_discard() { - NUM_EVENT=500000 + NUM_EVENT=5000000 diag "UST blocking mode: no event discarded" # Test without the plugin start_lttng_sessiond create_lttng_session_ok $SESSION_NAME $TRACE_PATH - enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME" + # infinite blocking timeout + enable_ust_lttng_channel_ok $SESSION_NAME $CHANNEL_NAME "--blocking-timeout=inf" + enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME" $CHANNEL_NAME start_lttng_tracing_ok $SESSION_NAME - # infinite retry timeout - LTTNG_UST_BLOCKING_RETRY_TIMEOUT=-1 run_app + LTTNG_UST_ALLOW_BLOCKING=1 run_app stop_lttng_tracing_ok $SESSION_NAME destroy_lttng_session_ok $SESSION_NAME stop_lttng_sessiond - nr_events=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l) + nr_events=$("$BABELTRACE_BIN" $TRACE_PATH 2>/dev/null | wc -l) test $nr_events -eq $NUM_EVENT ok $? "No event lost with UST blocking mode: found $nr_events expect $NUM_EVENT" @@ -136,9 +133,11 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" +bail_out_if_no_babeltrace + TESTS=( "test_ust_implicit_no_blocking" - "test_ust_explicit_no_blocking" + "test_ust_implicit_no_blocking_with_channel_blocking" "test_ust_timeout_no_blocking" "test_ust_snapshot_no_blocking" "test_ust_blocking_no_discard" @@ -149,7 +148,7 @@ i=0 while [ "$i" -lt "$TEST_COUNT" ]; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp -d -t tmp.test_blocking_ust_trace_path.XXXXXX) # Execute test ${TESTS[$i]}