| 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 17 matching lines...) Expand all Loading... |
| 28 echo $1 | 28 echo $1 |
| 29 return | 29 return |
| 30 fi | 30 fi |
| 31 shift | 31 shift |
| 32 done | 32 done |
| 33 } | 33 } |
| 34 | 34 |
| 35 TEST_PATTERN=$(first_non_option $@) | 35 TEST_PATTERN=$(first_non_option $@) |
| 36 | 36 |
| 37 SDK_DIR=$(cd ../../out/ReleaseIA32/dart-sdk/; pwd) | 37 SDK_DIR=$(cd ../../out/ReleaseIA32/dart-sdk/; pwd) |
| 38 dart=$SDK_DIR/bin/dart | 38 package_root=$SDK_DIR/../packages |
| 39 dartanalyzer=$SDK_DIR/bin/dartanalyzer | 39 dart="$SDK_DIR/bin/dart --package-root=$package_root" |
| 40 dartanalyzer="$SDK_DIR/bin/dartanalyzer --package-root=$package_root" |
| 40 | 41 |
| 41 function fail { | 42 function fail { |
| 42 return 1 | 43 return 1 |
| 43 } | 44 } |
| 44 | 45 |
| 45 function show_diff { | 46 function show_diff { |
| 46 diff -u -N $1 $2 | \ | 47 diff -u -N $1 $2 | \ |
| 47 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ | 48 sed -e "s/^\(+.*\)/[32m\1[0m/" |\ |
| 48 sed -e "s/^\(-.*\)/[31m\1[0m/" | 49 sed -e "s/^\(-.*\)/[31m\1[0m/" |
| 49 return 1 | 50 return 1 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 fi | 119 fi |
| 119 | 120 |
| 120 echo -e "\nRunning unit tests... " | 121 echo -e "\nRunning unit tests... " |
| 121 $dart $DART_FLAGS test/run_all.dart $@ || compare_all | 122 $dart $DART_FLAGS test/run_all.dart $@ || compare_all |
| 122 | 123 |
| 123 # Run Dart analyzer to check that we're generating warning clean code. | 124 # Run Dart analyzer to check that we're generating warning clean code. |
| 124 # It's a bit slow, so only do this for TodoMVC. | 125 # It's a bit slow, so only do this for TodoMVC. |
| 125 OUT_PATTERN="$DIR/../../../third_party/samples/todomvc/test/out/test/*$TEST_PATT
ERN*_bootstrap.dart" | 126 OUT_PATTERN="$DIR/../../../third_party/samples/todomvc/test/out/test/*$TEST_PATT
ERN*_bootstrap.dart" |
| 126 if [[ `ls $OUT_PATTERN 2>/dev/null` != "" ]]; then | 127 if [[ `ls $OUT_PATTERN 2>/dev/null` != "" ]]; then |
| 127 echo -e "\nAnalyzing generated code for warnings or type errors." | 128 echo -e "\nAnalyzing generated code for warnings or type errors." |
| 128 ls $OUT_PATTERN 2>/dev/null | $dartanalyzer --package-root=packages \ | 129 ls $OUT_PATTERN 2>/dev/null | $dartanalyzer \ |
| 129 --fatal-warnings --fatal-type-errors -batch | 130 --fatal-warnings --fatal-type-errors -batch |
| 130 fi | 131 fi |
| 131 | 132 |
| 132 echo -e "[32mAll tests pass[0m" | 133 echo -e "[32mAll tests pass[0m" |
| OLD | NEW |