Skip to contentSkip to conversation

Test add-context perf raw command

PATCH Mathieu Desnoyers 1 participant 1 message Jun 21, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

What happens if we run this test on other architecture than x86 ?

We should try to test this feature throughout the stack, including tracing and looking at the result, but somehow check that we are on the right architecture to do so.

Thanks,

Mathieu

Quoted 139 lines · ----- On Jun 21, 2016, at 3:21 PM, Julien Desfossez [email protected]…

---
tests/fast_regression | 1 +
tests/regression/ust/test_perf_raw | 103 +++++++++++++++++++++++++++++++++++++

2 files changed, 104 insertions(+)

create mode 100755 tests/regression/ust/test_perf_raw

tests/fast_regression +0 -0
index 0c4f079..a3084d5 100644
@@ -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

tests/fast_regression +1 -0
+regression/ust/test_perf_raw
tests/regression/ust/test_perf_raw new file +62 -3
new file mode 100755
index 0000000..00d7c52
@@ -0,0 +1,103 @@
+#!/bin/bash
+#
+# Copyright (C) - 2016 Julien Desfossez <[email protected]>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License, version 2 only, as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+TEST_DESC="UST tracer - Perf counters"
+
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/../..
+LTTNG_BIN="lttng"
+SESSION_NAME="perf_counters"
+EVENT_NAME="tp:tptest"
+NUM_TESTS=15
+NR_ITER=1
+NR_USEC_WAIT=1
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_NAME="gen-ust-events"
+TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
+
+source $TESTDIR/utils/utils.sh
+
+function enable_ust_lttng_event_per_chan()
+{
+	sess_name="$1"
+	event_name="$2"
+	chan_name="$3"
+
+	$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" -s $sess_name
-c $chan_name -u >/dev/null 2>&1
+	ok $? "Enable event $event_name for session $sess_name in channel $chan_name"
+}
+
+function add_ust_lttng_context_ok()
+{
+	sess_name="$1"
+	chan_name="$2"
+	type="$3"
+
+	$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"
+}
+
+function add_ust_lttng_context_fail()
+{
+	sess_name="$1"
+	chan_name="$2"
+	type="$3"
+
+	$TESTDIR/../src/bin/lttng/$LTTNG_BIN add-context -s $sess_name -c $chan_name
-t $type -u >/dev/null 2>&1
+	test $? -ne "4"
+	ok $? "Add context $type for session $sess_name in channel $chan_name failed

as expected"

tests/regression/ust/test_perf_raw new file +18 -0
+}
+
+# Only test parsing since this feature depends on the counters available on
+# specifics processors and does not work in VM.
+function test_parsing_raw()
+{
+	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
+
+	add_ust_lttng_context_ok $SESSION_NAME $CHAN_NAME "perf:thread:raw:r0110:test"
+	add_ust_lttng_context_fail $SESSION_NAME $CHAN_NAME

"perf:thread:raw:b0110:test"

tests/regression/ust/test_perf_raw new file +7 -0
+	add_ust_lttng_context_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:r0110:"
+	add_ust_lttng_context_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:r0110::"
+	add_ust_lttng_context_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:r:test"
+	add_ust_lttng_context_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw:r::"
+	add_ust_lttng_context_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw::"
+	add_ust_lttng_context_fail $SESSION_NAME $CHAN_NAME "perf:thread:raw"
+	add_ust_lttng_context_fail $SESSION_NAME $CHAN_NAME

"perf:thread:raw:r0110:test:wrong"

tests/regression/ust/test_perf_raw new file +16 -1
+
+	destroy_lttng_session_ok $SESSION_NAME
+
+	rm -rf $TRACE_PATH
+}
+
+# MUST set TESTDIR before calling those functions
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+start_lttng_sessiond
+
+test_parsing_raw
+
+stop_lttng_sessiond
--

1.9.1

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 7 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev