OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 set -e # bail on error | 2 set -e # bail on error |
3 | 3 |
4 function fail { | 4 function fail { |
5 echo -e "[31mSome tests failed[0m" | 5 echo -e "[31mSome tests failed[0m" |
6 return 1 | 6 return 1 |
7 } | 7 } |
8 | 8 |
9 # Arguments passed to the diff tool. We exclude: | 9 # Arguments passed to the diff tool. We exclude: |
10 # - *.map files so they aren't compared, as the diff is not human readable. | 10 # - *.map files so they aren't compared, as the diff is not human readable. |
(...skipping 20 matching lines...) Expand all Loading... |
31 # Check minimum SDK version | 31 # Check minimum SDK version |
32 ./tool/sdk_version_check.dart 1.9.0-dev.4.0 || fail | 32 ./tool/sdk_version_check.dart 1.9.0-dev.4.0 || fail |
33 | 33 |
34 # Make sure we don't run tests in code coverage mode. | 34 # Make sure we don't run tests in code coverage mode. |
35 # this will cause us to generate files that are not part of the baseline | 35 # this will cause us to generate files that are not part of the baseline |
36 # TODO(jmesserly): we should move diff into Dart code, so we don't need to | 36 # TODO(jmesserly): we should move diff into Dart code, so we don't need to |
37 # worry about this. Also if we're in code coverage mode, we should avoid running | 37 # worry about this. Also if we're in code coverage mode, we should avoid running |
38 # all_tests twice. Finally self_host_test is not currently being tracked by | 38 # all_tests twice. Finally self_host_test is not currently being tracked by |
39 # code coverage. | 39 # code coverage. |
40 unset COVERALLS_TOKEN | 40 unset COVERALLS_TOKEN |
41 dart -c test/all_tests.dart || fail | 41 pub run test:test test/all_tests.dart || fail |
42 | 42 |
43 # validate codegen_test output | 43 # validate codegen_test output |
44 pushd test/codegen/ &> /dev/null | 44 pushd test/codegen/ &> /dev/null |
45 rm -r actual/dev_compiler/ actual/sunflower/dev_compiler | 45 rm -r actual/dev_compiler/ actual/sunflower/dev_compiler |
46 diff $DIFF_ARGS > /dev/null || show_diff | 46 diff $DIFF_ARGS > /dev/null || show_diff |
47 popd &> /dev/null | 47 popd &> /dev/null |
48 | 48 |
49 # validate dart_codegen_test output | 49 # validate dart_codegen_test output |
50 pushd test/dart_codegen/ &> /dev/null | 50 pushd test/dart_codegen/ &> /dev/null |
51 diff $DIFF_ARGS > /dev/null || show_diff | 51 diff $DIFF_ARGS > /dev/null || show_diff |
52 popd &> /dev/null | 52 popd &> /dev/null |
53 | 53 |
54 # run self host and analyzer after other tests, because they're ~seconds to run. | 54 # run self host and analyzer after other tests, because they're ~seconds to run. |
55 dart -c test/checker/self_host_test.dart || fail | 55 pub run test:test test/checker/self_host_test.dart || fail |
56 | 56 |
57 # Run analyzer on bin/devc.dart, as it includes most of the code we care about | 57 # Run analyzer on bin/devc.dart, as it includes most of the code we care about |
58 # via transitive dependencies. This seems to be the only fast way to avoid | 58 # via transitive dependencies. This seems to be the only fast way to avoid |
59 # repeated analysis of the same code. | 59 # repeated analysis of the same code. |
60 # TODO(jmesserly): ideally we could do test/all_tests.dart, but | 60 # TODO(jmesserly): ideally we could do test/all_tests.dart, but |
61 # dart_runtime_test.dart creates invalid generic type instantiation AA. | 61 # dart_runtime_test.dart creates invalid generic type instantiation AA. |
62 echo "Running dartanalyzer to check for errors/warnings/hints..." | 62 echo "Running dartanalyzer to check for errors/warnings/hints..." |
63 dartanalyzer --fatal-warnings --package-warnings bin/devc.dart | (! grep $PWD) \ | 63 dartanalyzer --fatal-warnings --package-warnings bin/devc.dart | (! grep $PWD) \ |
64 || fail | 64 || fail |
65 | 65 |
66 { | 66 { |
67 fc=`find test -name "*.dart" |\ | 67 fc=`find test -name "*.dart" |\ |
68 xargs grep "/\*\S* should be \S*\*/" | wc -l` | 68 xargs grep "/\*\S* should be \S*\*/" | wc -l` |
69 echo "There are" $fc "tests marked as known failures." | 69 echo "There are" $fc "tests marked as known failures." |
70 } | 70 } |
71 | 71 |
72 # Run formatter in rewrite mode on all files that are part of the project. | 72 # Run formatter in rewrite mode on all files that are part of the project. |
73 # This checks that all files are commited first to git, so no state is lost. | 73 # This checks that all files are commited first to git, so no state is lost. |
74 # The formatter ignores: | 74 # The formatter ignores: |
75 # * local files that have never been added to git, | 75 # * local files that have never been added to git, |
76 # * subdirectories of test/ and tool/, unless explicitly added. Those dirs | 76 # * subdirectories of test/ and tool/, unless explicitly added. Those dirs |
77 # contain a lot of generated or external source we should not reformat. | 77 # contain a lot of generated or external source we should not reformat. |
78 (files=`git ls-files 'bin/*.dart' 'lib/*.dart' test/*.dart test/checker/*.dart \ | 78 (files=`git ls-files 'bin/*.dart' 'lib/*.dart' test/*.dart test/checker/*.dart \ |
79 tool/*.dart | grep -v lib/src/js/`; git status -s $files | grep -q . \ | 79 tool/*.dart | grep -v lib/src/js/`; git status -s $files | grep -q . \ |
80 && echo "Did not run the formatter, please commit edited files first." \ | 80 && echo "Did not run the formatter, please commit edited files first." \ |
81 || (echo "Running dart formatter" ; pub run dart_style:format -w $files)) | 81 || (echo "Running dart formatter" ; pub run dart_style:format -w $files)) |
82 | 82 |
83 echo -e "[32mAll tests pass[0m" | 83 echo -e "[32mAll tests pass[0m" |
OLD | NEW |