| OLD | NEW |
| 1 //#!/usr/bin/env dart | 1 //#!/usr/bin/env dart |
| 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 /** | 6 /** |
| 7 * testrunner is a program to run Dart unit tests. Unlike $DART/tools/test.dart, | 7 * testrunner is a program to run Dart unit tests. Unlike $DART/tools/test.dart, |
| 8 * this program is intended for 3rd parties to be able to run unit tests in | 8 * this program is intended for 3rd parties to be able to run unit tests in |
| 9 * a batched fashion. As such, it adds some features and removes others. Some | 9 * a batched fashion. As such, it adds some features and removes others. Some |
| 10 * of the removed features are: | 10 * of the removed features are: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 * All files that match the `--test-file-pattern` will be included; by default | 34 * All files that match the `--test-file-pattern` will be included; by default |
| 35 * this is files with names that end in _test.dart. | 35 * this is files with names that end in _test.dart. |
| 36 * | 36 * |
| 37 * Options can be specified on the command line, via a configuration | 37 * Options can be specified on the command line, via a configuration |
| 38 * file (`--config`) or via a test.config file in the test directory, | 38 * file (`--config`) or via a test.config file in the test directory, |
| 39 * in decreasing order of priority. | 39 * in decreasing order of priority. |
| 40 * | 40 * |
| 41 * The three runtimes are: | 41 * The three runtimes are: |
| 42 * | 42 * |
| 43 * vm - run native Dart in the VM; i.e. using $DARTSDK/dart-sdk/bin/dart. | 43 * vm - run native Dart in the VM; i.e. using $DARTSDK/dart-sdk/bin/dart. |
| 44 * drt-dart - run native Dart in DumpRenderTree, the headless version of | 44 * TODO(antonm): fix the option name. |
| 45 * Dartium, which is located in $DARTSDK/chromium/DumpRenderTree, if | 45 * drt-dart - run native Dart in content shell, the headless version of |
| 46 * Dartium, which is located in $DARTSDK/chromium/content_shell, if |
| 46 * you installed the SDK that is bundled with the editor, or available | 47 * you installed the SDK that is bundled with the editor, or available |
| 47 * from http://gsdview.appspot.com/dartium-archive/continuous/ | 48 * from http://gsdview.appspot.com/dartium-archive/continuous/ |
| 48 * otherwise. | 49 * otherwise. |
| 49 * | 50 * |
| 50 * drt-js - run Dart compiled to Javascript in DumpRenderTree. | 51 * TODO(antonm): fix the option name. |
| 52 * drt-js - run Dart compiled to Javascript in content shell. |
| 51 * | 53 * |
| 52 * testrunner supports simple DOM render tests. These can use expected values | 54 * testrunner supports simple DOM render tests. These can use expected values |
| 53 * for the render output from DumpRenderTree, either are textual DOM | 55 * for the render output from content shell, either are textual DOM |
| 54 * descriptions (`--layout-tests`) or pixel renderings (`--pixel-tests`). | 56 * descriptions (`--layout-tests`) or pixel renderings (`--pixel-tests`). |
| 55 * When running layout tests, testrunner will see if there is a file with | 57 * When running layout tests, testrunner will see if there is a file with |
| 56 * a .png or a .txt extension in a directory with the same name as the | 58 * a .png or a .txt extension in a directory with the same name as the |
| 57 * test file (without extension) and with the test name as the file name. | 59 * test file (without extension) and with the test name as the file name. |
| 58 * For example, if there is a test file foo_test.dart with tests 'test1' | 60 * For example, if there is a test file foo_test.dart with tests 'test1' |
| 59 * and 'test2', it will look for foo_test/test1.txt and foo_test/test2.txt | 61 * and 'test2', it will look for foo_test/test1.txt and foo_test/test2.txt |
| 60 * for text render layout files. If these exist it will do additional checks | 62 * for text render layout files. If these exist it will do additional checks |
| 61 * of the rendered layout; if not, the test will fail. | 63 * of the rendered layout; if not, the test will fail. |
| 62 * | 64 * |
| 63 * Layout file (re)generation can be done using `--regenerate`. This will | 65 * Layout file (re)generation can be done using `--regenerate`. This will |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 exit(0); | 352 exit(0); |
| 351 } | 353 } |
| 352 dartsdk = runner.substring(0, idx); | 354 dartsdk = runner.substring(0, idx); |
| 353 } | 355 } |
| 354 if (Platform.operatingSystem == 'macos') { | 356 if (Platform.operatingSystem == 'macos') { |
| 355 config['dart2js'] = | 357 config['dart2js'] = |
| 356 '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}dart2js'; | 358 '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}dart2js'; |
| 357 config['dart'] = '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}dart'; | 359 config['dart'] = '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}dart'; |
| 358 config['pub'] = '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}pub'; | 360 config['pub'] = '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}pub'; |
| 359 config['drt'] = | 361 config['drt'] = |
| 360 '$dartsdk/chromium/DumpRenderTree.app/Contents/MacOS/DumpRenderTree'; | 362 '$dartsdk/chromium/Content Shell.app/Contents/MacOS/Content Shell'; |
| 361 } else if (Platform.operatingSystem == 'linux') { | 363 } else if (Platform.operatingSystem == 'linux') { |
| 362 config['dart2js'] = | 364 config['dart2js'] = |
| 363 '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}dart2js'; | 365 '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}dart2js'; |
| 364 config['dart'] = '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}dart'; | 366 config['dart'] = '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}dart'; |
| 365 config['pub'] = '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}pub'; | 367 config['pub'] = '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}pub'; |
| 366 config['drt'] = '$dartsdk${pathSep}chromium${pathSep}DumpRenderTree'; | 368 config['drt'] = '$dartsdk${pathSep}chromium${pathSep}content_shell'; |
| 367 } else { | 369 } else { |
| 368 config['dart2js'] = | 370 config['dart2js'] = |
| 369 '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}dart2js.bat'; | 371 '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}dart2js.bat'; |
| 370 config['dart'] = '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}dart.exe'
; | 372 config['dart'] = '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}dart.exe'
; |
| 371 config['pub'] = '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}pub.bat'; | 373 config['pub'] = '$dartsdk${pathSep}dart-sdk${pathSep}bin${pathSep}pub.bat'; |
| 372 config['drt'] = '$dartsdk${pathSep}chromium${pathSep}DumpRenderTree.exe'; | 374 config['drt'] = '$dartsdk${pathSep}chromium${pathSep}content_shell.exe'; |
| 373 } | 375 } |
| 374 | 376 |
| 375 for (var prog in [ 'drt', 'dart', 'pub', 'dart2js' ]) { | 377 for (var prog in [ 'drt', 'dart', 'pub', 'dart2js' ]) { |
| 376 config[prog] = makePathAbsolute(config[prog]); | 378 config[prog] = makePathAbsolute(config[prog]); |
| 377 } | 379 } |
| 378 config['runnerDir'] = runnerDirectory; | 380 config['runnerDir'] = runnerDirectory; |
| 379 config['include'] = normalizeFilter(config['include']); | 381 config['include'] = normalizeFilter(config['include']); |
| 380 config['exclude'] = normalizeFilter(config['exclude']); | 382 config['exclude'] = normalizeFilter(config['exclude']); |
| 381 } | 383 } |
| 382 | 384 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 if (dirs.length == 0) { | 417 if (dirs.length == 0) { |
| 416 dirs.add('.'); // Use current working directory as default. | 418 dirs.add('.'); // Use current working directory as default. |
| 417 } | 419 } |
| 418 var f = buildFileList(dirs, | 420 var f = buildFileList(dirs, |
| 419 new RegExp(config['test-file-pattern']), config['recurse']); | 421 new RegExp(config['test-file-pattern']), config['recurse']); |
| 420 if (config['sort']) f.sort(); | 422 if (config['sort']) f.sort(); |
| 421 processTests(config, f); | 423 processTests(config, f); |
| 422 } | 424 } |
| 423 } | 425 } |
| 424 } | 426 } |
| OLD | NEW |