X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Fnotification%2Ftest_notification_multi_app;h=f2cbf43a86e9eba9f54c2828a7eff9cd042e2e96;hp=752f4d6de73e1fba346c5c02b139adf02f4e287e;hb=2463b7879c00298daa79744cdaae82ac061a4ed8;hpb=6c4a91d639747f260ab46decebc50998ef063712 diff --git a/tests/regression/tools/notification/test_notification_multi_app b/tests/regression/tools/notification/test_notification_multi_app index 752f4d6de..f2cbf43a8 100755 --- a/tests/regression/tools/notification/test_notification_multi_app +++ b/tests/regression/tools/notification/test_notification_multi_app @@ -1,19 +1,8 @@ #!/bin/bash # -# Copyright (C) - 2017 Jonathan Rajotte > +# Copyright (C) 2017 Jonathan Rajotte > # -# This library is free software; you can redistribute it and/or modify it under -# the terms of the GNU Lesser General Public License as published by the Free -# Software Foundation; version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -# details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this library; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# SPDX-License-Identifier: LGPL-2.1-only TEST_DESC="Notification" @@ -43,6 +32,7 @@ NUM_TEST_KERNEL=50 NUM_TESTS=$(($NUM_TEST_UST + $NUM_TEST_KERNEL)) source $TESTDIR/utils/utils.sh +source $CURDIR/util_event_generator.sh consumerd_pipe=() file_sync_after_first_event=$(mktemp -u) @@ -54,54 +44,6 @@ print_test_banner "$TEST_DESC" app_pids=() -function kernel_event_generator_toogle_state -{ - kernel_event_generator_suspended=$((kernel_event_generator_suspended==0)) - -} -function kernel_event_generator -{ - state_file=$1 - kernel_event_generator_suspended=0 - trap kernel_event_generator_toogle_state SIGUSR1 - - while (true); do - if [[ $kernel_event_generator_suspended -eq "1" ]]; then - touch $state_file - sleep 0.5 - else - if [[ -f $state_file ]]; then - rm $state_file 2> /dev/null - fi - echo -n "1000" > /proc/lttng-test-filter-event - fi - done -} - -function ust_event_generator_toogle_state -{ - ust_event_generator_suspended=$((ust_event_generator_suspended==0)) - -} -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 - sleep 0.5 - else - if [[ -f $state_file ]]; then - rm $state_file 2> /dev/null - fi - taskset -c 0 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT > /dev/null 2>&1 - fi - done -} - function start_client { local pid=-1 local output_file=$1 @@ -297,7 +239,6 @@ function test_multi_app () print_errors $output_dir "${high_output_file_pattern}" fi - rm -rf $output_dir destroy_lttng_session_ok $SESSION_NAME stop_lttng_sessiond @@ -305,17 +246,19 @@ function test_multi_app () for pipe in "${consumerd_pipe[@]}"; do rm -rf "${pipe}" done + + rm -rf $output_dir } function test_multi_app_ust () { diag "Multi client app UST notification" - ust_event_generator $TESTAPP_STATE_FILE & + ust_event_generator "$TESTAPP_BIN" "$TESTAPP_STATE_FILE" & local generator_pid=$! test_multi_app ust $generator_pid - kill -s SIGTERM $generator_pid 2> /dev/null + kill -s SIGUSR2 $generator_pid 2> /dev/null wait $generator_pid 2> /dev/null rm -rf ${TESTAPP_STATE_FILE} 2> /dev/null } @@ -325,13 +268,13 @@ function test_multi_app_kernel () diag "Multi client app kernel notification" modprobe lttng-test - kernel_event_generator $TESTAPP_STATE_FILE & + kernel_event_generator generate_filter_events $TESTAPP_STATE_FILE & local generator_pid=$! test_multi_app kernel $generator_pid - kill -s SIGTERM $generator_pid 2> /dev/null + kill -s SIGUSR2 $generator_pid 2> /dev/null wait $generator_pid 2> /dev/null rm -rf ${TESTAPP_STATE_FILE} 2> /dev/null @@ -343,12 +286,12 @@ function test_on_register_evaluation_ust () diag "On register notification UST" # Start app in infinite loop - ust_event_generator $TESTAPP_STATE_FILE & + ust_event_generator "$TESTAPP_BIN" "$TESTAPP_STATE_FILE" & local generator_pid=$! test_on_register_evaluation ust $generator_pid - kill -s SIGTERM $generator_pid 2> /dev/null + kill -s SIGUSR2 $generator_pid 2> /dev/null wait $generator_pid 2> /dev/null rm -rf ${TESTAPP_STATE_FILE} 2> /dev/null @@ -360,13 +303,13 @@ function test_on_register_evaluation_kernel() modprobe lttng-test - kernel_event_generator $TESTAPP_STATE_FILE & + kernel_event_generator generate_filter_events $TESTAPP_STATE_FILE & local generator_pid=$! test_on_register_evaluation kernel $generator_pid - kill -s SIGTERM $generator_pid 2> /dev/null + kill -s SIGUSR2 $generator_pid 2> /dev/null wait $generator_pid 2> /dev/null rm -rf ${TESTAPP_STATE_FILE} 2> /dev/null @@ -453,18 +396,18 @@ function test_on_register_evaluation () print_errors "${high_output_file_pattern}" fi - rm -rf $output_dir destroy_lttng_session_ok $SESSION_NAME stop_lttng_sessiond - kill -s SIGTERM $generator_pid 2> /dev/null + kill -s SIGUSR2 $generator_pid 2> /dev/null wait $generator_pid 2> /dev/null for pipe in "${consumerd_pipe[@]}"; do rm -rf "${pipe}" done + rm -rf "$output_dir" }