gnutls: add initial ptest support
PATCH 1/1 gnutls: add initial ptest support
Step 1 of adding gnutls unit-tests into ptest. Only self-contained test (no external file system dependencies) are included in this step.
Sample output:
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-01-13T11:32
STOP: ptest-runner
TOTAL: 1 FAIL: 0
Signed-off-by Ravineet Singh <[email protected]>
--- .../gnutls/gnutls/Add-ptest-support.patch | 59 ++++++++++++ meta/recipes-support/gnutls/gnutls/run-ptest | 89 +++++++++++++++++++ meta/recipes-support/gnutls/gnutls_3.7.8.bb | 11 ++- 3 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-support/gnutls/gnutls/Add-ptest-support.patch create mode 100644 meta/recipes-support/gnutls/gnutls/run-ptest
meta/recipes-support/gnutls/gnutls/Add-ptest-support.patch new file +59 -0
@@ -0,0 +1,59 @@ +From 74080376904713a8e6cceefbc25c81512796bf0c Mon Sep 17 00:00:00 2001 +From: Ravineet Singh <[email protected]> +Date: Tue, 10 Jan 2023 16:11:10 +0100 +Subject: [PATCH] gnutls: add ptest support + +Signed-off-by: Ravineet Singh <[email protected]> +--- + 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 +
meta/recipes-support/gnutls/gnutls/run-ptest new file +89 -0
89 lines not on this page · raw message
meta/recipes-support/gnutls/gnutls_3.7.8.bb +10 -1
@@ -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,11 @@ do_install:append:class-target() { fi } +TESTDIR = "tests" +do_compile:append() { + oe_runmake ${PARALLEL_MAKE} -C ${TESTDIR} buildtest-TESTS +} + PACKAGES =+ "${PN}-openssl ${PN}-xx ${PN}-fips" FILES:${PN}-dev += "${bindir}/gnutls-cli-debug"
@@ -75,6 +82,8 @@ FILES:${PN}-openssl = "${libdir}/libgnutls-openssl.so.*" FILES:${PN}-xx = "${libdir}/libgnutlsxx.so.*" FILES:${PN}-fips = "${bindir}/fipshmac" +RDEPENDS:${PN}-ptest += "bash" + BBCLASSEXTEND = "native nativesdk" pkg_postinst_ontarget:${PN}-fips () {
Signature · 1 line
2.34.1
Hi,
First, this should be sent to openembedded-core@ as the files are in openembedded-core.
meta/recipes-support/gnutls/gnutls_3.7.8.bb do_install:append:class-target() { · line 77
Quoted 5 lines
meta/recipes-support/gnutls/gnutls_3.7.8.bb +5
-0+TESTDIR = "tests" +do_compile:append() { + oe_runmake ${PARALLEL_MAKE} -C ${TESTDIR} buildtest-TESTS +} +
No need for a variable you only use one, and will never be changed.
Quoted 1 line
+RDEPENDS:${PN}-ptest += "bash"
Is this just for the run-ptest script? If so, please write the script in plain sh. Some people don’t want GPLv3.
Ross