summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/gnutls/gnutls
diff options
context:
space:
mode:
authorRavineet Singh <ravineet.a.singh@est.tech>2023-02-01 16:20:49 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-02-02 09:51:00 +0000
commita08c791bae13bda56ee71e9023329473e8d5baa5 (patch)
treeb26f44baf0e9c95c56d1acda71b0821c5fe2e6f2 /meta/recipes-support/gnutls/gnutls
parent729c16b00e0e9036218a18a7234d90706542f4ab (diff)
downloadpoky-a08c791bae13bda56ee71e9023329473e8d5baa5.tar.gz
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>
Diffstat (limited to 'meta/recipes-support/gnutls/gnutls')
-rw-r--r--meta/recipes-support/gnutls/gnutls/Add-ptest-support.patch60
-rw-r--r--meta/recipes-support/gnutls/gnutls/run-ptest90
2 files changed, 150 insertions, 0 deletions
diff --git a/meta/recipes-support/gnutls/gnutls/Add-ptest-support.patch b/meta/recipes-support/gnutls/gnutls/Add-ptest-support.patch
new file mode 100644
index 0000000000..8ad6ba5ad5
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/Add-ptest-support.patch
@@ -0,0 +1,60 @@
1From 74080376904713a8e6cceefbc25c81512796bf0c Mon Sep 17 00:00:00 2001
2From: Ravineet Singh <ravineet.a.singh@est.tech>
3Date: Tue, 10 Jan 2023 16:11:10 +0100
4Subject: [PATCH] gnutls: add ptest support
5
6Upstream-Status: Inappropriate [embedded specific]
7Signed-off-by: Ravineet Singh <ravineet.a.singh@est.tech>
8---
9 Makefile.am | 3 +++
10 configure.ac | 2 ++
11 tests/Makefile.am | 6 ++++++
12 3 files changed, 11 insertions(+)
13
14diff --git a/Makefile.am b/Makefile.am
15index 843193f9f..816b09fec 100644
16--- a/Makefile.am
17+++ b/Makefile.am
18@@ -191,6 +191,9 @@ dist-hook:
19 mv ChangeLog $(distdir)
20 touch -c $(distdir)/doc/*.html $(distdir)/doc/*.pdf $(distdir)/doc/*.info
21
22+install-ptest:
23+ $(MAKE) -C tests DESTDIR=$(DESTDIR)/tests $@
24+
25 .PHONY: abi-check abi-dump-versioned abi-dump-latest pic-check symbol-check local-code-coverage-output files-update AUTHORS
26
27 include $(top_srcdir)/cligen/cligen.mk
28diff --git a/configure.ac b/configure.ac
29index baff1c007..f9f596abf 100644
30--- a/configure.ac
31+++ b/configure.ac
32@@ -1150,6 +1150,8 @@ AC_SUBST(LIBGNUTLS_CFLAGS)
33
34 AM_CONDITIONAL(NEEDS_LIBRT, test "$gnutls_needs_librt" = "yes")
35
36+AM_EXTRA_RECURSIVE_TARGETS([buildtest-TESTS])
37+
38 AC_DEFINE([GNUTLS_INTERNAL_BUILD], 1, [We allow temporarily usage of deprecated functions - until they are removed.])
39
40 hw_features=
41diff --git a/tests/Makefile.am b/tests/Makefile.am
42index 573e911a0..e8a26f8b9 100644
43--- a/tests/Makefile.am
44+++ b/tests/Makefile.am
45@@ -644,6 +644,12 @@ SH_LOG_COMPILER = $(SHELL)
46 AM_VALGRINDFLAGS = --suppressions=$(srcdir)/suppressions.valgrind
47 LOG_COMPILER = $(LOG_VALGRIND)
48
49+install-ptest: $(check_PROGRAMS)
50+ @$(INSTALL) -d $(DESTDIR)
51+ @for file in $^; do \
52+ $(INSTALL_PROGRAM) $$file $(DESTDIR) ; \
53+ done
54+
55 distclean-local:
56 rm -rf softhsm-*.db softhsm-*.config *.tmp tmp-* x509-crt-list-import-url.config.db port.lock.d
57
58--
592.31.1
60
diff --git a/meta/recipes-support/gnutls/gnutls/run-ptest b/meta/recipes-support/gnutls/gnutls/run-ptest
new file mode 100644
index 0000000000..84948f487d
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/run-ptest
@@ -0,0 +1,90 @@
1#!/bin/sh
2
3rjob() {
4 local job=$1
5 local log=$2
6
7 # TODO: Output will be garbled
8 ./${job} >> ${log} 2>&1
9
10 ret=$?
11 case $ret in
12 0)
13 echo "PASS: $t" >> ${log}
14 echo "PASS: $t"
15 ;;
16 77)
17 echo "SKIP: $t" >> ${log}
18 echo "SKIP: $t"
19 ;;
20 *)
21 echo "FAIL: $t" >> ${log}
22 echo "FAIL: $t"
23 ;;
24 esac
25}
26
27is_disallowed() {
28 local key=$1
29 $(echo ${test_disallowlist} | grep -w -q ${key})
30 return $?
31}
32
33# TODO
34# This list should probably be in a external file
35# Testcases defined here either take very long time (dtls-stress)
36# or are dependent on local files (certs, etc) in local file system
37# currently not exported to target.
38
39test_disallowlist=""
40test_disallowlist="${test_disallowlist} dtls-stress"
41test_disallowlist="${test_disallowlist} handshake-large-cert"
42test_disallowlist="${test_disallowlist} id-on-xmppAddr"
43test_disallowlist="${test_disallowlist} mini-x509-cas"
44test_disallowlist="${test_disallowlist} pkcs12_simple"
45test_disallowlist="${test_disallowlist} protocol-set-allowlist"
46test_disallowlist="${test_disallowlist} psk-file"
47test_disallowlist="${test_disallowlist} rawpk-api"
48test_disallowlist="${test_disallowlist} set_pkcs12_cred"
49test_disallowlist="${test_disallowlist} system-override-curves-allowlist"
50test_disallowlist="${test_disallowlist} system-override-hash"
51test_disallowlist="${test_disallowlist} system-override-sig"
52test_disallowlist="${test_disallowlist} system-override-sig-tls"
53test_disallowlist="${test_disallowlist} system-prio-file"
54test_disallowlist="${test_disallowlist} x509cert-tl"
55
56LOG=${PWD}/tests.log
57cd tests
58max_njobs=$(grep -c ^processor /proc/cpuinfo)
59njobs=0
60
61for t in *; do
62 [ -x $t ] || continue
63 [ -f $t ] || continue
64
65 is_disallowed ${t}
66 [ $? -eq 0 ] && continue
67
68 rjob ${t} ${LOG} &
69 one=1
70 njobs=$(expr ${njobs} + ${one})
71 if [ ${njobs} -eq ${max_njobs} ]; then
72 wait
73 njobs=0
74 fi
75done
76wait
77
78skipped=$(grep -c SKIP ${LOG})
79passed=$(grep -c PASS ${LOG})
80failed=$(grep -c FAIL ${LOG})
81total=$(expr ${passed} + ${failed} + ${skipped})
82
83echo
84echo "gnutls test summary:"
85echo "--------------------"
86echo "total: ${total}"
87echo "pass : ${passed}"
88echo "fail : ${failed}"
89echo "skip : ${skipped}"
90echo