summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-03-01 21:28:58 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-03-02 20:39:35 +0000
commite2bf02e7bdac075889d929d1df010142d1a673ec (patch)
treecbcf766dbeca618c7a930340150f293d761036c4
parent8784e75a71a1fabeab36b35a8a48ceba73f206a4 (diff)
downloadpoky-e2bf02e7bdac075889d929d1df010142d1a673ec.tar.gz
poky-e2bf02e7bdac075889d929d1df010142d1a673ec.tar.bz2
poky-e2bf02e7bdac075889d929d1df010142d1a673ec.zip
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. (From OE-Core rev: 0f51f9a37e5d058bce28cfe7b9a32a895f83c091) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/cases/reproducible.py1
-rw-r--r--meta/recipes-extended/ltp/ltp/determinism.patch43
-rw-r--r--meta/recipes-extended/ltp/ltp_20210121.bb13
3 files changed, 56 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py b/meta/lib/oeqa/selftest/cases/reproducible.py
index 1d4e744250..3d6a88314b 100644
--- a/meta/lib/oeqa/selftest/cases/reproducible.py
+++ b/meta/lib/oeqa/selftest/cases/reproducible.py
@@ -34,7 +34,6 @@ exclude_packages = [
'go-runtime',
'go_',
'go-',
- 'ltp',
'meson',
'ovmf-shell-efi',
'perf',
diff --git a/meta/recipes-extended/ltp/ltp/determinism.patch b/meta/recipes-extended/ltp/ltp/determinism.patch
new file mode 100644
index 0000000000..76d40721b8
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/determinism.patch
@@ -0,0 +1,43 @@
+open_posix_testsuite/generate-makefiles.sh: Fix determinism issue
+
+Currently the list of tests is generated by the order of the files found
+within the directories. This results in differences in the run.sh and
+Makefiles. Within Yocto Project this results in differing target
+test packages. The fix is simple, just sort the output from locate-test.
+
+mk/lib.mk: Sort wildcard expansion for determinism
+
+The order of the objects linked into libltp.a varies depending on the
+order of the files found on disk. This results in most ltp binaries
+differing depending on that order too.
+
+Sort the wildcard expansion of *.c which leads to reproducible binaries.
+
+Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
+Upstream-Status: Submitted [http://lists.linux.it/pipermail/ltp/2021-March/021272.html http://lists.linux.it/pipermail/ltp/2021-March/021273.html]
+
+Index: git/testcases/open_posix_testsuite/scripts/generate-makefiles.sh
+===================================================================
+--- git.orig/testcases/open_posix_testsuite/scripts/generate-makefiles.sh
++++ git/testcases/open_posix_testsuite/scripts/generate-makefiles.sh
+@@ -24,7 +24,7 @@ generate_locate_test_makefile() {
+
+ echo "Generating $maketype Makefiles"
+
+- locate-test --$maketype | sed -e 's,^./,,g' > make-gen.$maketype
++ locate-test --$maketype | sed -e 's,^./,,g' | sort > make-gen.$maketype
+
+ generate_makefiles make-gen.$maketype $*
+
+Index: git/include/mk/lib.mk
+===================================================================
+--- git.orig/include/mk/lib.mk
++++ git/include/mk/lib.mk
+@@ -50,6 +50,7 @@ endif
+ MAKE_TARGETS += $(LIB)
+
+ LIBSRCS ?= $(wildcard $(abs_srcdir)/*.c)
++LIBSRCS := $(sort $(LIBSRCS))
+ LIBSRCS := $(abspath $(LIBSRCS))
+ LIBSRCS := $(subst $(abs_srcdir)/,,$(wildcard $(LIBSRCS)))
+ LIBSRCS := $(filter-out $(FILTER_OUT_LIBSRCS),$(LIBSRCS))
diff --git a/meta/recipes-extended/ltp/ltp_20210121.bb b/meta/recipes-extended/ltp/ltp_20210121.bb
index c541f9859f..593f07087c 100644
--- a/meta/recipes-extended/ltp/ltp_20210121.bb
+++ b/meta/recipes-extended/ltp/ltp_20210121.bb
@@ -29,11 +29,16 @@ CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__"
CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
SRCREV = "4d005621edd109d119627eb9210b224a63bf22cb"
+# remove at next version upgrade or when output changes
+PR = "r1"
+HASHEQUIV_HASH_VERSION .= ".1"
+
SRC_URI = "git://github.com/linux-test-project/ltp.git \
file://0001-build-Add-option-to-select-libc-implementation.patch \
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 +56,14 @@ EXTRA_OECONF = " --with-realtime-testsuite --with-open-posix-testsuite "
# ltp network/rpc test cases ftbfs when libtirpc is found
EXTRA_OECONF += " --without-tirpc "
+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