blob: 84948f487d1b8882809a8268eb9b583dbd6afef2 [file] [log] [blame]
Patrick Williams864cc432023-02-09 14:54:44 -06001#!/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