summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/lttng/lttng-tools/0005-Tests-use-modprobe-to-test-for-the-presence-of-lttng.patch
blob: 16df3e610aaa6e2ceb544ead8cf05362bbe5a7a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
From 9bc81a446d0a3ea9a884739eee48d3f14db3283c Mon Sep 17 00:00:00 2001
From: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Date: Wed, 28 Mar 2018 15:21:26 -0400
Subject: [PATCH lttng-tools] Tests: use modprobe to test for the presence of
 lttng-modules
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Upstream-Status: Backport [28702730192ae1ded06105c54c5dc]

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
---
 tests/regression/tools/regen-metadata/test_kernel      |  8 ++------
 tests/regression/tools/regen-statedump/test_kernel     |  7 +------
 tests/regression/tools/snapshots/test_kernel           |  9 +++------
 tests/regression/tools/snapshots/test_kernel_streaming |  8 ++------
 tests/regression/tools/streaming/test_kernel           |  8 ++------
 tests/utils/utils.sh                                   | 10 ++++++++++
 6 files changed, 20 insertions(+), 30 deletions(-)

diff --git a/tests/regression/tools/regen-metadata/test_kernel b/tests/regression/tools/regen-metadata/test_kernel
index fd139aeef..1849b9cd0 100755
--- a/tests/regression/tools/regen-metadata/test_kernel
+++ b/tests/regression/tools/regen-metadata/test_kernel
@@ -28,12 +28,6 @@ NUM_TESTS=18
 
 source $TESTDIR/utils/utils.sh
 
-# LTTng kernel modules check
-out=`ls /lib/modules/$(uname -r)/extra | grep lttng`
-if [ -z "$out" ]; then
-	BAIL_OUT "LTTng modules not detected."
-fi
-
 function lttng_create_session_uri
 {
 	# Create session with default path
@@ -91,6 +85,8 @@ fi
 
 skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
 {
+	validate_lttng_modules_present
+
 	start_lttng_relayd "-o $TRACE_PATH"
 	start_lttng_sessiond
 	modprobe lttng-test
diff --git a/tests/regression/tools/regen-statedump/test_kernel b/tests/regression/tools/regen-statedump/test_kernel
index 85afe76a1..50054eb07 100755
--- a/tests/regression/tools/regen-statedump/test_kernel
+++ b/tests/regression/tools/regen-statedump/test_kernel
@@ -29,12 +29,6 @@ NUM_TESTS=11
 
 source $TESTDIR/utils/utils.sh
 
-# LTTng kernel modules check
-out=`ls /lib/modules/$(uname -r)/extra | grep lttng`
-if [ -z "$out" ]; then
-	BAIL_OUT "LTTng modules not detected."
-fi
-
 function test_kernel_local ()
 {
 	diag "Test kernel local with statedump regeneration"
@@ -64,6 +58,7 @@ fi
 
 skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
 {
+	validate_lttng_modules_present
 	start_lttng_sessiond
 	modprobe lttng-test
 
diff --git a/tests/regression/tools/snapshots/test_kernel b/tests/regression/tools/snapshots/test_kernel
index 886c4557a..ff563100b 100755
--- a/tests/regression/tools/snapshots/test_kernel
+++ b/tests/regression/tools/snapshots/test_kernel
@@ -29,12 +29,6 @@ NUM_TESTS=2060
 
 source $TESTDIR/utils/utils.sh
 
-# LTTng kernel modules check
-out=`ls /lib/modules/$(uname -r)/extra | grep lttng`
-if [ -z "$out" ]; then
-	BAIL_OUT "LTTng modules not detected."
-fi
-
 function test_kernel_local_snapshot ()
 {
 	diag "Test local kernel snapshots"
@@ -241,6 +235,9 @@ fi
 
 skip $isroot "Root access is needed. Skipping all kernel snapshot tests." $NUM_TESTS ||
 {
+
+	validate_lttng_modules_present
+
 	start_lttng_sessiond
 
 	#tests=( test_kernel_1000_local_snapshots )
diff --git a/tests/regression/tools/snapshots/test_kernel_streaming b/tests/regression/tools/snapshots/test_kernel_streaming
index 7b96ef270..1d97519aa 100755
--- a/tests/regression/tools/snapshots/test_kernel_streaming
+++ b/tests/regression/tools/snapshots/test_kernel_streaming
@@ -29,12 +29,6 @@ NUM_TESTS=61
 
 source $TESTDIR/utils/utils.sh
 
-# LTTng kernel modules check
-out=`ls /lib/modules/$(uname -r)/extra | grep lttng`
-if [ -z "$out" ]; then
-	BAIL_OUT "LTTng modules not detected."
-fi
-
 function snapshot_add_output ()
 {
 	local sess_name=$1
@@ -169,6 +163,8 @@ fi
 
 skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
 {
+	validate_lttng_modules_present
+
 	start_lttng_relayd "-o $TRACE_PATH"
 	start_lttng_sessiond
 
diff --git a/tests/regression/tools/streaming/test_kernel b/tests/regression/tools/streaming/test_kernel
index d54bcedf5..6bb23d9f5 100755
--- a/tests/regression/tools/streaming/test_kernel
+++ b/tests/regression/tools/streaming/test_kernel
@@ -28,12 +28,6 @@ NUM_TESTS=10
 
 source $TESTDIR/utils/utils.sh
 
-# LTTng kernel modules check
-out=`ls /lib/modules/$(uname -r)/extra | grep lttng`
-if [ -z "$out" ]; then
-	BAIL_OUT "LTTng modules not detected."
-fi
-
 function lttng_create_session_uri
 {
 	# Create session with default path
@@ -80,6 +74,8 @@ fi
 
 skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
 {
+	validate_lttng_modules_present
+
 	start_lttng_relayd "-o $TRACE_PATH"
 	start_lttng_sessiond
 
diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh
index af63824ce..26e59e383 100644
--- a/tests/utils/utils.sh
+++ b/tests/utils/utils.sh
@@ -125,6 +125,16 @@ function conf_proc_count()
 	echo
 }
 
+# Check if base lttng-modules are present.
+# Bail out on failure
+function validate_lttng_modules_present ()
+{
+	modprobe -n lttng-tracer 2>/dev/null
+	if [ $? -ne 0  ]; then
+		BAIL_OUT "LTTng modules not detected."
+	fi
+}
+
 function enable_kernel_lttng_event
 {
 	local withtap="$1"
-- 
2.17.1