Tests: use modprobe to test for the presence of lttng-modules
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 28 Mar 2018 19:21:26 +0000 (15:21 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 3 Apr 2018 20:13:10 +0000 (16:13 -0400)
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
tests/regression/tools/regen-statedump/test_kernel
tests/regression/tools/rotation/test_kernel
tests/regression/tools/snapshots/test_kernel
tests/regression/tools/snapshots/test_kernel_streaming
tests/regression/tools/streaming/test_kernel
tests/utils/utils.sh

index fd139aeefbf1b173dd655dad496ea34f9896d425..1849b9cd0b10c9ea66bbbcb5a8ebe92ac03e956a 100755 (executable)
@@ -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
index 85afe76a18756782626c1cc50dee66af5cf403f9..50054eb074d48cfe5cb789d54ec4c3bed0082272 100755 (executable)
@@ -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
 
index 3ef3b7dfd298e85dd8d42f2e0c9d66d77481f76b..0d72f9eaec1fbc1aec279c1ef20c783959349d98 100755 (executable)
@@ -29,12 +29,6 @@ NUM_TESTS=68
 source $TESTDIR/utils/utils.sh
 source $CURDIR/rotate_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
@@ -126,6 +120,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
index 886c4557a513732b093f53c61f5f6992ca016445..ff563100b2bf40c0796613298811fd9f2e780ebc 100755 (executable)
@@ -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 )
index 7653bd9f970923d47aea71a5dcd22a96edc5b487..bdbcc4929eda08bacb2dacc621644786d7aced4c 100755 (executable)
@@ -29,12 +29,6 @@ NUM_TESTS=36
 
 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
@@ -143,6 +137,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
 
index d54bcedf52e995891e768a757f1da8d9e54e7d0c..6bb23d9f54e7da4a967e57d1b58e660297a0f312 100755 (executable)
@@ -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
 
index c88387dc76d12808dcd7403039a8f36c58ea89e6..92ed7b354bc492649967d249b53a695fdabf559f 100644 (file)
@@ -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"
This page took 0.028182 seconds and 4 git commands to generate.