Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 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 | for 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 |
| 75 | done |
| 76 | wait |
| 77 | |
| 78 | skipped=$(grep -c SKIP ${LOG}) |
| 79 | passed=$(grep -c PASS ${LOG}) |
| 80 | failed=$(grep -c FAIL ${LOG}) |
| 81 | total=$(expr ${passed} + ${failed} + ${skipped}) |
| 82 | |
| 83 | echo |
| 84 | echo "gnutls test summary:" |
| 85 | echo "--------------------" |
| 86 | echo "total: ${total}" |
| 87 | echo "pass : ${passed}" |
| 88 | echo "fail : ${failed}" |
| 89 | echo "skip : ${skipped}" |
| 90 | echo |