summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2021-10-11 11:40:36 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-10-29 11:17:26 +0100
commitbe011b75c0f67d1dad1dd288de3f697cab79b3a0 (patch)
tree31e02e06113d3605cfe1689da875d80b5e77d653 /meta/recipes-kernel/lttng
parent984e5e04aa291baf14c08a33277156db7559385e (diff)
downloadpoky-be011b75c0f67d1dad1dd288de3f697cab79b3a0.tar.gz
lttng-tools: replace ad hoc ptest fixup with upstream fixes
(From OE-Core rev: e9613ecfcec8b606b05407b6199806df7ac18e9b) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 87fd3080c86f6987e4403a2cb8263564f6e1ac4f) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel/lttng')
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools/0001-Fix-Tests-race-condition-in-test_event_tracker.patch221
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools/0001-tests-wait-some-more-before-analysing-traces-or-star.patch88
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools/0002-Fix-Tests-race-condition-in-test_ns_contexts_change.patch46
-rw-r--r--meta/recipes-kernel/lttng/lttng-tools_2.13.0.bb3
4 files changed, 269 insertions, 89 deletions
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-Tests-race-condition-in-test_event_tracker.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-Tests-race-condition-in-test_event_tracker.patch
new file mode 100644
index 0000000000..10020e1ecf
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-tools/0001-Fix-Tests-race-condition-in-test_event_tracker.patch
@@ -0,0 +1,221 @@
1From d3392e4850532c02e53e3c3ff1cc27df7e51c941 Mon Sep 17 00:00:00 2001
2From: Francis Deslauriers <francis.deslauriers@efficios.com>
3Date: Tue, 7 Sep 2021 17:10:31 -0400
4Subject: [PATCH 1/2] Fix: Tests: race condition in test_event_tracker
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Background
10==========
11The `test_event_tracker` file contains test cases when the event
12generating app in executed in two distinct steps. Those two steps are
13preparation and execution.
14 1. the preparation is the launching the app in the background, and
15 2. the execution is actually generating the event that should or
16 should not be traced depending on the test case.
17
18This is useful to test the tracker feature since we want to ensure that
19already running apps are notified properly when changing their tracking
20status.
21
22Issue
23=====
24The `test_event_vpid_track_untrack` test case suffers from a race
25condition that is easy to reproduce on Yocto.
26
27The issue is that sometimes events are end up the trace when none is
28expected.
29
30This is due to the absence of synchronization point at the launch of the
31app which leads to the app being scheduled in-between the track-untrack
32calls leading to events being recorded to the trace.
33
34It's easy to reproduce this issue on my machine by adding a `sleep 5`
35between the track and untrack calls and setting the `NR_USEC_WAIT`
36variable to 1.
37
38Fix
39===
40Using the testapp `--sync-before-last-event-touch` flag to make the app
41create a file when all but the last event are executed. We then have the
42app wait until we create a file (`--sync-before-last-event`) to generate
43that last event. This way, we are sure no event will be generated when
44running the track and untrack commands.
45
46Notes
47=====
48- This issue affects other test cases in this file.
49- This commit fixes a typo in the test header.
50- This commit adds `diag` calls to help tracking to what test the output
51 relates to when reading the log.
52
53Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
54Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
55Change-Id: Ia2b68128dc9a805526f9748f31ec2c2d95566f31
56Upstream-Status: Backport
57Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
58---
59 .../tools/tracker/test_event_tracker | 56 ++++++++++++++-----
60 1 file changed, 42 insertions(+), 14 deletions(-)
61
62diff --git a/tests/regression/tools/tracker/test_event_tracker b/tests/regression/tools/tracker/test_event_tracker
63index feb3787..cc0f698 100755
64--- a/tests/regression/tools/tracker/test_event_tracker
65+++ b/tests/regression/tools/tracker/test_event_tracker
66@@ -5,7 +5,7 @@
67 #
68 # SPDX-License-Identifier: GPL-2.0-only
69
70-TEST_DESC="LTTng - Event traker test"
71+TEST_DESC="LTTng - Event tracker test"
72
73 CURDIR=$(dirname "$0")/
74 TESTDIR="$CURDIR/../../.."
75@@ -15,7 +15,7 @@ TESTAPP_KERNEL_NAME="gen-kernel-test-events"
76 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
77 TESTAPP_KERNEL_BIN="$TESTAPP_PATH/$TESTAPP_KERNEL_NAME/$TESTAPP_KERNEL_NAME"
78 SESSION_NAME="tracker"
79-NR_ITER=100
80+NR_ITER=1
81 NUM_GLOBAL_TESTS=2
82 NUM_UST_TESTS=283
83 NUM_KERNEL_TESTS=462
84@@ -30,27 +30,41 @@ SCRIPT_GROUPNAME="$(id -gn)"
85
86 CHILD_PID=-1
87 WAIT_PATH=
88-AFTER_FIRST_PATH=
89-BEFORE_LAST_PATH=
90+TOUCH_BEFORE_LAST_PATH=
91+SYNC_BEFORE_LAST_PATH=
92
93 source $TESTDIR/utils/utils.sh
94
95+# Launch the testapp and execute it up until right before the last event. It is
96+# useful to do it in two seperate steps in order to test tracking and
97+# untracking on an active app.
98 function prepare_ust_app
99 {
100- AFTER_FIRST_PATH=$(mktemp --tmpdir -u tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX)
101- BEFORE_LAST_PATH=$(mktemp --tmpdir -u tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX)
102+ TOUCH_BEFORE_LAST_PATH=$(mktemp --tmpdir -u tmp.${FUNCNAME[0]}_touch_before_last.XXXXXX)
103+ SYNC_BEFORE_LAST_PATH=$(mktemp --tmpdir -u tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX)
104+
105+ $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
106+ --sync-before-last-event-touch "$TOUCH_BEFORE_LAST_PATH" \
107+ --sync-before-last-event "$SYNC_BEFORE_LAST_PATH" &
108
109- $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT -a "$AFTER_FIRST_PATH" -b "$BEFORE_LAST_PATH" &
110 CHILD_PID=$!
111+
112+ # Wait for the app to execute all the way to right before the last
113+ # event.
114+ while [ ! -f "${TOUCH_BEFORE_LAST_PATH}" ]; do
115+ sleep 0.5
116+ done
117 }
118
119+# Generate the last event.
120 function trace_ust_app
121 {
122- touch "$BEFORE_LAST_PATH"
123- wait
124+ # Ask the test app to generate the last event.
125+ touch "$SYNC_BEFORE_LAST_PATH"
126+ wait "$CHILD_PID"
127 ok $? "Traced application stopped."
128- rm "$BEFORE_LAST_PATH"
129- rm "$AFTER_FIRST_PATH"
130+ rm "$SYNC_BEFORE_LAST_PATH"
131+ rm "$TOUCH_BEFORE_LAST_PATH"
132 }
133
134 function prepare_kernel_app
135@@ -64,7 +78,7 @@ function prepare_kernel_app
136 function trace_kernel_app
137 {
138 touch "$WAIT_PATH"
139- wait
140+ wait "$CHILD_PID"
141 ok $? "Traced application stopped."
142 rm "$WAIT_PATH"
143 }
144@@ -78,6 +92,8 @@ function test_event_tracker()
145 local tracker="$4"
146 local channel=''
147
148+ diag "${FUNCNAME[0]} $*"
149+
150 trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
151
152 create_lttng_session_ok $SESSION_NAME "$trace_path"
153@@ -117,6 +133,8 @@ function test_event_vpid_tracker()
154 local wildcard="$3"
155 local channel=''
156
157+ diag "${FUNCNAME[0]} $*"
158+
159 trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
160
161 create_lttng_session_ok $SESSION_NAME "$trace_path"
162@@ -160,6 +178,8 @@ function test_event_pid_tracker()
163 local wildcard="$3"
164 local channel=''
165
166+ diag "${FUNCNAME[0]} $*"
167+
168 trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
169
170 create_lttng_session_ok $SESSION_NAME "$trace_path"
171@@ -203,6 +223,8 @@ function test_event_tracker_fail()
172 local wildcard="$2"
173 local tracker="$3"
174
175+ diag "${FUNCNAME[0]} $*"
176+
177 trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
178
179 create_lttng_session_ok $SESSION_NAME "$trace_path"
180@@ -222,6 +244,8 @@ function test_event_track_untrack()
181 local tracker="$4"
182 local channel=''
183
184+ diag "${FUNCNAME[0]} $*"
185+
186 trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
187
188 create_lttng_session_ok $SESSION_NAME "$trace_path"
189@@ -262,6 +286,8 @@ function test_event_vpid_track_untrack()
190 local wildcard="$3"
191 local channel=''
192
193+ diag "${FUNCNAME[0]} $*"
194+
195 trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
196
197 create_lttng_session_ok $SESSION_NAME "$trace_path"
198@@ -302,6 +328,8 @@ function test_event_pid_track_untrack()
199 local wildcard="$3"
200 local channel=''
201
202+ diag "${FUNCNAME[0]} $*"
203+
204 trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
205
206 create_lttng_session_ok $SESSION_NAME "$trace_path"
207@@ -336,9 +364,9 @@ function test_event_pid_track_untrack()
208
209 function test_event_ust_vpid_untrack_snapshot()
210 {
211- local trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
212+ diag "${FUNCNAME[0]} $*"
213
214- diag "Test_event_ust_vpid_untrack_snapshot"
215+ local trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX)
216
217 create_lttng_session_ok $SESSION_NAME "$trace_path" "--snapshot"
218
219--
2202.20.1
221
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0001-tests-wait-some-more-before-analysing-traces-or-star.patch b/meta/recipes-kernel/lttng/lttng-tools/0001-tests-wait-some-more-before-analysing-traces-or-star.patch
deleted file mode 100644
index c4cac9cc58..0000000000
--- a/meta/recipes-kernel/lttng/lttng-tools/0001-tests-wait-some-more-before-analysing-traces-or-star.patch
+++ /dev/null
@@ -1,88 +0,0 @@
1From 8d9daede0882d239b0a47b0f7a6db68ba4934a7d Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex@linutronix.de>
3Date: Sat, 4 Sep 2021 13:57:39 +0200
4Subject: [PATCH] tests: wait some more before analysing traces or starting
5 tracing
6
7Otherwise, there are sporadic race failures where lttng tracing
8is stopped before all expected events are collected or is started too soon, e.g.:
9
10PASS: tools/tracker/test_event_tracker 205 - Traced application stopped.
11PASS: tools/tracker/test_event_tracker 206 - Stop lttng tracing for session
12PASS: tools/tracker/test_event_tracker 207 - Destroy session tracker
13FAIL: tools/tracker/test_event_tracker 208 - Validate empty trace
14
15PASS: ust/namespaces/test_ns_contexts_change 42 - Stop lttng tracing for session mnt_ns
16PASS: ust/namespaces/test_ns_contexts_change 43 - Destroy session mnt_ns
17PASS: ust/namespaces/test_ns_contexts_change 44 - Wait after kill session daemon
18PASS: ust/namespaces/test_ns_contexts_change 45 - Validate trace for event mnt_ns = 4026531840, 1000 events
19PASS: ust/namespaces/test_ns_contexts_change 46 - Read a total of 1000 events, expected 1000
20PASS: ust/namespaces/test_ns_contexts_change 47 - Validate trace for event mnt_ns = 4026532303, 233 events
21FAIL: ust/namespaces/test_ns_contexts_change 48 - Read a total of 233 events, expected 1000
22
23This is a hack; issue should be fixed upstream with explicit syncs.
24It has been reported here: https://bugs.lttng.org/issues/1217
25
26Upstream-Status: Inappropriate [needs a real fix]
27Signed-off-by: Alexander Kanavin <alex@linutronix.de>
28---
29 tests/regression/tools/tracker/test_event_tracker | 8 ++++++++
30 tests/regression/ust/namespaces/test_ns_contexts_change | 2 ++
31 2 files changed, 10 insertions(+)
32
33diff --git a/tests/regression/tools/tracker/test_event_tracker b/tests/regression/tools/tracker/test_event_tracker
34index feb3787..a0f2257 100755
35--- a/tests/regression/tools/tracker/test_event_tracker
36+++ b/tests/regression/tools/tracker/test_event_tracker
37@@ -130,6 +130,8 @@ function test_event_vpid_tracker()
38
39 prepare_"$domain"_app
40
41+sleep 5
42+
43 start_lttng_tracing_ok
44
45 if [ "$expect_event" -eq 1 ]; then
46@@ -173,6 +175,8 @@ function test_event_pid_tracker()
47
48 prepare_"$domain"_app
49
50+sleep 5
51+
52 start_lttng_tracing_ok
53
54 if [ "$expect_event" -eq 1 ]; then
55@@ -275,6 +279,8 @@ function test_event_vpid_track_untrack()
56
57 prepare_"$domain"_app
58
59+sleep 5
60+
61 start_lttng_tracing_ok
62
63 lttng_track_"$domain"_ok "--vpid ${CHILD_PID}"
64@@ -315,6 +321,8 @@ function test_event_pid_track_untrack()
65
66 prepare_"$domain"_app
67
68+sleep 5
69+
70 start_lttng_tracing_ok
71
72 lttng_track_"$domain"_ok "--pid ${CHILD_PID}"
73diff --git a/tests/regression/ust/namespaces/test_ns_contexts_change b/tests/regression/ust/namespaces/test_ns_contexts_change
74index c0af15e..b111bfe 100755
75--- a/tests/regression/ust/namespaces/test_ns_contexts_change
76+++ b/tests/regression/ust/namespaces/test_ns_contexts_change
77@@ -79,6 +79,8 @@ function test_ns()
78
79 touch "$file_sync_before_last"
80
81+sleep 5
82+
83 # stop and destroy
84 stop_lttng_tracing_ok "$session_name"
85 destroy_lttng_session_ok "$session_name"
86--
872.20.1
88
diff --git a/meta/recipes-kernel/lttng/lttng-tools/0002-Fix-Tests-race-condition-in-test_ns_contexts_change.patch b/meta/recipes-kernel/lttng/lttng-tools/0002-Fix-Tests-race-condition-in-test_ns_contexts_change.patch
new file mode 100644
index 0000000000..a8d983105a
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-tools/0002-Fix-Tests-race-condition-in-test_ns_contexts_change.patch
@@ -0,0 +1,46 @@
1From d284752e616dfc4c9288be3bb21c04ea78cdd967 Mon Sep 17 00:00:00 2001
2From: Francis Deslauriers <francis.deslauriers@efficios.com>
3Date: Wed, 8 Sep 2021 10:16:23 -0400
4Subject: [PATCH 2/2] Fix: Tests: race condition in test_ns_contexts_change
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Issue
10=====
11The test script doesn't wait for the test application to complete before
12stopping the tracing session. The race is that depending on the
13scheduling the application is not always done generating events when the
14session is stopped.
15
16Fix
17===
18Make the test script wait for the termination of the test app before
19stopping the session.
20
21Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
22Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
23Change-Id: I29d9b41d2a2ed60a6c42020509c2067442ae332c
24Upstream-Status: Backport
25Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
26---
27 tests/regression/ust/namespaces/test_ns_contexts_change | 3 +++
28 1 file changed, 3 insertions(+)
29
30diff --git a/tests/regression/ust/namespaces/test_ns_contexts_change b/tests/regression/ust/namespaces/test_ns_contexts_change
31index c0af15e..8a4b62c 100755
32--- a/tests/regression/ust/namespaces/test_ns_contexts_change
33+++ b/tests/regression/ust/namespaces/test_ns_contexts_change
34@@ -79,6 +79,9 @@ function test_ns()
35
36 touch "$file_sync_before_last"
37
38+ # Wait for the test app to generate all expected events and exit.
39+ wait $app_pid
40+
41 # stop and destroy
42 stop_lttng_tracing_ok "$session_name"
43 destroy_lttng_session_ok "$session_name"
44--
452.20.1
46
diff --git a/meta/recipes-kernel/lttng/lttng-tools_2.13.0.bb b/meta/recipes-kernel/lttng/lttng-tools_2.13.0.bb
index 47cab42fcf..1491aff618 100644
--- a/meta/recipes-kernel/lttng/lttng-tools_2.13.0.bb
+++ b/meta/recipes-kernel/lttng/lttng-tools_2.13.0.bb
@@ -37,7 +37,8 @@ SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \
37 file://lttng-sessiond.service \ 37 file://lttng-sessiond.service \
38 file://determinism.patch \ 38 file://determinism.patch \
39 file://0001-src-common-correct-header-location.patch \ 39 file://0001-src-common-correct-header-location.patch \
40 file://0001-tests-wait-some-more-before-analysing-traces-or-star.patch \ 40 file://0001-Fix-Tests-race-condition-in-test_event_tracker.patch \
41 file://0002-Fix-Tests-race-condition-in-test_ns_contexts_change.patch \
41 " 42 "
42 43
43SRC_URI[sha256sum] = "8dc894f9a7a840e943c1c344345c75f001a9529daa9157f1a0e6175c081c29e6" 44SRC_URI[sha256sum] = "8dc894f9a7a840e943c1c344345c75f001a9529daa9157f1a0e6175c081c29e6"