forked from dart-archive/dart-tutorials-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.sh
executable file
·69 lines (60 loc) · 1.54 KB
/
runtests.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
#!/bin/bash
shopt -s nullglob
EXITSTATUS=0
PASSING=0
WARNINGS=0
FAILURES=0
#####
# Type Analysis
#ANA="dart_analyzer --fatal-type-errors --extended-exit-code --type-checks-for-inferred-types"
# use new experimental analyzer
ANA="dartanalyzer --fatal-type-errors"
echo
echo "Type Analysis, running dart_analyzer..."
pub_result=`pub install`
cmd="$ANA --package-root packages"
for dir in web/* bin/*
do
echo $dir
# Run pub if there is a pubspec in this code directory.
# if [ -a "$dir/pubspec.yaml" ]; then
# pub_result=`pushd $dir && pub install && popd`
# cmd="$ANA --package-root $dir/packages"
# else
# cmd="$ANA"
# fi
# Loop through each Dart file in this code directory.
files="$dir/*.dart"
for file in $files
do
results=`$cmd $file 2>&1`
exit_code=$?
if [ $exit_code -eq 2 ]; then
let FAILURES++
EXITSTATUS=1
echo "$results"
echo "$file: FAILURE."
elif [ $exit_code -eq 1 ]; then
let WARNINGS++
echo "$results"
echo "$file: WARNING."
elif [ $exit_code -eq 0 ]; then
let PASSING++
echo "$results"
echo "$file: Passed analysis."
else
echo "$file: Unknown exit code: $exit_code."
fi
# Remove the output directory so that subsequent test runs will still see
# the warnings and errors.
rm -rf out/
done
done
echo
echo "####################################################"
echo "PASSING = $PASSING"
echo "WARNINGS = $WARNINGS"
echo "FAILURES = $FAILURES"
echo "####################################################"
echo
exit $EXITSTATUS