tests: invoke full_cleanup from script trap handlers, use modprobe -r
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 16 May 2019 19:08:01 +0000 (15:08 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 5 Sep 2019 17:44:26 +0000 (13:44 -0400)
Scripts implementing their own trap handlers override the generic
one provided by utils.sh (full_cleanup). Invoke it at the end of
the handlers to provide the utils cleanup as well.

Moreover, change use of "rmmod" to "modprobe -r", which is better
in trap handlers because it does not print errors if the module
was not loaded yet when the signal occurs.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/regression/kernel/test_clock_override
tests/regression/kernel/test_rotation_destroy_flush
tests/regression/tools/crash/test_crash
tests/regression/tools/notification/test_notification_kernel
tests/regression/tools/notification/test_notification_multi_app
tests/regression/tools/notification/test_notification_ust
tests/regression/tools/streaming/test_high_throughput_limits
tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush
tests/stress/test_multi_sessions_per_uid_10app
tests/stress/test_multi_sessions_per_uid_5app_streaming
tests/stress/test_multi_sessions_per_uid_5app_streaming_kill_relayd

index e19b77e1dc08868281ce7969e497032f223006e7..1fbba7717884ce60252a7bc770a6876268d1082f 100755 (executable)
@@ -49,11 +49,9 @@ source $TESTDIR/utils/utils.sh
 function signal_cleanup()
 {
        diag "*** Exiting ***"
-       rmmod lttng-test
        stop_lttng_sessiond
-       rmmod lttng-clock-plugin-test
-       rmmod lttng-clock
-       exit 1
+       modprobe -r lttng-test lttng-clock-plugin-test lttng-clock
+       full_cleanup
 }
 
 function extract_clock_metadata()
@@ -93,10 +91,8 @@ function test_clock_override_metadata()
        stop_lttng_tracing_ok $SESSION_NAME
        destroy_lttng_session_ok $SESSION_NAME
 
-       rmmod lttng-test
        stop_lttng_sessiond
-       rmmod lttng-clock-plugin-test
-       rmmod lttng-clock
+       modprobe -r lttng-test lttng-clock-plugin-test lttng-clock
 
        local TRACE_METADATA_FILE_PATH="$(find "$TRACE_PATH" -name metadata -type f)"
        local TRACE_METADATA_DIR="$(dirname "$TRACE_METADATA_FILE_PATH")"
index 0b0b0ca7513399ef1acf6980e7f5f44a51eca9a8..03933a3af18e4079f8b1a6bfa9e28cc921a04376 100755 (executable)
@@ -39,9 +39,8 @@ source $TESTDIR/utils/utils.sh
 function signal_cleanup()
 {
        diag "*** Exiting ***"
-       rmmod lttng-test
-       stop_lttng_sessiond
-       exit 1
+       modprobe -r lttng-test
+       full_cleanup
 }
 
 function enable_kernel_lttng_channel_size_limit ()
@@ -107,7 +106,7 @@ function test_rotation_destroy_flush_single()
 
        rm -rf $TRACE_PATH
 
-       rmmod lttng-test
+       modprobe -r lttng-test
        stop_lttng_sessiond
 }
 
index 30af291c613ddbb77d924c98a31cc7b9a8748dae..ad03bf404863a1d603f709ff1567de725737854a 100755 (executable)
@@ -398,8 +398,7 @@ function interrupt_cleanup()
 {
     diag "*** Cleaning-up test ***"
     stop_test_apps
-    stop_lttng_sessiond
-    exit 1
+    full_cleanup
 }
 
 TESTS=(
index e7368df260e0bde0e5fbc97ca9dc147c85236232..cc6fc5816e0c512081b4e3ea0a499739d4fd072e 100755 (executable)
@@ -56,7 +56,7 @@ function kernel_event_generator
        state_file=$1
        kernel_event_generator_suspended=0
        trap kernel_event_generator_toogle_state SIGUSR1
-       trap "exit" SIGTERM SIGINT EXIT
+
        while (true); do
                if [[ $kernel_event_generator_suspended -eq "1" ]]; then
                        touch $state_file
index 7465a83f813fa7bdc8d34cb6bfaab745d44d897a..51d94e4fa9a4761ed002e3cb87995e4ffd886ddd 100755 (executable)
@@ -64,7 +64,7 @@ function kernel_event_generator
        state_file=$1
        kernel_event_generator_suspended=0
        trap kernel_event_generator_toogle_state SIGUSR1
-       trap "exit" SIGTERM SIGINT
+
        while (true); do
                if [[ $kernel_event_generator_suspended -eq "1" ]]; then
                        touch $state_file
index 8941e476d50b9e5730fc90633da412acc703ca28..82f79a8e6ad56c030a49fdce365596272fab683e 100755 (executable)
@@ -56,7 +56,7 @@ function ust_event_generator
        state_file=$1
        ust_event_generator_suspended=0
        trap ust_event_generator_toogle_state SIGUSR1
-       trap "exit" SIGTERM SIGINT
+
        while (true); do
                if [[ $ust_event_generator_suspended -eq "1" ]]; then
                        touch $state_file
index 5945bde79a600e7d9c30dd4d5e98967f15f68a46..1bcf35328691e7807a51523374bab2a097f40b9d 100755 (executable)
@@ -176,7 +176,6 @@ function interrupt_cleanup()
        reset_bw_limit
        # invoke utils cleanup
        full_cleanup
-       exit 1
 }
 
 plan_tests $NUM_TESTS
index a7a93771a1bfca3744abd1a77f62d963fe4824f6..e404564e8412385d0ea179dc1b35ec85db7cf018 100755 (executable)
@@ -48,8 +48,7 @@ function run_app()
 function signal_cleanup()
 {
        diag "*** Exiting ***"
-       stop_lttng_sessiond
-       exit 1
+       full_cleanup
 }
 
 function enable_ust_lttng_channel_size_limit ()
index 82e8ad505bbd4d9f789a5032afe8a0794389dcb7..c9f8403e13e5c961a7775c2d59442d2faa329bf3 100755 (executable)
@@ -112,11 +112,10 @@ function sighandler()
 {
        cleanup
        rm $LOG_FILE
-       exit 1
+       full_cleanup
 }
 
-trap sighandler SIGINT
-trap sighandler SIGTERM
+trap sighandler SIGINT SIGTERM
 
 # Make sure we collect a coredump if possible.
 ulimit -c unlimited
index ed989498dbd7df7e7ed2b1b2ab94fe7e1cdb1da9..4203ac30ee1210e61d7eadc97fc9cdf76f957414 100755 (executable)
@@ -142,11 +142,10 @@ function sighandler()
 {
        cleanup
        rm $LOG_FILE_SESSIOND $LOG_FILE_RELAYD
-       exit 1
+       full_cleanup
 }
 
-trap sighandler SIGINT
-trap sighandler SIGTERM
+trap sighandler SIGINT SIGTERM
 
 # Make sure we collect a coredump if possible.
 ulimit -c unlimited
index c699ac226d54ac8c486b977b4dab5edd5c8d3c89..d0121e32e429df5e05a691b7df00425e2d867eae 100755 (executable)
@@ -144,11 +144,10 @@ function sighandler()
 {
        cleanup
        #rm $LOG_FILE_SESSIOND $LOG_FILE_RELAYD
-       exit 1
+       full_cleanup
 }
 
-trap sighandler SIGINT
-trap sighandler SIGTERM
+trap sighandler SIGINT SIGTERM
 
 # Make sure we collect a coredump if possible.
 ulimit -c unlimited
This page took 0.031022 seconds and 5 git commands to generate.