From 7cd988f06d15559d0e455f519cc8da814696462e Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Tue, 5 Jul 2016 11:50:47 -0400 Subject: [PATCH] Test the parsing of perf raw context MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Only test the parsing of the new option in fast_regression since the real integration test requires particular hardware and kernel configuration which might not be available. Signed-off-by: Julien Desfossez Signed-off-by: Jérémie Galarneau --- tests/fast_regression | 1 + tests/regression/Makefile.am | 3 +- tests/regression/ust/test_event_perf | 47 ++++++++++++++++++++-------- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/tests/fast_regression b/tests/fast_regression index 8edbecadd..23211f49a 100644 --- a/tests/fast_regression +++ b/tests/fast_regression @@ -31,3 +31,4 @@ regression/ust/clock-override/test_clock_override regression/ust/rotation-destroy-flush/test_rotation_destroy_flush regression/ust/test_event_basic regression/ust/test_event_tracef +regression/ust/test_event_perf diff --git a/tests/regression/Makefile.am b/tests/regression/Makefile.am index f2fa9d7aa..01cff148c 100644 --- a/tests/regression/Makefile.am +++ b/tests/regression/Makefile.am @@ -38,7 +38,8 @@ TESTS += ust/before-after/test_before_after \ ust/getcpu-override/test_getcpu_override \ ust/clock-override/test_clock_override \ ust/test_event_basic \ - ust/test_event_tracef + ust/test_event_tracef \ + ust/test_event_perf endif # HAVE_LIBLTTNG_UST_CTL if PYTHON_BINDING diff --git a/tests/regression/ust/test_event_perf b/tests/regression/ust/test_event_perf index a01418ab5..3328fe8f1 100755 --- a/tests/regression/ust/test_event_perf +++ b/tests/regression/ust/test_event_perf @@ -23,7 +23,7 @@ TESTDIR=$CURDIR/../.. LTTNG_BIN="lttng" SESSION_NAME="perf_counters" EVENT_NAME="tp:tptest" -NUM_TESTS=10 +NUM_TESTS=24 NR_ITER=1 NR_USEC_WAIT=1 TESTAPP_PATH="$TESTDIR/utils/testapp" @@ -42,14 +42,33 @@ function enable_ust_lttng_event_per_chan() ok $? "Enable event $event_name for session $sess_name in channel $chan_name" } -function add_ust_lttng_context() +# Only test parsing of the enabling by raw ID +function test_parsing_raw() { - sess_name="$1" - chan_name="$2" - type="$3" + TRACE_PATH=$(mktemp -d) + SESSION_NAME="ust_event_basic" + CHAN_NAME="mychan" + + create_lttng_session_ok $SESSION_NAME $TRACE_PATH + + enable_ust_lttng_channel_ok $SESSION_NAME $CHAN_NAME + + enable_ust_lttng_event_per_chan $SESSION_NAME $EVENT_NAME $CHAN_NAME - $TESTDIR/../src/bin/lttng/$LTTNG_BIN add-context -s $sess_name -c $chan_name -t $type -u >/dev/null 2>&1 - ok $? "Add context $type for session $sess_name in channel $chan_name" + add_context_ust_ok $SESSION_NAME $CHAN_NAME "perf:thread:raw:r0110:test" + add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:rZZZ:test" + add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:b0110:test" + add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:r0110:" + add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:r0110::" + add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:r:test" + add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:r::" + add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw::" + add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw" + add_context_ust_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:r0110:test:wrong" + + destroy_lttng_session_ok $SESSION_NAME + + rm -rf $TRACE_PATH } function test_event_basic() @@ -64,7 +83,7 @@ function test_event_basic() enable_ust_lttng_event_per_chan $SESSION_NAME $EVENT_NAME $CHAN_NAME - add_ust_lttng_context $SESSION_NAME $CHAN_NAME "perf:thread:page-fault" + add_context_ust_ok $SESSION_NAME $CHAN_NAME "perf:thread:page-fault" start_lttng_tracing_ok @@ -89,11 +108,13 @@ else isroot=0 fi -skip $isroot "Root access is needed. Skipping UST perf tests." ${NUM_TESTS} || -{ - start_lttng_sessiond +start_lttng_sessiond - test_event_basic +test_parsing_raw - stop_lttng_sessiond +skip $isroot "Root access is needed. Skipping UST perf tests." 8 || +{ + test_event_basic } + +stop_lttng_sessiond -- 2.34.1