forked from dart-lang/site-www
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.sh
executable file
·64 lines (56 loc) · 1.46 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
#!/bin/bash
shopt -s nullglob
EXITSTATUS=0
PASSING=0
WARNINGS=0
FAILURES=0
#####
# Type Analysis
ANA="dartanalyzer"
echo
echo "Type Analysis, running dartanalyzer..."
for dir in src/tests/site/code/ src/tests/site/articles/*/*/bin/ src/tests/site/articles/*/ src/site/tools/*/code/ src/site/articles/*/code/ src/site/polymer/code/
do
# Run pub if there is a pubspec in this code directory.
if [ -a "$dir/pubspec.yaml" ]; then
pub_result=`pushd $dir && pub get && 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
echo ""
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