Skip to content

Commit

Permalink
refactor ci-tests.sh for clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
mcginty committed Feb 10, 2024
1 parent 6d8c2c5 commit 90abe6c
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions ci-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 90abe6c

Please sign in to comment.