Test: save/load: pid_tracker basic test
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 9 Apr 2015 20:38:24 +0000 (16:38 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 14 Aug 2015 21:56:48 +0000 (17:56 -0400)
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/regression/tools/save-load/load-42-trackers.lttng [new file with mode: 0644]
tests/regression/tools/save-load/test_load
tests/regression/tools/save-load/test_save

diff --git a/tests/regression/tools/save-load/load-42-trackers.lttng b/tests/regression/tools/save-load/load-42-trackers.lttng
new file mode 100644 (file)
index 0000000..34082df
--- /dev/null
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sessions>
+       <session>
+               <name>load-42-trackers</name>
+               <domains>
+                       <domain>
+                               <type>UST</type>
+                               <buffer_type>PER_UID</buffer_type>
+                               <channels>
+                                       <channel>
+                                               <name>channel0</name>
+                                               <enabled>true</enabled>
+                                               <overwrite_mode>DISCARD</overwrite_mode>
+                                               <subbuffer_size>131072</subbuffer_size>
+                                               <subbuffer_count>4</subbuffer_count>
+                                               <switch_timer_interval>0</switch_timer_interval>
+                                               <read_timer_interval>0</read_timer_interval>
+                                               <output_type>MMAP</output_type>
+                                               <tracefile_size>0</tracefile_size>
+                                               <tracefile_count>0</tracefile_count>
+                                               <live_timer_interval>0</live_timer_interval>
+                                               <events>
+                                                       <event>
+                                                               <name>*</name>
+                                                               <enabled>true</enabled>
+                                                               <type>TRACEPOINT</type>
+                                                               <loglevel_type>ALL</loglevel_type>
+                                                               <loglevel>-1</loglevel>
+                                                       </event>
+                                               </events>
+                                               <contexts/>
+                                       </channel>
+                               </channels>
+                               <trackers>
+                                       <pid_tracker>
+                                               <targets>
+                                                       <pid_target>
+                                                               <pid>666</pid>
+                                                       </pid_target>
+                                               </targets>
+                                       </pid_tracker>
+                               </trackers>
+                       </domain>
+               </domains>
+               <started>false</started>
+               <output>
+                       <consumer_output>
+                               <enabled>true</enabled>
+                               <destination>
+                                       <path>/tmp/lttng/load-42-1</path>
+                               </destination>
+                       </consumer_output>
+               </output>
+       </session>
+</sessions>
index c6234efe1fce443e6f7573079db2f7e05b954983..35955b5387e486d26a33e48ef4b6030c5ee7771a 100755 (executable)
@@ -29,7 +29,7 @@ EVENT_NAME="tp:tptest"
 
 DIR=$(readlink -f $TESTDIR)
 
-NUM_TESTS=21
+NUM_TESTS=26
 
 source $TESTDIR/utils/utils.sh
 
@@ -38,16 +38,6 @@ plan_tests $NUM_TESTS
 
 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"
@@ -70,9 +60,9 @@ function test_complex_load()
 
        # 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
@@ -107,6 +97,7 @@ function test_all_load()
 
        destroy_lttng_session_ok $SESSION_NAME
        destroy_lttng_session_ok "$SESSION_NAME-complex"
+       destroy_lttng_session_ok "$SESSION_NAME-trackers"
 
        stop_lttng_relayd_nocheck
 }
@@ -123,6 +114,31 @@ function test_overwrite()
        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 "//command/output/sessions/session/domains/domain/trackers/pid_tracker/targets/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
 
 TESTS=(
@@ -130,6 +146,7 @@ TESTS=(
        test_complex_load
        test_all_load
        test_overwrite
+       test_trackers
 )
 
 for fct_test in ${TESTS[@]};
index 674d00134a157cb08c05556bd71ce94c8795a223..467722e43b9e2f81e4329fec0a70d101f033f782 100755 (executable)
@@ -29,7 +29,7 @@ EVENT_NAME="tp:tptest"
 
 DIR=$(readlink -f $TESTDIR)
 
-NUM_TESTS=37
+NUM_TESTS=41
 
 source $TESTDIR/utils/utils.sh
 
@@ -68,6 +68,7 @@ function test_basic_save()
        create_lttng_session_ok $SESSION_NAME $TRACE_PATH
        enable_ust_lttng_channel_ok $SESSION_NAME $CHANNEL_NAME
        enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
+       lttng_track_ok "-p 666 -u -s $SESSION_NAME"
 
        lttng_save $SESSION_NAME "-o $TRACE_PATH"
 
@@ -92,6 +93,10 @@ function test_basic_save_all()
        enable_ust_lttng_event_ok $SESSION_NAME-2 $EVENT_NAME $CHANNEL_NAME
        enable_ust_lttng_event_ok $SESSION_NAME-3 $EVENT_NAME $CHANNEL_NAME
 
+       lttng_track_ok "-p 666 -u -s $SESSION_NAME-1"
+       lttng_track_ok "-p 666 -u -s $SESSION_NAME-2"
+       lttng_track_ok "-p 666 -u -s $SESSION_NAME-3"
+
        lttng_save "" "-a -o $TRACE_PATH"
 
        is_session_saved $TRACE_PATH $SESSION_NAME-1
This page took 0.027839 seconds and 4 git commands to generate.