forked from Argyle-Software/kyber
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_all_tests.sh
executable file
·65 lines (52 loc) · 1.39 KB
/
run_all_tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
set -e
# This script runs a matrix of every valid feature combination
# Enable avx2 target features
# Enable LLVM address sanitser checks
# export RUSTFLAGS="-Z sanitizer=address -C target-cpu=native -C target-feature=+aes,+avx2,+sse2,+sse4.1,+bmi2,+popcnt"
# export RUSTDOCFLAGS="-Z sanitizer=address"
TARGET=$(rustc -vV | sed -n 's|host: ||p')
# KAT and AVX2 bash variables
if [ -z "$KAT" ]
then
echo Not running Known Answer Tests
KAT=""
else
echo Running Known Answer Tests
KAT="KAT"
fi
if [ -z "$AVX2" ]
then
echo Not using AVX2 optimisations
OPT=("")
else
echo Using AVX2 optimisations
OPT=("" "avx2")
fi
# # Required for address sanitiser checks
# rustup default nightly
# Print Headers
announce(){
title="# $1 #"
edge=$(echo "$title" | sed 's/./#/g')
echo -e "\n\n$edge"; echo "$title"; echo -e "$edge";
}
##############################################################
start=`date +%s`
announce $TARGET
LEVELS=("kyber512" "kyber768" "kyber1024")
NINES=("" "90s")
for level in "${LEVELS[@]}"; do
for nine in "${NINES[@]}"; do
for opt in "${OPT[@]}"; do
name="$level $nine $opt"
feat=${level:+"$level"}${opt:+",$opt"}${nine:+",$nine"}${KAT:+",$KAT"}
announce "$name"
cargo test --features $feat
break;
done
done
done
end=`date +%s`
runtime=$((end-start))
announce "Test runtime: $runtime seconds"