blob: 16df3e610aaa6e2ceb544ead8cf05362bbe5a7a5 [file] [log] [blame]
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