Chromium Code Reviews| 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 \ |
| 14 --exclude=dart_runtime.js \ | 14 --exclude=dart_runtime.js \ |
| 15 --exclude=dart_core.js \ | 15 --exclude=dart_core.js \ |
| 16 --exclude=harmony_feature_check.js \ | 16 --exclude=harmony_feature_check.js \ |
| 17 --exclude=messages_widget.js \ | 17 --exclude=messages_widget.js \ |
| 18 --exclude=messages.css \ | 18 --exclude=messages.css \ |
| 19 expect actual" | 19 expect actual" |
| 20 | 20 |
| 21 function show_diff { | 21 function show_diff { |
| 22 echo "Fail: actual output did not match expected" | 22 echo "Fail: actual output did not match expected" |
| 23 echo | 23 echo |
| 24 diff $DIFF_ARGS |\ | 24 diff $DIFF_ARGS |\ |
| 25 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ | 25 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ |
| 26 sed -e "s/^\(-.*\)/[31m\1[0m/" | 26 sed -e "s/^\(-.*\)/[31m\1[0m/" |
| 27 echo | 27 echo |
| 28 echo "You can update these expectations with:" | 28 echo "You can update these expectations with:" |
| 29 echo "$ pushd `pwd` && cp -a actual/* expect && popd" | 29 echo "$ cp -a test/codegen/actual/* test/codegen/expect" |
|
Jennifer Messerly
2015/03/11 23:48:00
This doesn't work if you're standing in a folder b
Siggi Cherem (dart-lang)
2015/03/12 00:16:26
Ah, I see, never mind, I somehow missed that. reve
| |
| 30 fail | 30 fail |
| 31 } | 31 } |
| 32 | 32 |
| 33 # the directory of this script | 33 # the directory of this script |
| 34 TEST_DIR=$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd ) | 34 TEST_DIR=$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd ) |
| 35 | 35 |
| 36 # Some tests require being run from the package root | 36 # Some tests require being run from the package root |
| 37 cd $TEST_DIR/.. | 37 cd $TEST_DIR/.. |
| 38 | 38 |
| 39 # Check minimum SDK version | 39 # Check minimum SDK version |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 # * local files that have never been added to git, | 80 # * local files that have never been added to git, |
| 81 # * subdirectories of test/ and tool/, unless explicitly added. Those dirs | 81 # * subdirectories of test/ and tool/, unless explicitly added. Those dirs |
| 82 # contain a lot of generated or external source we should not reformat. | 82 # 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 \ | 83 (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 . \ | 84 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." \ | 85 && echo "Did not run the formatter, please commit edited files first." \ |
| 86 || (echo "Running dart formatter" ; pub run dart_style:format -w $files)) | 86 || (echo "Running dart formatter" ; pub run dart_style:format -w $files)) |
| 87 popd &> /dev/null | 87 popd &> /dev/null |
| 88 | 88 |
| 89 echo -e "[32mAll tests pass[0m" | 89 echo -e "[32mAll tests pass[0m" |
| OLD | NEW |