diff --git a/ci-tests.sh b/ci-tests.sh index 110829a..0cf1ca0 100755 --- a/ci-tests.sh +++ b/ci-tests.sh @@ -3,17 +3,32 @@ set -e TARGET="$([ -n "$1" ] && echo "--target $1" || echo "")" COMMON_FEATURES="xchachapoly vector-tests" +COMMON_ARGS="--color=always" -set -x -cargo check --benches -cargo test $TARGET --no-default-features -cargo test $TARGET --features "$COMMON_FEATURES" -cargo test $TARGET --features "ring-resolver $COMMON_FEATURES" -cargo test $TARGET --features "ring-accelerated $COMMON_FEATURES" +FEATURE_SETS=( + "" # common features only + "ring-resolver" + "ring-accelerated" + "libsodium-resolver" + "libsodium-accelerated" +) if ! rustc -vV | grep 'host: .*windows' &> /dev/null; then - cargo test $TARGET --features "hfs pqclean_kyber1024 $COMMON_FEATURES" - cargo test $TARGET --features "ring-resolver hfs pqclean_kyber1024 $COMMON_FEATURES" + FEATURE_SETS+=("hfs pqclean_kyber1024") + FEATURE_SETS+=("ring-resolver hfs pqclean_kyber1024") fi -cargo test $TARGET --features "libsodium-resolver $COMMON_FEATURES" -cargo test $TARGET --features "libsodium-accelerated $COMMON_FEATURES" +cmd() { + echo -e "\033[34m=>\033[m "$@"" + output="$("$@" 2>&1)" || (echo "$output" && exit 1) +} + +cmd cargo check --benches + +cmd cargo test $COMMON_ARGS $TARGET --no-default-features +cmd cargo clippy $COMMON_ARGS --no-default-features + +for feature_set in ${FEATURE_SETS[@]}; do + features="$COMMON_FEATURES $feature_set" + cmd cargo test $COMMON_ARGS $TARGET --features "$features" + cmd cargo clippy $COMMON_ARGS --features "$features" -- -D warnings +done