Manuel Pégourié-Gonnard | fb2ed58 | 2022-07-21 11:04:52 +0200 | [diff] [blame^] | 1 | #!/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 ----- |
| 10 | DRIVER_COMPONENT=test_psa_crypto_config_accel_hash_use_psa |
| 11 | reference_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 | } |
| 19 | SUITES="rsa pkcs1_v15 pk pkparse pkwrite" |
| 20 | # ----- END edit this ----- |
| 21 | |
| 22 | set -eu |
| 23 | |
| 24 | cleanup() { |
| 25 | make clean |
| 26 | git checkout -- include/mbedtls/mbedtls_config.h include/psa/crypto_config.h |
| 27 | } |
| 28 | |
| 29 | record() { |
| 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 |
| 36 | HEAD=$(git branch --show-current) |
| 37 | |
| 38 | # get the numbers before this PR for default and full |
| 39 | cleanup |
| 40 | git checkout $(git merge-base HEAD development) |
| 41 | record "before-default" |
| 42 | |
| 43 | cleanup |
| 44 | scripts/config.py full |
| 45 | record "before-full" |
| 46 | |
| 47 | # get the numbers now for default and full |
| 48 | cleanup |
| 49 | git checkout $HEAD |
| 50 | record "after-default" |
| 51 | |
| 52 | cleanup |
| 53 | scripts/config.py full |
| 54 | record "after-full" |
| 55 | |
| 56 | # get the numbers now for driver-only and reference |
| 57 | cleanup |
| 58 | reference_config |
| 59 | record "reference" |
| 60 | |
| 61 | cleanup |
| 62 | export MBEDTLS_TEST_OUTCOME_FILE="$PWD/outcome-drivers.csv" |
| 63 | tests/scripts/all.sh -k test_psa_crypto_config_accel_hash_use_psa |
| 64 | |
| 65 | # analysis |
| 66 | |
| 67 | compare_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 | |
| 86 | compare_builds () { |
| 87 | printf "\n*** Comparing $1 -> $2 ***\n" |
| 88 | for suite in $SUITES; do |
| 89 | compare_suite "$1" "$2" "$suite" |
| 90 | done |
| 91 | } |
| 92 | |
| 93 | compare_builds before-default after-default |
| 94 | compare_builds before-full after-full |
| 95 | compare_builds reference drivers |
| 96 | |