@@ -43,61 +43,71 @@ function analyze_and_test() {
43
43
pub $PUB_ARGS
44
44
travis_fold end analyzeAndTest.get
45
45
46
+ # TODO: rename DIR since it now more generally contains analysis targets, not only directories
46
47
DIR=()
47
- for d in bin lib test ; do
48
- if [[ -d $d ]]; then DIR+=($d ); fi
48
+ for d in analysis_options.yaml bin lib test ; do
49
+ if [[ -e $d ]]; then DIR+=($d ); fi
49
50
done
50
51
51
52
if [[ ${# DIR} -le 0 ]]; then
52
53
echo
53
54
echo " NOTHING TO ANALYZE in this project."
54
- else
55
- echo
56
- EXPECTED_FILE=$PROJECT_ROOT /analyzer-$DART_MAJOR_VERS -results.txt
57
- if [[ ! -e $EXPECTED_FILE ]]; then
58
- EXPECTED_FILE=$PROJECT_ROOT /analyzer-results.txt
59
- fi
60
- travis_fold start analyzeAndTest.analyze
61
- if [[ -e $EXPECTED_FILE && -z $QUICK ]]; then
62
- # Run the analyzer a first time to ensure that there are no errors.
63
- #
64
- # Note: catch non-zero exit codes to avoid aborting this script when the
65
- # analyzer reports "foo.dart is a part and cannot be analyzed":
66
- $ANALYZE ${DIR[*]} > $LOG_FILE || {
67
- echo " WARNING: Ignoring Analyzer exit code $? "
68
- }
69
- if grep -qvE ' ^Analyzing|^No issues found' $LOG_FILE ; then
70
- cat $LOG_FILE
71
- echo " No analysis errors or warnings should be present in original source files."
72
- echo " Ensure that these issues are disabled using appropriate markers like: "
73
- echo " // ignore_for_file: $DART_MAJOR_VERS , some_analyzer_error_or_warning_id"
74
- EXIT_STATUS=1
75
- return 1;
76
- fi
77
- fi
78
- disableInFileAnalyzerFlags ${DIR[*]}
55
+ return
56
+ fi
57
+
58
+ echo
59
+ EXPECTED_FILE=$PROJECT_ROOT /analyzer-$DART_MAJOR_VERS -results.txt
60
+ if [[ ! -e $EXPECTED_FILE ]]; then
61
+ EXPECTED_FILE=$PROJECT_ROOT /analyzer-results.txt
62
+ fi
63
+ travis_fold start analyzeAndTest.analyze
64
+ if [[ -e $EXPECTED_FILE && -z $QUICK ]]; then
65
+ # Run the analyzer a first time to ensure that there are no errors.
66
+ #
67
+ # Note: catch non-zero exit codes to avoid aborting this script when the
68
+ # analyzer reports "foo.dart is a part and cannot be analyzed":
69
+ echo " $ $ANALYZE ${DIR[*]} "
79
70
$ANALYZE ${DIR[*]} > $LOG_FILE || {
80
71
echo " WARNING: Ignoring Analyzer exit code $? "
81
72
}
82
- if [[ -e $EXPECTED_FILE ]]; then
83
- if grep -ve ' ^#' $EXPECTED_FILE | diff - $LOG_FILE > /dev/null; then
84
- echo " Analyzer output is as expected ($EXPECTED_FILE )."
85
- else
86
- cat $LOG_FILE
87
- echo " Unexpected analyzer output ($EXPECTED_FILE ); here's the diff:"
88
- (set -x; diff $LOG_FILE $EXPECTED_FILE ) || true
89
- EXIT_STATUS=1
90
- if [[ -n $SAVE_LOGS ]]; then cp $LOG_FILE $EXPECTED_FILE ; fi
91
- fi
92
- elif grep -qvE ' ^Analyzing|^No issues found' $LOG_FILE ; then
73
+ if grep -qvE ' ^Analyzing|^No issues found' $LOG_FILE ; then
93
74
cat $LOG_FILE
75
+ echo " No analysis errors or warnings should be present in original source files."
76
+ echo " Ensure that these issues are disabled using appropriate markers like: "
77
+ echo " // ignore_for_file: $DART_MAJOR_VERS , some_analyzer_error_or_warning_id"
94
78
EXIT_STATUS=1
95
- if [[ -n $SAVE_LOGS ]]; then cp $LOG_FILE $EXPECTED_FILE ; fi
79
+ return 1;
80
+ fi
81
+ fi
82
+ disableInFileAnalyzerFlags ${DIR[*]}
83
+ echo " $ $ANALYZE ${DIR[*]} "
84
+ $ANALYZE ${DIR[*]} > $LOG_FILE || {
85
+ echo " WARNING: Ignoring analyzer exit code $? "
86
+ }
87
+ if [[ -e $EXPECTED_FILE ]]; then
88
+ if grep -ve ' ^#' $EXPECTED_FILE | diff - $LOG_FILE > /dev/null; then
89
+ echo " Analyzer output is as expected ($EXPECTED_FILE )."
96
90
else
97
91
cat $LOG_FILE
92
+ echo " Unexpected analyzer output ($EXPECTED_FILE ); here's the diff:"
93
+ (set -x; diff $LOG_FILE $EXPECTED_FILE ) || true
94
+ EXIT_STATUS=1
95
+ if [[ -n $SAVE_LOGS ]]; then cp $LOG_FILE $EXPECTED_FILE ; fi
98
96
fi
99
- reEnableInFileAnalyzerFlags ${DIR[*]}
100
- travis_fold end analyzeAndTest.analyze
97
+ elif grep -qvE ' ^Analyzing|^No issues found' $LOG_FILE ; then
98
+ cat $LOG_FILE
99
+ EXIT_STATUS=1
100
+ if [[ -n $SAVE_LOGS ]]; then cp $LOG_FILE $EXPECTED_FILE ; fi
101
+ else
102
+ cat $LOG_FILE
103
+ fi
104
+ reEnableInFileAnalyzerFlags ${DIR[*]}
105
+ travis_fold end analyzeAndTest.analyze
106
+
107
+ if [[ ! -d test ]]; then
108
+ echo
109
+ echo " NOTHING TO TEST in this project."
110
+ return
101
111
fi
102
112
103
113
echo
@@ -107,7 +117,7 @@ function analyze_and_test() {
107
117
TEST=" pub run test"
108
118
TEST_ARGS=" --exclude-tags=browser"
109
119
110
- echo $ TEST $TEST_ARGS
120
+ echo " $ $ TEST $TEST_ARGS "
111
121
$TEST $TEST_ARGS | tee $LOG_FILE | $FILTER1 | $FILTER2 " $FILTER_ARG "
112
122
LOG=$( grep -E ' All tests passed!|^No tests ran' $LOG_FILE )
113
123
if [[ -z " $LOG " ]]; then EXIT_STATUS=1; fi
@@ -125,6 +135,7 @@ function analyze_and_test() {
125
135
if [[ -n $TRAVIS ]]; then PLATFORM=travischrome; fi
126
136
# Name the sole browser test file, otherwise all other files get compiled too:
127
137
TEST=" pub run test"
138
+ echo " $ $TEST --tags browser --platform $PLATFORM $TEST_FILES "
128
139
$TEST --tags browser --platform $PLATFORM $TEST_FILES \
129
140
| tee $LOG_FILE | $FILTER1 | $FILTER2 " $FILTER_ARG "
130
141
LOG=$( grep ' All tests passed!' $LOG_FILE )
0 commit comments