+ kernel_event_generator $TESTAPP_STATE_FILE &
+ local generator_pid=$!
+
+ test_on_register_evaluation kernel $generator_pid
+
+
+ kill -9 $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 testpoint_base_path=$(readlink -f "$CURDIR/lttng.t_p_n_register_evaluation")
+ local testpoint_pipe_path=$(mktemp -u "${testpoint_base_path}.XXXXXX")
+ local domain_string=""
+ local event_name=""
+
+ # Cleanup
+ rm ${CURDIR}/${high_output_file_pattern}* 2> /dev/null
+
+ 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
+ for f in "$testpoint_base_path"*; do
+ consumerd_pipe+=("$f")
+ done
+
+ high_app_output_file=${high_output_file_pattern}.first_receiver
+ high_app_output_path=$CURDIR/${high_app_output_file}
+ start_client $high_app_output_path $SESSION_NAME $CHANNEL_NAME $domain_string HIGH RATIO 0.420 1
+
+ wait_for_message "${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 "${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=$CURDIR/${high_app_output_file}
+ start_client $high_app_output_path $SESSION_NAME $CHANNEL_NAME $domain_string HIGH RATIO 0.420 1
+ wait_for_message "${high_app_output_file}" "sync: ready"
+ wait_for_message "${high_app_output_file}" "notification: high 0"
+
+ # Resume consumerd
+ for pipe in "${consumerd_pipe[@]}"; do
+ resume_consumerd "${pipe}"
+ done
+
+ wait_for_message "${high_output_file_pattern}" "exit: 0"
+ ret=$?
+ ok $ret "Application for high notification terminated normally"
+ if [[ $ret -eq "0" ]]; then
+ rm ${CURDIR}/${high_output_file_pattern}* 2> /dev/null
+ else
+ # Keep the file
+ print_errors "${high_output_file_pattern}"
+ fi
+
+ destroy_lttng_session_ok $SESSION_NAME