Tests: live/test_{lttng_,}kernel: use lttng_test_filter_event instead of sched_switch
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 9 Jul 2020 20:44:32 +0000 (16:44 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 21 Jul 2020 20:05:32 +0000 (16:05 -0400)
Background
==========
These tests currently rely on system load (the `sched_switch` event) to
generate trace data.

Issue
=====
This is can be problematic for the `test_kernel`
test case because it has a fixed sized buffer to store the trace:
  #define mmap_size 524288

This caused this test failure to randomly happen on my machine:
  ok 7 - Get one index per stream
  # mmap_size not big enough
  not ok 8 - Get one data packet for stream 0, offset 0, len 4096
  #     Failed test (live_test.c:main() at line 709)
  [error] Error detaching viewer session
  not ok 9 - Detach viewer session
  #     Failed test (live_test.c:main() at line 715)

Solution
========
Using the `lttng_test_filter_event` event to control the size and
number of the event expected in the trace rather then depending on how
many Electon apps are currently fighting for my CPUs.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I15d500d5becf9c5e526ae11ff0b2a2f4f6b753ac

tests/regression/tools/live/test_kernel
tests/regression/tools/live/test_lttng_kernel

index 5e4a8d882539f211801d9d5a1137a027a276cc95..25cb0eda17d6dabe3b4846d6ba2daba331a0942b 100755 (executable)
@@ -14,7 +14,7 @@ NR_USEC_WAIT=1
 DELAY_USEC=2000000
 
 SESSION_NAME="live"
 DELAY_USEC=2000000
 
 SESSION_NAME="live"
-EVENT_NAME="sched_switch"
+EVENT_NAME="lttng_test_filter_event"
 
 TRACE_PATH=$(mktemp -d)
 
 
 TRACE_PATH=$(mktemp -d)
 
@@ -47,11 +47,15 @@ else
        exit 0
 fi
 
        exit 0
 fi
 
+modprobe lttng-test
+
 start_lttng_sessiond_notap
 start_lttng_relayd_notap "-o $TRACE_PATH"
 
 setup_live_tracing
 
 start_lttng_sessiond_notap
 start_lttng_relayd_notap "-o $TRACE_PATH"
 
 setup_live_tracing
 
+echo -n "1" > /proc/lttng-test-filter-event
+
 # Start the live test
 $TESTDIR/regression/tools/live/live_test
 
 # Start the live test
 $TESTDIR/regression/tools/live/live_test
 
@@ -59,3 +63,5 @@ clean_live_tracing
 
 stop_lttng_relayd_notap
 stop_lttng_sessiond_notap
 
 stop_lttng_relayd_notap
 stop_lttng_sessiond_notap
+
+modprobe --remove lttng-test
index 5a566d2698919a7a06335cecad1332a4773d2159..ea2a1e4e47c55e96a83e011f885560fe35cee755 100755 (executable)
@@ -12,7 +12,7 @@ TESTDIR=$CURDIR/../../../
 DELAY_USEC=2000000
 
 SESSION_NAME="live"
 DELAY_USEC=2000000
 
 SESSION_NAME="live"
-EVENT_NAME="sched_switch"
+EVENT_NAME="lttng_test_filter_event"
 
 TRACE_PATH=$(mktemp -d)
 
 
 TRACE_PATH=$(mktemp -d)
 
@@ -53,13 +53,14 @@ fi
 
 skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
 {
 
 skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
 {
+       modprobe lttng-test
+
        start_lttng_sessiond
        start_lttng_relayd "-o $TRACE_PATH"
 
        setup_live_tracing
 
        start_lttng_sessiond
        start_lttng_relayd "-o $TRACE_PATH"
 
        setup_live_tracing
 
-       # Just hit some events
-       sleep 2
+       echo -n "1" > /proc/lttng-test-filter-event
 
        clean_live_tracing
 
 
        clean_live_tracing
 
@@ -68,4 +69,6 @@ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
 
        stop_lttng_relayd
        stop_lttng_sessiond
 
        stop_lttng_relayd
        stop_lttng_sessiond
+
+       modprobe --remove lttng-test
 }
 }
This page took 0.026482 seconds and 4 git commands to generate.