[lttng-dev] [PATCH lttng-tools v3 2/3] Test the parsing of perf raw context

Julien Desfossez jdesfossez at efficios.com
Tue Jul 5 15:50:47 UTC 2016


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 <jdesfossez at efficios.com>
---
 tests/fast_regression                |  1 +
 tests/regression/ust/test_event_perf | 47 ++++++++++++++++++++++++++----------
 2 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/tests/fast_regression b/tests/fast_regression
index 0c4f079..ab5521f 100644
--- a/tests/fast_regression
+++ b/tests/fast_regression
@@ -30,3 +30,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/ust/test_event_perf b/tests/regression/ust/test_event_perf
index 7dc2168..133dafa 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
 
@@ -96,11 +115,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
-- 
1.9.1



More information about the lttng-dev mailing list