-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlint_and_test.sh
executable file
·49 lines (38 loc) · 1.1 KB
/
lint_and_test.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
set -e
NUM_RUNS=1
echo "Number of test runs is set to $NUM_RUNS"
# needed if cargo was installed but the terminal has not been reinitialized yet
if [ -d "$HOME/.cargo/bin" ] && ! echo ":$PATH:" | grep ":$HOME/.cargo/bin:"; then
echo "./cargo/bin is not in the path, adding it for you"
export PATH="$HOME/.cargo/bin:$PATH"
fi
echo "Running cargo check..."
cargo check --all-targets --all-features
echo "Formatting..."
cargo fmt --all
# Configure clippy lints
CLIPPY=
allow() {
CLIPPY="$CLIPPY --allow=$1"
}
deny() {
CLIPPY="$CLIPPY --deny=$1"
}
allow "clippy::too-many-arguments"
allow "clippy::significant-drop-in-scrutinee"
deny "warnings"
deny "bare_trait_objects"
deny "clippy::map_unwrap_or"
deny "ellipsis_inclusive_range_patterns"
deny "unconditional_recursion"
echo "Clippy checks: $CLIPPY"
cargo clippy --all-targets --tests -Z=unstable-options -- --deny=warnings $CLIPPY
# Run all the tests
counter=0
while [ "$counter" -lt "$NUM_RUNS" ]
do
echo "---------------- Running tests ----------------"
cargo test --all-features -- --test-threads=1
((counter += 1))
printf "\n\n"
done