| 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. |
| 11 # - runtime JS files that are just copied over from the sources and are not | 11 # - runtime JS files that are just copied over from the sources and are not |
| 12 # duplicated in the expected folder. | 12 # duplicated in the expected folder. |
| 13 DIFF_ARGS="-u -r -N --exclude=\*.map \ | 13 DIFF_ARGS="-u -r -N --exclude=\*.map expect actual" |
| 14 --exclude=dart_runtime.js \ | |
| 15 --exclude=dart_core.js \ | |
| 16 --exclude=harmony_feature_check.js \ | |
| 17 --exclude=messages_widget.js \ | |
| 18 --exclude=messages.css \ | |
| 19 expect actual" | |
| 20 | 14 |
| 21 function show_diff { | 15 function show_diff { |
| 22 echo "Fail: actual output did not match expected" | 16 echo "Fail: actual output did not match expected" |
| 23 echo | 17 echo |
| 24 diff $DIFF_ARGS |\ | 18 diff $DIFF_ARGS |\ |
| 25 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ | 19 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ |
| 26 sed -e "s/^\(-.*\)/[31m\1[0m/" | 20 sed -e "s/^\(-.*\)/[31m\1[0m/" |
| 27 echo | 21 echo |
| 28 echo "You can update these expectations with:" | 22 echo "You can update these expectations with:" |
| 29 echo "$ pushd `pwd` && cp -a actual/* expect && popd" | 23 echo "$ pushd `pwd` && cp -a actual/* expect && popd" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 41 | 35 |
| 42 # Remove packages symlinks, and old codegen output | 36 # Remove packages symlinks, and old codegen output |
| 43 find test/codegen -name packages -exec rm {} \; | 37 find test/codegen -name packages -exec rm {} \; |
| 44 rm -r test/codegen/actual 2> /dev/null || true | 38 rm -r test/codegen/actual 2> /dev/null || true |
| 45 find test/dart_codegen -name packages -exec rm {} \; | 39 find test/dart_codegen -name packages -exec rm {} \; |
| 46 rm -r test/dart_codegen/actual 2> /dev/null || true | 40 rm -r test/dart_codegen/actual 2> /dev/null || true |
| 47 dart -c test/all_tests.dart || fail | 41 dart -c test/all_tests.dart || fail |
| 48 | 42 |
| 49 # validate codegen_test output | 43 # validate codegen_test output |
| 50 pushd test/codegen/ &> /dev/null | 44 pushd test/codegen/ &> /dev/null |
| 45 rm -r actual/dev_compiler/ actual/server_mode/dev_compiler/ |
| 51 diff $DIFF_ARGS > /dev/null || show_diff | 46 diff $DIFF_ARGS > /dev/null || show_diff |
| 52 popd &> /dev/null | 47 popd &> /dev/null |
| 53 | 48 |
| 54 # validate dart_codegen_test output | 49 # validate dart_codegen_test output |
| 55 pushd test/dart_codegen/ &> /dev/null | 50 pushd test/dart_codegen/ &> /dev/null |
| 56 diff $DIFF_ARGS > /dev/null || show_diff | 51 diff $DIFF_ARGS > /dev/null || show_diff |
| 57 popd &> /dev/null | 52 popd &> /dev/null |
| 58 | 53 |
| 59 # 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. |
| 60 dart -c test/checker/self_host_test.dart || fail | 55 dart -c test/checker/self_host_test.dart || fail |
| (...skipping 19 matching lines...) Expand all Loading... |
| 80 # * local files that have never been added to git, | 75 # * local files that have never been added to git, |
| 81 # * subdirectories of test/ and tool/, unless explicitly added. Those dirs | 76 # * subdirectories of test/ and tool/, unless explicitly added. Those dirs |
| 82 # 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. |
| 83 (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 \ |
| 84 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 . \ |
| 85 && echo "Did not run the formatter, please commit edited files first." \ | 80 && echo "Did not run the formatter, please commit edited files first." \ |
| 86 || (echo "Running dart formatter" ; pub run dart_style:format -w $files)) | 81 || (echo "Running dart formatter" ; pub run dart_style:format -w $files)) |
| 87 popd &> /dev/null | 82 popd &> /dev/null |
| 88 | 83 |
| 89 echo -e "[32mAll tests pass[0m" | 84 echo -e "[32mAll tests pass[0m" |
| OLD | NEW |