Observed issue
==============
If a test or a component in LTTng fails to unload the modules
properly, the state of the system is polluted.
Solution
========
Use a helper test function and check before and after each of the
kernel tests.
Known drawbacks
===============
None.
Change-Id: I0cce0d9e280bd66535af490c9a111526ab78373c
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
23 files changed:
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
validate_lttng_modules_present
start_lttng_sessiond
test_all_event
stop_lttng_sessiond
validate_lttng_modules_present
start_lttng_sessiond
test_all_event
stop_lttng_sessiond
+ lttng_modules_loaded_fail
CURDIR=$(dirname "$0")/
TESTDIR=$CURDIR/../..
CURDIR=$(dirname "$0")/
TESTDIR=$CURDIR/../..
TEST_APP_USERSPACE="$TESTDIR/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack"
TEST_APP_KERNELSPACE="$TESTDIR/utils/testapp/gen-syscall-events/gen-syscall-events"
PARSE_CALLSTACK="$TESTDIR/utils/parse-callstack.py"
TEST_APP_USERSPACE="$TESTDIR/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack"
TEST_APP_KERNELSPACE="$TESTDIR/utils/testapp/gen-syscall-events/gen-syscall-events"
PARSE_CALLSTACK="$TESTDIR/utils/parse-callstack.py"
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
validate_lttng_modules_present
start_lttng_sessiond
validate_lttng_modules_present
start_lttng_sessiond
test_kernel_callstack
stop_lttng_sessiond
test_kernel_callstack
stop_lttng_sessiond
+ lttng_modules_loaded_fail
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
source $TESTDIR/utils/utils.sh
source $TESTDIR/utils/utils.sh
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
start_lttng_sessiond
test_channel_buffer
test_channel_buffer_too_large
stop_lttng_sessiond
start_lttng_sessiond
test_channel_buffer
test_channel_buffer_too_large
stop_lttng_sessiond
+ lttng_modules_loaded_fail
TESTDIR=$CURDIR/../..
SESSION_NAME="clock_override"
TESTDIR=$CURDIR/../..
SESSION_NAME="clock_override"
EVENT_NAME="lttng_test_filter_event"
TESTCMD="echo -n 10 > /proc/lttng-test-filter-event"
EVENT_NAME="lttng_test_filter_event"
TESTCMD="echo -n 10 > /proc/lttng-test-filter-event"
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
+ modprobe --remove lttng-test
- modprobe --remove lttng-test lttng-clock-plugin-test lttng-clock
+ modprobe --remove lttng-clock-plugin-test lttng-clock
# Use Babeltrace with "-n all" to give a comma separated list for
# easy extraction of timestamps.
# Use Babeltrace with "-n all" to give a comma separated list for
# easy extraction of timestamps.
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
validate_lttng_modules_present
trap signal_cleanup SIGTERM SIGINT
validate_lttng_modules_present
trap signal_cleanup SIGTERM SIGINT
+ lttng_modules_loaded_fail
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
check_skip_kernel_test $NUM_TESTS "Skipping all tests." ||
{
check_skip_kernel_test $NUM_TESTS "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
validate_lttng_modules_present
start_lttng_sessiond
validate_lttng_modules_present
start_lttng_sessiond
test_enable_after_start
stop_lttng_sessiond
test_enable_after_start
stop_lttng_sessiond
+ lttng_modules_loaded_fail
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
source $TESTDIR/utils/utils.sh
source $TESTDIR/utils/utils.sh
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
start_lttng_sessiond_notap
validate_lttng_modules_present
modprobe lttng-test
start_lttng_sessiond_notap
validate_lttng_modules_present
modprobe lttng-test
modprobe --remove lttng-test
stop_lttng_sessiond_notap
modprobe --remove lttng-test
stop_lttng_sessiond_notap
+ lttng_modules_loaded_fail
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
PAYLOAD="test_logger"
SESSION_NAME="kernel_event_basic"
PAYLOAD="test_logger"
SESSION_NAME="kernel_event_basic"
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
validate_lttng_modules_present
start_lttng_sessiond
validate_lttng_modules_present
start_lttng_sessiond
test_payload_limit
stop_lttng_sessiond
test_payload_limit
stop_lttng_sessiond
+ lttng_modules_loaded_fail
CURDIR=$(dirname "$0")/
TESTDIR=$CURDIR/../..
CURDIR=$(dirname "$0")/
TESTDIR=$CURDIR/../..
NUM_TESTS=$((TESTS_PER_NS * 8))
NUM_TESTS=$((TESTS_PER_NS * 8))
trace_path=$(mktemp -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
trace_path=$(mktemp -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
+ lttng_modules_loaded_fail
start_lttng_sessiond
create_lttng_session_ok "$session_name" "$trace_path"
start_lttng_sessiond
create_lttng_session_ok "$session_name" "$trace_path"
destroy_lttng_session_ok "$session_name"
stop_lttng_sessiond
destroy_lttng_session_ok "$session_name"
stop_lttng_sessiond
+ lttng_modules_loaded_fail
TESTAPP_NAME="gen-ns-events"
TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
TESTAPP_NAME="gen-ns-events"
TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
NUM_TESTS=$((TESTS_PER_NS * 6))
NUM_TESTS=$((TESTS_PER_NS * 6))
app_ns_inode=$(stat -c '%i' -L "/proc/$app_pid/ns/$ns")
ok $? "Get app current $ns namespace inode: $app_ns_inode" || app_ns_inode="invalid"
app_ns_inode=$(stat -c '%i' -L "/proc/$app_pid/ns/$ns")
ok $? "Get app current $ns namespace inode: $app_ns_inode" || app_ns_inode="invalid"
+ lttng_modules_loaded_fail
start_lttng_sessiond
create_lttng_session_ok "$session_name" "$trace_path"
start_lttng_sessiond
create_lttng_session_ok "$session_name" "$trace_path"
# stop and destroy
destroy_lttng_session_ok "$session_name"
stop_lttng_sessiond
# stop and destroy
destroy_lttng_session_ok "$session_name"
stop_lttng_sessiond
+ lttng_modules_loaded_fail
rm -rf "$trace_path"
rm -f "$file_sync_wait_after_unshare"
rm -rf "$trace_path"
rm -f "$file_sync_wait_after_unshare"
SESSION_NAME="rotation_destroy_flush"
NR_ITER=10
SESSION_NAME="rotation_destroy_flush"
NR_ITER=10
-NUM_TESTS=$((13*$NR_ITER))
+NUM_TESTS=$((15*$NR_ITER))
EVENT_NAME="lttng_test_filter_event"
CHANNEL_NAME="testchan"
PAGE_SIZE=$(getconf PAGE_SIZE)
EVENT_NAME="lttng_test_filter_event"
CHANNEL_NAME="testchan"
PAGE_SIZE=$(getconf PAGE_SIZE)
function test_rotation_destroy_flush_single()
{
function test_rotation_destroy_flush_single()
{
+ lttng_modules_loaded_fail
start_lttng_sessiond
modprobe lttng-test
start_lttng_sessiond
modprobe lttng-test
modprobe --remove lttng-test
stop_lttng_sessiond
modprobe --remove lttng-test
stop_lttng_sessiond
+ lttng_modules_loaded_fail
}
function test_rotation_destroy_flush()
}
function test_rotation_destroy_flush()
SUPPORTED_SYSCALLS_COUNT=$(echo $SUPPORTED_SYSCALLS_LIST | awk -F '[\t,]' '{print NF}')
# Two tests validate their trace for every supported syscall
SUPPORTED_SYSCALLS_COUNT=$(echo $SUPPORTED_SYSCALLS_LIST | awk -F '[\t,]' '{print NF}')
# Two tests validate their trace for every supported syscall
-NUM_TESTS=$((88+(2*SUPPORTED_SYSCALLS_COUNT)))
+NUM_TESTS=$((90+(2*SUPPORTED_SYSCALLS_COUNT)))
# shellcheck source=../../utils/utils.sh
source $TESTDIR/utils/utils.sh
# shellcheck source=../../utils/utils.sh
source $TESTDIR/utils/utils.sh
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
validate_lttng_modules_present
start_lttng_sessiond
validate_lttng_modules_present
start_lttng_sessiond
test_epoll_pwait_concurrent_unmap
stop_lttng_sessiond
test_epoll_pwait_concurrent_unmap
stop_lttng_sessiond
+ lttng_modules_loaded_fail
NEW_WARNING=$(dmesg | grep " WARNING:" | cut -d' ' -f1 | tail -1)
NEW_OOPS=$(dmesg | grep " OOPS:" | cut -d' ' -f1 | tail -1)
NEW_WARNING=$(dmesg | grep " WARNING:" | cut -d' ' -f1 | tail -1)
NEW_OOPS=$(dmesg | grep " OOPS:" | cut -d' ' -f1 | tail -1)
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
# `gen-syscall-event` starts and waits for the creation a file passed by
# arguments to start executing 3 syscalls (open,read,close) and returning.
# `gen-syscall-event` starts and waits for the creation a file passed by
# arguments to start executing 3 syscalls (open,read,close) and returning.
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
validate_lttng_modules_present
start_lttng_sessiond
validate_lttng_modules_present
start_lttng_sessiond
test_syscall_enable_channel_disable_one
stop_lttng_sessiond
test_syscall_enable_channel_disable_one
stop_lttng_sessiond
+ lttng_modules_loaded_fail
SDT_TEST_BIN="$SDT_TEST_BIN_DIR/$SDT_TEST_BIN_NAME"
ELF_SYMBOL="test_function"
PROBE_EVENT_NAME=userspace_probe_test_event
SDT_TEST_BIN="$SDT_TEST_BIN_DIR/$SDT_TEST_BIN_NAME"
ELF_SYMBOL="test_function"
PROBE_EVENT_NAME=userspace_probe_test_event
OUTPUT_DEST=/dev/null
ERROR_OUTPUT_DEST=/dev/null
OUTPUT_DEST=/dev/null
ERROR_OUTPUT_DEST=/dev/null
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
validate_lttng_modules_present
start_lttng_sessiond
validate_lttng_modules_present
start_lttng_sessiond
+ lttng_modules_loaded_fail
PAGE_SIZE=$(getconf PAGE_SIZE)
TRACE_PATH=$(mktemp -d -t tmp.test_clear_kernel_trace_path.XXXXXX)
PAGE_SIZE=$(getconf PAGE_SIZE)
TRACE_PATH=$(mktemp -d -t tmp.test_clear_kernel_trace_path.XXXXXX)
# shellcheck source=../utils/utils.sh
source "$TESTDIR/utils/utils.sh"
# shellcheck source=../utils/utils.sh
source "$TESTDIR/utils/utils.sh"
{
trap signal_cleanup SIGTERM SIGINT
{
trap signal_cleanup SIGTERM SIGINT
+ lttng_modules_loaded_fail
validate_lttng_modules_present
start_lttng_relayd "-o $TRACE_PATH"
validate_lttng_modules_present
start_lttng_relayd "-o $TRACE_PATH"
modprobe --remove lttng-test
stop_lttng_sessiond
stop_lttng_relayd
modprobe --remove lttng-test
stop_lttng_sessiond
stop_lttng_relayd
+ lttng_modules_loaded_fail
test_kernel_disallow_clear
}
test_kernel_disallow_clear
}
source $TESTDIR/utils/utils.sh
source $TESTDIR/utils/utils.sh
trap interrupt_cleanup SIGTERM SIGINT
trap interrupt_cleanup SIGTERM SIGINT
for fct_test in ${TESTS[@]};
do
${fct_test}
for fct_test in ${TESTS[@]};
do
${fct_test}
+
+# Start and stop to clean up kernel modules
+start_lttng_sessiond_notap
+stop_lttng_sessiond_notap
+lttng_modules_loaded_fail
+
rm -rf $OUTPUT_DIR
OUTPUT_DEST=/dev/null 2>&1
rm -rf $OUTPUT_DIR
OUTPUT_DEST=/dev/null 2>&1
SESSION_NAME="valid_filter"
NR_ITER=100
SESSION_NAME="valid_filter"
NR_ITER=100
NUM_UST_TESTS=1122
NUM_KERNEL_TESTS=1056
NUM_TESTS=$(($NUM_UST_TESTS+$NUM_KERNEL_TESTS+$NUM_GLOBAL_TESTS))
NUM_UST_TESTS=1122
NUM_KERNEL_TESTS=1056
NUM_TESTS=$(($NUM_UST_TESTS+$NUM_KERNEL_TESTS+$NUM_GLOBAL_TESTS))
issue_356_filter+="intfield > 6 && intfield > 7 && "
issue_356_filter+="intfield > 8 || intfield > 0"
issue_356_filter+="intfield > 6 && intfield > 7 && "
issue_356_filter+="intfield > 8 || intfield > 0"
+lttng_modules_loaded_fail
start_lttng_sessiond
### UST TESTS
start_lttng_sessiond
### UST TESTS
test_valid_filter kernel -k "lttng_test_filter_event" "$filter" "validator_$validator"
if [ $? -eq 1 ]; then
test_valid_filter kernel -k "lttng_test_filter_event" "$filter" "validator_$validator"
if [ $? -eq 1 ]; then
+ # The module removal will fail if events are
+ # still being produced
+ while ! modprobe --remove lttng-test ; do
+ sleep 1
+ done
stop_lttng_sessiond
exit 1
fi
stop_lttng_sessiond
exit 1
fi
- modprobe --remove lttng-test
+ # The module removal will fail if events are still being produced
+ while ! modprobe --remove lttng-test ; do
+ sleep 1
+ done
+lttng_modules_loaded_fail
clean_live_tracing
stop_lttng_relayd_notap
clean_live_tracing
stop_lttng_relayd_notap
-stop_lttng_sessiond_notap
-
modprobe --remove lttng-test
modprobe --remove lttng-test
+stop_lttng_sessiond_notap
TRACE_PATH=$(mktemp -d -t tmp.test_metadata_env_kernel_trace_path.XXXXXX)
TRACE_PATH=$(mktemp -d -t tmp.test_metadata_env_kernel_trace_path.XXXXXX)
source "$TESTDIR/utils/utils.sh"
source "$TESTDIR/utils/utils.sh"
check_skip_kernel_test "$NUM_TESTS" "Skipping kernel metadata tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping kernel metadata tests." ||
{
+ lttng_modules_loaded_fail
validate_lttng_modules_present
modprobe lttng-test
validate_lttng_modules_present
modprobe lttng-test
modprobe --remove lttng-test
stop_lttng_sessiond
modprobe --remove lttng-test
stop_lttng_sessiond
+ lttng_modules_loaded_fail
TRACE_PATH=$(mktemp -d -t tmp.test_regen_metadata_kernel_trace_path.XXXXXX)
TRACE_PATH=$(mktemp -d -t tmp.test_regen_metadata_kernel_trace_path.XXXXXX)
source $TESTDIR/utils/utils.sh
source $TESTDIR/utils/utils.sh
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
validate_lttng_modules_present
start_lttng_relayd "-o $TRACE_PATH"
validate_lttng_modules_present
start_lttng_relayd "-o $TRACE_PATH"
modprobe --remove lttng-test
stop_lttng_sessiond
stop_lttng_relayd
modprobe --remove lttng-test
stop_lttng_sessiond
stop_lttng_relayd
+ lttng_modules_loaded_fail
TRACE_PATH=$(mktemp -d -t tmp.test_regenerate_statedump_kernel_trace_path.XXXXXX)
TRACE_PATH=$(mktemp -d -t tmp.test_regenerate_statedump_kernel_trace_path.XXXXXX)
source $TESTDIR/utils/utils.sh
source $TESTDIR/utils/utils.sh
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
validate_lttng_modules_present
start_lttng_sessiond
modprobe lttng-test
validate_lttng_modules_present
start_lttng_sessiond
modprobe lttng-test
modprobe --remove lttng-test
stop_lttng_sessiond
modprobe --remove lttng-test
stop_lttng_sessiond
+ lttng_modules_loaded_fail
TRACE_PATH=$(mktemp -d -t tmp.rotation_kernel_tracing.XXXXXX)
TRACE_PATH=$(mktemp -d -t tmp.rotation_kernel_tracing.XXXXXX)
source $TESTDIR/utils/utils.sh
source $CURDIR/rotate_utils.sh
source $TESTDIR/utils/utils.sh
source $CURDIR/rotate_utils.sh
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
validate_lttng_modules_present
start_lttng_relayd "-o $TRACE_PATH"
validate_lttng_modules_present
start_lttng_relayd "-o $TRACE_PATH"
modprobe --remove lttng-test
stop_lttng_sessiond
stop_lttng_relayd
modprobe --remove lttng-test
stop_lttng_sessiond
stop_lttng_relayd
+ lttng_modules_loaded_fail
TRACE_PATH=$(mktemp -d -t tmp.test_snapshots_kernel_trace_path.XXXXXX)
TRACE_PATH=$(mktemp -d -t tmp.test_snapshots_kernel_trace_path.XXXXXX)
source $TESTDIR/utils/utils.sh
source $TESTDIR/utils/utils.sh
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
validate_lttng_modules_present
start_lttng_sessiond
validate_lttng_modules_present
start_lttng_sessiond
+ lttng_modules_loaded_fail
TRACE_PATH=$(mktemp -d -t tmp.test_streaming_kernel_trace_path.XXXXXX)
TRACE_PATH=$(mktemp -d -t tmp.test_streaming_kernel_trace_path.XXXXXX)
source $TESTDIR/utils/utils.sh
source $TESTDIR/utils/utils.sh
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
check_skip_kernel_test "$NUM_TESTS" "Skipping all tests." ||
{
+ lttng_modules_loaded_fail
validate_lttng_modules_present
start_lttng_relayd "-o $TRACE_PATH"
validate_lttng_modules_present
start_lttng_relayd "-o $TRACE_PATH"
stop_lttng_sessiond
stop_lttng_relayd
stop_lttng_sessiond
stop_lttng_relayd
+ lttng_modules_loaded_fail