mirror of
https://git.yoctoproject.org/poky
synced 2026-04-21 03:32:12 +02:00
gnutls: add ptest support
Add gnutls unit-tests into ptest. Only self-contained tests (no external file system dependencies) are included. Some tests have been put in a disallow list in the run-ptest; these tests either require additional files (certificates) or environment setup prior to being run, via wrapper shell script. As autotools packages are built out-of-tree, it is cumbersome to add additional files. With regards to tests requiring wrapper scripts, it is possible to add logic to run these tests under run-ptests but that will require more effort to maintain, hence skipped. Verified via: $ runqemu qemux86-64 kvm nographic serial qemuparams='-m 4096 -smp 32' root@qemux86-64:~# ptest-runner gnutls START: ptest-runner BEGIN: /usr/lib64/gnutls/ptest PASS: aead-cipher-vec PASS: alerts PASS: anti_replay ... gnutls test summary: -------------------- total: 375 pass : 364 fail : 0 skip : 11 DURATION: 184 END: /usr/lib64/gnutls/ptest 2023-02-01T13:55 STOP: ptest-runner TOTAL: 1 FAIL: 0 (From OE-Core rev: 6061df3084b991ba4a54a3dca5dadda97e2364ac) Signed-off-by: Ravineet Singh <ravineet.a.singh@est.tech> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
729c16b00e
commit
a08c791bae
@@ -88,6 +88,7 @@ PTESTS_SLOW = "\
|
||||
elfutils-ptest \
|
||||
gettext-ptest \
|
||||
glib-2.0-ptest \
|
||||
gnutls-ptest \
|
||||
gstreamer1.0-ptest \
|
||||
libevent-ptest \
|
||||
libgcrypt-ptest \
|
||||
|
||||
60
meta/recipes-support/gnutls/gnutls/Add-ptest-support.patch
Normal file
60
meta/recipes-support/gnutls/gnutls/Add-ptest-support.patch
Normal file
@@ -0,0 +1,60 @@
|
||||
From 74080376904713a8e6cceefbc25c81512796bf0c Mon Sep 17 00:00:00 2001
|
||||
From: Ravineet Singh <ravineet.a.singh@est.tech>
|
||||
Date: Tue, 10 Jan 2023 16:11:10 +0100
|
||||
Subject: [PATCH] gnutls: add ptest support
|
||||
|
||||
Upstream-Status: Inappropriate [embedded specific]
|
||||
Signed-off-by: Ravineet Singh <ravineet.a.singh@est.tech>
|
||||
---
|
||||
Makefile.am | 3 +++
|
||||
configure.ac | 2 ++
|
||||
tests/Makefile.am | 6 ++++++
|
||||
3 files changed, 11 insertions(+)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 843193f9f..816b09fec 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -191,6 +191,9 @@ dist-hook:
|
||||
mv ChangeLog $(distdir)
|
||||
touch -c $(distdir)/doc/*.html $(distdir)/doc/*.pdf $(distdir)/doc/*.info
|
||||
|
||||
+install-ptest:
|
||||
+ $(MAKE) -C tests DESTDIR=$(DESTDIR)/tests $@
|
||||
+
|
||||
.PHONY: abi-check abi-dump-versioned abi-dump-latest pic-check symbol-check local-code-coverage-output files-update AUTHORS
|
||||
|
||||
include $(top_srcdir)/cligen/cligen.mk
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index baff1c007..f9f596abf 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1150,6 +1150,8 @@ AC_SUBST(LIBGNUTLS_CFLAGS)
|
||||
|
||||
AM_CONDITIONAL(NEEDS_LIBRT, test "$gnutls_needs_librt" = "yes")
|
||||
|
||||
+AM_EXTRA_RECURSIVE_TARGETS([buildtest-TESTS])
|
||||
+
|
||||
AC_DEFINE([GNUTLS_INTERNAL_BUILD], 1, [We allow temporarily usage of deprecated functions - until they are removed.])
|
||||
|
||||
hw_features=
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index 573e911a0..e8a26f8b9 100644
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -644,6 +644,12 @@ SH_LOG_COMPILER = $(SHELL)
|
||||
AM_VALGRINDFLAGS = --suppressions=$(srcdir)/suppressions.valgrind
|
||||
LOG_COMPILER = $(LOG_VALGRIND)
|
||||
|
||||
+install-ptest: $(check_PROGRAMS)
|
||||
+ @$(INSTALL) -d $(DESTDIR)
|
||||
+ @for file in $^; do \
|
||||
+ $(INSTALL_PROGRAM) $$file $(DESTDIR) ; \
|
||||
+ done
|
||||
+
|
||||
distclean-local:
|
||||
rm -rf softhsm-*.db softhsm-*.config *.tmp tmp-* x509-crt-list-import-url.config.db port.lock.d
|
||||
|
||||
--
|
||||
2.31.1
|
||||
|
||||
90
meta/recipes-support/gnutls/gnutls/run-ptest
Normal file
90
meta/recipes-support/gnutls/gnutls/run-ptest
Normal file
@@ -0,0 +1,90 @@
|
||||
#!/bin/sh
|
||||
|
||||
rjob() {
|
||||
local job=$1
|
||||
local log=$2
|
||||
|
||||
# TODO: Output will be garbled
|
||||
./${job} >> ${log} 2>&1
|
||||
|
||||
ret=$?
|
||||
case $ret in
|
||||
0)
|
||||
echo "PASS: $t" >> ${log}
|
||||
echo "PASS: $t"
|
||||
;;
|
||||
77)
|
||||
echo "SKIP: $t" >> ${log}
|
||||
echo "SKIP: $t"
|
||||
;;
|
||||
*)
|
||||
echo "FAIL: $t" >> ${log}
|
||||
echo "FAIL: $t"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
is_disallowed() {
|
||||
local key=$1
|
||||
$(echo ${test_disallowlist} | grep -w -q ${key})
|
||||
return $?
|
||||
}
|
||||
|
||||
# TODO
|
||||
# This list should probably be in a external file
|
||||
# Testcases defined here either take very long time (dtls-stress)
|
||||
# or are dependent on local files (certs, etc) in local file system
|
||||
# currently not exported to target.
|
||||
|
||||
test_disallowlist=""
|
||||
test_disallowlist="${test_disallowlist} dtls-stress"
|
||||
test_disallowlist="${test_disallowlist} handshake-large-cert"
|
||||
test_disallowlist="${test_disallowlist} id-on-xmppAddr"
|
||||
test_disallowlist="${test_disallowlist} mini-x509-cas"
|
||||
test_disallowlist="${test_disallowlist} pkcs12_simple"
|
||||
test_disallowlist="${test_disallowlist} protocol-set-allowlist"
|
||||
test_disallowlist="${test_disallowlist} psk-file"
|
||||
test_disallowlist="${test_disallowlist} rawpk-api"
|
||||
test_disallowlist="${test_disallowlist} set_pkcs12_cred"
|
||||
test_disallowlist="${test_disallowlist} system-override-curves-allowlist"
|
||||
test_disallowlist="${test_disallowlist} system-override-hash"
|
||||
test_disallowlist="${test_disallowlist} system-override-sig"
|
||||
test_disallowlist="${test_disallowlist} system-override-sig-tls"
|
||||
test_disallowlist="${test_disallowlist} system-prio-file"
|
||||
test_disallowlist="${test_disallowlist} x509cert-tl"
|
||||
|
||||
LOG=${PWD}/tests.log
|
||||
cd tests
|
||||
max_njobs=$(grep -c ^processor /proc/cpuinfo)
|
||||
njobs=0
|
||||
|
||||
for t in *; do
|
||||
[ -x $t ] || continue
|
||||
[ -f $t ] || continue
|
||||
|
||||
is_disallowed ${t}
|
||||
[ $? -eq 0 ] && continue
|
||||
|
||||
rjob ${t} ${LOG} &
|
||||
one=1
|
||||
njobs=$(expr ${njobs} + ${one})
|
||||
if [ ${njobs} -eq ${max_njobs} ]; then
|
||||
wait
|
||||
njobs=0
|
||||
fi
|
||||
done
|
||||
wait
|
||||
|
||||
skipped=$(grep -c SKIP ${LOG})
|
||||
passed=$(grep -c PASS ${LOG})
|
||||
failed=$(grep -c FAIL ${LOG})
|
||||
total=$(expr ${passed} + ${failed} + ${skipped})
|
||||
|
||||
echo
|
||||
echo "gnutls test summary:"
|
||||
echo "--------------------"
|
||||
echo "total: ${total}"
|
||||
echo "pass : ${passed}"
|
||||
echo "fail : ${failed}"
|
||||
echo "skip : ${skipped}"
|
||||
echo
|
||||
@@ -22,11 +22,13 @@ SHRT_VER = "${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}"
|
||||
SRC_URI = "https://www.gnupg.org/ftp/gcrypt/gnutls/v${SHRT_VER}/gnutls-${PV}.tar.xz \
|
||||
file://arm_eabi.patch \
|
||||
file://0001-Creating-.hmac-file-should-be-excuted-in-target-envi.patch \
|
||||
file://run-ptest \
|
||||
file://Add-ptest-support.patch \
|
||||
"
|
||||
|
||||
SRC_URI[sha256sum] = "c58ad39af0670efe6a8aee5e3a8b2331a1200418b64b7c51977fb396d4617114"
|
||||
|
||||
inherit autotools texinfo pkgconfig gettext lib_package gtk-doc
|
||||
inherit autotools texinfo pkgconfig gettext lib_package gtk-doc ptest
|
||||
|
||||
PACKAGECONFIG ??= "libidn ${@bb.utils.filter('DISTRO_FEATURES', 'seccomp', d)}"
|
||||
|
||||
@@ -68,6 +70,10 @@ do_install:append:class-target() {
|
||||
fi
|
||||
}
|
||||
|
||||
do_compile:append() {
|
||||
oe_runmake ${PARALLEL_MAKE} -C tests buildtest-TESTS
|
||||
}
|
||||
|
||||
PACKAGES =+ "${PN}-openssl ${PN}-xx ${PN}-fips"
|
||||
|
||||
FILES:${PN}-dev += "${bindir}/gnutls-cli-debug"
|
||||
|
||||
Reference in New Issue
Block a user