-
Notifications
You must be signed in to change notification settings - Fork 12
/
run-one-test.sh
executable file
·75 lines (70 loc) · 2.19 KB
/
run-one-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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
ADMIT_VCS=false
if [[ "$1" = "--admit-vcs" ]]; then
ADMIT_VCS=true
shift # Remove the flag from the arguments
fi
STAINLESS="$1"
function run_tests {
project=$1
# One shift for stainless executable, the other for the project folder
shift
shift
conf="$project/stainless.conf"
if [ ! -f $conf ]; then
conf=stainless.conf.nightly
fi
echo ""
echo `date`
echo "------------------------------------------------------------------------------------------"
# Check if there is a verify.sh file in the project folder
# If yes, then echo a message saying we run it and its content, then run it, other run the command X
status=-1
if [ -f "$project/verify.sh" ]; then
echo "Running verify.sh script in bolts project: $project..."
cd "$project"
echo "$ cat ./verify.sh"
cat "./verify.sh"
echo ""
if [ "$ADMIT_VCS" = true ]; then
bash "./verify.sh" "--compact" "--admit-vcs=true"
else
bash "./verify.sh" "--compact"
fi
status=$?
cd -
else
echo "Running '$STAINLESS --config-file=$conf $@' on bolts project: $project..."
echo "$ find $project -name '*.scala' -exec $STAINLESS --config-file=$conf $@ {} +"
if [ "$ADMIT_VCS" = true ]; then
find "$project" -name '*.scala' -exec $STAINLESS "--config-file=$conf" "--compact" "--admit-vcs=true" "$@" {} +
else
find "$project" -name '*.scala' -exec $STAINLESS "--config-file=$conf" "$@" {} +
fi
status=$?
fi
if [ $ADMIT_VCS = true ]; then
if [ $status -eq 0 ] || [ $status -eq 1 ]; then
echo "Stainless accepted project: $project."
exit 0
else
echo "Stainless rejected project: $project."
exit 1
fi
echo "------------------------------------------------------------------------------------------"
echo ""
return $status
else
if [ $status -ne 0 ]
then
echo "'$STAINLESS $@' failed on bolts project: $project."
echo "------------------------------------------------------------------------------------------"
echo ""
exit 1
fi
echo "------------------------------------------------------------------------------------------"
echo ""
exit 0
fi
}
run_tests "${@:2}"