Tests: notification.c: add `test_scenario` parameter
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 11 Feb 2020 20:44:21 +0000 (15:44 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 4 Mar 2021 16:59:25 +0000 (11:59 -0500)
This parameter signifies what test cases to run. Test cases are grouped
by test scenario requirements (e.g. what test app to run).

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ic94bc8e08ada7ed3c9b6ec36f89b57d0becde9d3
Depends-on: lttng-ust: I5a800fc92e588c2a6a0e26282b0ad5f31c044479

tests/regression/Makefile.am
tests/regression/tools/notification/Makefile.am
tests/regression/tools/notification/notification.c
tests/regression/tools/notification/test_notification_kernel [deleted file]
tests/regression/tools/notification/test_notification_kernel_buffer_usage [new file with mode: 0755]
tests/regression/tools/notification/test_notification_kernel_error [new file with mode: 0755]
tests/regression/tools/notification/test_notification_ust [deleted file]
tests/regression/tools/notification/test_notification_ust_buffer_usage [new file with mode: 0755]
tests/regression/tools/notification/test_notification_ust_error [new file with mode: 0755]

index 2ec92262ce11b7d911f341f149659fe5054aec46..b066149652fdb319d3d1a4e69fa32a46ae282b37 100644 (file)
@@ -27,8 +27,10 @@ TESTS = tools/filtering/test_invalid_filter \
        tools/crash/test_crash \
        tools/regen-metadata/test_ust \
        tools/regen-statedump/test_ust \
-       tools/notification/test_notification_ust \
-       tools/notification/test_notification_kernel \
+       tools/notification/test_notification_ust_error \
+       tools/notification/test_notification_ust_buffer_usage \
+       tools/notification/test_notification_kernel_error \
+       tools/notification/test_notification_kernel_buffer_usage \
        tools/notification/test_notification_multi_app \
        tools/rotation/test_ust \
        tools/rotation/test_kernel \
index f1f2a1667982469df24f1f36757d92683931b42f..89315aa765f5d39a31c2de30cf31840c63a8fcb8 100644 (file)
@@ -10,7 +10,7 @@ noinst_PROGRAMS = base_client notification rotation
 if NO_SHARED
 
 CLEANFILES = libpause_consumer.so libpause_consumer.so.debug
-EXTRA_DIST = test_notification_ust test_notification_kernel test_notification_multi_app base_client.c notification.c consumer_testpoints.c
+EXTRA_DIST = test_notification_ust_error test_notification_ust_buffer_usage test_notification_kernel_error test_notification_kernel_buffer_usage test_notification_multi_app base_client.c notification.c consumer_testpoints.c
 
 else
 
@@ -37,8 +37,8 @@ notification_LDADD = $(LIB_LTTNG_CTL) $(LIBTAP) -lm
 rotation_SOURCES = rotation.c
 rotation_LDADD = $(LIB_LTTNG_CTL) $(LIBTAP) -lm
 
-noinst_SCRIPTS = test_notification_ust test_notification_kernel test_notification_multi_app test_rotation
-EXTRA_DIST = test_notification_ust test_notification_kernel test_notification_multi_app test_rotation
+noinst_SCRIPTS = test_notification_ust_error test_notification_ust_buffer_usage test_notification_kernel_error test_notification_kernel_buffer_usage test_notification_multi_app test_rotation
+EXTRA_DIST = test_notification_ust_error test_notification_ust_buffer_usage test_notification_kernel_error test_notification_kernel_buffer_usage test_notification_multi_app test_rotation
 
 
 all-local:
index 631948cda93d4a440875a8146fb306d4147edf5a..2fece6bbde05c17ee36431266dab5a19af4d5b95 100644 (file)
@@ -854,28 +854,19 @@ end:
 
 int main(int argc, const char *argv[])
 {
+       int test_scenario;
        const char *session_name = NULL;
        const char *channel_name = NULL;
        const char *domain_type_string = NULL;
        enum lttng_domain_type domain_type = LTTNG_DOMAIN_NONE;
 
-       plan_tests(NUM_TESTS);
-
-       /* Argument 6 and upward are named pipe location for consumerd control */
-       named_pipe_args_start = 6;
-
-       if (argc < 7) {
-               fail("Missing parameter for tests to run %d", argc);
+       if (argc < 3) {
+               fail("Missing test scenario and/or domain type argument(s)");
                goto error;
        }
 
-       nb_args = argc;
-
-       domain_type_string = argv[1];
-       session_name = argv[2];
-       channel_name = argv[3];
-       app_pid = (pid_t) atoi(argv[4]);
-       app_state_file = argv[5];
+       test_scenario = atoi(argv[1]);
+       domain_type_string = argv[2];
 
        if (!strcmp("LTTNG_DOMAIN_UST", domain_type_string)) {
                domain_type = LTTNG_DOMAIN_UST;
@@ -888,23 +879,70 @@ int main(int argc, const char *argv[])
                goto error;
        }
 
-       /*
-        * Test cases are responsible for resuming the app when needed and
-        * making sure it's suspended when returning.
-        */
-       suspend_application();
+       switch (test_scenario) {
+       case 1:
+       {
+               plan_tests(7);
+               /* Test cases that need gen-ust-event testapp. */
+               diag("Test basic notification error paths for domain %s",
+                               domain_type_string);
+               test_invalid_channel_subscription(domain_type);
+               break;
+       }
+       case 2:
+       {
+               /* Test cases that need a tracing session enabled. */
+               plan_tests(99);
 
-       diag("Test trigger for domain %s with buffer_usage_low condition", domain_type_string);
-       test_triggers_buffer_usage_condition(session_name, channel_name, domain_type, LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW);
-       diag("Test trigger for domain %s with buffer_usage_high condition", domain_type_string);
-       test_triggers_buffer_usage_condition(session_name, channel_name, domain_type, LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH);
+               /*
+                * Argument 7 and upward are named pipe location for consumerd
+                * control.
+                */
+               named_pipe_args_start = 7;
+
+               if (argc < 8) {
+                       fail("Missing parameter for tests to run %d", argc);
+                       goto error;
+               }
 
-       /* Basic error path check. */
-       test_invalid_channel_subscription(domain_type);
-       test_subscription_twice(session_name, channel_name, domain_type);
+               nb_args = argc;
+
+               session_name = argv[3];
+               channel_name = argv[4];
+               app_pid = (pid_t) atoi(argv[5]);
+               app_state_file = argv[6];
+
+               /*
+                * Test cases are responsible for resuming the app when needed
+                * and making sure it's suspended when returning.
+                */
+               suspend_application();
+
+               test_subscription_twice(session_name, channel_name,
+                               domain_type);
+
+               diag("Test trigger for domain %s with buffer_usage_low condition",
+                               domain_type_string);
+               test_triggers_buffer_usage_condition(session_name, channel_name,
+                               domain_type,
+                               LTTNG_CONDITION_TYPE_BUFFER_USAGE_LOW);
+
+               diag("Test trigger for domain %s with buffer_usage_high condition",
+                               domain_type_string);
+               test_triggers_buffer_usage_condition(session_name, channel_name,
+                               domain_type,
+                               LTTNG_CONDITION_TYPE_BUFFER_USAGE_HIGH);
+
+               diag("Test buffer usage notification channel api for domain %s",
+                               domain_type_string);
+               test_buffer_usage_notification_channel(session_name, channel_name,
+                               domain_type, argv);
+               break;
+       }
+       default:
+               abort();
+       }
 
-       diag("Test buffer usage notification channel api for domain %s", domain_type_string);
-       test_buffer_usage_notification_channel(session_name, channel_name, domain_type, argv);
 error:
        return exit_status();
 }
diff --git a/tests/regression/tools/notification/test_notification_kernel b/tests/regression/tools/notification/test_notification_kernel
deleted file mode 100755 (executable)
index 4caa976..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2017 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
-#
-# SPDX-License-Identifier: LGPL-2.1-only
-
-CURDIR=$(dirname $0)/
-TESTDIR=$CURDIR/../../../
-
-TMPDIR=$(mktemp -d)
-
-#This is needed since the testpoint create a pipe with the consumerd type suffixed
-TESTPOINT_BASE_PATH=$(readlink -f "$TMPDIR/lttng.t_p_n")
-TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX")
-TESTPOINT=$(readlink -f ${CURDIR}/.libs/libpause_consumer.so)
-
-
-TESTAPP_PATH="$TESTDIR/utils/testapp"
-TESTAPP_NAME="gen-ust-events"
-TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
-TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX")
-
-NR_ITER=-1
-NR_USEC_WAIT=5
-
-SESSION_NAME="my_session"
-CHANNEL_NAME="my_channel"
-
-TRACE_PATH=$(mktemp -d)
-PAGE_SIZE=$(getconf PAGE_SIZE)
-
-DIR=$(readlink -f $TESTDIR)
-NUM_TESTS=104
-
-source $TESTDIR/utils/utils.sh
-
-function kernel_event_generator_toggle_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_toggle_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 2> /dev/null
-               fi
-       done
-}
-
-function kernel_test
-{
-       local consumerd_pipe=()
-       local event_name="lttng_test_filter_event"
-
-       modprobe lttng-test
-
-       LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LD_PRELOAD=${TESTPOINT}"
-       start_lttng_sessiond_notap
-
-       create_lttng_session_notap $SESSION_NAME $TRACE_PATH
-
-       lttng_enable_kernel_channel_notap $SESSION_NAME $CHANNEL_NAME --subbuf-size=$PAGE_SIZE
-       enable_kernel_lttng_event_notap $SESSION_NAME $event_name $CHANNEL_NAME
-
-       #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
-
-       kernel_event_generator $TESTAPP_STATE_PATH &
-       APP_PID=$!
-
-       $CURDIR/notification LTTNG_DOMAIN_KERNEL $SESSION_NAME $CHANNEL_NAME $APP_PID $TESTAPP_STATE_PATH ${consumerd_pipe[@]}
-
-       destroy_lttng_session_notap $SESSION_NAME
-       stop_lttng_sessiond_notap
-
-       kill -9 $APP_PID
-       wait $APP_PID 2> /dev/null
-
-
-       modprobe --remove lttng-test
-
-       rm -rf ${consumerd_pipe[@]} 2> /dev/null
-}
-
-if [ "$(id -u)" == "0" ]; then
-       validate_lttng_modules_present
-       kernel_test
-else
-       # Kernel tests are skipped.
-       plan_tests $NUM_TESTS
-       skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
-fi
-
-# Just in case cleanup
-rm -rf $TRACE_PATH
-rm -rf $TMPDIR
diff --git a/tests/regression/tools/notification/test_notification_kernel_buffer_usage b/tests/regression/tools/notification/test_notification_kernel_buffer_usage
new file mode 100755 (executable)
index 0000000..904212f
--- /dev/null
@@ -0,0 +1,116 @@
+#!/bin/bash
+#
+# Copyright (C) 2017 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
+#
+# SPDX-License-Identifier: LGPL-2.1-only
+
+CURDIR=$(dirname "$0")/
+TESTDIR=$CURDIR/../../../
+
+TMPDIR=$(mktemp -d)
+
+#This is needed since the testpoint create a pipe with the consumerd type suffixed
+TESTPOINT_BASE_PATH=$(readlink -f "$TMPDIR/lttng.t_p_n")
+TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX")
+TESTPOINT=$(readlink -f "${CURDIR}/.libs/libpause_consumer.so")
+TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX")
+
+
+SESSION_NAME="my_session"
+CHANNEL_NAME="my_channel"
+
+NUM_TESTS=104
+
+# shellcheck source=../../../utils/utils.sh
+source "$TESTDIR/utils/utils.sh"
+
+function kernel_event_generator_toggle_state
+{
+       kernel_event_generator_suspended=$((kernel_event_generator_suspended==0))
+}
+
+function generate_filter_events
+{
+       /bin/echo -n "10" > /proc/lttng-test-filter-event 2> /dev/null
+}
+
+function kernel_event_generator
+{
+       command_to_run=$1
+       state_file=$2
+       kernel_event_generator_suspended=0
+       trap kernel_event_generator_toggle_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
+                       $command_to_run
+               fi
+       done
+}
+
+function test_buffer_usage_notification
+{
+       local event_name="lttng_test_filter_event"
+       local trace_path
+       local page_size
+       local consumerd_pipe=()
+
+       trace_path=$(mktemp -d)
+       page_size=$(getconf PAGE_SIZE)
+
+       create_lttng_session_notap $SESSION_NAME "$trace_path"
+
+       lttng_enable_kernel_channel_notap $SESSION_NAME $CHANNEL_NAME \
+               --subbuf-size="$page_size"
+       enable_kernel_lttng_event_notap $SESSION_NAME $event_name $CHANNEL_NAME
+
+       kernel_event_generator generate_filter_events "$TESTAPP_STATE_PATH" &
+       APP_PID=$!
+
+       # 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
+
+       "$CURDIR/notification" 2 LTTNG_DOMAIN_KERNEL $SESSION_NAME $CHANNEL_NAME \
+               $APP_PID $TESTAPP_STATE_PATH ${consumerd_pipe[@]}
+
+       destroy_lttng_session_notap $SESSION_NAME
+
+       kill -9 $APP_PID
+       wait $APP_PID 2> /dev/null
+}
+
+if [ "$(id -u)" == "0" ]; then
+
+       validate_lttng_modules_present
+
+
+       modprobe lttng-test
+
+       # Used on sessiond launch.
+       LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 \
+               CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} \
+               LD_PRELOAD=${TESTPOINT}"
+       start_lttng_sessiond_notap
+
+       test_buffer_usage_notification
+
+       stop_lttng_sessiond_notap
+       rmmod lttng-test
+
+       rm -rf "${consumerd_pipe[@]}" 2> /dev/null
+else
+       # Kernel tests are skipped.
+       plan_tests $NUM_TESTS
+       skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
+fi
+
+rm -rf "$TMPDIR"
diff --git a/tests/regression/tools/notification/test_notification_kernel_error b/tests/regression/tools/notification/test_notification_kernel_error
new file mode 100755 (executable)
index 0000000..b69a4d8
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+#
+# Copyright (C) 2017 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
+#
+# SPDX-License-Identifier: LGPL-2.1-only
+
+CURDIR=$(dirname "$0")/
+TESTDIR=$CURDIR/../../../
+
+TMPDIR=$(mktemp -d)
+
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX")
+
+NUM_TESTS=44
+
+# shellcheck source=../../../utils/utils.sh
+source "$TESTDIR/utils/utils.sh"
+
+function test_basic_error_path
+{
+       $CURDIR/notification 1 LTTNG_DOMAIN_KERNEL
+}
+
+
+if [ "$(id -u)" == "0" ]; then
+       validate_lttng_modules_present
+
+       modprobe lttng-test
+
+       start_lttng_sessiond_notap
+
+       test_basic_error_path
+
+       stop_lttng_sessiond_notap
+       rmmod lttng-test
+
+else
+       # Kernel tests are skipped.
+       plan_tests $NUM_TESTS
+       skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
+fi
+
+# Just in case cleanup
+rm -rf "$TMPDIR"
diff --git a/tests/regression/tools/notification/test_notification_ust b/tests/regression/tools/notification/test_notification_ust
deleted file mode 100755 (executable)
index 8a3f460..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2017 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
-#
-# SPDX-License-Identifier: LGPL-2.1-only
-
-CURDIR=$(dirname $0)/
-TESTDIR=$CURDIR/../../../
-
-TMPDIR=$(mktemp -d)
-
-#This is needed since the testpoint create a pipe with the consumerd type suffixed
-TESTPOINT_BASE_PATH=$(readlink -f "$TMPDIR/lttng.t_p_n")
-TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX")
-TESTPOINT=$(readlink -f ${CURDIR}/.libs/libpause_consumer.so)
-
-
-TESTAPP_PATH="$TESTDIR/utils/testapp"
-TESTAPP_NAME="gen-ust-events"
-TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
-TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX")
-
-NR_ITER=5
-NR_USEC_WAIT=5
-
-SESSION_NAME="my_session"
-CHANNEL_NAME="my_channel"
-
-TRACE_PATH=$(mktemp -d)
-PAGE_SIZE=$(getconf PAGE_SIZE)
-
-DIR=$(readlink -f $TESTDIR)
-
-
-source $TESTDIR/utils/utils.sh
-
-function ust_event_generator_toggle_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_toggle_state SIGUSR1
-
-       while (true); do
-               if [[ $ust_event_generator_suspended -eq "1" ]]; then
-                       touch $state_file
-                       sleep 0.5
-               else
-                       if [[ -f $state_file ]]; then
-                               rm -rf $state_file 2> /dev/null
-                       fi
-                       taskset  -c 0 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT > /dev/null 2>&1
-               fi
-       done
-}
-
-consumerd_pipe=()
-file_sync_after_first_event=$(mktemp -u)
-event_name="tp:tptest"
-
-LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LD_PRELOAD=${TESTPOINT}"
-start_lttng_sessiond_notap
-
-create_lttng_session_notap $SESSION_NAME $TRACE_PATH
-
-enable_ust_lttng_channel_notap $SESSION_NAME $CHANNEL_NAME --subbuf-size=$PAGE_SIZE
-enable_ust_lttng_event_notap $SESSION_NAME $event_name $CHANNEL_NAME
-
-#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
-
-
-ust_event_generator $TESTAPP_STATE_PATH &
-APP_PID=$!
-
-$CURDIR/notification LTTNG_DOMAIN_UST $SESSION_NAME $CHANNEL_NAME $APP_PID $TESTAPP_STATE_PATH ${consumerd_pipe[@]}
-
-destroy_lttng_session_notap $SESSION_NAME
-stop_lttng_sessiond_notap
-
-# On ungraceful kill the app is cleaned up via the full_cleanup call
-# Suppress kill message
-kill -9 $APP_PID
-wait $APP_PID 2> /dev/null
-
-rm -rf $TMPDIR
-
-# Just in case cleanup
-rm -rf $TRACE_PATH
diff --git a/tests/regression/tools/notification/test_notification_ust_buffer_usage b/tests/regression/tools/notification/test_notification_ust_buffer_usage
new file mode 100755 (executable)
index 0000000..7e530d8
--- /dev/null
@@ -0,0 +1,96 @@
+#!/bin/bash
+#
+# Copyright (C) 2017 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
+#
+# SPDX-License-Identifier: LGPL-2.1-only
+
+CURDIR=$(dirname "$0")/
+TESTDIR=$CURDIR/../../../
+
+TMPDIR=$(mktemp -d)
+
+#This is needed since the testpoint create a pipe with the consumerd type suffixed
+TESTPOINT_BASE_PATH=$(readlink -f "$TMPDIR/lttng.t_p_n")
+TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX")
+TESTPOINT=$(readlink -f "${CURDIR}/.libs/libpause_consumer.so")
+
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+
+GEN_UST_EVENTS_TESTAPP_NAME="gen-ust-events"
+GEN_UST_EVENTS_TESTAPP_BIN="$TESTAPP_PATH/$GEN_UST_EVENTS_TESTAPP_NAME/$GEN_UST_EVENTS_TESTAPP_NAME"
+
+TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX")
+
+SESSION_NAME="my_session"
+CHANNEL_NAME="my_channel"
+
+TRACE_PATH=$(mktemp -d)
+PAGE_SIZE=$(getconf PAGE_SIZE)
+
+# shellcheck source=../../../utils/utils.sh
+source "$TESTDIR/utils/utils.sh"
+
+function ust_event_generator_toggle_state
+{
+       ust_event_generator_suspended=$((ust_event_generator_suspended==0))
+
+}
+function ust_event_generator
+{
+       test_app=$1
+       state_file=$2
+       ust_event_generator_suspended=0
+       trap ust_event_generator_toggle_state SIGUSR1
+
+       while (true); do
+               if [[ $ust_event_generator_suspended -eq "1" ]]; then
+                       touch $state_file
+                       sleep 0.5
+               else
+                       if [[ -f $state_file ]]; then
+                               rm -rf $state_file 2> /dev/null
+                       fi
+                       taskset  -c 0 $test_app -i $NR_ITER -w $NR_USEC_WAIT > /dev/null 2>&1
+               fi
+       done
+}
+
+function test_buffer_usage_notification
+{
+       consumerd_pipe=()
+       event_name="tp:tptest"
+
+       create_lttng_session_notap $SESSION_NAME "$TRACE_PATH"
+
+       enable_ust_lttng_channel_notap $SESSION_NAME $CHANNEL_NAME --subbuf-size="$PAGE_SIZE"
+       enable_ust_lttng_event_notap $SESSION_NAME $event_name $CHANNEL_NAME
+
+       # 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
+
+       ust_event_generator $GEN_UST_EVENTS_TESTAPP_BIN $TESTAPP_STATE_PATH &
+       APP_PID=$!
+
+       "$CURDIR/notification" 2 LTTNG_DOMAIN_UST $SESSION_NAME $CHANNEL_NAME $APP_PID "$TESTAPP_STATE_PATH" "${consumerd_pipe[@]}"
+
+       destroy_lttng_session_notap $SESSION_NAME
+
+       # On ungraceful kill the app is cleaned up via the full_cleanup call
+       # Suppress kill message
+       kill -9 $APP_PID
+       wait $APP_PID 2> /dev/null
+
+       # Just in case cleanup
+       rm -rf "$TRACE_PATH"
+}
+
+LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 CONSUMER_PAUSE_PIPE_PATH=${TESTPOINT_PIPE_PATH} LD_PRELOAD=${TESTPOINT}"
+start_lttng_sessiond_notap
+
+test_buffer_usage_notification
+
+stop_lttng_sessiond_notap
+
+rm -rf "$TMPDIR"
diff --git a/tests/regression/tools/notification/test_notification_ust_error b/tests/regression/tools/notification/test_notification_ust_error
new file mode 100755 (executable)
index 0000000..53c3959
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# Copyright (C) 2017 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
+#
+# SPDX-License-Identifier: LGPL-2.1-only
+
+CURDIR=$(dirname "$0")/
+TESTDIR=$CURDIR/../../../
+
+TMPDIR=$(mktemp -d)
+
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+
+GEN_UST_EVENTS_TESTAPP_NAME="gen-ust-events"
+GEN_UST_EVENTS_TESTAPP_BIN="$TESTAPP_PATH/$GEN_UST_EVENTS_TESTAPP_NAME/$GEN_UST_EVENTS_TESTAPP_NAME"
+
+TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX")
+
+# shellcheck source=../../../utils/utils.sh
+source "$TESTDIR/utils/utils.sh"
+
+function test_basic_error_path
+{
+       $CURDIR/notification 1 LTTNG_DOMAIN_UST
+}
+
+start_lttng_sessiond_notap
+
+test_basic_error_path
+
+stop_lttng_sessiond_notap
This page took 0.034275 seconds and 4 git commands to generate.