]> code.ossystems Code Review - openembedded-core.git/commitdiff
lttng: Fix reproducibility issues
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 1 Mar 2021 14:23:31 +0000 (14:23 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 2 Mar 2021 14:15:27 +0000 (14:15 +0000)
Add a hack to hardcode in specific rpaths which we then remove,
allowing the build to be reproducible.

Strip build patches out of one of the test scripts too.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/selftest/cases/reproducible.py
meta/recipes-kernel/lttng/lttng-tools/determinism.patch [new file with mode: 0644]
meta/recipes-kernel/lttng/lttng-tools_2.12.2.bb

index bd260a4139376e56fdb30e20574ae1b268216222..9c6f2e89d92970bf69bcd08adfdd9b883521e51a 100644 (file)
@@ -34,8 +34,6 @@ exclude_packages = [
        'go-runtime',
        'go_',
        'go-',
-       'lttng-tools-dbg',
-       'lttng-tools-ptest',
        'ltp',
        'meson',
        'ovmf-shell-efi',
diff --git a/meta/recipes-kernel/lttng/lttng-tools/determinism.patch b/meta/recipes-kernel/lttng/lttng-tools/determinism.patch
new file mode 100644 (file)
index 0000000..b2ab880
--- /dev/null
@@ -0,0 +1,64 @@
+This is a bit ugly. 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.
+
+Instead, hack in a bogus but harmless path, then delete it later in
+our do_install. Ultimately we may want to pass a specific path to use
+to configure if we really do need to set an RPATH at all. It is unclear
+to me whether the tests need that or not.
+
+Fixes reproducibility issues for lttng-tools.
+
+Upstream-Status: Pending [needs discussion with upstream about the correct solution]
+RP 2021/3/1
+
+Index: lttng-tools-2.12.2/tests/regression/ust/ust-dl/Makefile.am
+===================================================================
+--- lttng-tools-2.12.2.orig/tests/regression/ust/ust-dl/Makefile.am
++++ lttng-tools-2.12.2/tests/regression/ust/ust-dl/Makefile.am
+@@ -27,16 +27,16 @@ noinst_LTLIBRARIES = libzzz.la libbar.la
+ libzzz_la_SOURCES = libzzz.c libzzz.h
+ libzzz_la_LDFLAGS = -module -shared -avoid-version \
+-              -rpath $(abs_builddir)
++              -rpath /usr/lib
+ libbar_la_SOURCES = libbar.c libbar.h
+ libbar_la_LDFLAGS = -module -shared -avoid-version \
+-              -rpath $(abs_builddir)
++              -rpath /usr/lib
+ libbar_la_LIBADD = libzzz.la
+ libfoo_la_SOURCES = libfoo.c libfoo.h
+ libfoo_la_LDFLAGS = -module -shared -avoid-version \
+-              -rpath $(abs_builddir)
++              -rpath /usr/lib
+ libfoo_la_LIBADD = libbar.la
+ CLEANFILES = libfoo.so libfoo.so.debug libbar.so libbar.so.debug \
+@@ -44,7 +44,7 @@ CLEANFILES = libfoo.so libfoo.so.debug l
+ 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 /usr/lib
+ # Extract debug symbols
+ libfoo.so.debug: libfoo.la
+Index: lttng-tools-2.12.2/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am
+===================================================================
+--- lttng-tools-2.12.2.orig/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am
++++ lttng-tools-2.12.2/tests/utils/testapp/userspace-probe-elf-binary/Makefile.am
+@@ -5,7 +5,7 @@ AM_CFLAGS += -O0
+ 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 /usr/lib
+ noinst_PROGRAMS = userspace-probe-elf-binary
+ userspace_probe_elf_binary_SOURCES = userspace-probe-elf-binary.c
index 0787e04d191211954600e9c94700ccf6c5a3c2c6..1f509caeb487ccd8054564a3266f0bda296a13f0 100644 (file)
@@ -35,6 +35,7 @@ SRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \
            file://run-ptest \
            file://lttng-sessiond.service \
            file://0001-tests-regression-disable-the-tools-live-tests.patch \
+           file://determinism.patch \
            "
 
 SRC_URI[sha256sum] = "9ed9161795ff023b076f9f95afaa4f1f822ec42495c0fa04c586ab8fa74e84f1"
@@ -113,6 +114,8 @@ do_install_ptest () {
     done
 
     chrpath --delete ${D}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary
+    chrpath --delete ${D}${PTEST_PATH}/tests/regression/ust/ust-dl/libbar.so
+    chrpath --delete ${D}${PTEST_PATH}/tests/regression/ust/ust-dl/libfoo.so
 
     #
     # Use the versioned libs of liblttng-ust-dl.
@@ -150,6 +153,10 @@ do_install_ptest () {
         -e 's#\(^test.*LDADD.=\)#disable\1#g' \
         -i ${D}${PTEST_PATH}/tests/unit/Makefile
 
+    # Fix hardcoded build path
+    sed -e 's#TESTAPP_PATH=.*/tests/regression/#TESTAPP_PATH=${PTEST_PATH}/tests/regression/#' \
+        -i ${D}${PTEST_PATH}/tests/regression/ust/python-logging/test_python_logging
+
     # Substitute links to installed binaries.
     for prog in lttng lttng-relayd lttng-sessiond lttng-consumerd lttng-crash; do
         exedir="${D}${PTEST_PATH}/src/bin/${prog}"