[lttng-dev] [PATCH lttng-tools 2/2] Test kernel wildcards
Jérémie Galarneau
jeremie.galarneau at efficios.com
Sat Sep 5 17:08:53 EDT 2015
This test hangs here on the latest lttng-modules (89406ecda) and Linux 4.1.6.
$ sudo ./tests/regression/tools/wildcard/test_event_wildcard
1..76
# LTTng - Event wildcard test
ok 1 - Start session daemon
# Test UST wildcard
ok 2 - Create session wildcard in /tmp/tmp.bMYvA8LmhA
ok 3 - Enable event tp:tp* for session wildcard
ok 4 - Start tracing for session
ok 5 - Traced application stopped.
ok 6 - Stop lttng tracing for session
ok 7 - Destroy session wildcard
ok 8 - Trace match
ok 9 - Create session wildcard in /tmp/tmp.40lme2ZfE2
ok 10 - Enable event * for session wildcard
ok 11 - Start tracing for session
ok 12 - Traced application stopped.
ok 13 - Stop lttng tracing for session
ok 14 - Destroy session wildcard
ok 15 - Trace match
ok 16 - Create session wildcard in /tmp/tmp.Px1eQtqdJX
ok 17 - Enable event tp:tptest* for session wildcard
ok 18 - Start tracing for session
ok 19 - Traced application stopped.
ok 20 - Stop lttng tracing for session
ok 21 - Destroy session wildcard
ok 22 - Trace match
ok 23 - Create session wildcard in /tmp/tmp.UExqHOU7iV
ok 24 - Enable event tp:abc* for session wildcard
ok 25 - Start tracing for session
ok 26 - Traced application stopped.
ok 27 - Stop lttng tracing for session
ok 28 - Destroy session wildcard
ok 29 - Validate empty trace
ok 30 - Create session wildcard in /tmp/tmp.Rvxoa79wgE
ok 31 - Enable ust event tp:*tp for session on channel failed as expected
ok 32 - Destroy session wildcard
ok 33 - Create session wildcard in /tmp/tmp.kQ9mPvTWXL
ok 34 - Enable ust event tp:tp** for session on channel failed as expected
ok 35 - Destroy session wildcard
ok 36 - Create session wildcard in /tmp/tmp.FBm6SWo0ov
ok 37 - Enable ust event *tp:tp* for session on channel failed as expected
ok 38 - Destroy session wildcard
# Test kernel wildcards
ok 39 - Create session wildcard in /tmp/tmp.BDcvQm9jEG
^ Hangs here.
It eventually times out with:
Error: Condition timed out. The consumer thread was never ready. Killing it
Error: Fatal error spawning consumer control thread
PERROR - 17:07:40.767365 [6552/6555]: sendmsg: Broken pipe (in
lttcomm_send_unix_sock() at unix.c:219)
Error: Failed to send data back to client
Any idea?
Jérémie
On Fri, Sep 4, 2015 at 7:53 PM, Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> ---
> .../regression/tools/wildcard/test_event_wildcard | 87 ++++++++++++++++------
> tests/utils/utils.sh | 37 +++++++--
> 2 files changed, 96 insertions(+), 28 deletions(-)
>
> diff --git a/tests/regression/tools/wildcard/test_event_wildcard b/tests/regression/tools/wildcard/test_event_wildcard
> index 7fbfc18..126bdae 100755
> --- a/tests/regression/tools/wildcard/test_event_wildcard
> +++ b/tests/regression/tools/wildcard/test_event_wildcard
> @@ -16,37 +16,47 @@
> # this program; if not, write to the Free Software Foundation, Inc., 51
> # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
>
> -TEST_DESC="UST tracer - Event wildcard"
> +TEST_DESC="LTTng - Event wildcard test"
>
> CURDIR=$(dirname $0)/
> -TESTDIR=$CURDIR/../..
> +TESTDIR=$CURDIR/../../..
> LTTNG_BIN="lttng"
> TESTAPP_PATH="$TESTDIR/utils/testapp"
> TESTAPP_NAME="gen-ust-events"
> TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
> SESSION_NAME="wildcard"
> -EVENT_NAME="tp:tptest"
> -NUM_TESTS=39
> NR_ITER=100
> +NUM_GLOBAL_TESTS=2
> +NUM_UST_TESTS=37
> +NUM_KERNEL_TESTS=37
> +NUM_TESTS=$(($NUM_UST_TESTS+$NUM_KERNEL_TESTS+$NUM_GLOBAL_TESTS))
>
> source $TESTDIR/utils/utils.sh
>
> -if [ ! -x "$TESTAPP_BIN" ]; then
> - BAIL_OUT "No UST nevents binary detected."
> -fi
> +function run_ust
> +{
> + $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
> +}
> +
> +function run_kernel
> +{
> + # Trigger the event for 100 iterations
> + echo -n "100" > /proc/lttng-test-filter-event
> +}
>
> function test_event_wildcard()
> {
> TRACE_PATH=$(mktemp -d)
> - FIND="${1}"
> - WILDCARD="${2}"
> + DOMAIN="$1"
> + FIND="$2"
> + WILDCARD="$3"
>
> create_lttng_session_ok $SESSION_NAME $TRACE_PATH
> - enable_ust_lttng_event_ok $SESSION_NAME "$WILDCARD"
> + enable_${DOMAIN}_lttng_event_ok $SESSION_NAME "$WILDCARD"
>
> start_lttng_tracing_ok
>
> - $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
> + run_${DOMAIN}
> ok $? "Traced application stopped."
>
> stop_lttng_tracing_ok
> @@ -64,16 +74,16 @@ function test_event_wildcard()
> function test_event_wildcard_fail()
> {
> TRACE_PATH=$(mktemp -d)
> - WILDCARD="${1}"
> + DOMAIN="$1"
> + WILDCARD="$2"
>
> create_lttng_session_ok $SESSION_NAME $TRACE_PATH
> - enable_ust_lttng_event_fail $SESSION_NAME "$WILDCARD"
> + enable_${DOMAIN}_lttng_event_fail $SESSION_NAME "$WILDCARD"
> destroy_lttng_session_ok $SESSION_NAME
>
> rm -rf $TRACE_PATH
> }
>
> -
> # MUST set TESTDIR before calling those functions
> plan_tests $NUM_TESTS
>
> @@ -81,13 +91,48 @@ print_test_banner "$TEST_DESC"
>
> start_lttng_sessiond
>
> -test_event_wildcard 1 'tp:tp*'
> -test_event_wildcard 1 '*'
> -test_event_wildcard 1 'tp:tptest*'
> -test_event_wildcard 0 'tp:abc*'
> +diag "Test UST wildcard"
> +
> +if [ ! -x "$TESTAPP_BIN" ]; then
> + BAIL_OUT "No UST nevents binary detected."
> +fi
> +
> +EVENT_NAME="tp:tptest"
> +
> +test_event_wildcard ust 1 'tp:tp*'
> +test_event_wildcard ust 1 '*'
> +test_event_wildcard ust 1 'tp:tptest*'
> +test_event_wildcard ust 0 'tp:abc*'
> +
> +test_event_wildcard_fail ust 'tp:*tp'
> +test_event_wildcard_fail ust 'tp:tp**'
> +test_event_wildcard_fail ust '*tp:tp*'
> +
> +
> +if [ "$(id -u)" == "0" ]; then
> + isroot=1
> +else
> + isroot=0
> +fi
>
> -test_event_wildcard_fail 'tp:*tp'
> -test_event_wildcard_fail 'tp:tp**'
> -test_event_wildcard_fail '*tp:tp*'
> +skip $isroot "Root access is needed. Skipping all kernel wildcard tests." $NUM_KERNEL_TESTS ||
> +{
> + diag "Test kernel wildcards"
> +
> + modprobe lttng-test
> +
> + EVENT_NAME="lttng_test_filter_event"
> +
> + test_event_wildcard kernel 1 'lttng_test_*'
> + test_event_wildcard kernel 1 '*'
> + test_event_wildcard kernel 1 'lttng_test_filter_event*'
> + test_event_wildcard kernel 0 'lttng_test_asdfasdf*'
> +
> + test_event_wildcard_fail kernel 'tp_*tp'
> + test_event_wildcard_fail kernel 'tp_tp**'
> + test_event_wildcard_fail kernel '*tp_tp*'
> +
> + rmmod lttng-test
> +}
>
> stop_lttng_sessiond
> diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh
> index 1e1e791..d466ee6 100644
> --- a/tests/utils/utils.sh
> +++ b/tests/utils/utils.sh
> @@ -86,18 +86,19 @@ function randstring()
> echo
> }
>
> -function lttng_enable_kernel_event
> +function enable_kernel_lttng_event
> {
> - local sess_name=$1
> - local event_name=$2
> - local channel_name=$3
> + local expected_to_fail="$1"
> + local sess_name="$2"
> + local event_name="$3"
> + local channel_name="$4"
>
> - if [ -z $event_name ]; then
> + if [ -z "$event_name" ]; then
> # Enable all event if no event name specified
> event_name="-a"
> fi
>
> - if [ -z $channel_name ]; then
> + if [ -z "$channel_name" ]; then
> # default channel if none specified
> chan=""
> else
> @@ -105,7 +106,29 @@ function lttng_enable_kernel_event
> fi
>
> $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" $chan -s $sess_name -k 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
> - ok $? "Enable kernel event $event_name for session $sess_name"
> + ret=$?
> + if [[ $expected_to_fail -eq "1" ]]; then
> + test $ret -ne "0"
> + ok $? "Enable kernel event $event_name for session $session_name on channel $channel_name failed as expected"
> + else
> + ok $ret "Enable kernel event $event_name for session $sess_name"
> + fi
> +}
> +
> +function enable_kernel_lttng_event_ok ()
> +{
> + enable_kernel_lttng_event 0 "$@"
> +}
> +
> +function enable_kernel_lttng_event_fail ()
> +{
> + enable_kernel_lttng_event 1 "$@"
> +}
> +
> +# Old interface
> +function lttng_enable_kernel_event
> +{
> + enable_kernel_lttng_event_ok "$@"
> }
>
> function lttng_enable_kernel_syscall()
> --
> 2.1.4
>
--
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list