Skip to contentSkip to conversation

Test: enable kernel events after start

PATCH New Julien Desfossez 2 participants 2 messages Aug 4, 2013 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

PATCH 2/2 Test: enable kernel events after start

This test detects if we actually append new metadata when enabling a kernel event after a start.

---
 tests/regression/kernel/test_event_basic |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
tests/regression/kernel/test_event_basic +23 -1
index 5c19744..a182f9f 100755
@@ -19,7 +19,7 @@ TEST_DESC="Kernel tracer - Basic event"
 
 CURDIR=$(dirname $0)/
 TESTDIR=$CURDIR/../..
-NUM_TESTS=12
+NUM_TESTS=20
 
 source $TESTDIR/utils/utils.sh
 
@@ -46,6 +46,27 @@ function test_event_basic()
 	rm -rf $TRACE_PATH
 }
 
+function test_enable_after_start()
+{
+	TRACE_PATH=$(mktemp -d)
+	SESSION_NAME="kernel_enable_after_start"
+
+	create_lttng_session $SESSION_NAME $TRACE_PATH
+
+	lttng_enable_kernel_event $SESSION_NAME "sched_switch"
+
+	start_lttng_tracing
+	lttng_enable_kernel_event $SESSION_NAME "sched_process_exit"
+	stop_lttng_tracing
+
+	validate_trace "sched_switch" $TRACE_PATH
+	validate_trace "sched_process_exit" $TRACE_PATH
+
+	destroy_lttng_session $SESSION_NAME
+
+	rm -rf $TRACE_PATH
+}
+
 # MUST set TESTDIR before calling those functions
 plan_tests $NUM_TESTS
 
@@ -62,6 +83,7 @@ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
 	start_lttng_sessiond
 
 	test_event_basic
+	test_enable_after_start
 
 	stop_lttng_sessiond
 }
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [LTTNG-TOOLS 2.3 PATCH 1/2] Fix: return code of get_subbuff on metadata stream

In reply to a message not in the archive
Quoted 4 lines · * Julien Desfossez ([email protected]) wrote:

If no metadata is available on the kernel metadata stream when we do a get_subbuff, the kernel returns -EPERM, the consumer was not checking for this return code and closed the stream prematurely. It worked if no new metadata was added during the session.

Is the proper fix to change lttng-tools or lttng-modules ?

I would rather think that lttng-modules should return -ENODATA rather than -EPERM in this case. It's clearly not a permission issue.

Thoughts ?

Thanks,

Mathieu

Quoted 23 lines
---
 src/common/consumer.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/common/consumer.c +2 -1
index 4b657f3..a070f36 100644
@@ -2288,7 +2288,8 @@ restart:
 				} while (len > 0);
 
 				/* It's ok to have an unavailable sub-buffer */
-				if (len < 0 && len != -EAGAIN && len != -ENODATA) {
+				if (len < 0 && len != -EAGAIN && len != -ENODATA &&
+						len != -EPERM) {
 					/* Clean up stream from consumer and free it. */
 					lttng_poll_del(&events, stream->wait_fd);
 					consumer_del_metadata_stream(stream, metadata_ht);
Signature · 1 line
1.7.10.4
Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com