projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tests: use modprobe to test for the presence of lttng-modules
[lttng-tools.git]
/
tests
/
utils
/
utils.sh
diff --git
a/tests/utils/utils.sh
b/tests/utils/utils.sh
index 100f4fd2a1fc02566518168a2d2cd57447d71061..26e59e383a9a3556c8f6a86dbb2deb4edb2d4c55 100644
(file)
--- a/
tests/utils/utils.sh
+++ b/
tests/utils/utils.sh
@@
-125,12
+125,23
@@
function conf_proc_count()
echo
}
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
{
function enable_kernel_lttng_event
{
- local expected_to_fail="$1"
- local sess_name="$2"
- local event_name="$3"
- local channel_name="$4"
+ local withtap="$1"
+ local expected_to_fail="$2"
+ local sess_name="$3"
+ local event_name="$4"
+ local channel_name="$5"
if [ -z "$event_name" ]; then
# Enable all event if no event name specified
if [ -z "$event_name" ]; then
# Enable all event if no event name specified
@@
-148,20
+159,30
@@
function enable_kernel_lttng_event
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test $ret -ne "0"
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test $ret -ne "0"
- ok $? "Enable kernel event $event_name for session $session_name on channel $channel_name failed as expected"
+ ret=$?
+ if [ $withtap -eq "1" ]; then
+ ok $ret "Enable kernel event $event_name for session $session_name on channel $channel_name failed as expected"
+ fi
else
else
- ok $ret "Enable kernel event $event_name for session $sess_name"
+ if [ $withtap -eq "1" ]; then
+ ok $ret "Enable kernel event $event_name for session $sess_name"
+ fi
fi
}
function enable_kernel_lttng_event_ok ()
{
fi
}
function enable_kernel_lttng_event_ok ()
{
- enable_kernel_lttng_event 0 "$@"
+ enable_kernel_lttng_event
1
0 "$@"
}
function enable_kernel_lttng_event_fail ()
{
}
function enable_kernel_lttng_event_fail ()
{
- enable_kernel_lttng_event 1 "$@"
+ enable_kernel_lttng_event 1 1 "$@"
+}
+
+function enable_kernel_lttng_event_notap ()
+{
+ enable_kernel_lttng_event 0 0 "$@"
}
# Old interface
}
# Old interface
@@
-251,28
+272,45
@@
function lttng_disable_kernel_syscall_fail()
function lttng_enable_kernel_channel()
{
function lttng_enable_kernel_channel()
{
- local expected_to_fail=$1
- local sess_name=$2
- local channel_name=$3
+ local withtap=$1
+ local expected_to_fail=$2
+ local sess_name=$3
+ local channel_name=$4
+ local opt=$5
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -k $channel_name -s $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -k $channel_name -s $sess_name
$opt
1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test "$ret" -ne "0"
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test "$ret" -ne "0"
- ok $? "Enable channel $channel_name for session $sess_name failed as expected"
+ ret=$?
+ if [ $withtap -eq "1" ]; then
+ ok $ret "Enable channel $channel_name for session $sess_name failed as expected"
+ fi
else
else
- ok $ret "Enable channel $channel_name for session $sess_name"
+ if [ $withtap -eq "1" ]; then
+ ok $ret "Enable channel $channel_name for session $sess_name"
+ fi
fi
}
function lttng_enable_kernel_channel_ok()
{
fi
}
function lttng_enable_kernel_channel_ok()
{
- lttng_enable_kernel_channel 0 "$@"
+ lttng_enable_kernel_channel
1
0 "$@"
}
function lttng_enable_kernel_channel_fail()
{
}
function lttng_enable_kernel_channel_fail()
{
- lttng_enable_kernel_channel 1 "$@"
+ lttng_enable_kernel_channel 1 1 "$@"
+}
+
+function lttng_enable_kernel_channel_notap()
+{
+ lttng_enable_kernel_channel 0 0 "$@"
+}
+
+function enable_kernel_lttng_channel_ok()
+{
+ lttng_enable_kernel_channel 1 0 "$@"
}
function lttng_disable_kernel_channel()
}
function lttng_disable_kernel_channel()
@@
-573,9
+611,9
@@
function stop_lttng_consumerd_opt()
if [ $withtap -eq "1" ]; then
diag "Killing $CONSUMERD_BIN pids: $(echo $PID_CONSUMERD | tr '\n' ' ')"
fi
if [ $withtap -eq "1" ]; then
diag "Killing $CONSUMERD_BIN pids: $(echo $PID_CONSUMERD | tr '\n' ' ')"
fi
+
kill $kill_opt $PID_CONSUMERD 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
retval=$?
kill $kill_opt $PID_CONSUMERD 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
retval=$?
- set +x
if [ $? -eq 1 ]; then
if [ $withtap -eq "1" ]; then
if [ $? -eq 1 ]; then
if [ $withtap -eq "1" ]; then
@@
-630,7
+668,6
@@
function sigstop_lttng_consumerd_opt()
fi
kill $kill_opt $PID_CONSUMERD 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
retval=$?
fi
kill $kill_opt $PID_CONSUMERD 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
retval=$?
- set +x
if [ $? -eq 1 ]; then
if [ $withtap -eq "1" ]; then
if [ $? -eq 1 ]; then
if [ $withtap -eq "1" ]; then
@@
-687,57
+724,81
@@
function create_lttng_session_no_output ()
function create_lttng_session ()
{
function create_lttng_session ()
{
- local expected_to_fail=$1
- local sess_name=$2
- local trace_path=$3
- local opt=$4
+ local withtap=$1
+ local expected_to_fail=$2
+ local sess_name=$3
+ local trace_path=$4
+ local opt=$5
$TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name -o $trace_path $opt > $OUTPUT_DEST
ret=$?
$TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name -o $trace_path $opt > $OUTPUT_DEST
ret=$?
- if [
[ $expected_to_fail -eq "1" ]
]; then
+ if [
$expected_to_fail -eq "1"
]; then
test "$ret" -ne "0"
test "$ret" -ne "0"
- ok $? "Create session $sess_name in $trace_path failed as expected"
+ ret=$?
+ if [ $withtap -eq "1" ]; then
+ ok $ret "Create session $sess_name in $trace_path failed as expected"
+ fi
else
else
- ok $ret "Create session $sess_name in $trace_path"
+ if [ $withtap -eq "1" ]; then
+ ok $ret "Create session $sess_name in $trace_path"
+ fi
fi
fi
+ return $ret
}
function create_lttng_session_ok ()
{
}
function create_lttng_session_ok ()
{
- create_lttng_session 0 "$@"
+ create_lttng_session
1
0 "$@"
}
function create_lttng_session_fail ()
{
}
function create_lttng_session_fail ()
{
- create_lttng_session 1 "$@"
+ create_lttng_session 1 1 "$@"
+}
+
+function create_lttng_session_notap ()
+{
+ create_lttng_session 0 0 "$@"
}
function enable_ust_lttng_channel ()
{
}
function enable_ust_lttng_channel ()
{
- local expected_to_fail=$1
- local sess_name=$2
- local channel_name=$3
- local opt=$4
+ local withtap=$1
+ local expected_to_fail=$2
+ local sess_name=$3
+ local channel_name=$4
+ local opt=$5
$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -u $channel_name -s $sess_name $opt 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test "$ret" -ne "0"
$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -u $channel_name -s $sess_name $opt 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test "$ret" -ne "0"
- ok $? "Enable channel $channel_name for session $sess_name failed as expected"
+ ret=$?
+ if [ $withtap -eq "1" ]; then
+ ok $ret "Enable channel $channel_name for session $sess_name failed as expected"
+ fi
else
else
- ok $ret "Enable channel $channel_name for session $sess_name"
+ if [ $withtap -eq "1" ]; then
+ ok $ret "Enable channel $channel_name for session $sess_name"
+ fi
fi
fi
+ return $ret
}
function enable_ust_lttng_channel_ok ()
{
}
function enable_ust_lttng_channel_ok ()
{
- enable_ust_lttng_channel 0 "$@"
+ enable_ust_lttng_channel
1
0 "$@"
}
function enable_ust_lttng_channel_fail ()
{
}
function enable_ust_lttng_channel_fail ()
{
- enable_ust_lttng_channel 1 "$@"
+ enable_ust_lttng_channel 1 1 "$@"
+}
+
+function enable_ust_lttng_channel_notap ()
+{
+ enable_ust_lttng_channel 0 0 "$@"
}
function disable_ust_lttng_channel()
}
function disable_ust_lttng_channel()
@@
-787,10
+848,11
@@
function enable_lttng_mmap_overwrite_ust_channel()
function enable_ust_lttng_event ()
{
function enable_ust_lttng_event ()
{
- local expected_to_fail=$1
- local sess_name=$2
- local event_name="$3"
- local channel_name=$4
+ local withtap=$1
+ local expected_to_fail=$2
+ local sess_name=$3
+ local event_name="$4"
+ local channel_name=$5
if [ -z $channel_name ]; then
# default channel if none specified
if [ -z $channel_name ]; then
# default channel if none specified
@@
-803,20
+865,31
@@
function enable_ust_lttng_event ()
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test $ret -ne "0"
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test $ret -ne "0"
- ok $? "Enable ust event $event_name for session $session_name failed as expected"
+ ret=$?
+ if [[ $withtap -eq "1" ]]; then
+ ok $ret "Enable ust event $event_name for session $session_name failed as expected"
+ fi
else
else
- ok $ret "Enable ust event $event_name for session $sess_name"
+ if [[ $withtap -eq "1" ]]; then
+ ok $ret "Enable ust event $event_name for session $sess_name"
+ fi
fi
fi
+ return $ret
}
function enable_ust_lttng_event_ok ()
{
}
function enable_ust_lttng_event_ok ()
{
- enable_ust_lttng_event 0 "$@"
+ enable_ust_lttng_event
1
0 "$@"
}
function enable_ust_lttng_event_fail ()
{
}
function enable_ust_lttng_event_fail ()
{
- enable_ust_lttng_event 1 "$@"
+ enable_ust_lttng_event 1 1 "$@"
+}
+
+function enable_ust_lttng_event_notap ()
+{
+ enable_ust_lttng_event 0 0 "$@"
}
function enable_jul_lttng_event()
}
function enable_jul_lttng_event()
@@
-1050,30
+1123,40
@@
function stop_lttng_tracing_fail ()
function destroy_lttng_session ()
{
function destroy_lttng_session ()
{
- local expected_to_fail=$1
- local sess_name=$2
+ local withtap=$1
+ local expected_to_fail=$2
+ local sess_name=$3
$TESTDIR/../src/bin/lttng/$LTTNG_BIN destroy $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test "$ret" -ne "0"
$TESTDIR/../src/bin/lttng/$LTTNG_BIN destroy $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test "$ret" -ne "0"
- ok $? "Destroy session $sess_name failed as expected"
+ ret=$?
+ if [ $withtap -eq "1" ]; then
+ ok $ret "Destroy session $sess_name failed as expected"
+ fi
else
else
- ok $ret "Destroy session $sess_name"
+ if [ $withtap -eq "1" ]; then
+ ok $ret "Destroy session $sess_name"
+ fi
fi
}
function destroy_lttng_session_ok ()
{
fi
}
function destroy_lttng_session_ok ()
{
- destroy_lttng_session 0 "$@"
+ destroy_lttng_session
1
0 "$@"
}
function destroy_lttng_session_fail ()
{
}
function destroy_lttng_session_fail ()
{
- destroy_lttng_session 1 "$@"
+ destroy_lttng_session 1
1
"$@"
}
}
+function destroy_lttng_session_notap ()
+{
+ destroy_lttng_session 0 0 "$@"
+}
function destroy_lttng_sessions ()
{
function destroy_lttng_sessions ()
{
@@
-1424,7
+1507,14
@@
function validate_trace_empty()
skip 0 "Babeltrace binary not found. Skipping trace validation"
fi
skip 0 "Babeltrace binary not found. Skipping trace validation"
fi
- traced=$($BABELTRACE_BIN $trace_path 2>/dev/null | wc -l)
+ events=$($BABELTRACE_BIN $trace_path 2>/dev/null)
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ fail "Failed to parse trace"
+ return $ret
+ fi
+
+ traced=$(echo -n "$events" | wc -l)
if [ "$traced" -eq 0 ]; then
pass "Validate empty trace"
else
if [ "$traced" -eq 0 ]; then
pass "Validate empty trace"
else
This page took
0.026884 seconds
and
4
git commands to generate.