Skip to contentSkip to conversation

mpfr: add ptest support

PATCH New Pratik Farkase 1 participant 1 message Oct 19

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpfr: add ptest support

Build mpfr's upstream 'make check' programs and run them under ptest. The tests read their .dat input files relative to the compiled-in SRCDIR, so build them with srcdir=. and install the data files alongside the binaries, which run-ptest executes from the tests directory.

Tested on qemux86-64 with ptest-runner: 195 tests, all pass.

---
 .../distro/include/ptest-packagelists.inc     |  1 +
 meta/recipes-support/mpfr/mpfr/run-ptest      | 20 +++++++++++++++++++
 meta/recipes-support/mpfr/mpfr_4.2.2.bb       | 19 ++++++++++++++++--
 3 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100755 meta/recipes-support/mpfr/mpfr/run-ptest
meta/conf/distro/include/ptest-packagelists.inc +1 -0
index 518962cbaa..a77cf7f5be 100644
@@ -66,6 +66,7 @@ PTESTS_FAST = "\
     lua \
     lzo \
     m4 \
+    mpfr \
     nettle \
     npth \
     opkg \
meta/recipes-support/mpfr/mpfr/run-ptest new file +20 -0
new file mode 100755
index 0000000000..ddc2e1845f
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+cd "$(dirname "$0")/tests" || exit 1
+
+for t in t*; do
+    # Only the executable test programs, not data files or libraries.
+    [ -f "$t" ] && [ -x "$t" ] || continue
+    case "$t" in
+        *.la|*.sh) continue ;;
+    esac
+
+    ./"$t"
+    rc=$?
+
+    case "$rc" in
+        0)  echo "PASS: $t" ;;
+        77) echo "SKIP: $t" ;;
+        *)  echo "FAIL: $t" ;;
+    esac
+done
meta/recipes-support/mpfr/mpfr_4.2.2.bb +17 -2
index 4d1747c3fd..6b48940171 100644
@@ -4,7 +4,7 @@ HOMEPAGE = "https://www.mpfr.org/"
 LICENSE = "LGPL-3.0-or-later"
 SECTION = "devel"
 
-inherit autotools texinfo
+inherit autotools texinfo ptest
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \
                     file://COPYING.LESSER;md5=3000208d539ec061b899bce1d9ce9404 \
@@ -13,9 +13,24 @@ CVE_PRODUCT = "gnu_mpfr"
 
 DEPENDS = "gmp"
 
-SRC_URI = "https://www.mpfr.org/mpfr-${PV}/mpfr-${PV}.tar.xz"
+SRC_URI = "https://www.mpfr.org/mpfr-${PV}/mpfr-${PV}.tar.xz \
+           file://run-ptest \
+           "
 SRC_URI[sha256sum] = "b67ba0383ef7e8a8563734e2e889ef5ec3c3b898a01d00fa0a6869ad81c6ce01"
 
 UPSTREAM_CHECK_URI = "http://www.mpfr.org/mpfr-current/"
 
+do_compile_ptest() {
+    oe_runmake -C ${B}/tests check TESTS= srcdir=.
+}
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/tests
+    find ${B}/tests -maxdepth 1 -type f -executable ! -name "*.la" | while read -r t; do
+        ${B}/libtool --mode=install install -m 0755 "$t" ${D}${PTEST_PATH}/tests/
+    done
+    # Data files consumed by tfpif, tinp_str and tmul.
+    install -m 0644 ${S}/tests/*.dat ${D}${PTEST_PATH}/tests/
+}
+
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.43.0