| Message ID | 20261202140420.1557412-1-pratik.farkase@est.tech |
|---|---|
| State | Changes Requested |
| Headers | show |
| Series | libxcrypt: add ptest support | expand |
On Wed Dec 2, 2026 at 3:04 PM CET, Pratik Farkase wrote: > Build libxcrypt's upstream test programs and run them under ptest. The > test list is taken from the TESTS variable of the build's Makefile, so > tests added upstream are picked up without a recipe change. Each test's > output is captured and printed only when the test fails, because several > tests print their own PASS:/FAIL: lines that would otherwise be counted > as extra results. > > Skip alg-yescrypt. It allocates about 1 GiB for its scrypt known-answer > test and 256 MiB for its ROM test, which fail on the 1 GiB ptest image, > and it then crashes reading the uninitialised ROM [1]. > > The suite takes about 7.5 minutes on qemuriscv64, which is over the > default 450s timeout, so raise the timeout to 900s and list libxcrypt > in PTESTS_SLOW. > > [1] https://github.com/besser82/libxcrypt/issues/165 > > Tested with testimage on qemuriscv64: 50 passed, 1 skipped > (getrandom-fallbacks), 0 failed. > > Signed-off-by: Pratik Farkase <pratik.farkase@est.tech> > --- Hi Pratik, Thanks for your effort on adding ptests. My build was not happy about that one while using musl: ERROR: Nothing RPROVIDES 'libxcrypt-ptest' (but virtual:mcextend:libxcrypt:/srv/pokybuild/yocto-worker/qemuarm64-musl-ptest/build/layers/openembedded-core/meta/recipes-core/images/core-image-ptest.bb RDEPENDS on or otherwise requires it) libxcrypt RPROVIDES libxcrypt-ptest but was skipped: PREFERRED_PROVIDER_virtual/crypt set to musl, not libxcrypt NOTE: Runtime target 'libxcrypt-ptest' is unbuildable, removing... Missing or unbuildable dependency chain was: ['libxcrypt-ptest'] https://autobuilder.yoctoproject.org/valkyrie/#/builders/109/builds/1679 https://autobuilder.yoctoproject.org/valkyrie/#/builders/110/builds/1695 Can you have a look at that? Thanks, Mathieu
diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc index 6c8ff85fd0..9fe1ca062d 100644 --- a/meta/conf/distro/include/ptest-packagelists.inc +++ b/meta/conf/distro/include/ptest-packagelists.inc @@ -147,6 +147,7 @@ PTESTS_SLOW = "\ libpcap \ libpng \ libsoup \ + libxcrypt \ ${@bb.utils.contains('DISTRO_FEATURES', 'seccomp', 'libseccomp', '',d)} \ lttng-tools \ lz4 \ diff --git a/meta/recipes-core/images/core-image-ptest.bb b/meta/recipes-core/images/core-image-ptest.bb index 9b8af9b93a..852ea036c7 100644 --- a/meta/recipes-core/images/core-image-ptest.bb +++ b/meta/recipes-core/images/core-image-ptest.bb @@ -12,6 +12,7 @@ PTESTS = "${PTESTS_SLOW} ${PTESTS_FAST}" PTEST_RUNNER_TIMEOUT:virtclass-mcextend-python3-cffi = "600" PTEST_RUNNER_TIMEOUT:virtclass-mcextend-go = "4800" PTEST_RUNNER_TIMEOUT:virtclass-mcextend-icu = "2400" +PTEST_RUNNER_TIMEOUT:virtclass-mcextend-libxcrypt = "900" IMAGE_INSTALL:append = " ${MCNAME}-ptest openssh" diff --git a/meta/recipes-core/libxcrypt/files/run-ptest b/meta/recipes-core/libxcrypt/files/run-ptest new file mode 100644 index 0000000000..24c056ba90 --- /dev/null +++ b/meta/recipes-core/libxcrypt/files/run-ptest @@ -0,0 +1,12 @@ +#!/bin/sh + +cd "$(dirname "$0")/test" || exit 1 + +for t in *; do + out=$(./"$t" 2>&1) + case $? in + 0) echo "PASS: $t" ;; + 77) echo "SKIP: $t" ;; + *) echo "FAIL: $t"; echo "$out" | sed 's/^/ /' ;; + esac +done diff --git a/meta/recipes-core/libxcrypt/libxcrypt_4.5.2.bb b/meta/recipes-core/libxcrypt/libxcrypt_4.5.2.bb index 79dba2f6dc..3178e1674b 100644 --- a/meta/recipes-core/libxcrypt/libxcrypt_4.5.2.bb +++ b/meta/recipes-core/libxcrypt/libxcrypt_4.5.2.bb @@ -1,2 +1,22 @@ require libxcrypt.inc +inherit ptest + +SRC_URI += "file://run-ptest" + +do_compile_ptest() { + oe_runmake check TESTS= +} + +LIBXCRYPT_PTEST_SKIP = "test/alg-yescrypt" + +do_install_ptest() { + install -d ${D}${PTEST_PATH}/test + for t in $(makefile-getvar ${B}/Makefile TESTS); do + case " ${LIBXCRYPT_PTEST_SKIP} " in + *" $t "*) continue ;; + esac + ${B}/libtool --mode=install install -m 0755 ${B}/$t ${D}${PTEST_PATH}/test/ + done +} +
Build libxcrypt's upstream test programs and run them under ptest. The test list is taken from the TESTS variable of the build's Makefile, so tests added upstream are picked up without a recipe change. Each test's output is captured and printed only when the test fails, because several tests print their own PASS:/FAIL: lines that would otherwise be counted as extra results. Skip alg-yescrypt. It allocates about 1 GiB for its scrypt known-answer test and 256 MiB for its ROM test, which fail on the 1 GiB ptest image, and it then crashes reading the uninitialised ROM [1]. The suite takes about 7.5 minutes on qemuriscv64, which is over the default 450s timeout, so raise the timeout to 900s and list libxcrypt in PTESTS_SLOW. [1] https://github.com/besser82/libxcrypt/issues/165 Tested with testimage on qemuriscv64: 50 passed, 1 skipped (getrandom-fallbacks), 0 failed. Signed-off-by: Pratik Farkase <pratik.farkase@est.tech> --- .../distro/include/ptest-packagelists.inc | 1 + meta/recipes-core/images/core-image-ptest.bb | 1 + meta/recipes-core/libxcrypt/files/run-ptest | 12 +++++++++++ .../recipes-core/libxcrypt/libxcrypt_4.5.2.bb | 20 +++++++++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 meta/recipes-core/libxcrypt/files/run-ptest