From: Jonathan Rajotte Date: Wed, 28 Mar 2018 19:21:26 +0000 (-0400) Subject: Tests: use modprobe to test for the presence of lttng-modules X-Git-Tag: v2.10.7~11 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f637036a7801f35cc8ccb16d2d623ab49a20edbe;p=lttng-tools.git Tests: use modprobe to test for the presence of lttng-modules Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- 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"