| 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 expect actual" | 13 DIFF_ARGS="-u -r -N --exclude=\*.map expect actual" |
| 14 | 14 |
| 15 function show_diff { | 15 function show_diff { |
| 16 echo "Fail: actual output did not match expected" | 16 echo "Fail: actual output did not match expected" |
| 17 echo | 17 echo |
| 18 diff $DIFF_ARGS |\ | 18 diff $DIFF_ARGS |\ |
| 19 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ | 19 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ |
| 20 sed -e "s/^\(-.*\)/[31m\1[0m/" | 20 sed -e "s/^\(-.*\)/[31m\1[0m/" |
| 21 echo | 21 echo |
| 22 echo "You can update these expectations with:" | 22 echo "You can update these expectations with:" |
| 23 echo "$ pushd `pwd` && cp -a actual/* expect && popd" | 23 echo "$ pushd `pwd` && cp -a actual/* expect && popd" |
| 24 fail | 24 fail |
| 25 } | 25 } |
| 26 | 26 |
| 27 # the directory of this script | |
| 28 TEST_DIR=$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd ) | |
| 29 | |
| 30 # Some tests require being run from the package root | 27 # Some tests require being run from the package root |
| 31 cd $TEST_DIR/.. | 28 # switch to the root directory of dev_compiler |
| 29 cd $( dirname "${BASH_SOURCE[0]}" )/.. |
| 32 | 30 |
| 33 # Check minimum SDK version | 31 # Check minimum SDK version |
| 34 ./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 |
| 35 | 33 |
| 36 ./tool/build_sdk.sh | 34 # Make sure we don't run tests in code coverage mode. |
| 37 | 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 |
| 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 |
| 39 # code coverage. |
| 40 unset COVERALLS_TOKEN |
| 38 dart -c test/all_tests.dart || fail | 41 dart -c test/all_tests.dart || fail |
| 39 | 42 |
| 40 # validate codegen_test output | 43 # validate codegen_test output |
| 41 pushd test/codegen/ &> /dev/null | 44 pushd test/codegen/ &> /dev/null |
| 42 rm -r actual/dev_compiler/ actual/server_mode/dev_compiler/ \ | 45 rm -r actual/dev_compiler/ actual/server_mode/dev_compiler/ \ |
| 43 actual/sunflower/dev_compiler | 46 actual/sunflower/dev_compiler |
| 44 diff $DIFF_ARGS > /dev/null || show_diff | 47 diff $DIFF_ARGS > /dev/null || show_diff |
| 45 popd &> /dev/null | 48 popd &> /dev/null |
| 46 | 49 |
| 47 # validate dart_codegen_test output | 50 # validate dart_codegen_test output |
| (...skipping 22 matching lines...) Expand all Loading... |
| 70 # Run formatter in rewrite mode on all files that are part of the project. | 73 # Run formatter in rewrite mode on all files that are part of the project. |
| 71 # This checks that all files are commited first to git, so no state is lost. | 74 # This checks that all files are commited first to git, so no state is lost. |
| 72 # The formatter ignores: | 75 # The formatter ignores: |
| 73 # * local files that have never been added to git, | 76 # * local files that have never been added to git, |
| 74 # * subdirectories of test/ and tool/, unless explicitly added. Those dirs | 77 # * subdirectories of test/ and tool/, unless explicitly added. Those dirs |
| 75 # contain a lot of generated or external source we should not reformat. | 78 # contain a lot of generated or external source we should not reformat. |
| 76 (files=`git ls-files 'bin/*.dart' 'lib/*.dart' test/*.dart test/checker/*.dart \ | 79 (files=`git ls-files 'bin/*.dart' 'lib/*.dart' test/*.dart test/checker/*.dart \ |
| 77 tool/*.dart | grep -v lib/src/js/`; git status -s $files | grep -q . \ | 80 tool/*.dart | grep -v lib/src/js/`; git status -s $files | grep -q . \ |
| 78 && echo "Did not run the formatter, please commit edited files first." \ | 81 && echo "Did not run the formatter, please commit edited files first." \ |
| 79 || (echo "Running dart formatter" ; pub run dart_style:format -w $files)) | 82 || (echo "Running dart formatter" ; pub run dart_style:format -w $files)) |
| 80 popd &> /dev/null | |
| 81 | 83 |
| 82 echo -e "[32mAll tests pass[0m" | 84 echo -e "[32mAll tests pass[0m" |
| OLD | NEW |