+ if [[ $ret -ne "0" ]]; then
+ print_errors $output_dir "${high_output_file_pattern}"
+ fi
+
+
+ destroy_lttng_session_ok $SESSION_NAME
+ stop_lttng_sessiond
+
+ 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 &
+ local generator_pid=$!
+
+ test_multi_app ust $generator_pid
+
+ kill -s SIGTERM $generator_pid 2> /dev/null
+ wait $generator_pid 2> /dev/null
+ rm -rf ${TESTAPP_STATE_FILE} 2> /dev/null
+}
+
+function test_multi_app_kernel ()
+{
+ diag "Multi client app kernel notification"
+ modprobe lttng-test
+
+ kernel_event_generator $TESTAPP_STATE_FILE &
+ local generator_pid=$!
+
+ test_multi_app kernel $generator_pid
+
+
+ kill -s SIGTERM $generator_pid 2> /dev/null
+ wait $generator_pid 2> /dev/null
+ rm -rf ${TESTAPP_STATE_FILE} 2> /dev/null
+
+ rmmod lttng-test
+}
+
+function test_on_register_evaluation_ust ()
+{
+ diag "On register notification UST"
+
+ # Start app in infinite loop
+ ust_event_generator $TESTAPP_STATE_FILE &
+ local generator_pid=$!
+
+ test_on_register_evaluation ust $generator_pid
+
+ kill -s SIGTERM $generator_pid 2> /dev/null
+ wait $generator_pid 2> /dev/null
+ rm -rf ${TESTAPP_STATE_FILE} 2> /dev/null
+
+}
+
+function test_on_register_evaluation_kernel()
+{
+ diag "On register notification kernel"
+
+ modprobe lttng-test
+
+ kernel_event_generator $TESTAPP_STATE_FILE &
+ local generator_pid=$!
+
+ test_on_register_evaluation kernel $generator_pid
+
+
+ kill -s SIGTERM $generator_pid 2> /dev/null
+ wait $generator_pid 2> /dev/null
+ rm -rf ${TESTAPP_STATE_FILE} 2> /dev/null
+
+ rmmod lttng-test
+}
+
+function test_on_register_evaluation ()
+{
+ local domain_type=$1
+ local event_generator_pid=$2
+
+ local app_pids=()
+ local high_output_file_pattern="high_app_output_file_on_register_evaluation"
+
+ local output_dir=$(mktemp -d)
+ local testpoint_base_path=$(readlink -f "$output_dir/lttng.t_p_n_register_evaluation")
+ local testpoint_pipe_path=$(mktemp -u "${testpoint_base_path}.XXXXXX")
+ local domain_string=""
+ local event_name=""
+
+ case $domain_type in
+ ust)
+ domain_string=LTTNG_DOMAIN_UST
+ event_name="tp:tptest"
+ ;;
+ kernel)
+ domain_string=LTTNG_DOMAIN_KERNEL
+ event_name="lttng_test_filter_event"
+ ;;
+ *)
+ fail "Invalid domain type"
+ exit 1
+ ;;
+ esac
+
+ # Setup
+ LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${testpoint_pipe_path} LD_PRELOAD=${TESTPOINT}"
+ start_lttng_sessiond
+
+ create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+ enable_${domain_type}_lttng_channel_ok $SESSION_NAME $CHANNEL_NAME --subbuf-size=$PAGE_SIZE
+ enable_${domain_type}_lttng_event_ok $SESSION_NAME $event_name $CHANNEL_NAME
+
+ # Fetch consumerd testpoint pipe information
+ # This is needed since the testpoint create a pipe with the consumer type suffixed
+ consumerd_pipe=()
+ for f in "$testpoint_pipe_path"*; do
+ consumerd_pipe+=("$f")
+ done
+
+ high_app_output_file=${high_output_file_pattern}.first_receiver
+ high_app_output_path=$output_dir/${high_app_output_file}
+ start_client $high_app_output_path $SESSION_NAME $CHANNEL_NAME $domain_string HIGH RATIO 0.420 1
+
+ wait_for_message $output_dir "${high_app_output_file}" "sync: ready"
+
+ # Stop consumerd consumption to force high notification
+ start_lttng_tracing_ok $SESSION_NAME
+
+ for pipe in "${consumerd_pipe[@]}"; do
+ stop_consumerd "${pipe}"
+ done
+
+ wait_for_message $output_dir "${high_app_output_file}" "notification: high 0"
+
+ # Start a second receiver, the receiver should receive a high
+ # notification on subscription
+ high_app_output_file=${high_output_file_pattern}.second_receiver
+ high_app_output_path=$output_dir/${high_app_output_file}
+ start_client $high_app_output_path $SESSION_NAME $CHANNEL_NAME $domain_string HIGH RATIO 0.420 1
+ wait_for_message $output_dir "${high_app_output_file}" "sync: ready"
+ wait_for_message $output_dir "${high_app_output_file}" "notification: high 0"
+
+ # Resume consumerd
+ for pipe in "${consumerd_pipe[@]}"; do
+ resume_consumerd "${pipe}"
+ done
+
+ wait_for_message $output_dir "${high_output_file_pattern}" "exit: 0"
+ ret=$?
+ ok $ret "Application for high notification terminated normally"
+ if [[ $ret -ne "0" ]]; then