Skip to contentSkip to conversation

ltp: Fixing determinism issues

PATCH Superseded Richard Purdie 2 participants 4 messages Mar 2, 2021 – Mar 4, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ltp: Fixing determinism issues

Add a patch adding sorting to a couple of points in the Makefiles which removes most of the determinism issues in ltp.

Build swapon before the main build to ensure libswapon.o is built deterministically as it races with swapoff.

All issues reported on the upstream mailing list.

---
 meta/lib/oeqa/selftest/cases/reproducible.py  |  1 -
 .../ltp/ltp/determinism.patch                 | 43 +++++++++++++++++++
 meta/recipes-extended/ltp/ltp_20210121.bb     | 11 +++++
 3 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/ltp/ltp/determinism.patch
meta/lib/oeqa/selftest/cases/reproducible.py +0 -1
index 1d4e744250a..3d6a88314b8 100644
@@ -34,7 +34,6 @@ exclude_packages = [
 	'go-runtime',
 	'go_',
 	'go-',
-	'ltp',
 	'meson',
 	'ovmf-shell-efi',
 	'perf',
meta/recipes-extended/ltp/ltp/determinism.patch new file +43 -0

43 lines not on this page · raw message

meta/recipes-extended/ltp/ltp_20210121.bb +11 -0
index c541f9859fd..1b33bfff0b9 100644
@@ -34,6 +34,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
            file://0007-Fix-test_proc_kill-hanging.patch \
            file://0001-Add-more-musl-exclusions.patch \
            file://0001-Remove-OOM-tests-from-runtest-mm.patch \
+           file://determinism.patch \
            "
 
 S = "${WORKDIR}/git"
@@ -51,6 +52,16 @@ EXTRA_OECONF = " --with-realtime-testsuite --with-open-posix-testsuite "
 # ltp network/rpc test cases ftbfs when libtirpc is found
 EXTRA_OECONF += " --without-tirpc "
 
+EXTRA_OEMAKE += " V=1"
+
+do_compile_prepend() {
+	# Reported at http://lists.linux.it/pipermail/ltp/2021-March/021274.html
+	# Avoid a race over construction of libswapon.o which is built by swapon and swapoff
+	# but the object differs depending upon which one built it
+	# ("../swapon/libswapon.c" vs "libswapon.c" references)
+	make -C ${B}/testcases/kernel/syscalls/swapon/
+}
+
 do_install(){
     install -d ${D}${prefix}/
     oe_runmake DESTDIR=${D} SKIP_IDCHECK=1 install
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/2 python3-cython: Remove build paths from debug sources

There are build paths which are in generated sources injected into ${PN}-src. These are in generated files and don't influence the binary output. As such we can correct them at do_package time by tweaking in an appropriately injected function. This fixes the reproducbility of the recipe.

---
 meta/lib/oeqa/selftest/cases/reproducible.py      |  1 -
 .../python/python3-cython_0.29.21.bb              | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/reproducible.py +0 -1
index 3d6a88314b8..0d0259477e3 100644
@@ -37,7 +37,6 @@ exclude_packages = [
 	'meson',
 	'ovmf-shell-efi',
 	'perf',
-	'python3-cython',
 	'ruby-ri-docs'
 	]
 
meta/recipes-devtools/python/python3-cython_0.29.21.bb +15 -0
index 2ce6bdbd68b..01f716c16f5 100644
@@ -16,3 +16,18 @@ do_install_append() {
     mv ${D}${bindir}/cythonize ${D}${bindir}/cythonize3
     mv ${D}${bindir}/cygdb ${D}${bindir}/cygdb3
 }
+
+PACKAGEBUILDPKGD += "cython_fix_sources"
+
+cython_fix_sources () {
+	sed -i -e 's#${WORKDIR}#/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}#g' \
+		${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/FlowControl.c \
+		${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/FusedNode.c \
+		${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/Scanning.c \
+		${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/Visitor.c \
+		${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Plex/Actions.c \
+		${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Plex/Scanners.c \
+		${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Runtime/refnanny.c \
+		${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Tempita/_tempita.c \
+		${PKGD}${libdir}/${PYTHON_DIR}/site-packages/Cython*/SOURCES.txt
+}
Signature · 1 line
2.27.0
#2 lore raw

Re: [OE-core] [PATCH 2/2] python3-cython: Remove build paths from debug sources

Quoted 38 lines · Richard Purdie

There are build paths which are in generated sources injected into ${PN}-src. These are in generated files and don't influence the binary output. As such we can correct them at do_package time by tweaking in an appropriately injected function. This fixes the reproducbility of the recipe.

---
 meta/lib/oeqa/selftest/cases/reproducible.py      |  1 -
 .../python/python3-cython_0.29.21.bb              | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/reproducible.py +0 -1
index 3d6a88314b8..0d0259477e3 100644
@@ -37,7 +37,6 @@ exclude_packages = [
        'meson',
        'ovmf-shell-efi',
        'perf',
-       'python3-cython',
        'ruby-ri-docs'
        ]
 
meta/recipes-devtools/python/python3-cython_0.29.21.bb +5 -0
index 2ce6bdbd68b..01f716c16f5 100644
@@ -16,3 +16,18 @@ do_install_append() {
     mv ${D}${bindir}/cythonize ${D}${bindir}/cythonize3
     mv ${D}${bindir}/cygdb ${D}${bindir}/cygdb3
 }
+
+PACKAGEBUILDPKGD += "cython_fix_sources"
+
+cython_fix_sources () {
+       sed -i -e 's#${WORKDIR}#/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}#g' \

meta/recipes-devtools/python/python3-cython_0.29.21.bb do_install_append() { · line 33

Quoted 10 lines
meta/recipes-devtools/python/python3-cython_0.29.21.bb +10 -0
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/FlowControl.c \
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/FusedNode.c \
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/Scanning.c \
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/Visitor.c \
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Plex/Actions.c \
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Plex/Scanners.c \
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Runtime/refnanny.c \
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Tempita/_tempita.c \
+               ${PKGD}${libdir}/${PYTHON_DIR}/site-packages/Cython*/SOURCES.txt
+}

this fails build on clang
https://errors.yoctoproject.org/Errors/Details/573408/

Quoted 6 lines

--
2.27.0

#3 lore raw

Re: [OE-core] [PATCH 2/2] python3-cython: Remove build paths from debug sources

Hi Richard

We can also reproduce the failure with

PACKAGE_DEBUG_SPLIT_STYLE = "debug-without-src"

so I guess we should check for this var

Quoted 61 lines · Khem Raj
Quoted 38 lines · Richard Purdie

There are build paths which are in generated sources injected into ${PN}-src. These are in generated files and don't influence the binary output. As such we can correct them at do_package time by tweaking in an appropriately injected function. This fixes the reproducbility of the recipe.

---
 meta/lib/oeqa/selftest/cases/reproducible.py      |  1 -
 .../python/python3-cython_0.29.21.bb              | 15 +++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/reproducible.py +0 -1
index 3d6a88314b8..0d0259477e3 100644
@@ -37,7 +37,6 @@ exclude_packages = [
        'meson',
        'ovmf-shell-efi',
        'perf',
-       'python3-cython',
        'ruby-ri-docs'
        ]
 
meta/recipes-devtools/python/python3-cython_0.29.21.bb +5 -0
index 2ce6bdbd68b..01f716c16f5 100644
@@ -16,3 +16,18 @@ do_install_append() {
     mv ${D}${bindir}/cythonize ${D}${bindir}/cythonize3
     mv ${D}${bindir}/cygdb ${D}${bindir}/cygdb3
 }
+
+PACKAGEBUILDPKGD += "cython_fix_sources"
+
+cython_fix_sources () {
+       sed -i -e 's#${WORKDIR}#/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}#g' \

meta/recipes-devtools/python/python3-cython_0.29.21.bb do_install_append() { · line 33

Quoted 10 lines
meta/recipes-devtools/python/python3-cython_0.29.21.bb +10 -0
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/FlowControl.c \
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/FusedNode.c \
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/Scanning.c \
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Compiler/Visitor.c \
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Plex/Actions.c \
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Plex/Scanners.c \
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Runtime/refnanny.c \
+               ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython-${PV}/Cython/Tempita/_tempita.c \
+               ${PKGD}${libdir}/${PYTHON_DIR}/site-packages/Cython*/SOURCES.txt
+}

this fails build on clang
https://errors.yoctoproject.org/Errors/Details/573408/

Quoted 6 lines

--
2.27.0