nettle: rewrite ptest integration

Instead of patching a relative path to an unversioned libnettle.so to be
a bare filename which then needs nettle-dev to be installed, create a
symlink in the expected place which points to the actual library. This
means nettle-ptest no longer needs to depend on nettle-dev.

Explicitly skip symbols-test, it has been silently failing as nm isn't
available and also needs a static libnettle.a to run.

Install two rsa-* example binaries that are needed for pkcs1-conv-test
to pass.

(From OE-Core rev: dc5cd169e8b9a0f9d9881f116a8d83706460bb7c)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton
2023-06-08 12:59:15 +01:00
committed by Richard Purdie
parent 5be5b6ee21
commit 098df1bd77
3 changed files with 32 additions and 58 deletions

View File

@@ -1,29 +0,0 @@
Remove the relative path for libnettle.so so the test
program can find it.
Relative paths are not suitable, as the folder strucure for ptest
is different from the one expected by the nettle testsuite.
Upstream-Status: Inappropriate [embedded specific]
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
testsuite/dlopen-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testsuite/dlopen-test.c b/testsuite/dlopen-test.c
index 4265bf7..1a25d17 100644
--- a/testsuite/dlopen-test.c
+++ b/testsuite/dlopen-test.c
@@ -15,7 +15,7 @@ int
main (int argc UNUSED, char **argv UNUSED)
{
#if HAVE_LIBDL
- void *handle = dlopen ("../libnettle." SO_EXT, RTLD_NOW);
+ void *handle = dlopen ("libnettle.so", RTLD_NOW);
int (*get_version)(void);
if (!handle)
{
--
2.17.1

View File

@@ -6,31 +6,35 @@ failed=0
all=0
for f in *-test; do
if [ "$f" = "sha1-huge-test" ] ; then
echo "SKIP: $f (skipped for ludicrous run time)"
continue
fi
"./$f"
case "$?" in
0)
echo "PASS: $f"
all=$((all + 1))
case "$f" in
"sha1-huge-test")
echo "SKIP: $f (long run time)"
;;
77)
echo "SKIP: $f"
"symbols-test")
echo "SKIP: $f (needs static libraries)"
;;
*)
echo "FAIL: $f"
failed=$((failed + 1))
all=$((all + 1))
"./$f"
case "$?" in
0)
echo "PASS: $f"
all=$((all + 1))
;;
77)
echo "SKIP: $f"
;;
*)
echo "FAIL: $f"
failed=$((failed + 1))
all=$((all + 1))
;;
esac
;;
esac
done
if [ "$failed" -eq 0 ] ; then
echo "All $all tests passed"
echo "All $all tests passed"
else
echo "$failed of $all tests failed"
echo "$failed of $all tests failed"
fi

View File

@@ -20,10 +20,6 @@ SRC_URI = "${GNU_MIRROR}/${BPN}/${BP}.tar.gz \
file://check-header-files-of-openssl-only-if-enable_.patch \
"
SRC_URI:append:class-target = "\
file://dlopen-test.patch \
"
SRC_URI[sha256sum] = "364f3e2b77cd7dcde83fd7c45219c834e54b0c75e428b6f894a23d12dd41cbfe"
UPSTREAM_CHECK_REGEX = "nettle-(?P<pver>\d+(\.\d+)+)\.tar"
@@ -44,14 +40,17 @@ do_install:append() {
do_install_ptest() {
install -d ${D}${PTEST_PATH}/testsuite/
install ${S}/testsuite/gold-bug.txt ${D}${PTEST_PATH}/testsuite/
install ${S}/testsuite/*-test ${D}${PTEST_PATH}/testsuite/
# tools can be found in PATH, not in ../tools/
sed -i -e 's|../tools/||' ${D}${PTEST_PATH}/testsuite/*-test
install ${B}/testsuite/*-test ${D}${PTEST_PATH}/testsuite/
install ${S}/testsuite/*-test ${D}${PTEST_PATH}/testsuite/
install ${S}/testsuite/gold-bug.txt ${D}${PTEST_PATH}/testsuite/
# Install a symlink for dlopen-test
ln -sr ${D}${libdir}/libnettle.so.*.* ${D}${PTEST_PATH}/libnettle.so
# These examples are needed for pkcs1-conv-test
install ${B}/examples/rsa-sign ${B}/examples/rsa-verify ${D}${PTEST_PATH}/testsuite/
# Fix build-time relative paths
sed -i -e 's|../tools/|${bindir}/|g' ${D}${PTEST_PATH}/testsuite/*-test
sed -i -e 's|../examples/|./|g' ${D}${PTEST_PATH}/testsuite/*-test
}
RDEPENDS:${PN}-ptest += "${PN}-dev"
INSANE_SKIP:${PN}-ptest += "dev-deps"
BBCLASSEXTEND = "native nativesdk"