diff options
Diffstat (limited to 'meta/recipes-support/gnutls/gnutls/run-ptest')
-rw-r--r-- | meta/recipes-support/gnutls/gnutls/run-ptest | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/meta/recipes-support/gnutls/gnutls/run-ptest b/meta/recipes-support/gnutls/gnutls/run-ptest new file mode 100644 index 0000000000..17e26eae70 --- /dev/null +++ b/meta/recipes-support/gnutls/gnutls/run-ptest | |||
@@ -0,0 +1,100 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | rjob() { | ||
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 | |||
27 | is_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 | |||
39 | test_disallowlist="" | ||
40 | test_disallowlist="${test_disallowlist} dtls-stress" | ||
41 | test_disallowlist="${test_disallowlist} handshake-large-cert" | ||
42 | test_disallowlist="${test_disallowlist} id-on-xmppAddr" | ||
43 | test_disallowlist="${test_disallowlist} mini-x509-cas" | ||
44 | test_disallowlist="${test_disallowlist} pkcs12_simple" | ||
45 | test_disallowlist="${test_disallowlist} protocol-set-allowlist" | ||
46 | test_disallowlist="${test_disallowlist} psk-file" | ||
47 | test_disallowlist="${test_disallowlist} rawpk-api" | ||
48 | test_disallowlist="${test_disallowlist} set_pkcs12_cred" | ||
49 | test_disallowlist="${test_disallowlist} system-override-curves-allowlist" | ||
50 | test_disallowlist="${test_disallowlist} system-override-hash" | ||
51 | test_disallowlist="${test_disallowlist} system-override-sig" | ||
52 | test_disallowlist="${test_disallowlist} system-override-sig-tls" | ||
53 | test_disallowlist="${test_disallowlist} system-prio-file" | ||
54 | test_disallowlist="${test_disallowlist} x509cert-tl" | ||
55 | |||
56 | LOG=${PWD}/tests.log | ||
57 | cd tests | ||
58 | max_njobs=$(grep -c ^processor /proc/cpuinfo) | ||
59 | njobs=0 | ||
60 | |||
61 | set +e | ||
62 | |||
63 | for t in *; do | ||
64 | [ -x $t ] || continue | ||
65 | [ -f $t ] || continue | ||
66 | |||
67 | is_disallowed ${t} | ||
68 | [ $? -eq 0 ] && continue | ||
69 | |||
70 | rjob ${t} ${LOG} & | ||
71 | one=1 | ||
72 | njobs=$(expr ${njobs} + ${one}) | ||
73 | if [ ${njobs} -eq ${max_njobs} ]; then | ||
74 | wait | ||
75 | njobs=0 | ||
76 | fi | ||
77 | done | ||
78 | wait | ||
79 | |||
80 | skipped=$(grep -c SKIP ${LOG}) | ||
81 | passed=$(grep -c PASS ${LOG}) | ||
82 | failed=$(grep -c FAIL ${LOG}) | ||
83 | total=$(expr ${passed} + ${failed} + ${skipped}) | ||
84 | |||
85 | if [ ${failed} -ne 0 ]; then | ||
86 | echo | ||
87 | echo "Tests failed for gnutls, log is:" | ||
88 | echo "--------------------" | ||
89 | cat ${LOG} | ||
90 | echo | ||
91 | fi | ||
92 | |||
93 | echo | ||
94 | echo "gnutls test summary:" | ||
95 | echo "--------------------" | ||
96 | echo "total: ${total}" | ||
97 | echo "pass : ${passed}" | ||
98 | echo "fail : ${failed}" | ||
99 | echo "skip : ${skipped}" | ||
100 | echo | ||