| 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: | |
| 10 # - *.map files so they aren't compared, as the diff is not human readable. | |
| 11 # - runtime JS files that are just copied over from the sources and are not | |
| 12 # duplicated in the expected folder. | |
| 13 DIFF_ARGS="-u -r -N --exclude=\*.map expect actual" | |
| 14 | |
| 15 function show_diff { | |
| 16 echo "Fail: actual output did not match expected" | |
| 17 echo | |
| 18 diff $DIFF_ARGS |\ | |
| 19 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ | |
| 20 sed -e "s/^\(-.*\)/[31m\1[0m/" | |
| 21 echo | |
| 22 echo "You can update these expectations with:" | |
| 23 echo "$ pushd `pwd` && cp -a actual/* expect && popd" | |
| 24 fail | |
| 25 } | |
| 26 | |
| 27 # Some tests require being run from the package root | 9 # Some tests require being run from the package root |
| 28 # switch to the root directory of dev_compiler | 10 # switch to the root directory of dev_compiler |
| 29 cd $( dirname "${BASH_SOURCE[0]}" )/.. | 11 cd $( dirname "${BASH_SOURCE[0]}" )/.. |
| 30 | 12 |
| 31 # Check minimum SDK version | 13 # Check minimum SDK version |
| 32 ./tool/sdk_version_check.dart 1.9.0-dev.4.0 || fail | 14 ./tool/sdk_version_check.dart 1.9.0-dev.4.0 || fail |
| 33 | 15 |
| 34 # Make sure we don't run tests in code coverage mode. | 16 # 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 | 17 # 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 | 18 # 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 | 19 # 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 | 20 # all_tests twice. Finally self_host_test is not currently being tracked by |
| 39 # code coverage. | 21 # code coverage. |
| 40 unset COVERALLS_TOKEN | 22 unset COVERALLS_TOKEN |
| 41 pub run test:test test/all_tests.dart || fail | 23 pub run test:test test/all_tests.dart || fail |
| 42 | 24 |
| 43 # validate codegen_test output | |
| 44 pushd test/codegen/ &> /dev/null | |
| 45 rm -r actual/dev_compiler/ actual/sunflower/dev_compiler | |
| 46 diff $DIFF_ARGS > /dev/null || show_diff | |
| 47 popd &> /dev/null | |
| 48 | |
| 49 # run self host and analyzer after other tests, because they're ~seconds to run. | 25 # run self host and analyzer after other tests, because they're ~seconds to run. |
| 50 pub run test:test test/checker/self_host_test.dart || fail | 26 pub run test:test test/checker/self_host_test.dart || fail |
| 51 | 27 |
| 52 { | 28 { |
| 53 fc=`find test -name "*.dart" |\ | 29 fc=`find test -name "*.dart" |\ |
| 54 xargs grep "/\*\S* should be \S*\*/" | wc -l` | 30 xargs grep "/\*\S* should be \S*\*/" | wc -l` |
| 55 echo "There are" $fc "tests marked as known failures." | 31 echo "There are" $fc "tests marked as known failures." |
| 56 } | 32 } |
| 57 | 33 |
| 58 echo -e "[32mAll tests pass[0m" | 34 echo -e "[32mAll tests pass[0m" |
| OLD | NEW |