From 18299a114c66280ba2d00becc3fae235d3a6cbd7 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 1 Mar 2021 14:23:31 +0000 Subject: lttng: Fix reproducibility issues 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 --- meta/lib/oeqa/selftest/cases/reproducible.py | 2 - .../lttng/lttng-tools/determinism.patch | 64 ++++++++++++++++++++++ meta/recipes-kernel/lttng/lttng-tools_2.12.2.bb | 7 +++ 3 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 meta/recipes-kernel/lttng/lttng-tools/determinism.patch diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py b/meta/lib/oeqa/selftest/cases/reproducible.py index bd260a4139..9c6f2e89d9 100644 --- a/meta/lib/oeqa/selftest/cases/reproducible.py +++ b/meta/lib/oeqa/selftest/cases/reproducible.py @@ -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 index 0000000000..b2ab880bd6 --- /dev/null +++ b/meta/recipes-kernel/lttng/lttng-tools/determinism.patch @@ -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 diff --git a/meta/recipes-kernel/lttng/lttng-tools_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-tools_2.12.2.bb index 0787e04d19..1f509caeb4 100644 --- a/meta/recipes-kernel/lttng/lttng-tools_2.12.2.bb +++ b/meta/recipes-kernel/lttng/lttng-tools_2.12.2.bb @@ -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}" -- cgit 1.2.3-korg