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 'DumpRenderTree' in your path. Filter tests by passing a | 7 # both 'dart' and 'DumpRenderTree' 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 |
11 | 11 |
12 # bail on error | 12 # bail on error |
13 set -e | 13 set -e |
14 | 14 |
15 # print commands executed by this script | 15 # print commands executed by this script |
16 # set -x | 16 # set -x |
17 | 17 |
18 DIR=$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd ) | 18 DIR=$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd ) |
19 DART_FLAGS="--checked" | 19 DART_FLAGS="--checked" |
20 TEST_PATTERN=$1 | 20 TEST_PATTERN=$1 |
21 | 21 |
22 function show_diff { | 22 function show_diff { |
23 echo -en "[33mExpected[0m" | 23 diff -u $1 $2 | \ |
24 echo -n " " | 24 sed -e "s/^\(+.*\)/\x1b[32m\1\x1b[0m/" |\ |
25 echo -e "[32mOutput[0m" | 25 sed -e "s/^\(-.*\)/\x1b[31m\1\x1b[0m/" |
26 diff -t -y $1 $2 | \ | |
27 sed -e "s/\(^.\{63\}\)\(\s[<]\(\s\|$\)\)\(.*\)/[31m\1[33m\2[32m\4[0m/" |
\ | |
28 sed -e "s/\(^.\{63\}\)\(\s[|]\(\s\|$\)\)\(.*\)/[33m\1[33m\2[33m\4[0m/" |
\ | |
29 sed -e "s/\(^.\{63\}\)\(\s[>]\(\s\|$\)\)\(.*\)/[31m\1[33m\2[32m\4[0m/" | |
30 return 1 | 26 return 1 |
31 } | 27 } |
32 | 28 |
33 function update { | 29 function update { |
34 read -p "Would you like to update the expectations? [y/N]: " answer | 30 read -p "Would you like to update the expectations? [y/N]: " answer |
35 if [[ $answer == 'y' || $answer == 'Y' ]]; then | 31 if [[ $answer == 'y' || $answer == 'Y' ]]; then |
36 cp $2 $1 | 32 cp $2 $1 |
37 return 0 | 33 return 0 |
38 fi | 34 fi |
39 return 1 | 35 return 1 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 # Run Dart analyzer to check that we're generating warning clean code. | 96 # Run Dart analyzer to check that we're generating warning clean code. |
101 OUT_PATTERN="$DIR/data/output/*$TEST_PATTERN*_bootstrap.dart" | 97 OUT_PATTERN="$DIR/data/output/*$TEST_PATTERN*_bootstrap.dart" |
102 if [[ `ls $OUT_PATTERN 2>/dev/null` != "" ]]; then | 98 if [[ `ls $OUT_PATTERN 2>/dev/null` != "" ]]; then |
103 echo -e "\n Analyzing generated code for warnings or type errors." | 99 echo -e "\n Analyzing generated code for warnings or type errors." |
104 # TODO(jmesserly): batch mode does not return the right exit code. | 100 # TODO(jmesserly): batch mode does not return the right exit code. |
105 ls $OUT_PATTERN | dart_analyzer --fatal-warnings --fatal-type-errors \ | 101 ls $OUT_PATTERN | dart_analyzer --fatal-warnings --fatal-type-errors \ |
106 --work $DIR/data/output/analyzer/ -batch | 102 --work $DIR/data/output/analyzer/ -batch |
107 fi | 103 fi |
108 | 104 |
109 echo All tests pass. | 105 echo All tests pass. |
OLD | NEW |