Tests: Add tracepoints to libbar, libfoo and libzzz
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 22 Jul 2016 19:10:57 +0000 (15:10 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 22 Jul 2016 21:09:48 +0000 (17:09 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/regression/ust/ust-dl/Makefile.am
tests/regression/ust/ust-dl/libbar-tp.c [new file with mode: 0644]
tests/regression/ust/ust-dl/libbar-tp.h [new file with mode: 0644]
tests/regression/ust/ust-dl/libbar.c
tests/regression/ust/ust-dl/libfoo-tp.c [new file with mode: 0644]
tests/regression/ust/ust-dl/libfoo-tp.h [new file with mode: 0644]
tests/regression/ust/ust-dl/libfoo.c
tests/regression/ust/ust-dl/libzzz-tp.c [new file with mode: 0644]
tests/regression/ust/ust-dl/libzzz-tp.h [new file with mode: 0644]
tests/regression/ust/ust-dl/libzzz.c
tests/regression/ust/ust-dl/run.sh

index 5230007d4ca0fe04df2286d26eefe78e0f3deb7f..385d448241472e1e42a5d45be63bee2424488117 100644 (file)
@@ -2,11 +2,12 @@ if NO_SHARED
 # Do not build this test if shared libraries support was
 # explicitly disabled.
 
-CLEANFILES = libfoo.so libfoo.so.debug libbar.so libbar.so.debug \
-       libzzz.so libzzz.so.debug prog
+CLEANFILES = libbar.so libbar.so.debug libfoo.so libfoo.so.debug \
+       libzzz.so libzzz.so.debug prog libtp.so
 
-EXTRA_DIST = test_ust-dl test_ust-dl.py libfoo.c libfoo.h \
-       libbar.c libbar.h libzzz.c libzzz.h prog.c
+EXTRA_DIST = test_ust-dl test_ust-dl.py libbar.c libbar.h libbar-tp.h \
+       libbar-tp.c libfoo.c libfoo.h libfoo-tp.h libfoo-tp.c \
+       libzzz.c libzzz.h libzzz-tp.h libzzz-tp.c prog.c libtp.c
 
 else
 
@@ -20,7 +21,7 @@ noinst_PROGRAMS = prog
 prog_SOURCES = prog.c
 prog_LDADD = -ldl
 
-noinst_LTLIBRARIES = libzzz.la libbar.la libfoo.la
+noinst_LTLIBRARIES = libzzz.la libbar.la libfoo.la libtp.la
 
 libzzz_la_SOURCES = libzzz.c libzzz.h
 libzzz_la_LDFLAGS = -module -shared -avoid-version \
@@ -37,7 +38,11 @@ libfoo_la_LDFLAGS = -module -shared -avoid-version \
 libfoo_la_LIBADD = libbar.la
 
 CLEANFILES = libfoo.so libfoo.so.debug libbar.so libbar.so.debug \
-       libzzz.so libzzz.so.debug
+       libzzz.so libzzz.so.debug libtp.so
+
+libtp_la_SOURCES = libbar-tp.h libbar-tp.c libfoo-tp.h libfoo-tp.c \
+       libzzz-tp.h libzzz-tp.c
+libtp_la_LDFLAGS = -module -shared -rpath $(abs_builddir)
 
 # Extract debug symbols
 libfoo.so.debug: libfoo.la
@@ -58,10 +63,13 @@ libzzz.so: libzzz.so.debug
        @cp -f .libs/libzzz.so libzzz.so
        $(objcopy_verbose)$(OBJCOPY) --strip-debug --add-gnu-debuglink=libzzz.so.debug libzzz.so
 
+libtp.so: libtp.la
+       @cp -f .libs/libtp.so libtp.so
+
 noinst_SCRIPTS = test_ust-dl test_ust-dl.py
 EXTRA_DIST = test_ust-dl test_ust-dl.py
 
-all-local: libfoo.so libbar.so libzzz.so
+all-local: libfoo.so libbar.so libzzz.so libtp.so
        @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
                for script in $(EXTRA_DIST); do \
                        cp -f $(srcdir)/$$script $(builddir); \
diff --git a/tests/regression/ust/ust-dl/libbar-tp.c b/tests/regression/ust/ust-dl/libbar-tp.c
new file mode 100644 (file)
index 0000000..3652150
--- /dev/null
@@ -0,0 +1,2 @@
+#define TRACEPOINT_CREATE_PROBES
+#include "libbar-tp.h"
diff --git a/tests/regression/ust/ust-dl/libbar-tp.h b/tests/regression/ust/ust-dl/libbar-tp.h
new file mode 100644 (file)
index 0000000..8fc8ee4
--- /dev/null
@@ -0,0 +1,21 @@
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER libbar
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./libbar-tp.h"
+
+#if !defined(_LIBBAR_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _LIBBAR_TP_H
+
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(
+    libbar,
+    bar,
+    TP_ARGS(void),
+    TP_FIELDS()
+)
+
+#endif /* _LIBBAR_TP_H */
+
+#include <lttng/tracepoint-event.h>
index 4ebd6b109c88524f8afb241afc44b6720769422c..cff053adcd04def14116985b17a9196d1b16ccb9 100644 (file)
@@ -1,6 +1,11 @@
 #include "libbar.h"
 
+#define TRACEPOINT_DEFINE
+#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
+#include "libbar-tp.h"
+
 int bar(void)
 {
+       tracepoint(libbar, bar);
        return 1;
 }
diff --git a/tests/regression/ust/ust-dl/libfoo-tp.c b/tests/regression/ust/ust-dl/libfoo-tp.c
new file mode 100644 (file)
index 0000000..ec944cf
--- /dev/null
@@ -0,0 +1,2 @@
+#define TRACEPOINT_CREATE_PROBES
+#include "libfoo-tp.h"
diff --git a/tests/regression/ust/ust-dl/libfoo-tp.h b/tests/regression/ust/ust-dl/libfoo-tp.h
new file mode 100644 (file)
index 0000000..c3b23f1
--- /dev/null
@@ -0,0 +1,21 @@
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER libfoo
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./libfoo-tp.h"
+
+#if !defined(_LIBFOO_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _LIBFOO_TP_H
+
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(
+    libfoo,
+    foo,
+    TP_ARGS(void),
+    TP_FIELDS()
+)
+
+#endif /* _LIBFOO_TP_H */
+
+#include <lttng/tracepoint-event.h>
index c03fb28982f054ce6283d6590d2406b9ad0c2651..3bebed42776db4e4f3c6cb4d61cdfd0af6d985eb 100644 (file)
@@ -1,8 +1,13 @@
 #include "libfoo.h"
 #include "libbar.h"
 
+#define TRACEPOINT_DEFINE
+#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
+#include "libfoo-tp.h"
+
 int foo(void)
 {
+       tracepoint(libfoo, foo);
        bar();
        return 1;
 }
diff --git a/tests/regression/ust/ust-dl/libzzz-tp.c b/tests/regression/ust/ust-dl/libzzz-tp.c
new file mode 100644 (file)
index 0000000..bd7368a
--- /dev/null
@@ -0,0 +1,2 @@
+#define TRACEPOINT_CREATE_PROBES
+#include "libzzz-tp.h"
diff --git a/tests/regression/ust/ust-dl/libzzz-tp.h b/tests/regression/ust/ust-dl/libzzz-tp.h
new file mode 100644 (file)
index 0000000..7687a81
--- /dev/null
@@ -0,0 +1,21 @@
+#undef TRACEPOINT_PROVIDER
+#define TRACEPOINT_PROVIDER libzzz
+
+#undef TRACEPOINT_INCLUDE
+#define TRACEPOINT_INCLUDE "./libzzz-tp.h"
+
+#if !defined(_LIBZZZ_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
+#define _LIBZZZ_TP_H
+
+#include <lttng/tracepoint.h>
+
+TRACEPOINT_EVENT(
+    libzzz,
+    zzz,
+    TP_ARGS(void),
+    TP_FIELDS()
+)
+
+#endif /* _LIBZZZ_TP_H */
+
+#include <lttng/tracepoint-event.h>
index c3abc7f977d1eeaa28b083c5c0720966ed0b44d1..8e014645374833b03318c13c4d491ab415b66cef 100644 (file)
@@ -1,6 +1,11 @@
 #include "libzzz.h"
 
+#define TRACEPOINT_DEFINE
+#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE
+#include "libzzz-tp.h"
+
 int zzz(void)
 {
+       tracepoint(libzzz, zzz);
        return 1;
 }
index d489ad4dbff4e0aa2e64f02dd429d9caffafadc3..673efc9cba2936458147c28e6fcc063431b1b3fe 100755 (executable)
@@ -1,3 +1,3 @@
 #!/bin/sh
 
-LD_PRELOAD=liblttng-ust-dl.so LD_LIBRARY_PATH=. ./prog
+LD_PRELOAD="liblttng-ust-dl.so" LD_LIBRARY_PATH=. ./prog
This page took 0.029404 seconds and 4 git commands to generate.