Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mx.groups.io with SMTP id smtpd.web12.8873.1614693563173165862 for ; Tue, 02 Mar 2021 05:59:23 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=hx7wb4mV; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.48, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f48.google.com with SMTP id h98so19954174wrh.11 for ; Tue, 02 Mar 2021 05:59:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Iam+UK3LgMYXtGSoov9KGv/X0pJZ6QgXoT/MwX2QzLc=; b=hx7wb4mVn5DJeJq+J1ese5Omx1Je++i62n5jCajQx3T0uwxGEqn2Iuu+e7QvlGlEPw si9PLFMOBGxDWYOaJxEJfg9Qi0bj5E+31uEiOsLdLRHzOhkeyDJ9J8H1hivzqTz8wuLb Ek8NhDxboeVl8W/4xMDa5w5h0za0f7CPSiUaE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=Iam+UK3LgMYXtGSoov9KGv/X0pJZ6QgXoT/MwX2QzLc=; b=V2otKML+4AkaOtxi/x07/FmYmms2gNyS888qaAz54Fu/+aOtBYyTmtvjmqZenO6/Jk XOZK4KgEPUQsbI26NDRnoEbkBTPbAcsBTdiHXwEmMeyxkhq39aMz8UOMta1vDXoLybUB qRGbBlayH3x/pobyhrrxSNWXcQkxnw5Dp9ETOK1x+9EZNeRgkHxroefOtRHpiN9g4wKY Ex47jDG5X1qYgxVBy03XPuvBT8v5o13NKeEd7SAmf6KlN055RIxR7sPktJD0ldtJfUKa LpELKWsotQsshAIBUV2F6Ii+rcfadfGfmrNgMiUgKt1jpMYzsXnJ9ptpu5acQg+EjJ6i Ns5A== X-Gm-Message-State: AOAM532ka6vTGiM60SmiKpnhH+bMGA+0K6HCSWanHgPjQAzjTLdo3XpR s3t9OjzNYWoMgWYqldxzYOvVEJfglFXmeA== X-Google-Smtp-Source: ABdhPJxYYDTU62qURpvaZQnFLFyngTQlNgVQCPfyRXQTNvIvWYLM93SvLe9tubGIvL/+p/vNBwqhXQ== X-Received: by 2002:a5d:4d0f:: with SMTP id z15mr14039267wrt.192.1614693561330; Tue, 02 Mar 2021 05:59:21 -0800 (PST) Return-Path: Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:fd4c:95a0:62b1:7d53]) by smtp.gmail.com with ESMTPSA id a3sm28967525wrt.68.2021.03.02.05.59.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 05:59:21 -0800 (PST) From: "Richard Purdie" To: openembedded-core@lists.openembedded.org Subject: [PATCH 1/2] ltp: Fixing determinism issues Date: Tue, 2 Mar 2021 13:59:19 +0000 Message-Id: <20210302135920.2228759-1-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. Signed-off-by: Richard Purdie --- 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 diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py b/meta/lib/oeqa/selftest/cases/reproducible.py index 1d4e744250a..3d6a88314b8 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 00000000000..76d40721b87 --- /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 +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 c541f9859fd..1b33bfff0b9 100644 --- a/meta/recipes-extended/ltp/ltp_20210121.bb +++ b/meta/recipes-extended/ltp/ltp_20210121.bb @@ -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 -- 2.27.0