Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Side by Side Diff: test/run.sh

Issue 11275029: Support for specifying an output directory (issue #106) (Closed) Base URL: git@github.com:dart-lang/dart-web-components.git@master
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/directive_parser_test.dart ('k') | test/run_all.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 21 matching lines...) Expand all
32 32
33 function update { 33 function update {
34 read -p "Would you like to update the expectations? [y/N]: " answer 34 read -p "Would you like to update the expectations? [y/N]: " answer
35 if [[ $answer == 'y' || $answer == 'Y' ]]; then 35 if [[ $answer == 'y' || $answer == 'Y' ]]; then
36 cp $2 $1 36 cp $2 $1
37 return 0 37 return 0
38 fi 38 fi
39 return 1 39 return 1
40 } 40 }
41 41
42 function pass {
43 echo -e "PASS"
44 }
45
42 function compare { 46 function compare {
43 # use a standard diff, if they are not identical, format the diff nicely to 47 # use a standard diff, if they are not identical, format the diff nicely to
44 # see what's the error and prompt to see if they wish to update it. If they 48 # see what's the error and prompt to see if they wish to update it. If they
45 # do, continue running more tests. 49 # do, continue running more tests.
46 diff -q -s $1 $2 || show_diff $1 $2 || update $1 $2 50 diff -q $1 $2 && pass || show_diff $1 $2 || update $1 $2
47 } 51 }
48 52
49 if [[ ($TEST_PATTERN == "") ]]; then 53 if [[ ($TEST_PATTERN == "") ]]; then
50 # Note: dart_analyzer needs to be run from the root directory for proper path 54 # Note: dart_analyzer needs to be run from the root directory for proper path
51 # canonicalization. 55 # canonicalization.
52 pushd $DIR/.. 56 pushd $DIR/..
53 echo Analyzing compiler for warnings or type errors 57 echo Analyzing compiler for warnings or type errors
54 dart_analyzer --fatal-warnings --fatal-type-errors bin/dwc.dart \ 58 dart_analyzer --fatal-warnings --fatal-type-errors bin/dwc.dart \
55 --work analyzer_out 59 --work analyzer_out
56 rm -r analyzer_out 60 rm -r analyzer_out
57 popd 61 popd
58 fi 62 fi
59 63
60 # First clear the output folder. Otherwise we can miss bugs when we fail to 64 # First clear the output folder. Otherwise we can miss bugs when we fail to
61 # generate a file. 65 # generate a file.
62 if [[ -d $DIR/data/output ]]; then 66 if [[ -d $DIR/data/output ]]; then
63 rm -rf $DIR/data/output/* 67 rm -rf $DIR/data/output/*
64 ln -s $DIR/packages $DIR/data/output/packages 68 ln -s $DIR/packages $DIR/data/output/packages
65 fi 69 fi
66 70
67 pushd $DIR 71 pushd $DIR
68 dart $DART_FLAGS run_all.dart $TEST_PATTERN 72 dart $DART_FLAGS run_all.dart $TEST_PATTERN
69 popd 73 popd
70 74
71 # TODO(jmesserly): bash and dart regexp might not be 100% the same. Ideally we 75 # TODO(jmesserly): bash and dart regexp might not be 100% the same. Ideally we
72 # could do all the heavy lifting in Dart code, and keep this script as a thin 76 # could do all the heavy lifting in Dart code, and keep this script as a thin
73 # wrapper that sets `--enable-type-checks --enable-asserts` 77 # wrapper that sets `--enable-type-checks --enable-asserts`
74 for input in $DIR/data/input/*_test.html; do 78 for input in $DIR/data/input/*_test.html; do
75 if [[ ($TEST_PATTERN == "") || ($input =~ $TEST_PATTERN) ]]; then 79 if [[ ($TEST_PATTERN == "") || ($input =~ $TEST_PATTERN) ]]; then
76 echo -e "\nTesting $input:"
77 FILENAME=`basename $input.html` 80 FILENAME=`basename $input.html`
81 echo -e -n "Testing $FILENAME "
78 DUMP="$DIR/data/output/$FILENAME.txt" 82 DUMP="$DIR/data/output/$FILENAME.txt"
79 EXPECTATION="$DIR/data/expected/$FILENAME.txt" 83 EXPECTATION="$DIR/data/expected/$FILENAME.txt"
80 DART_PACKAGE_ROOT="file://$DIR/packages/" \ 84 DART_PACKAGE_ROOT="file://$DIR/packages/" \
81 DumpRenderTree $DIR/data/output/_$FILENAME > $DUMP 85 DumpRenderTree $DIR/data/output/_$FILENAME > $DUMP
82 86
83 compare $EXPECTATION $DUMP 87 compare $EXPECTATION $DUMP
84 fi 88 fi
85 done 89 done
86 90
87 # Run Dart analyzer to check that we're generating warning clean code. 91 # Run Dart analyzer to check that we're generating warning clean code.
88 OUT_PATTERN="$DIR/data/output/*$TEST_PATTERN*.dart" 92 OUT_PATTERN="$DIR/data/output/*$TEST_PATTERN*_bootstrap.dart"
89 if [[ `ls $OUT_PATTERN 2>/dev/null` != "" ]]; then 93 if [[ `ls $OUT_PATTERN 2>/dev/null` != "" ]]; then
90 echo Analyzing generated code for warnings or type errors. 94 echo -e "\n Analyzing generated code for warnings or type errors."
91 dart_analyzer --fatal-warnings --fatal-type-errors $OUT_PATTERN \ 95 ls $OUT_PATTERN | dart_analyzer --fatal-warnings --fatal-type-errors \
92 --work $DIR/data/output/analyzer/ 96 --work $DIR/data/output/analyzer/ -batch
93 fi 97 fi
94 98
95 echo All tests pass. 99 echo All tests pass.
OLDNEW
« no previous file with comments | « test/directive_parser_test.dart ('k') | test/run_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698