| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 # Usage: call directly in the commandline as test/run.sh ensuring that you have | 6 # Usage: call directly in the commandline as test/run.sh ensuring that you have |
| 7 # both 'dart' and 'content_shell' in your path. Filter tests by passing a | 7 # both 'dart' and 'content_shell' in your path. Filter tests by passing a |
| 8 # pattern as an argument to this script. | 8 # pattern as an argument to this script. |
| 9 | 9 |
| 10 # TODO(sigmund): replace with a real test runner | 10 # TODO(sigmund): replace with a real test runner |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 echo -e "\nAnalyzing runtime for warnings or type errors" | 61 echo -e "\nAnalyzing runtime for warnings or type errors" |
| 62 dartanalyzer --hints --fatal-warnings --fatal-type-errors lib/polymer.dart | 62 dartanalyzer --hints --fatal-warnings --fatal-type-errors lib/polymer.dart |
| 63 | 63 |
| 64 popd > /dev/null | 64 popd > /dev/null |
| 65 fi | 65 fi |
| 66 | 66 |
| 67 function compare_all { | 67 function compare_all { |
| 68 # TODO(jmesserly): bash and dart regexp might not be 100% the same. Ideally we | 68 # TODO(jmesserly): bash and dart regexp might not be 100% the same. Ideally we |
| 69 # could do all the heavy lifting in Dart code, and keep this script as a thin | 69 # could do all the heavy lifting in Dart code, and keep this script as a thin |
| 70 # wrapper that sets `--enable-type-checks --enable-asserts` | 70 # wrapper that sets `--enable-type-checks --enable-asserts` |
| 71 for input in $DIR/../example/component/news/test/*_test.html \ | 71 for input in $DIR/../example/component/news/test/*_test.html; do |
| 72 $DIR/../../../samples/third_party/todomvc/test/*_test.html; do | |
| 73 if [[ ($TEST_PATTERN == "") || ($input =~ $TEST_PATTERN) ]]; then | 72 if [[ ($TEST_PATTERN == "") || ($input =~ $TEST_PATTERN) ]]; then |
| 74 FILENAME=`basename $input` | 73 FILENAME=`basename $input` |
| 75 DIRNAME=`dirname $input` | 74 DIRNAME=`dirname $input` |
| 76 if [[ `basename $DIRNAME` == 'input' ]]; then | 75 if [[ `basename $DIRNAME` == 'input' ]]; then |
| 77 DIRNAME=`dirname $DIRNAME` | 76 DIRNAME=`dirname $DIRNAME` |
| 78 fi | 77 fi |
| 79 echo -e -n "Checking diff for $FILENAME " | 78 echo -e -n "Checking diff for $FILENAME " |
| 80 DUMP="$DIRNAME/out/$FILENAME.txt" | 79 DUMP="$DIRNAME/out/$FILENAME.txt" |
| 81 EXPECTATION="$DIRNAME/expected/$FILENAME.txt" | 80 EXPECTATION="$DIRNAME/expected/$FILENAME.txt" |
| 82 | 81 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 106 if [[ ($TEST_PATTERN == "") ]]; then | 105 if [[ ($TEST_PATTERN == "") ]]; then |
| 107 pushd $DIR/.. > /dev/null | 106 pushd $DIR/.. > /dev/null |
| 108 echo -e "\nTesting build.dart... " | 107 echo -e "\nTesting build.dart... " |
| 109 dart $DART_FLAGS build.dart | 108 dart $DART_FLAGS build.dart |
| 110 # Run it the way the editor does. Hide stdout because it is in noisy machine | 109 # Run it the way the editor does. Hide stdout because it is in noisy machine |
| 111 # format. Show stderr in case something breaks. | 110 # format. Show stderr in case something breaks. |
| 112 # NOTE: not using --checked because the editor doesn't use it, and to workarou
nd | 111 # NOTE: not using --checked because the editor doesn't use it, and to workarou
nd |
| 113 # http://dartbug.com/9637 | 112 # http://dartbug.com/9637 |
| 114 dart build.dart --machine --clean > /dev/null | 113 dart build.dart --machine --clean > /dev/null |
| 115 dart build.dart --machine --full > /dev/null | 114 dart build.dart --machine --full > /dev/null |
| 116 dart build.dart --machine --changed ../../samples/third_party/todomvc/web/inde
x.html > /dev/null | |
| 117 popd > /dev/null | 115 popd > /dev/null |
| 118 fi | 116 fi |
| 119 | 117 |
| 120 pushd $DIR > /dev/null | 118 pushd $DIR > /dev/null |
| 121 echo -e "\nRunning unit tests... " | 119 echo -e "\nRunning unit tests... " |
| 122 dart $DART_FLAGS run_all.dart $@ || compare_all | 120 dart $DART_FLAGS run_all.dart $@ || compare_all |
| 123 popd > /dev/null | 121 popd > /dev/null |
| 124 | 122 |
| 125 # Run Dart analyzer to check that we're generating warning clean code. | 123 # Run Dart analyzer to check that we're generating warning clean code. |
| 126 # It's a bit slow, so only do this for TodoMVC and html5_utils tests. | 124 # It's a bit slow, so only do this for TodoMVC and html5_utils tests. |
| 127 OUT_PATTERN="$DIR/../../../third_party/samples/todomvc/test/out/test/*$TEST_PATT
ERN*_bootstrap.dart" | 125 OUT_PATTERN="$DIR/../example/component/news/test/out/test/*$TEST_PATTERN*_bootst
rap.dart" |
| 128 if [[ `ls $OUT_PATTERN 2>/dev/null` != "" ]]; then | 126 if [[ `ls $OUT_PATTERN 2>/dev/null` != "" ]]; then |
| 129 echo -e "\nAnalyzing generated code for warnings or type errors." | 127 echo -e "\nAnalyzing generated code for warnings or type errors." |
| 130 ls $OUT_PATTERN 2>/dev/null | dartanalyzer --package-root=packages \ | 128 ls $OUT_PATTERN 2>/dev/null | dartanalyzer --package-root=packages \ |
| 131 --fatal-warnings --fatal-type-errors -batch | 129 --fatal-warnings --fatal-type-errors -batch |
| 132 fi | 130 fi |
| 133 | 131 |
| 134 echo -e "[32mAll tests pass[0m" | 132 echo -e "[32mAll tests pass[0m" |
| OLD | NEW |