SESSIOND_BIN="lttng-sessiond"
RELAYD_BIN="lttng-relayd"
LTTNG_BIN="lttng"
-export LTTNG_SESSION_CONFIG_XSD_PATH=${TESTDIR}../src/common/config/
+export LTTNG_SESSION_CONFIG_XSD_PATH=$(readlink -m ${TESTDIR}../src/common/config/)
SESSION_NAME="load-42"
EVENT_NAME="tp:tptest"
DIR=$(readlink -f $TESTDIR)
-NUM_TESTS=20
+NUM_TESTS=30
source $TESTDIR/utils/utils.sh
print_test_banner "$TEST_DESC"
-function disable_event()
-{
- local sess_name="$1"
- local chan_name="$2"
- local event_name="$3"
-
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-event "$event_name" -s $sess_name -c $chan_name -u >/dev/null 2>&1
- ok $? "Disable event $event_name for session $sess_name"
-}
-
function test_basic_load()
{
diag "Test basic load"
lttng_load "-i $CURDIR/$SESSION_NAME.lttng"
- destroy_lttng_session $SESSION_NAME
+ destroy_lttng_session_ok $SESSION_NAME
}
function test_complex_load()
{
local sess="$SESSION_NAME-complex"
+ local mi_result=""
+ local ret=1
diag "Test complex load"
# Start relayd with localhost binding. The complex session uses those
# Once loaded, we are suppose to be able to disable certain events/channels
# thus having a confirmation that it's valid
- disable_event $sess chan1 uevent1
- disable_event $sess chan2 uevent2
- disable_event $sess chan3 uevent3*
+ disable_ust_lttng_event $sess uevent1 chan1
+ disable_ust_lttng_event $sess uevent2 chan2
+ disable_ust_lttng_event $sess uevent3* chan3
disable_ust_lttng_channel $sess chan1
disable_ust_lttng_channel $sess chan2
disable_ust_lttng_channel $sess chan3
- destroy_lttng_session $sess
+ # Confirm that an event stored as disabled is restored in its disabled state
+ local mi_output_file=$(mktemp)
+ if [ $? -ne 0 ]; then
+ break;
+ fi
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN --mi XML list $sess -c chan2 > $mi_output_file
+ mi_result=$($CURDIR/../mi/extract_xml $mi_output_file "//lttng:command/lttng:output/lttng:sessions/lttng:session/lttng:domains/lttng:domain[lttng:type='UST']/lttng:channels/lttng:channel[lttng:name='chan2']/lttng:events/lttng:event[lttng:name='uevent_disabled']/lttng:enabled/text()")
+ if [[ $mi_result = "false" ]]; then
+ ok 0 "Disabled event is loaded in disabled state"
+ else
+ fail "Disabled event is loaded in disabled state"
+ fi
+
+ mi_result=$($CURDIR/../mi/extract_xml $mi_output_file "//lttng:command/lttng:output/lttng:sessions/lttng:session/lttng:domains/lttng:domain/lttng:channels/lttng:channel[lttng:name='chan2']/lttng:events/lttng:event[lttng:name='uevent_disabled']/lttng:enabled/text()")
+ test $mi_result = "false"
+ ok $? "Disabled event is loaded in disabled state"
+
+ # Check that uevent_same_name_diff_llevel with log level 6 (TRACE_INFO) is enabled
+ # This ensure that the state of events with similar name but not same
+ # descriptor tuple (exclusion,filter,loglevel) is restored correctly.
+ mi_result=$($CURDIR/../mi/extract_xml $mi_output_file "//lttng:command/lttng:output/lttng:sessions/lttng:session/lttng:domains/lttng:domain/lttng:channels/lttng:channel[lttng:name='chan2']/lttng:events/lttng:event[lttng:name='uevent_same_name_diff_llevel' and lttng:loglevel='TRACE_INFO']/lttng:enabled/text()")
+ test $mi_result = "true"
+ ok $? "Enabled event with same name but different loglevel is in disabled state"
+
+ destroy_lttng_session_ok $sess
- stop_lttng_relayd_nocheck
+ stop_lttng_relayd
}
function test_all_load()
lttng_load "-a -i $CURDIR"
- destroy_lttng_session $SESSION_NAME
- destroy_lttng_session "$SESSION_NAME-complex"
+ destroy_lttng_session_ok $SESSION_NAME
+ destroy_lttng_session_ok "$SESSION_NAME-complex"
+ destroy_lttng_session_ok "$SESSION_NAME-trackers"
- stop_lttng_relayd_nocheck
+ stop_lttng_relayd
}
function test_overwrite()
# This one should succeed
lttng_load "-f -i $CURDIR $SESSION_NAME"
- destroy_lttng_session $SESSION_NAME
+ destroy_lttng_session_ok $SESSION_NAME
+}
+
+function test_trackers()
+{
+ diag "Test trackers loading"
+
+ lttng_load "-i $CURDIR/$SESSION_NAME-trackers.lttng"
+
+ diag "Test pid tracker"
+ local mi_output_file=$(mktemp)
+ if [ $? -ne 0 ]; then
+ break;
+ fi
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN --mi XML list "$SESSION_NAME-trackers" > $mi_output_file
+ mi_result=$($CURDIR/../mi/extract_xml -e $mi_output_file "//lttng:command/lttng:output/lttng:sessions/lttng:session/lttng:domains/lttng:domain/lttng:trackers/lttng:pid_tracker/lttng:targets/lttng:pid_target")
+ if [[ $mi_result = "true" ]]; then
+ ok 0 "Pid target is present"
+ else
+ fail "Pid target missing"
+ fi
+
+ # Test to remove the target just to make sure
+ lttng_untrack_ok "-p 666 -u -s $SESSION_NAME-trackers"
+
+ destroy_lttng_session_ok "$SESSION_NAME-trackers"
}
start_lttng_sessiond
test_complex_load
test_all_load
test_overwrite
+ test_trackers
)
for fct_test in ${TESTS[@]};