/tests/regression/ust/ust-dl/test_ust-dl
/tests/regression/ust/multi-lib/exec-with-callsites
/tests/regression/ust/multi-lib/exec-without-callsites
+/tests/utils/testapp/gen-data-pending/gen-data-pending
/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack
/tests/utils/testapp/gen-ust-events/gen-ust-events
/tests/utils/testapp/gen-ust-events-ns/gen-ust-events-ns
tests/utils/lttngtest/Makefile
tests/utils/tap/Makefile
tests/utils/testapp/Makefile
+ tests/utils/testapp/gen-data-pending/Makefile
tests/utils/testapp/gen-ns-events/Makefile
tests/utils/testapp/gen-kernel-test-events/Makefile
tests/utils/testapp/gen-py-events/Makefile
* ret will be set to LTTNG_OK at the end of
* this function.
*/
- } else if (pending_ret < 0) {
+ } else if (pending_ret <= LTTNG_OK || pending_ret >= LTTNG_ERR_NR) {
ret = LTTNG_ERR_UNK;
- goto setup_error;
+ goto error;
} else {
ret = pending_ret;
- goto setup_error;
+ goto error;
}
pending_ret_byte = (uint8_t) pending_ret;
--- /dev/null
+#!/bin/bash
+#
+# Copyright (C) 2023 Kienan Stewart <kstewart@efficios.com>
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+TEST_DESC="lttng-sessiond should not crash when receiving data-pending for an active session"
+CURDIR=$(dirname "$0")
+TESTDIR=$(realpath "${CURDIR}/../../../")
+# Test app for ust event
+TESTAPP_PATH="${TESTDIR}/utils/testapp"
+TESTAPP_NAME="gen-data-pending"
+TESTAPP_BIN="${TESTAPP_PATH}/${TESTAPP_NAME}/${TESTAPP_NAME}"
+SESSION_NAME=asdf
+
+NUM_TESTS=7
+
+# shellcheck source-path=SCRIPTDIR/../../../
+source "${TESTDIR}/utils/utils.sh"
+if [ ! -x "${TESTAPP_BIN}" ] ; then
+ BAIL_OUT "Test binary '${TESTAPP_BIN}' not detected or not executable"
+fi
+
+OUTPUT_DIR=$(mktemp -d)
+CHANNEL_NAME=asdf
+
+plan_tests "${NUM_TESTS}"
+print_test_banner "${TEST_DESC}"
+
+# shellcheck disable=SC2119
+start_lttng_sessiond
+
+create_lttng_session_ok "${SESSION_NAME}" "${OUTPUT_DIR}"
+enable_ust_lttng_channel_ok "${SESSION_NAME}" "${CHANNEL_NAME}"
+start_lttng_tracing_ok "${SESSION_NAME}"
+
+"${TESTAPP_BIN}" "${SESSION_NAME}"
+
+stop_lttng_tracing_ok "${SESSION_NAME}"
+destroy_lttng_session_ok "${SESSION_NAME}"
+# shellcheck disable=SC2119
+stop_lttng_sessiond
+rm -rf "${OUTPUT_DIR}"
# SPDX-License-Identifier: GPL-2.0-only
SUBDIRS = \
+ gen-data-pending \
gen-kernel-test-events \
gen-py-events \
gen-syscall-events \
--- /dev/null
+# SPDX-FileCopyrightText: 2023 Kienan Stewart <kstewart@efficios.com>
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+
+AM_CPPFLAGS += -I$(top_srcdir)/tests/utils -I$(srcdir) \
+ -I$(top_srcdir)/tests/utils/testapp
+LIB_LTTNG_CTL = $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la
+
+if HAVE_LIBLTTNG_UST_CTL
+noinst_PROGRAMS = gen-data-pending
+gen_data_pending_SOURCES = main.cpp
+gen_data_pending_LDADD = $(LIB_LTTNG_CTL)
+endif
--- /dev/null
+/*
+ * SPDX-FileCopyrightText: 2023 Kienan Stewart <kstewart@efficios.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ */
+
+#include <lttng/lttng.h>
+
+#include <assert.h>
+
+int main(int argc, const char **argv)
+{
+ assert(argc >= 2);
+ lttng_data_pending(argv[1]);
+ return 0;
+}