From f9baf1797df8caf055d884a882f9e207be0f678e Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Thu, 9 Apr 2015 16:38:24 -0400 Subject: [PATCH] Test: save/load: pid_tracker basic test MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- .../tools/save-load/load-42-trackers.lttng | 55 +++++++++++++++++++ tests/regression/tools/save-load/test_load | 45 ++++++++++----- tests/regression/tools/save-load/test_save | 7 ++- 3 files changed, 92 insertions(+), 15 deletions(-) create mode 100644 tests/regression/tools/save-load/load-42-trackers.lttng 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 index 000000000..34082dfa0 --- /dev/null +++ b/tests/regression/tools/save-load/load-42-trackers.lttng @@ -0,0 +1,55 @@ + + + + load-42-trackers + + + UST + PER_UID + + + channel0 + true + DISCARD + 131072 + 4 + 0 + 0 + MMAP + 0 + 0 + 0 + + + * + true + TRACEPOINT + ALL + -1 + + + + + + + + + + 666 + + + + + + + false + + + true + + /tmp/lttng/load-42-1 + + + + + diff --git a/tests/regression/tools/save-load/test_load b/tests/regression/tools/save-load/test_load index c6234efe1..35955b538 100755 --- a/tests/regression/tools/save-load/test_load +++ b/tests/regression/tools/save-load/test_load @@ -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[@]}; diff --git a/tests/regression/tools/save-load/test_save b/tests/regression/tools/save-load/test_save index 674d00134..467722e43 100755 --- a/tests/regression/tools/save-load/test_save +++ b/tests/regression/tools/save-load/test_save @@ -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 -- 2.34.1