--- /dev/null
+#!/bin/sh
+# SPDX-License-Identifier: MIT
+
+cd "$(dirname "$0")/tests" || exit 1
+
+for t in *; do
+ [ -x "$t" ] || continue
+
+ suite="${t%%__*}"
+ name="${t#*__}"
+
+ case "$suite" in
+ libffi.bhaible)
+ ./"$t" > "$t.out" 2>&1
+ if ! LC_ALL=C uniq -u < "$t.out" | grep -q .; then
+ echo "PASS: $suite/$name"
+ else
+ echo "FAIL: $suite/$name"
+ cat "$t.out"
+ fi
+ rm -f "$t.out"
+ ;;
+ *)
+ if ./"$t" 2>&1; then
+ echo "PASS: $suite/$name"
+ else
+ echo "FAIL: $suite/$name"
+ fi
+ ;;
+ esac
+done
SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/${BPN}-${PV}.tar.gz \
file://not-win32.patch \
+ file://run-ptest \
"
SRC_URI[sha256sum] = "f3a3082a23b37c293a4fcd1053147b371f2ff91fa7ea1b2a52e335676bac82dc"
EXTRA_OECONF:class-native += "--with-gcc-arch=generic"
EXTRA_OEMAKE:class-target = "LIBTOOLFLAGS='--tag=CC'"
-inherit autotools texinfo multilib_header github-releases
+inherit autotools texinfo multilib_header github-releases ptest
do_install:append() {
oe_multilib_header ffi.h ffitarget.h
MIPS_INSTRUCTION_SET = "mips"
BBCLASSEXTEND = "native nativesdk"
+
+do_compile_ptest() {
+ mkdir -p ${B}/ptest-bins
+ cd ${S}/testsuite
+
+ for suite in libffi.call libffi.closures libffi.complex libffi.go libffi.threads; do
+ [ -d $suite ] || continue
+ extra=""
+ [ "$suite" = "libffi.threads" ] && extra="-lpthread"
+
+ for src in $suite/*.c $suite/*.cc; do
+ [ -f "$src" ] || continue
+ grep -q "dg-do run" "$src" || continue
+ name=$(basename "${src%.*}")
+ [ "$name" = "complex_int" ] && continue
+ case "$src" in
+ *.cc) compiler="${CXX}";;
+ *) compiler="${CC}";;
+ esac
+ $compiler ${CFLAGS} ${LDFLAGS} \
+ -I${B}/include -I${B} -I${S}/testsuite/libffi.call \
+ -o ${B}/ptest-bins/${suite}__${name} "$src" \
+ -L${B}/.libs -lffi $extra 2>/dev/null || true
+ done
+ done
+
+ for t in test-call test-callback; do
+ ${CC} ${CFLAGS} ${LDFLAGS} -I${B}/include -I${B} \
+ -o ${B}/ptest-bins/libffi.bhaible__${t} \
+ libffi.bhaible/${t}.c -L${B}/.libs -lffi || true
+ done
+}
+
+do_install_ptest() {
+ install -d ${D}${PTEST_PATH}/tests
+ for t in ${B}/ptest-bins/*; do
+ [ -f "$t" ] && install -m 0755 "$t" ${D}${PTEST_PATH}/tests/
+ done
+}