Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | From 9bc81a446d0a3ea9a884739eee48d3f14db3283c Mon Sep 17 00:00:00 2001 |
| 2 | From: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> |
| 3 | Date: Wed, 28 Mar 2018 15:21:26 -0400 |
| 4 | Subject: [PATCH lttng-tools] Tests: use modprobe to test for the presence of |
| 5 | lttng-modules |
| 6 | MIME-Version: 1.0 |
| 7 | Content-Type: text/plain; charset=UTF-8 |
| 8 | Content-Transfer-Encoding: 8bit |
| 9 | |
| 10 | Upstream-Status: Backport [28702730192ae1ded06105c54c5dc] |
| 11 | |
| 12 | Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com> |
| 13 | Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 14 | --- |
| 15 | tests/regression/tools/regen-metadata/test_kernel | 8 ++------ |
| 16 | tests/regression/tools/regen-statedump/test_kernel | 7 +------ |
| 17 | tests/regression/tools/snapshots/test_kernel | 9 +++------ |
| 18 | tests/regression/tools/snapshots/test_kernel_streaming | 8 ++------ |
| 19 | tests/regression/tools/streaming/test_kernel | 8 ++------ |
| 20 | tests/utils/utils.sh | 10 ++++++++++ |
| 21 | 6 files changed, 20 insertions(+), 30 deletions(-) |
| 22 | |
| 23 | diff --git a/tests/regression/tools/regen-metadata/test_kernel b/tests/regression/tools/regen-metadata/test_kernel |
| 24 | index fd139aeef..1849b9cd0 100755 |
| 25 | --- a/tests/regression/tools/regen-metadata/test_kernel |
| 26 | +++ b/tests/regression/tools/regen-metadata/test_kernel |
| 27 | @@ -28,12 +28,6 @@ NUM_TESTS=18 |
| 28 | |
| 29 | source $TESTDIR/utils/utils.sh |
| 30 | |
| 31 | -# LTTng kernel modules check |
| 32 | -out=`ls /lib/modules/$(uname -r)/extra | grep lttng` |
| 33 | -if [ -z "$out" ]; then |
| 34 | - BAIL_OUT "LTTng modules not detected." |
| 35 | -fi |
| 36 | - |
| 37 | function lttng_create_session_uri |
| 38 | { |
| 39 | # Create session with default path |
| 40 | @@ -91,6 +85,8 @@ fi |
| 41 | |
| 42 | skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || |
| 43 | { |
| 44 | + validate_lttng_modules_present |
| 45 | + |
| 46 | start_lttng_relayd "-o $TRACE_PATH" |
| 47 | start_lttng_sessiond |
| 48 | modprobe lttng-test |
| 49 | diff --git a/tests/regression/tools/regen-statedump/test_kernel b/tests/regression/tools/regen-statedump/test_kernel |
| 50 | index 85afe76a1..50054eb07 100755 |
| 51 | --- a/tests/regression/tools/regen-statedump/test_kernel |
| 52 | +++ b/tests/regression/tools/regen-statedump/test_kernel |
| 53 | @@ -29,12 +29,6 @@ NUM_TESTS=11 |
| 54 | |
| 55 | source $TESTDIR/utils/utils.sh |
| 56 | |
| 57 | -# LTTng kernel modules check |
| 58 | -out=`ls /lib/modules/$(uname -r)/extra | grep lttng` |
| 59 | -if [ -z "$out" ]; then |
| 60 | - BAIL_OUT "LTTng modules not detected." |
| 61 | -fi |
| 62 | - |
| 63 | function test_kernel_local () |
| 64 | { |
| 65 | diag "Test kernel local with statedump regeneration" |
| 66 | @@ -64,6 +58,7 @@ fi |
| 67 | |
| 68 | skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || |
| 69 | { |
| 70 | + validate_lttng_modules_present |
| 71 | start_lttng_sessiond |
| 72 | modprobe lttng-test |
| 73 | |
| 74 | diff --git a/tests/regression/tools/snapshots/test_kernel b/tests/regression/tools/snapshots/test_kernel |
| 75 | index 886c4557a..ff563100b 100755 |
| 76 | --- a/tests/regression/tools/snapshots/test_kernel |
| 77 | +++ b/tests/regression/tools/snapshots/test_kernel |
| 78 | @@ -29,12 +29,6 @@ NUM_TESTS=2060 |
| 79 | |
| 80 | source $TESTDIR/utils/utils.sh |
| 81 | |
| 82 | -# LTTng kernel modules check |
| 83 | -out=`ls /lib/modules/$(uname -r)/extra | grep lttng` |
| 84 | -if [ -z "$out" ]; then |
| 85 | - BAIL_OUT "LTTng modules not detected." |
| 86 | -fi |
| 87 | - |
| 88 | function test_kernel_local_snapshot () |
| 89 | { |
| 90 | diag "Test local kernel snapshots" |
| 91 | @@ -241,6 +235,9 @@ fi |
| 92 | |
| 93 | skip $isroot "Root access is needed. Skipping all kernel snapshot tests." $NUM_TESTS || |
| 94 | { |
| 95 | + |
| 96 | + validate_lttng_modules_present |
| 97 | + |
| 98 | start_lttng_sessiond |
| 99 | |
| 100 | #tests=( test_kernel_1000_local_snapshots ) |
| 101 | diff --git a/tests/regression/tools/snapshots/test_kernel_streaming b/tests/regression/tools/snapshots/test_kernel_streaming |
| 102 | index 7b96ef270..1d97519aa 100755 |
| 103 | --- a/tests/regression/tools/snapshots/test_kernel_streaming |
| 104 | +++ b/tests/regression/tools/snapshots/test_kernel_streaming |
| 105 | @@ -29,12 +29,6 @@ NUM_TESTS=61 |
| 106 | |
| 107 | source $TESTDIR/utils/utils.sh |
| 108 | |
| 109 | -# LTTng kernel modules check |
| 110 | -out=`ls /lib/modules/$(uname -r)/extra | grep lttng` |
| 111 | -if [ -z "$out" ]; then |
| 112 | - BAIL_OUT "LTTng modules not detected." |
| 113 | -fi |
| 114 | - |
| 115 | function snapshot_add_output () |
| 116 | { |
| 117 | local sess_name=$1 |
| 118 | @@ -169,6 +163,8 @@ fi |
| 119 | |
| 120 | skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || |
| 121 | { |
| 122 | + validate_lttng_modules_present |
| 123 | + |
| 124 | start_lttng_relayd "-o $TRACE_PATH" |
| 125 | start_lttng_sessiond |
| 126 | |
| 127 | diff --git a/tests/regression/tools/streaming/test_kernel b/tests/regression/tools/streaming/test_kernel |
| 128 | index d54bcedf5..6bb23d9f5 100755 |
| 129 | --- a/tests/regression/tools/streaming/test_kernel |
| 130 | +++ b/tests/regression/tools/streaming/test_kernel |
| 131 | @@ -28,12 +28,6 @@ NUM_TESTS=10 |
| 132 | |
| 133 | source $TESTDIR/utils/utils.sh |
| 134 | |
| 135 | -# LTTng kernel modules check |
| 136 | -out=`ls /lib/modules/$(uname -r)/extra | grep lttng` |
| 137 | -if [ -z "$out" ]; then |
| 138 | - BAIL_OUT "LTTng modules not detected." |
| 139 | -fi |
| 140 | - |
| 141 | function lttng_create_session_uri |
| 142 | { |
| 143 | # Create session with default path |
| 144 | @@ -80,6 +74,8 @@ fi |
| 145 | |
| 146 | skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || |
| 147 | { |
| 148 | + validate_lttng_modules_present |
| 149 | + |
| 150 | start_lttng_relayd "-o $TRACE_PATH" |
| 151 | start_lttng_sessiond |
| 152 | |
| 153 | diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh |
| 154 | index af63824ce..26e59e383 100644 |
| 155 | --- a/tests/utils/utils.sh |
| 156 | +++ b/tests/utils/utils.sh |
| 157 | @@ -125,6 +125,16 @@ function conf_proc_count() |
| 158 | echo |
| 159 | } |
| 160 | |
| 161 | +# Check if base lttng-modules are present. |
| 162 | +# Bail out on failure |
| 163 | +function validate_lttng_modules_present () |
| 164 | +{ |
| 165 | + modprobe -n lttng-tracer 2>/dev/null |
| 166 | + if [ $? -ne 0 ]; then |
| 167 | + BAIL_OUT "LTTng modules not detected." |
| 168 | + fi |
| 169 | +} |
| 170 | + |
| 171 | function enable_kernel_lttng_event |
| 172 | { |
| 173 | local withtap="$1" |
| 174 | -- |
| 175 | 2.17.1 |
| 176 | |