From: Jérémie Galarneau Date: Fri, 22 Jul 2016 19:10:57 +0000 (-0400) Subject: Tests: Add tracepoints to libbar, libfoo and libzzz X-Git-Tag: v2.9.0-rc1~81 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=818df80b8b47b736056088fd7d75263a21f6a5a9 Tests: Add tracepoints to libbar, libfoo and libzzz Signed-off-by: Jérémie Galarneau --- diff --git a/tests/regression/ust/ust-dl/Makefile.am b/tests/regression/ust/ust-dl/Makefile.am index 5230007d4..385d44824 100644 --- a/tests/regression/ust/ust-dl/Makefile.am +++ b/tests/regression/ust/ust-dl/Makefile.am @@ -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 index 000000000..36521507c --- /dev/null +++ b/tests/regression/ust/ust-dl/libbar-tp.c @@ -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 index 000000000..8fc8ee410 --- /dev/null +++ b/tests/regression/ust/ust-dl/libbar-tp.h @@ -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 + +TRACEPOINT_EVENT( + libbar, + bar, + TP_ARGS(void), + TP_FIELDS() +) + +#endif /* _LIBBAR_TP_H */ + +#include diff --git a/tests/regression/ust/ust-dl/libbar.c b/tests/regression/ust/ust-dl/libbar.c index 4ebd6b109..cff053adc 100644 --- a/tests/regression/ust/ust-dl/libbar.c +++ b/tests/regression/ust/ust-dl/libbar.c @@ -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 index 000000000..ec944cff6 --- /dev/null +++ b/tests/regression/ust/ust-dl/libfoo-tp.c @@ -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 index 000000000..c3b23f186 --- /dev/null +++ b/tests/regression/ust/ust-dl/libfoo-tp.h @@ -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 + +TRACEPOINT_EVENT( + libfoo, + foo, + TP_ARGS(void), + TP_FIELDS() +) + +#endif /* _LIBFOO_TP_H */ + +#include diff --git a/tests/regression/ust/ust-dl/libfoo.c b/tests/regression/ust/ust-dl/libfoo.c index c03fb2898..3bebed427 100644 --- a/tests/regression/ust/ust-dl/libfoo.c +++ b/tests/regression/ust/ust-dl/libfoo.c @@ -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 index 000000000..bd7368a1f --- /dev/null +++ b/tests/regression/ust/ust-dl/libzzz-tp.c @@ -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 index 000000000..7687a811d --- /dev/null +++ b/tests/regression/ust/ust-dl/libzzz-tp.h @@ -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 + +TRACEPOINT_EVENT( + libzzz, + zzz, + TP_ARGS(void), + TP_FIELDS() +) + +#endif /* _LIBZZZ_TP_H */ + +#include diff --git a/tests/regression/ust/ust-dl/libzzz.c b/tests/regression/ust/ust-dl/libzzz.c index c3abc7f97..8e0146453 100644 --- a/tests/regression/ust/ust-dl/libzzz.c +++ b/tests/regression/ust/ust-dl/libzzz.c @@ -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; } diff --git a/tests/regression/ust/ust-dl/run.sh b/tests/regression/ust/ust-dl/run.sh index d489ad4db..673efc9cb 100755 --- a/tests/regression/ust/ust-dl/run.sh +++ b/tests/regression/ust/ust-dl/run.sh @@ -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