From 9a0cd394a030ceff1e6cc17a05e2400745308914 Mon Sep 17 00:00:00 2001 From: Ricardo Simoes Date: Tue, 15 Jul 2025 08:54:59 +0200 Subject: dosfstools: Add ptests (From OE-Core rev: 875b8961221875e6a809d15b7d3b83ea00da0c0e) Signed-off-by: Ricardo Simoes Signed-off-by: Mark Jonas Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- meta/conf/distro/include/ptest-packagelists.inc | 1 + meta/recipes-devtools/dosfstools/dosfstools_4.2.bb | 30 +++++++++++++++++++++- meta/recipes-devtools/dosfstools/files/run-ptest | 5 ++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/dosfstools/files/run-ptest diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc index 4253c7b062..46c8945eb4 100644 --- a/meta/conf/distro/include/ptest-packagelists.inc +++ b/meta/conf/distro/include/ptest-packagelists.inc @@ -99,6 +99,7 @@ PTESTS_SLOW = "\ coreutils \ curl \ dbus \ + dosfstools \ e2fsprogs \ elfutils \ gettext \ diff --git a/meta/recipes-devtools/dosfstools/dosfstools_4.2.bb b/meta/recipes-devtools/dosfstools/dosfstools_4.2.bb index 86fb68f664..3b4c6b4a4b 100644 --- a/meta/recipes-devtools/dosfstools/dosfstools_4.2.bb +++ b/meta/recipes-devtools/dosfstools/dosfstools_4.2.bb @@ -10,18 +10,46 @@ LICENSE = "GPL-3.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/${BP}.tar.gz \ + file://run-ptest \ file://source-date-epoch.patch \ file://0001-fsck.fat-Adhere-to-the-fsck-exit-codes.patch \ file://0002-manpages-Document-fsck.fat-new-exit-codes.patch \ " SRC_URI[sha256sum] = "64926eebf90092dca21b14259a5301b7b98e7b1943e8a201c7d726084809b527" -inherit autotools gettext pkgconfig update-alternatives github-releases +inherit autotools gettext pkgconfig ptest update-alternatives github-releases EXTRA_OECONF = "--enable-compat-symlinks --without-iconv" CFLAGS += "-D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" +do_install_ptest () { + install -d ${D}${PTEST_PATH}/tests + install -m 0744 ${S}/tests/* ${D}${PTEST_PATH}/tests/ + install -m 0744 ${S}/test-driver ${D}${PTEST_PATH}/tests/ + + install -d ${D}${PTEST_PATH}/src + ln -sf ${sbindir}/mkfs.fat ${D}${PTEST_PATH}/src/mkfs.fat + ln -sf ${sbindir}/fsck.fat ${D}${PTEST_PATH}/src/fsck.fat + ln -sf ${sbindir}/fatlabel ${D}${PTEST_PATH}/src/fatlabel + + # dosfstools tests depends on variables defined in the tests/Makefile. + # To run the tests, we need to modify the following: + # - srcdir: used to find the test scripts for each dosfstools tools + # - top_srcdir: used to find the test-driver script + # - Makefile: originally used to recreate build rules when needed. They're not needed here + # because we only want to run the tests. + # - XXD_FOUND: Always satisfied by RDEPENDS of ptest package + sed \ + -e 's/^srcdir = ..*/srcdir = \./' \ + -e 's/^top_srcdir = ..*/top_srcdir = \./' \ + -e 's/^Makefile: ..*/Makefile: /' \ + -e 's/XXD_FOUND=/XXD_FOUND=yes/' \ + ${B}/tests/Makefile > ${D}${PTEST_PATH}/tests/Makefile +} + +RDEPENDS:${PN}-ptest += "bash diffutils gawk make xxd" + BBCLASSEXTEND = "native nativesdk" ALTERNATIVE_PRIORITY = "100" diff --git a/meta/recipes-devtools/dosfstools/files/run-ptest b/meta/recipes-devtools/dosfstools/files/run-ptest new file mode 100644 index 0000000000..4f6e349a23 --- /dev/null +++ b/meta/recipes-devtools/dosfstools/files/run-ptest @@ -0,0 +1,5 @@ +#!/bin/sh + +cd tests + +make check -- cgit v1.2.3-54-g00ecf