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 runtime JS files that are just | |
| 10 # copied over from the sources and are not duplicated in the expected folder. | |
|
Siggi Cherem (dart-lang)
2015/03/03 21:30:08
folder. =>
folder and .map files.
Or we could get
Jennifer Messerly
2015/03/03 22:08:18
Done.
| |
| 11 DIFF_ARGS="-u -r -N --exclude=\*.map expect actual" | |
| 12 | |
| 9 function show_diff { | 13 function show_diff { |
| 10 echo "Fail: actual output did not match expected" | 14 echo "Fail: actual output did not match expected" |
| 11 echo | 15 echo |
| 12 diff -u -r -N $1 $2 |\ | 16 diff $DIFF_ARGS |\ |
| 13 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ | 17 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ |
| 14 sed -e "s/^\(-.*\)/[31m\1[0m/" | 18 sed -e "s/^\(-.*\)/[31m\1[0m/" |
| 15 echo | 19 echo |
| 16 echo "You can update these expectations with:" | 20 echo "You can update these expectations with:" |
| 17 echo "$ pushd `pwd` && cp -a actual/* expect && popd" | 21 echo "$ pushd `pwd` && cp -a actual/* expect && popd" |
| 18 fail | 22 fail |
| 19 } | 23 } |
| 20 | 24 |
| 21 # the directory of this script | 25 # the directory of this script |
| 22 TEST_DIR=$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd ) | 26 TEST_DIR=$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd ) |
| 23 | 27 |
| 24 # Some tests require being run from the package root | 28 # Some tests require being run from the package root |
| 25 cd $TEST_DIR/.. | 29 cd $TEST_DIR/.. |
| 26 | 30 |
| 27 # Check minimum SDK version | 31 # Check minimum SDK version |
| 28 ./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 |
| 29 | 33 |
| 30 # Remove packages symlinks, and old codegen output | 34 # Remove packages symlinks, and old codegen output |
| 31 find test/codegen -name packages -exec rm {} \; | 35 find test/codegen -name packages -exec rm {} \; |
| 32 rm -r test/codegen/actual 2> /dev/null || true | 36 rm -r test/codegen/actual 2> /dev/null || true |
| 33 find test/dart_codegen -name packages -exec rm {} \; | 37 find test/dart_codegen -name packages -exec rm {} \; |
| 34 rm -r test/dart_codegen/actual 2> /dev/null || true | 38 rm -r test/dart_codegen/actual 2> /dev/null || true |
| 35 dart -c test/all_tests.dart || fail | 39 dart -c test/all_tests.dart || fail |
| 36 | 40 |
| 37 # validate codegen_test output | 41 # validate codegen_test output |
| 38 pushd test/codegen/ &> /dev/null | 42 pushd test/codegen/ &> /dev/null |
| 39 diff -u -r -N expect actual > /dev/null || show_diff expect actual | 43 diff $DIFF_ARGS > /dev/null || show_diff |
| 40 popd &> /dev/null | 44 popd &> /dev/null |
| 41 | 45 |
| 42 # validate dart_codegen_test output | 46 # validate dart_codegen_test output |
| 43 pushd test/dart_codegen/ &> /dev/null | 47 pushd test/dart_codegen/ &> /dev/null |
| 44 diff -u -r -N expect actual > /dev/null || show_diff expect actual | 48 diff $DIFF_ARGS > /dev/null || show_diff |
| 45 popd &> /dev/null | 49 popd &> /dev/null |
| 46 | 50 |
| 47 # run self host and analyzer after other tests, because they're ~seconds to run. | 51 # run self host and analyzer after other tests, because they're ~seconds to run. |
| 48 dart -c test/checker/self_host_test.dart || fail | 52 dart -c test/checker/self_host_test.dart || fail |
| 49 | 53 |
| 50 # Run analyzer on bin/devc.dart, as it includes most of the code we care about | 54 # Run analyzer on bin/devc.dart, as it includes most of the code we care about |
| 51 # via transitive dependencies. This seems to be the only fast way to avoid | 55 # via transitive dependencies. This seems to be the only fast way to avoid |
| 52 # repeated analysis of the same code. | 56 # repeated analysis of the same code. |
| 53 # TODO(jmesserly): ideally we could do test/all_tests.dart, but | 57 # TODO(jmesserly): ideally we could do test/all_tests.dart, but |
| 54 # dart_runtime_test.dart creates invalid generic type instantiation AA. | 58 # dart_runtime_test.dart creates invalid generic type instantiation AA. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 68 # * local files that have never been added to git, | 72 # * local files that have never been added to git, |
| 69 # * subdirectories of test/ and tool/, unless explicitly added. Those dirs | 73 # * subdirectories of test/ and tool/, unless explicitly added. Those dirs |
| 70 # contain a lot of generated or external source we should not reformat. | 74 # contain a lot of generated or external source we should not reformat. |
| 71 (files=`git ls-files 'bin/*.dart' 'lib/*.dart' test/*.dart test/checker/*.dart \ | 75 (files=`git ls-files 'bin/*.dart' 'lib/*.dart' test/*.dart test/checker/*.dart \ |
| 72 tool/*.dart | grep -v lib/src/js/`; git status -s $files | grep -q . \ | 76 tool/*.dart | grep -v lib/src/js/`; git status -s $files | grep -q . \ |
| 73 && echo "Did not run the formatter, please commit edited files first." \ | 77 && echo "Did not run the formatter, please commit edited files first." \ |
| 74 || (echo "Running dart formatter" ; pub run dart_style:format -w $files)) | 78 || (echo "Running dart formatter" ; pub run dart_style:format -w $files)) |
| 75 popd &> /dev/null | 79 popd &> /dev/null |
| 76 | 80 |
| 77 echo -e "[32mAll tests pass[0m" | 81 echo -e "[32mAll tests pass[0m" |
| OLD | NEW |