Skip to contentSkip to conversation

tests: Implement tests for lttng-ust LTTNG_UST_BLOCKING_RETRY_TIMEOUT

PATCH Jérémie Galarneau 1 participant 1 message Dec 1, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Merged in master with a couple of changes.

Jérémie

Quoted 96 lines · Mathieu Desnoyers
---
 configure.ac                                |   1 +
 tests/fast_regression                       |   1 +
 tests/regression/ust/Makefile.am            |   2 +-
 tests/regression/ust/blocking/Makefile.am   |  16 +++
 tests/regression/ust/blocking/test_blocking | 155 ++++++++++++++++++++++++++++
 5 files changed, 174 insertions(+), 1 deletion(-)
 create mode 100644 tests/regression/ust/blocking/Makefile.am
 create mode 100755 tests/regression/ust/blocking/test_blocking
configure.ac +1 -0
index f56a170..06b7e4b 100644
@@ -1021,6 +1021,7 @@ AC_CONFIG_FILES([
        tests/regression/ust/clock-override/Makefile
        tests/regression/ust/type-declarations/Makefile
        tests/regression/ust/rotation-destroy-flush/Makefile
+       tests/regression/ust/blocking/Makefile
        tests/stress/Makefile
        tests/unit/Makefile
        tests/unit/ini_config/Makefile
tests/fast_regression +1 -0
index 23211f4..bbce068 100644
@@ -29,6 +29,7 @@ regression/ust/python-logging/test_python_logging
 regression/ust/getcpu-override/test_getcpu_override
 regression/ust/clock-override/test_clock_override
 regression/ust/rotation-destroy-flush/test_rotation_destroy_flush
+regression/ust/blocking/test_blocking
 regression/ust/test_event_basic
 regression/ust/test_event_tracef
 regression/ust/test_event_perf
tests/regression/ust/Makefile.am +1 -1
index 7686251..06cf97a 100644
@@ -3,7 +3,7 @@ SUBDIRS = nprocesses high-throughput low-throughput before-after multi-session \
                overlap buffers-pid linking daemon exit-fast fork libc-wrapper \
                periodical-metadata-flush java-jul java-log4j python-logging \
                getcpu-override clock-override type-declarations \
-               rotation-destroy-flush
+               rotation-destroy-flush blocking
 
 if HAVE_OBJCOPY
 SUBDIRS += baddr-statedump ust-dl
tests/regression/ust/blocking/Makefile.am new file +16 -0
new file mode 100644
index 0000000..178cc45
@@ -0,0 +1,16 @@
+noinst_SCRIPTS = test_blocking
+EXTRA_DIST = test_blocking
+
+all-local:
+       @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+               for script in $(EXTRA_DIST); do \
+                       cp -f $(srcdir)/$$script $(builddir); \
+               done; \
+       fi
+
+clean-local:
+       @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
+               for script in $(EXTRA_DIST); do \
+                       rm -f $(builddir)/$$script; \
+               done; \
+       fi
tests/regression/ust/blocking/test_blocking new file +19 -0
new file mode 100755
index 0000000..a856046
@@ -0,0 +1,155 @@
+#!/bin/bash
+#
+# Copyright (C) - 2015 Jonathan Rajotte <[email protected]>
+# Copyright (C) - 2016 Mathieu Desnoyers <[email protected]>
+#
+# 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
+TEST_DESC="UST - Blocking mode"
+

tests/regression/ust/blocking/test_blocking line 29

Quoted 10 lines
tests/regression/ust/blocking/test_blocking new file +10 -0
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/../../..
+SESSION_NAME="blocking"
+
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_NAME="gen-ust-events"
+TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
+EVENT_NAME="tp:tptest"
+
+NUM_TESTS=35

Updated to reflect changes below.

Quoted 14 lines
tests/regression/ust/blocking/test_blocking new file +14 -0
+
+source $TESTDIR/utils/utils.sh
+
+# MUST set TESTDIR before calling those functions
+# Run app on CPU 0 to ensure we only write in a single ring buffer.
+function run_app()
+{
+       taskset 0x00000001 $TESTAPP_BIN $NUM_EVENT
+       ok $? "Application done"
+}
+
+function test_ust_implicit_no_blocking()
+{
+       NUM_EVENT=500000

tests/regression/ust/blocking/test_blocking line 53

Quoted 10 lines
tests/regression/ust/blocking/test_blocking new file +10 -0
+       diag "UST implicit non-blocking mode (default): will hang if fails"
+
+       # Test without the plugin
+       start_lttng_sessiond
+       create_lttng_session_no_output $SESSION_NAME
+       enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME"
+       start_lttng_tracing_ok $SESSION_NAME
+       run_app
+       stop_lttng_tracing_ok $SESSION_NAME
+       destroy_lttng_session_ok $SESSION_NAME

stop_lttng_sessiond

Quoted 7 lines
tests/regression/ust/blocking/test_blocking new file +7 -0
+
+       ok 0 "Does not hang"
+}
+
+function test_ust_explicit_no_blocking()
+{
+       NUM_EVENT=500000

tests/regression/ust/blocking/test_blocking line 70

Quoted 10 lines
tests/regression/ust/blocking/test_blocking new file +10 -0
+       diag "UST explicit non-blocking mode: will hang if fails"
+
+       # Test without the plugin
+       start_lttng_sessiond
+       create_lttng_session_no_output $SESSION_NAME
+       enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME"
+       start_lttng_tracing_ok $SESSION_NAME
+       LTTNG_UST_BLOCKING_RETRY_TIMEOUT=0 run_app
+       stop_lttng_tracing_ok $SESSION_NAME
+       destroy_lttng_session_ok $SESSION_NAME

stop_lttng_sessiond

Quoted 7 lines
tests/regression/ust/blocking/test_blocking new file +7 -0
+
+       ok 0 "Does not hang"
+}
+
+function test_ust_timeout_no_blocking()
+{
+       NUM_EVENT=12500

tests/regression/ust/blocking/test_blocking line 87

Quoted 10 lines
tests/regression/ust/blocking/test_blocking new file +10 -0
+       diag "UST 1ms timeout retry mode: will hang if fails"
+
+       start_lttng_sessiond
+       create_lttng_session_no_output $SESSION_NAME
+       enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME"
+       start_lttng_tracing_ok $SESSION_NAME
+       # retry timeout 1ms
+       LTTNG_UST_BLOCKING_RETRY_TIMEOUT=1 run_app
+       stop_lttng_tracing_ok $SESSION_NAME
+       destroy_lttng_session_ok $SESSION_NAME

stop_lttng_sessiond

Quoted 7 lines
tests/regression/ust/blocking/test_blocking new file +7 -0
+
+       ok 0 "Does not hang"
+}
+
+function test_ust_snapshot_no_blocking()
+{
+       NUM_EVENT=500000

tests/regression/ust/blocking/test_blocking line 104

Quoted 10 lines
tests/regression/ust/blocking/test_blocking new file +10 -0
+       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"
+       start_lttng_tracing_ok $SESSION_NAME
+       LTTNG_UST_BLOCKING_RETRY_TIMEOUT=-1 run_app
+       stop_lttng_tracing_ok $SESSION_NAME
+       destroy_lttng_session_ok $SESSION_NAME

stop_lttng_sessiond

Quoted 8 lines
tests/regression/ust/blocking/test_blocking new file +8 -0
+
+       ok 0 "Does not hang"
+}
+
+function test_ust_blocking_no_discard()
+{
+       NUM_EVENT=500000
+       diag "UST blocking mode: no event discarded"

tests/regression/ust/blocking/test_blocking line 122

Quoted 10 lines
tests/regression/ust/blocking/test_blocking new file +10 -0
+
+       # Test without the plugin
+       start_lttng_sessiond
+       create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+       enable_ust_lttng_event_ok $SESSION_NAME "$EVENT_NAME"
+       start_lttng_tracing_ok $SESSION_NAME
+       # infinite retry timeout
+       LTTNG_UST_BLOCKING_RETRY_TIMEOUT=-1 run_app
+       stop_lttng_tracing_ok $SESSION_NAME
+       destroy_lttng_session_ok $SESSION_NAME

stop_lttng_sessiond

Quoted 36 lines
tests/regression/ust/blocking/test_blocking new file +33 -1
+
+       nr_events=$(babeltrace $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"
+}
+
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+TESTS=(
+       "test_ust_implicit_no_blocking"
+       "test_ust_explicit_no_blocking"
+       "test_ust_timeout_no_blocking"
+       "test_ust_snapshot_no_blocking"
+       "test_ust_blocking_no_discard"
+)
+
+TEST_COUNT=${#TESTS[@]}
+i=0
+
+while [ "$i" -lt "$TEST_COUNT" ]; do
+
+       TRACE_PATH=$(mktemp -d)
+
+       # Execute test
+       ${TESTS[$i]}
+
+       rm -rf $TRACE_PATH
+
+       let "i++"
+done
--

2.1.4

Signature · 7 lines
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev