Yocto has trouble making LTTng-tools builds reproducibile since
abs_builddir is used as the rpath of the test libraries under
tests/regression/ust/ust-dl/.
From their commit message:
Specifing abs_builddir as an RPATH is plain wrong when cross
compiling. Sadly, removing the rpath makes libtool/automake do weird
things and breaks the build as shared libs are no longer generated.
We already try and delete the RPATH at do_install with chrpath however
that does leave the path in the string table so it doesn't help us
with reproducibility.
Their fix consists in hardcoding /usr/lib as the rpath of those
libraries. As mentionned, the rpath doesn't matter; it's used to
workaround libtool's behaviour.
This fix uses `$libdir`, which takes the user's specified prefix into
account to generate an rpath that is consistent with the one inserted in
the other artifacts.
Note that the change in the notification tests is a bit more involved
since we have to bypass libtool to instrument a test application with
uprobes.
Fixes #1361
Change-Id: I7739956f8bc8571ef90802c3b37a4e1f21352385
Reported-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$ELF_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-elf-binary/.libs" "$ELF_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$ELF_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-elf-binary/.libs" "$ELF_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
PROVIDER="foobar"
PROBE="tp1"
ENABLE_EXPR="sdt:$SDT_TEST_BIN:$PROVIDER:$PROBE"
PROVIDER="foobar"
PROBE="tp1"
ENABLE_EXPR="sdt:$SDT_TEST_BIN:$PROVIDER:$PROBE"
+ SESSION_NAME="${FUNCNAME[0]}"
diag "Userspace probe on SDT tracepoint enabled and traced"
diag "Userspace probe on SDT tracepoint enabled and traced"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$SDT_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-sdt-binary/.libs" "$SDT_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$SDT_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-sdt-binary/.libs" "$SDT_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$SDT_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-sdt-binary/.libs" "$SDT_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$SDT_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-sdt-binary/.libs" "$SDT_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$SDT_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-sdt-binary/.libs" "$SDT_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- LD_PRELOAD="$SDT_TEST_BIN_DIR/libzzz.so" eval "$SDT_TEST_BIN" > /dev/null
+ LD_PRELOAD="$SDT_TEST_BIN_DIR/libzzz.so" LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-sdt-binary/.libs" "$SDT_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
lttng_enable_kernel_userspace_probe_event_ok $SESSION_NAME "$ENABLE_EXPR" $PROBE_EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
- eval "$SDT_TEST_BIN" > /dev/null
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-sdt-binary/.libs" "$SDT_TEST_BIN" > /dev/null
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
stop_lttng_tracing_ok $SESSION_NAME
validate_trace $PROBE_EVENT_NAME "$TRACE_PATH"
shift
for i in $(seq 1 "$nr"); do
shift
for i in $(seq 1 "$nr"); do
- $USERSPACE_PROBE_ELF_TESTAPP_BIN "$@"
+ # This userspace probe test has to instrument the actual elf
+ # binary and not the generated libtool wrapper. However, we
+ # can't invoke the wrapper either since it will re-link the test
+ # application binary on its first invocation, resulting in a new
+ # binary with an 'lt-*' prefix under the .libs folder. The
+ # relinking stage adds the .libs folder to the 'lt-*' binary's
+ # rpath.
+ #
+ # To ensure the binary (inode) that instrumented is the same as
+ # what is running, set LD_LIBRARY_PATH to find the .libs folder
+ # that contains the libfoo.so library and invoke the binary
+ # directly.
+ LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TESTDIR/utils/testapp/userspace-probe-elf-binary/.libs" $USERSPACE_PROBE_ELF_TESTAPP_BIN "$@"
libzzz_la_SOURCES = libzzz.c libzzz.h
libzzz_la_LDFLAGS = -module -shared -avoid-version \
libzzz_la_SOURCES = libzzz.c libzzz.h
libzzz_la_LDFLAGS = -module -shared -avoid-version \
libbar_la_SOURCES = libbar.c libbar.h
libbar_la_LDFLAGS = -module -shared -avoid-version \
libbar_la_SOURCES = libbar.c libbar.h
libbar_la_LDFLAGS = -module -shared -avoid-version \
libbar_la_LIBADD = libzzz.la
libfoo_la_SOURCES = libfoo.c libfoo.h
libfoo_la_LDFLAGS = -module -shared -avoid-version \
libbar_la_LIBADD = libzzz.la
libfoo_la_SOURCES = libfoo.c libfoo.h
libfoo_la_LDFLAGS = -module -shared -avoid-version \
libfoo_la_LIBADD = libbar.la
CLEANFILES = libfoo.so libfoo.so.debug libbar.so libbar.so.debug \
libfoo_la_LIBADD = libbar.la
CLEANFILES = libfoo.so libfoo.so.debug libbar.so libbar.so.debug \
libtp_la_SOURCES = libbar-tp.h libbar-tp.c libfoo-tp.h libfoo-tp.c \
libzzz-tp.h libzzz-tp.c
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)
+libtp_la_LDFLAGS = -module -shared -rpath $(libdir)
# Extract debug symbols
libfoo.so.debug: libfoo.la
# Extract debug symbols
libfoo.so.debug: libfoo.la
noinst_LTLIBRARIES = libfoo.la
libfoo_la_SOURCES = foo.c foo.h
noinst_LTLIBRARIES = libfoo.la
libfoo_la_SOURCES = foo.c foo.h
-libfoo_la_LDFLAGS = -shared -module -avoid-version -rpath $(abs_builddir)/.libs/
+libfoo_la_LDFLAGS = -shared -module -avoid-version -rpath $(libdir)
noinst_PROGRAMS = userspace-probe-elf-binary
userspace_probe_elf_binary_SOURCES = userspace-probe-elf-binary.c
noinst_PROGRAMS = userspace-probe-elf-binary
userspace_probe_elf_binary_SOURCES = userspace-probe-elf-binary.c
libfoo_la_SOURCES = libfoo.h libfoo.c
libfoo_la_LIBADD = foobar_provider.o
libfoo_la_CFLAGS = -I$(abs_builddir)
libfoo_la_SOURCES = libfoo.h libfoo.c
libfoo_la_LIBADD = foobar_provider.o
libfoo_la_CFLAGS = -I$(abs_builddir)
-libfoo_la_LDFLAGS = -module -shared -avoid-version -rpath $(abs_builddir)/.libs/
+libfoo_la_LDFLAGS = -module -shared -avoid-version -rpath $(libdir)
nodist_libfoo_la_SOURCES = $(abs_builddir)/foobar_provider.h
libbar_la_SOURCES = libbar.h libbar.c
libbar_la_LIBADD = foobar_provider.o
libbar_la_CFLAGS = -I$(abs_builddir)
nodist_libfoo_la_SOURCES = $(abs_builddir)/foobar_provider.h
libbar_la_SOURCES = libbar.h libbar.c
libbar_la_LIBADD = foobar_provider.o
libbar_la_CFLAGS = -I$(abs_builddir)
-libbar_la_LDFLAGS = -module -shared -avoid-version -rpath $(abs_builddir)/.libs/
+libbar_la_LDFLAGS = -module -shared -avoid-version -rpath $(libdir)
nodist_libbar_la_SOURCES = $(abs_builddir)/foobar_provider.h
libzzz_la_SOURCES = libzzz.h libzzz.c
libzzz_la_LIBADD = foobar_provider.o
libzzz_la_CFLAGS = -I$(abs_builddir)
nodist_libbar_la_SOURCES = $(abs_builddir)/foobar_provider.h
libzzz_la_SOURCES = libzzz.h libzzz.c
libzzz_la_LIBADD = foobar_provider.o
libzzz_la_CFLAGS = -I$(abs_builddir)
-libzzz_la_LDFLAGS = -module -shared -avoid-version -rpath $(abs_builddir)/.libs/
+libzzz_la_LDFLAGS = -module -shared -avoid-version -rpath $(libdir)
nodist_libzzz_la_SOURCES = $(abs_builddir)/foobar_provider.h
dtrace_verbose = $(dtrace_verbose_@AM_V@)
nodist_libzzz_la_SOURCES = $(abs_builddir)/foobar_provider.h
dtrace_verbose = $(dtrace_verbose_@AM_V@)