blob: 2ed3ca94b4864045064f284d473f58f839f09457 [file] [log] [blame]
Manuel Pégourié-Gonnardfb2ed582022-07-21 11:04:52 +02001#!/bin/sh
2
3# This is only an example/template script, you should make a copy and edit it
4# to suit your needs. The part that needs editing is at the top.
5#
6# Also, you can comment out parts that don't need to be re-done when
7# re-running this script (for example "get numbers before this PR").
8
9# ----- BEGIN edit this -----
10DRIVER_COMPONENT=test_psa_crypto_config_accel_hash_use_psa
11reference_config () {
12 scripts/config.py set MBEDTLS_USE_PSA_CRYPTO
13 scripts/config.py unset MBEDTLS_PKCS1_V21
14 scripts/config.py unset MBEDTLS_X509_RSASSA_PSS_SUPPORT
15 scripts/config.py unset MBEDTLS_PKCS5_C
16 scripts/config.py unset MBEDTLS_PKCS12_C
17 scripts/config.py unset MBEDTLS_ECDSA_DETERMINISTIC
18}
19SUITES="rsa pkcs1_v15 pk pkparse pkwrite"
20# ----- END edit this -----
21
22set -eu
23
24cleanup() {
25 make clean
26 git checkout -- include/mbedtls/mbedtls_config.h include/psa/crypto_config.h
27}
28
29record() {
30 export MBEDTLS_TEST_OUTCOME_FILE="$PWD/outcome-$1.csv"
31 rm -f $MBEDTLS_TEST_OUTCOME_FILE
32 make check
33}
34
35# save current HEAD
36HEAD=$(git branch --show-current)
37
38# get the numbers before this PR for default and full
39cleanup
40git checkout $(git merge-base HEAD development)
41record "before-default"
42
43cleanup
44scripts/config.py full
45record "before-full"
46
47# get the numbers now for default and full
48cleanup
49git checkout $HEAD
50record "after-default"
51
52cleanup
53scripts/config.py full
54record "after-full"
55
56# get the numbers now for driver-only and reference
57cleanup
58reference_config
59record "reference"
60
61cleanup
62export MBEDTLS_TEST_OUTCOME_FILE="$PWD/outcome-drivers.csv"
63tests/scripts/all.sh -k test_psa_crypto_config_accel_hash_use_psa
64
65# analysis
66
67compare_suite () {
68 ref="outcome-$1.csv"
69 new="outcome-$2.csv"
70 suite="$3"
71
72 pattern_suite=";test_suite_$suite;"
73 total=$(grep -c "$pattern_suite" "$ref")
74 sed_cmd="s/^.*$pattern_suite\(.*\);SKIP.*/\1/p"
75 sed -n "$sed_cmd" "$ref" > skipped-ref
76 sed -n "$sed_cmd" "$new" > skipped-new
77 nb_ref=$(wc -l <skipped-ref)
78 nb_new=$(wc -l <skipped-new)
79
80 printf "%12s: total %3d; skipped %3d -> %3d\n" \
81 $suite $total $nb_ref $nb_new
82 diff skipped-ref skipped-new | grep '^> ' || true
83 rm skipped-ref skipped-new
84}
85
86compare_builds () {
87 printf "\n*** Comparing $1 -> $2 ***\n"
88 for suite in $SUITES; do
89 compare_suite "$1" "$2" "$suite"
90 done
91}
92
93compare_builds before-default after-default
94compare_builds before-full after-full
95compare_builds reference drivers
96