[lttng-dev] [PATCH lttng-tools 2/7] Tests: Add "linking" ust regression test
Jérémie Galarneau
jeremie.galarneau at efficios.com
Mon Mar 25 20:28:31 EDT 2013
Based on the "demo" test formerly part of lttng-ust.
Tests userspace tracing with directly, statically and dynamically linked
providers. Also meant as an exemple of building and tracing an application
with all types of provider linking.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau at efficios.com>
---
.gitignore | 3 +
configure.ac | 1 +
tests/fast_regression | 1 +
tests/long_regression | 1 +
tests/regression/ust/Makefile.am | 2 +-
tests/regression/ust/linking/Makefile.am | 85 +++++++++++
tests/regression/ust/linking/README | 29 ++++
tests/regression/ust/linking/demo.c | 69 +++++++++
tests/regression/ust/linking/demo_preload | 4 +
tests/regression/ust/linking/test_linking | 35 +++++
tests/regression/ust/linking/test_linking.py | 199 +++++++++++++++++++++++++
tests/regression/ust/linking/tp.c | 26 ++++
tests/regression/ust/linking/tp2.c | 26 ++++
tests/regression/ust/linking/tp3.c | 26 ++++
tests/regression/ust/linking/ust_tests_demo.h | 61 ++++++++
tests/regression/ust/linking/ust_tests_demo2.h | 68 +++++++++
tests/regression/ust/linking/ust_tests_demo3.h | 53 +++++++
17 files changed, 688 insertions(+), 1 deletion(-)
create mode 100644 tests/regression/ust/linking/Makefile.am
create mode 100644 tests/regression/ust/linking/README
create mode 100644 tests/regression/ust/linking/demo.c
create mode 100755 tests/regression/ust/linking/demo_preload
create mode 100755 tests/regression/ust/linking/test_linking
create mode 100644 tests/regression/ust/linking/test_linking.py
create mode 100644 tests/regression/ust/linking/tp.c
create mode 100644 tests/regression/ust/linking/tp2.c
create mode 100644 tests/regression/ust/linking/tp3.c
create mode 100644 tests/regression/ust/linking/ust_tests_demo.h
create mode 100644 tests/regression/ust/linking/ust_tests_demo2.h
create mode 100644 tests/regression/ust/linking/ust_tests_demo3.h
diff --git a/.gitignore b/.gitignore
index ee58252..b9c3ec8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -64,5 +64,8 @@ gen-events
gen-ust-events
health_check
tests/regression/ust/overlap/demo/demo
+tests/regression/ust/linking/demo_builtin
+tests/regression/ust/linking/demo_static
+tests/regression/ust/linking/demo
benchmark/
diff --git a/configure.ac b/configure.ac
index 9f120f2..5494cd8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -332,6 +332,7 @@ AC_CONFIG_FILES([
tests/regression/ust/multi-session/Makefile
tests/regression/ust/overlap/Makefile
tests/regression/ust/overlap/demo/Makefile
+ tests/regression/ust/linking/Makefile
tests/unit/Makefile
tests/utils/Makefile
tests/utils/tap/Makefile
diff --git a/tests/fast_regression b/tests/fast_regression
index fb4ac60..b700fa5 100644
--- a/tests/fast_regression
+++ b/tests/fast_regression
@@ -12,3 +12,4 @@ regression/ust/nprocesses/test_nprocesses
regression/ust/overlap/test_overlap
regression/ust/test_event_basic
regression/ust/test_event_wildcard
+regression/ust/linking/test_linking
diff --git a/tests/long_regression b/tests/long_regression
index c198178..1fb68c3 100644
--- a/tests/long_regression
+++ b/tests/long_regression
@@ -14,3 +14,4 @@ regression/ust/nprocesses/test_nprocesses
regression/ust/overlap/test_overlap
regression/ust/test_event_basic
regression/ust/test_event_wildcard
+regression/ust/linking/test_linking
diff --git a/tests/regression/ust/Makefile.am b/tests/regression/ust/Makefile.am
index 78a5aab..74db00b 100644
--- a/tests/regression/ust/Makefile.am
+++ b/tests/regression/ust/Makefile.am
@@ -1,6 +1,6 @@
if HAVE_LIBLTTNG_UST_CTL
SUBDIRS = nprocesses high-throughput low-throughput before-after multi-session \
- overlap buffers-uid
+ overlap buffers-uid linking
EXTRA_DIST = test_event_basic test_event_wildcard
diff --git a/tests/regression/ust/linking/Makefile.am b/tests/regression/ust/linking/Makefile.am
new file mode 100644
index 0000000..d2c4eca
--- /dev/null
+++ b/tests/regression/ust/linking/Makefile.am
@@ -0,0 +1,85 @@
+# -Wsystem-headers is needed to print warnings in the tracepoint
+# description file.
+AM_CPPFLAGS = -I$(srcdir) -I$(top_builddir)/include -Wsystem-headers
+
+# Set LIBS to nothing so the application does not link on useless
+# libraries.
+LIBS =
+
+# Build a version of the test app with built-in tracepoints
+demo_builtin_SOURCES = demo.c tp.c tp2.c tp3.c ust_tests_demo.h \
+ ust_tests_demo2.h ust_tests_demo3.h
+demo_builtin_LDADD = -llttng-ust
+demo_builtin_CFLAGS = -Werror=old-style-definition
+
+# Build a version statically linked to the providers
+# contains ust_tests_demo.h and ust_tests_demo2.h provider probes
+noinst_LTLIBRARIES = liblttng-ust-provider-ust-tests-demo-static.la \
+ liblttng-ust-provider-ust-tests-demo3-static.la
+
+liblttng_ust_provider_ust_tests_demo_static_la_SOURCES = \
+ tp.c ust_tests_demo.h \
+ tp2.c ust_tests_demo2.h
+liblttng_ust_provider_ust_tests_demo_static_la_LIBADD = \
+ -llttng-ust
+
+# contains ust_tests_demo3.h provider probes
+liblttng_ust_provider_ust_tests_demo3_static_la_SOURCES = \
+ tp3.c ust_tests_demo3.h
+liblttng_ust_provider_ust_tests_demo3_static_la_LIBADD = \
+ -llttng-ust
+
+demo_static_SOURCES = demo.c
+demo_static_LDADD = liblttng-ust-provider-ust-tests-demo-static.la \
+ liblttng-ust-provider-ust-tests-demo3-static.la
+
+if LTTNG_TOOLS_BUILD_WITH_LIBDL
+demo_builtin_LDADD += -ldl
+demo_static_LDADD += -ldl
+endif
+if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
+demo_builtin_LDADD += -lc
+demo_static_LDADD += -lc
+endif
+
+noinst_PROGRAMS = demo_builtin demo_static
+
+if !NO_SHARED
+# Force the shared flag on the noinst libraries since they are
+# only built static by default
+FORCE_SHARED_LIB_OPTIONS = -module -shared -avoid-version \
+ -rpath $(abs_builddir)
+
+noinst_LTLIBRARIES += liblttng-ust-provider-ust-tests-demo.la \
+ liblttng-ust-provider-ust-tests-demo3.la
+
+#contains ust_tests_demo.h and ust_tests_demo2.h provider probes
+liblttng_ust_provider_ust_tests_demo_la_SOURCES = \
+ tp.c ust_tests_demo.h \
+ tp2.c ust_tests_demo2.h
+liblttng_ust_provider_ust_tests_demo_la_LIBADD = -llttng-ust
+liblttng_ust_provider_ust_tests_demo_la_LDFLAGS = \
+ $(FORCE_SHARED_LIB_OPTIONS)
+
+#contains ust_tests_demo3.h provider probes
+liblttng_ust_provider_ust_tests_demo3_la_SOURCES = \
+ tp3.c ust_tests_demo3.h
+liblttng_ust_provider_ust_tests_demo3_la_LIBADD = -llttng-ust
+liblttng_ust_provider_ust_tests_demo3_la_LDFLAGS = \
+ $(FORCE_SHARED_LIB_OPTIONS)
+
+noinst_PROGRAMS += demo
+demo_SOURCES = demo.c ust_tests_demo.h
+demo_CFLAGS = -DTEST_DYNAMIC_LINKAGE
+
+if LTTNG_TOOLS_BUILD_WITH_LIBDL
+demo_LDADD = -ldl
+endif
+if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
+demo_LDADD = -lc
+endif
+
+endif
+
+noinst_SCRIPTS = test_linking test_linking.py demo_preload
+EXTRA_DIST = test_linking test_linking.py demo_preload
diff --git a/tests/regression/ust/linking/README b/tests/regression/ust/linking/README
new file mode 100644
index 0000000..bbf3a4d
--- /dev/null
+++ b/tests/regression/ust/linking/README
@@ -0,0 +1,29 @@
+UST linking test
+----------------
+
+Tests userspace tracing with directly, statically and dynamically linked
+providers.
+
+DESCRIPTION
+-----------
+
+This test checks that tracepoints can be enabled by using LD_PRELOAD inside a
+launcher script. The test application is also compiled with tracepoint
+providers linked directly and statically. The same test suite is executed
+for every version of the binary.
+
+The resulting trace is verified to make sure it is valid and contains the
+expected valuess. This test also verifies that the execution of the demo test
+without LD_PRELOAD has not produced any logged events.
+
+Also serves as an example of building and tracing an application with all types
+of provider linking.
+
+DEPENDENCIES
+------------
+
+To run this test, you will need:
+
+ - lttng-tools
+ - babeltrace
+ - python 3.0 or better
diff --git a/tests/regression/ust/linking/demo.c b/tests/regression/ust/linking/demo.c
new file mode 100644
index 0000000..a02ee80
--- /dev/null
+++ b/tests/regression/ust/linking/demo.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2009 Pierre-Marc Fournier
+ * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+ *
+ * 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
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <stdarg.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <stdlib.h>
+
+#define TRACEPOINT_DEFINE
+
+#if TEST_DYNAMIC_LINKAGE
+#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
+#endif
+
+#include "ust_tests_demo.h"
+#include "ust_tests_demo2.h"
+#include "ust_tests_demo3.h"
+
+int main(int argc, char **argv)
+{
+ int i, netint;
+ long values[] = { 1, 2, 3 };
+ char text[10] = "test";
+ double dbl = 2.0;
+ float flt = 2222.0;
+ int delay = 0;
+
+ if (argc == 2)
+ delay = atoi(argv[1]);
+
+ fprintf(stderr, "Demo program starting.\n");
+
+ sleep(delay);
+
+ fprintf(stderr, "Tracing... ");
+ tracepoint(ust_tests_demo, starting, 123);
+ for (i = 0; i < 5; i++) {
+ netint = htonl(i);
+ tracepoint(ust_tests_demo2, loop, i, netint, values,
+ text, strlen(text), dbl, flt);
+ }
+ tracepoint(ust_tests_demo, done, 456);
+ tracepoint(ust_tests_demo3, done, 42);
+ fprintf(stderr, " done.\n");
+ return 0;
+}
diff --git a/tests/regression/ust/linking/demo_preload b/tests/regression/ust/linking/demo_preload
new file mode 100755
index 0000000..1f68a68
--- /dev/null
+++ b/tests/regression/ust/linking/demo_preload
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+CURDIR=$(dirname $0)
+LD_PRELOAD=${CURDIR}/.libs/liblttng-ust-provider-ust-tests-demo.so:${CURDIR}/.libs/liblttng-ust-provider-ust-tests-demo3.so ${CURDIR}/./demo ${*}
diff --git a/tests/regression/ust/linking/test_linking b/tests/regression/ust/linking/test_linking
new file mode 100755
index 0000000..77e0b82
--- /dev/null
+++ b/tests/regression/ust/linking/test_linking
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# Copyright (C) - 2013 Jérémie Galarneau <jeremie.galarneau at efficios.com>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License, version 2 only, as
+# published by the Free Software Foundation.
+#
+# This program 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 General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# Check for a running sessiond
+`pidof lt-lttng-sessiond`
+STOP_SESSIOND=$?
+
+CURDIR=$(dirname $0)
+TESTDIR=${CURDIR}/../../..
+
+# Try to launch a sessiond before invoking the python test script
+if [ $STOP_SESSIOND -ne 0 ]; then
+ DIR=$(readlink -f ${TESTDIR})
+ ${DIR}/../src/bin/lttng-sessiond/lttng-sessiond --daemonize --quiet --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd"
+fi
+
+python3 ${CURDIR}/test_linking.py
+
+if [ $STOP_SESSIOND -ne 0 ]; then
+ kill `pidof lt-lttng-sessiond`
+fi
diff --git a/tests/regression/ust/linking/test_linking.py b/tests/regression/ust/linking/test_linking.py
new file mode 100644
index 0000000..9591312
--- /dev/null
+++ b/tests/regression/ust/linking/test_linking.py
@@ -0,0 +1,199 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) - 2013 Jérémie Galarneau <jeremie.galarneau at efficios.com>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License, version 2 only, as
+# published by the Free Software Foundation.
+#
+# This program 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 General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import os
+import subprocess
+import re
+import shutil
+import sys
+
+test_path = os.path.dirname(os.path.abspath(__file__)) + "/"
+test_utils_path = test_path
+for i in range(4):
+ test_utils_path = os.path.dirname(test_utils_path)
+test_utils_path = test_utils_path + "/utils"
+sys.path.append(test_utils_path)
+from test_utils import *
+
+
+def check_ust_test_demo2_event(event_line, expected_int_field_value):
+ match = re.search(r".*ust_tests_demo2:loop.*", event_line)
+ if match is None:
+ return False
+ match = re.search(r".*intfield = (\d+)", event_line)
+ if match is None or int(match.group(1)) != expected_int_field_value:
+ return False
+ match = re.search(r".*longfield = (\d+)", event_line)
+ if match is None or int(match.group(1)) != expected_int_field_value:
+ return False
+ match = re.search(r".*netintfield = (\d+)", event_line)
+ if match is None or int(match.group(1)) != expected_int_field_value:
+ return False
+ match = re.search(r".*intfield2 = 0x(\d+)", event_line)
+ if match is None or int(match.group(1)) != expected_int_field_value:
+ return False
+ match = re.search(r".*netintfieldhex = 0x(\d+)", event_line)
+ if match is None or int(match.group(1)) != expected_int_field_value:
+ return False
+ match = re.search(r".*floatfield = (\d+)", event_line)
+ if match is None or int(match.group(1)) != 2222:
+ return False
+ match = re.search(r".*doublefield = (\d+)", event_line)
+ if match is None or int(match.group(1)) != 2:
+ return False
+ match = re.search(r".*_seqfield1_length = (\d+)", event_line)
+ if match is None or int(match.group(1)) != 4:
+ return False
+ match = re.search(r".*seqfield1 = \[ \[0\] = (\d+), \[1\] = (\d+), \[2\] = (\d+), \[3\] = (\d+) \]", event_line)
+ if match is None or int(match.group(1)) != 116 or int(match.group(2)) != 101 or int(match.group(3)) != 115 or int(match.group(4)) != 116:
+ return False
+ match = re.search(r".*arrfield1 = \[ \[0\] = (\d), \[1\] = (\d), \[2\] = (\d) \]", event_line)
+ if match is None or int(match.group(1)) != 1 or int(match.group(2)) != 2 or int(match.group(3)) != 3:
+ return False
+ match = re.search(r".*arrfield2 = \"([a-z]*)\"", event_line)
+ if match is None or match.group(1) != "test":
+ return False
+ match = re.search(r".*_seqfield2_length = (\d+)", event_line)
+ if match is None or int(match.group(1)) != 4:
+ return False
+ match = re.search(r".*seqfield2 = \"([a-z]*)\"", event_line)
+ if match is None or match.group(1) != "test":
+ return False
+ match = re.search(r".*stringfield = \"([a-z]*)\"", event_line)
+ if match is None or match.group(1) != "test":
+ return False
+
+ return True
+
+NR_TESTS = 0
+DYNAMIC_TEST_ENABLED = False
+
+test_executables = [test_path + "demo_static", test_path + "demo_builtin"]
+if os.path.exists(test_path + "demo"):
+ test_executables.append(test_path + "demo_preload")
+ NR_TESTS = 2
+ DYNAMIC_TEST_ENABLED = True
+
+# Only enable tests that were compiled successfully
+test_executables = [executable for executable in test_executables if os.path.exists(executable)]
+
+NR_TESTS += len(test_executables) * 10
+
+current_test = 1
+print("1..{0}".format(NR_TESTS))
+
+if NR_TESTS == 0:
+ print("# No test binary found")
+ exit(-1)
+
+# Check if a sessiond is running... bail out if none found.
+if session_daemon_alive() == 0:
+ bail("No sessiond running. Please make sure you are running this test with the \"run\" shell script and verify that the lttng tools are properly installed.")
+
+if DYNAMIC_TEST_ENABLED:
+ session_info = create_session()
+ enable_ust_tracepoint_event(session_info, "ust_tests_demo*")
+ start_session(session_info)
+
+ # Dry run, no events should be logged
+ demo_process = subprocess.Popen(test_path + "demo", stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ if sys.version_info >= (3 ,3):
+ try:
+ demo_process.wait(5)
+ except TimeoutExpired:
+ demo_process.kill()
+ bail("Failed to run demo test application without preloading")
+ else:
+ demo_process.wait()
+ stop_session(session_info)
+
+ print_test_result(demo_process.returncode == 0, current_test,\
+ "Running application dynamically linked to providers, no preload")
+ current_test += 1
+ print_test_result(not os.path.exists(session_info.trace_path), current_test,\
+ "No events logged when running demo application without preloading providers")
+ current_test += 1
+
+ shutil.rmtree(session_info.tmp_directory)
+
+for executable in test_executables:
+ executable_name = os.path.basename(executable)
+ session_info = create_session()
+ enable_ust_tracepoint_event(session_info, "ust_tests_demo*")
+ start_session(session_info)
+
+ demo_process = subprocess.Popen(executable, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ if sys.version_info >= (3, 3):
+ try:
+ demo_process.wait(5)
+ except TimeoutExpired:
+ demo_process.kill()
+ bail("Failed to run {0} test application".format(executable_name))
+ else:
+ demo_process.wait()
+ stop_session(session_info)
+
+ trace_found = os.path.exists(session_info.trace_path)
+ print_test_result(trace_found, current_test,\
+ "{0}, resulting trace found".format(executable_name))
+ current_test += 1
+
+ if not trace_found:
+ print("# Skipping " + executable_name + " trace verification tests")
+ continue
+
+ try:
+ babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ except FileNotFoundError:
+ bail("Could not open babeltrace. Please make sure it is installed.")
+
+ # We should find 8 events in the resulting trace
+ event_entries = []
+ for event_line in babeltrace_process.stdout:
+ event_line = event_line.decode('utf-8').replace("\n", "")
+ event_entries.append(event_line)
+
+ if len(event_entries) != 8:
+ bail("{0}, wrong number of events found in resulting trace.".format(executable_name))
+
+ shutil.rmtree(session_info.tmp_directory)
+
+ print_test_result(len(event_entries) == 8, current_test,\
+ "{0}, total number of events logged is correct".format(executable_name))
+ current_test += 1
+
+ # Check each loop event
+ match = re.search(r".*ust_tests_demo:starting.*value = (\d+) ", event_entries[0])
+ print_test_result(match is not None and (int(match.group(1)) == 123), current_test,\
+ "{0}, ust_tests_demo:starting event found in trace with a correct integer argument".format(executable_name))
+ current_test += 1
+
+ for i in range(5):
+ print_test_result(check_ust_test_demo2_event(event_entries[i+1], i), current_test,\
+ "{0}, ust_tests_demo2:loop event found in trace and arguments are correct, iteration ".format(executable_name)\
+ + str(i + 1))
+ current_test += 1
+
+ match = re.search(r".*ust_tests_demo:done.*value = (\d+)", event_entries[6])
+ print_test_result(match is not None and (int(match.group(1)) == 456), current_test,\
+ "{0}, ust_tests_demo:done event found in resulting trace with a correct integer argument".format(executable_name))
+ current_test += 1
+
+ match = re.search(r".*ust_tests_demo3:done.*value = (\d+)", event_entries[7])
+ print_test_result(match is not None and (int(match.group(1)) == 42), current_test,\
+ "{0}, ust_tests_demo3:done event found in resulting trace with a correct integer argument".format(executable_name))
+ current_test += 1
diff --git a/tests/regression/ust/linking/tp.c b/tests/regression/ust/linking/tp.c
new file mode 100644
index 0000000..8e44db4
--- /dev/null
+++ b/tests/regression/ust/linking/tp.c
@@ -0,0 +1,26 @@
+/*
+ * tp.c
+ *
+ * Copyright (c) 2011 Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define TRACEPOINT_CREATE_PROBES
+#include "ust_tests_demo.h"
diff --git a/tests/regression/ust/linking/tp2.c b/tests/regression/ust/linking/tp2.c
new file mode 100644
index 0000000..ba45c23
--- /dev/null
+++ b/tests/regression/ust/linking/tp2.c
@@ -0,0 +1,26 @@
+/*
+ * tp2.c
+ *
+ * Copyright (c) 2011 Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define TRACEPOINT_CREATE_PROBES
+#include "ust_tests_demo2.h"
diff --git a/tests/regression/ust/linking/tp3.c b/tests/regression/ust/linking/tp3.c
new file mode 100644
index 0000000..5f97651
--- /dev/null
+++ b/tests/regression/ust/linking/tp3.c
@@ -0,0 +1,26 @@
+/*
+ * tp3.c
+ *
+ * Copyright (c) 2011 Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#define TRACEPOINT_CREATE_PROBES
+#include "ust_tests_demo3.h"
diff --git a/tests/regression/ust/linking/ust_tests_demo.h b/tests/regression/ust/linking/ust_tests_demo.h
new file mode 100644
index 0000000..d2492b8
--- /dev/null
+++ b/tests/regression/ust/linking/ust_tests_demo.h
@@ -0,0 +1,61 @@
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER ust_tests_demo
+
+#if !defined(_TRACEPOINT_UST_TESTS_DEMO_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _TRACEPOINT_UST_TESTS_DEMO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(ust_tests_demo, starting,
+ TP_ARGS(int, value),
+ TP_FIELDS(
+ ctf_integer(int, value, value)
+ )
+)
+TRACEPOINT_LOGLEVEL(ust_tests_demo, starting, TRACE_CRIT)
+
+TRACEPOINT_EVENT(ust_tests_demo, done,
+ TP_ARGS(int, value),
+ TP_FIELDS(
+ ctf_integer(int, value, value)
+ )
+)
+TRACEPOINT_LOGLEVEL(ust_tests_demo, done, TRACE_CRIT)
+
+#endif /* _TRACEPOINT_UST_TESTS_DEMO_H */
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./ust_tests_demo.h"
+
+/* This part must be outside ifdef protection */
+#include <lttng/tracepoint-event.h>
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/tests/regression/ust/linking/ust_tests_demo2.h b/tests/regression/ust/linking/ust_tests_demo2.h
new file mode 100644
index 0000000..25d42ad
--- /dev/null
+++ b/tests/regression/ust/linking/ust_tests_demo2.h
@@ -0,0 +1,68 @@
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER ust_tests_demo2
+
+#if !defined(_TRACEPOINT_UST_TESTS_DEMO2_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _TRACEPOINT_UST_TESTS_DEMO2_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(ust_tests_demo2, loop,
+ TP_ARGS(int, anint, int, netint, long *, values,
+ char *, text, size_t, textlen,
+ double, doublearg, float, floatarg),
+ TP_FIELDS(
+ ctf_integer(int, intfield, anint)
+ ctf_integer_hex(int, intfield2, anint)
+ ctf_integer(long, longfield, anint)
+ ctf_integer_network(int, netintfield, netint)
+ ctf_integer_network_hex(int, netintfieldhex, netint)
+ ctf_array(long, arrfield1, values, 3)
+ ctf_array_text(char, arrfield2, text, 10)
+ ctf_sequence(char, seqfield1, text,
+ size_t, textlen)
+ ctf_sequence_text(char, seqfield2, text,
+ size_t, textlen)
+ ctf_string(stringfield, text)
+ ctf_float(float, floatfield, floatarg)
+ ctf_float(double, doublefield, doublearg)
+ )
+)
+TRACEPOINT_LOGLEVEL(ust_tests_demo2, loop, TRACE_WARNING)
+
+#endif /* _TRACEPOINT_UST_TESTS_DEMO2_H */
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./ust_tests_demo2.h"
+
+/* This part must be outside ifdef protection */
+#include <lttng/tracepoint-event.h>
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/tests/regression/ust/linking/ust_tests_demo3.h b/tests/regression/ust/linking/ust_tests_demo3.h
new file mode 100644
index 0000000..c7b63dd
--- /dev/null
+++ b/tests/regression/ust/linking/ust_tests_demo3.h
@@ -0,0 +1,53 @@
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER ust_tests_demo3
+
+#if !defined(_TRACEPOINT_UST_TESTS_DEMO3_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _TRACEPOINT_UST_TESTS_DEMO3_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(ust_tests_demo3, done,
+ TP_ARGS(int, value),
+ TP_FIELDS(
+ ctf_integer(int, value, value)
+ )
+)
+TRACEPOINT_LOGLEVEL(ust_tests_demo3, done, TRACE_WARNING)
+
+#endif /* _TRACEPOINT_UST_TESTS_DEMO3_H */
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./ust_tests_demo3.h"
+
+/* This part must be outside ifdef protection */
+#include <lttng/tracepoint-event.h>
+
+#ifdef __cplusplus
+}
+#endif
--
1.8.2
More information about the lttng-dev
mailing list