| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 echo -e "\nAnalyzing runtime for warnings or type errors" | 80 echo -e "\nAnalyzing runtime for warnings or type errors" |
| 81 $dartanalyzer --hints --fatal-warnings --fatal-type-errors lib/polymer.dart | 81 $dartanalyzer --hints --fatal-warnings --fatal-type-errors lib/polymer.dart |
| 82 | 82 |
| 83 popd > /dev/null | 83 popd > /dev/null |
| 84 fi | 84 fi |
| 85 | 85 |
| 86 function compare_all { | 86 function compare_all { |
| 87 # TODO(jmesserly): bash and dart regexp might not be 100% the same. Ideally we | 87 # TODO(jmesserly): bash and dart regexp might not be 100% the same. Ideally we |
| 88 # could do all the heavy lifting in Dart code, and keep this script as a thin | 88 # could do all the heavy lifting in Dart code, and keep this script as a thin |
| 89 # wrapper that sets `--enable-type-checks --enable-asserts` | 89 # wrapper that sets `--enable-type-checks --enable-asserts` |
| 90 for input in $DIR/../example/component/news/test/*_test.html \ | 90 for input in $DIR/../example/component/news/test/*_test.html; do |
| 91 $DIR/../../../samples/third_party/todomvc/test/*_test.html; do | |
| 92 if [[ ($TEST_PATTERN == "") || ($input =~ $TEST_PATTERN) ]]; then | 91 if [[ ($TEST_PATTERN == "") || ($input =~ $TEST_PATTERN) ]]; then |
| 93 FILENAME=`basename $input` | 92 FILENAME=`basename $input` |
| 94 DIRNAME=`dirname $input` | 93 DIRNAME=`dirname $input` |
| 95 if [[ `basename $DIRNAME` == 'input' ]]; then | 94 if [[ `basename $DIRNAME` == 'input' ]]; then |
| 96 DIRNAME=`dirname $DIRNAME` | 95 DIRNAME=`dirname $DIRNAME` |
| 97 fi | 96 fi |
| 98 echo -e -n "Checking diff for $FILENAME " | 97 echo -e -n "Checking diff for $FILENAME " |
| 99 DUMP="test/data/out/example/test/$FILENAME.txt" | 98 DUMP="test/data/out/example/test/$FILENAME.txt" |
| 100 EXPECTATION="$DIRNAME/expected/$FILENAME.txt" | 99 EXPECTATION="$DIRNAME/expected/$FILENAME.txt" |
| 101 | 100 |
| 102 compare $EXPECTATION $DUMP | 101 compare $EXPECTATION $DUMP |
| 103 fi | 102 fi |
| 104 done | 103 done |
| 105 echo -e "[31mSome tests failed[0m" | 104 echo -e "[31mSome tests failed[0m" |
| 106 fail | 105 fail |
| 107 } | 106 } |
| 108 | 107 |
| 109 if [[ ($TEST_PATTERN == "") ]]; then | 108 if [[ ($TEST_PATTERN == "") ]]; then |
| 110 echo -e "\nTesting build.dart... " | 109 echo -e "\nTesting build.dart... " |
| 111 $dart $DART_FLAGS build.dart | 110 $dart $DART_FLAGS build.dart |
| 112 # Run it the way the editor does. Hide stdout because it is in noisy machine | 111 # Run it the way the editor does. Hide stdout because it is in noisy machine |
| 113 # format. Show stderr in case something breaks. | 112 # format. Show stderr in case something breaks. |
| 114 # NOTE: not using --checked because the editor doesn't use it, and to workarou
nd | 113 # NOTE: not using --checked because the editor doesn't use it, and to workarou
nd |
| 115 # http://dartbug.com/9637 | 114 # http://dartbug.com/9637 |
| 116 $dart build.dart --machine --clean > /dev/null | 115 $dart build.dart --machine --clean > /dev/null |
| 117 $dart build.dart --machine --full > /dev/null | 116 $dart build.dart --machine --full > /dev/null |
| 118 $dart build.dart --machine --changed ../../samples/third_party/todomvc/web/ind
ex.html > /dev/null | |
| 119 fi | 117 fi |
| 120 | 118 |
| 121 echo -e "\nRunning unit tests... " | 119 echo -e "\nRunning unit tests... " |
| 122 $dart $DART_FLAGS test/run_all.dart $@ || compare_all | 120 $dart $DART_FLAGS test/run_all.dart $@ || compare_all |
| 123 | 121 |
| 124 # Run Dart analyzer to check that we're generating warning clean code. | 122 # Run Dart analyzer to check that we're generating warning clean code. |
| 125 # It's a bit slow, so only do this for TodoMVC. | 123 # It's a bit slow, so only do this for one test. |
| 126 OUT_PATTERN="$DIR/../../../third_party/samples/todomvc/test/out/test/*$TEST_PATT
ERN*_bootstrap.dart" | 124 OUT_PATTERN="$DIR/../example/component/news/test/out/test/*$TEST_PATTERN*_bootst
rap.dart" |
| 127 if [[ `ls $OUT_PATTERN 2>/dev/null` != "" ]]; then | 125 if [[ `ls $OUT_PATTERN 2>/dev/null` != "" ]]; then |
| 128 echo -e "\nAnalyzing generated code for warnings or type errors." | 126 echo -e "\nAnalyzing generated code for warnings or type errors." |
| 129 ls $OUT_PATTERN 2>/dev/null | $dartanalyzer \ | 127 ls $OUT_PATTERN 2>/dev/null | $dartanalyzer \ |
| 130 --fatal-warnings --fatal-type-errors -batch | 128 --fatal-warnings --fatal-type-errors -batch |
| 131 fi | 129 fi |
| 132 | 130 |
| 133 echo -e "[32mAll tests pass[0m" | 131 echo -e "[32mAll tests pass[0m" |
| OLD | NEW |