From 3910e60db80edb67d66cbe6c0da382579f6a73df Mon Sep 17 00:00:00 2001 From: David Goulet Date: Fri, 5 Sep 2014 15:17:31 -0400 Subject: [PATCH] Fix: disable event for JUL domain Could not be backported from master. Ref. commit is 0dcfcf94b356c12e3936fa27f350896d96724e4e This fixes the disable event for JUL that was not working and fixes the buggy test. Signed-off-by: David Goulet --- src/bin/lttng-sessiond/event.c | 1 + tests/regression/ust/java-jul/test_java_jul | 8 ++++---- tests/utils/utils.sh | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/bin/lttng-sessiond/event.c b/src/bin/lttng-sessiond/event.c index 2ccffae65..280765a5f 100644 --- a/src/bin/lttng-sessiond/event.c +++ b/src/bin/lttng-sessiond/event.c @@ -768,6 +768,7 @@ int event_jul_disable(struct ltt_ust_session *usess, char *event_name) ret = LTTNG_ERR_UST_DISABLE_FAIL; goto error; } + uevent->enabled = 0; ret = jul_disable_event(jevent); if (ret != LTTNG_OK) { diff --git a/tests/regression/ust/java-jul/test_java_jul b/tests/regression/ust/java-jul/test_java_jul index bf3bb0bc2..421c0f51f 100755 --- a/tests/regression/ust/java-jul/test_java_jul +++ b/tests/regression/ust/java-jul/test_java_jul @@ -285,13 +285,13 @@ function test_jul_multi_session_disable() destroy_lttng_session $SESSION_NAME-2 # Validate test. Expecting one event of the second TP. - trace_matches $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME-1 + trace_match_only $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME-1 if [ $? -ne 0 ]; then return $? fi # Validate test. Expecting one event of the second TP. - trace_matches $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME-2 + trace_match_only $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME-2 if [ $? -ne 0 ]; then return $? fi @@ -430,7 +430,7 @@ function test_jul_disable() destroy_lttng_session $SESSION_NAME # Validate test. Expecting one event of the second TP only. - trace_matches $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME + trace_match_only $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME if [ $? -ne 0 ]; then return $? fi @@ -455,7 +455,7 @@ function test_jul_disable_enable() destroy_lttng_session $SESSION_NAME # Validate test. Expecting NR_ITER event of the main INFO tp. - trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH/$SESSION_NAME + trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH/$SESSION_NAME if [ $? -ne 0 ]; then return $? fi diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 9df1c4fe2..8cb664dd5 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -472,3 +472,23 @@ function validate_trace IFS=$OLDIFS return $ret } + +function trace_match_only() +{ + local event_name=$1 + local nr_iter=$2 + local trace_path=$3 + + which $BABELTRACE_BIN >/dev/null + skip $? -ne 0 "Babeltrace binary not found. Skipping trace matches" + + local count=$($BABELTRACE_BIN $trace_path | grep $event_name | wc -l) + local total=$($BABELTRACE_BIN $trace_path | wc -l) + + if [ "$nr_iter" -eq "$count" ] && [ "$total" -eq "$nr_iter" ]; then + pass "Trace match with $total event $event_name" + else + fail "Trace match" + diag "$total event(s) found, expecting $nr_iter of event $event_name and only found $count" + fi +} -- 2.34.1