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

Side by Side Diff: tools/testing/dart/test_suite.dart

Issue 12340021: Start two http servers for every configuration (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Classes and methods for enumerating and preparing tests. 6 * Classes and methods for enumerating and preparing tests.
7 * 7 *
8 * This library includes: 8 * This library includes:
9 * 9 *
10 * - Creating tests by listing all the Dart files in certain directories, 10 * - Creating tests by listing all the Dart files in certain directories,
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 */ 403 */
404 class StandardTestSuite extends TestSuite { 404 class StandardTestSuite extends TestSuite {
405 final Path suiteDir; 405 final Path suiteDir;
406 final List<String> statusFilePaths; 406 final List<String> statusFilePaths;
407 TestCaseEvent doTest; 407 TestCaseEvent doTest;
408 TestExpectations testExpectations; 408 TestExpectations testExpectations;
409 List<TestInformation> cachedTests; 409 List<TestInformation> cachedTests;
410 final Path dartDir; 410 final Path dartDir;
411 Predicate<String> isTestFilePredicate; 411 Predicate<String> isTestFilePredicate;
412 final bool listRecursively; 412 final bool listRecursively;
413 /**
414 * The set of servers that have been started to run these tests (Could be
415 * none).
416 */
417 List serverList;
418 413
419 static final RegExp multiTestRegExp = new RegExp(r"/// [0-9][0-9]:(.*)"); 414 static final RegExp multiTestRegExp = new RegExp(r"/// [0-9][0-9]:(.*)");
420 415
421 StandardTestSuite(Map configuration, 416 StandardTestSuite(Map configuration,
422 String suiteName, 417 String suiteName,
423 Path suiteDirectory, 418 Path suiteDirectory,
424 this.statusFilePaths, 419 this.statusFilePaths,
425 {this.isTestFilePredicate, 420 {this.isTestFilePredicate,
426 bool recursive: false, 421 bool recursive: false})
427 this.serverList: const []})
428 : super(configuration, suiteName), 422 : super(configuration, suiteName),
429 dartDir = TestUtils.dartDir(), 423 dartDir = TestUtils.dartDir(),
430 listRecursively = recursive, 424 listRecursively = recursive,
431 suiteDir = TestUtils.dartDir().join(suiteDirectory); 425 suiteDir = TestUtils.dartDir().join(suiteDirectory);
432 426
433 /** 427 /**
434 * Creates a test suite whose file organization matches an expected structure. 428 * Creates a test suite whose file organization matches an expected structure.
435 * To use this, your suite should look like: 429 * To use this, your suite should look like:
436 * 430 *
437 * dart/ 431 * dart/
(...skipping 16 matching lines...) Expand all
454 * new StandardTestSuite.forDirectory(configuration, 'path/to/mytestsuite'); 448 * new StandardTestSuite.forDirectory(configuration, 'path/to/mytestsuite');
455 * 449 *
456 * instead of having to create a custom [StandardTestSuite] subclass. In 450 * instead of having to create a custom [StandardTestSuite] subclass. In
457 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES] 451 * particular, if you add 'path/to/mytestsuite' to [TEST_SUITE_DIRECTORIES]
458 * in test.dart, this will all be set up for you. 452 * in test.dart, this will all be set up for you.
459 * 453 *
460 * The [StandardTestSuite] also optionally takes a list of servers that have 454 * The [StandardTestSuite] also optionally takes a list of servers that have
461 * been started up by the test harness, to be used by browser tests. 455 * been started up by the test harness, to be used by browser tests.
462 */ 456 */
463 factory StandardTestSuite.forDirectory( 457 factory StandardTestSuite.forDirectory(
464 Map configuration, Path directory, {List serverList : const []}) { 458 Map configuration, Path directory) {
465 final name = directory.filename; 459 final name = directory.filename;
466 460
467 return new StandardTestSuite(configuration, 461 return new StandardTestSuite(configuration,
468 name, directory, 462 name, directory,
469 ['$directory/$name.status', '$directory/${name}_dart2js.status'], 463 ['$directory/$name.status', '$directory/${name}_dart2js.status'],
470 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'), 464 isTestFilePredicate: (filename) => filename.endsWith('_test.dart'),
471 recursive: true, serverList: serverList); 465 recursive: true);
472 } 466 }
473 467
474 Collection<Uri> get dart2JsBootstrapDependencies { 468 Collection<Uri> get dart2JsBootstrapDependencies {
475 if (!useSdk) return []; 469 if (!useSdk) return [];
476 470
477 var snapshotPath = TestUtils.absolutePath(new Path(buildDir).join( 471 var snapshotPath = TestUtils.absolutePath(new Path(buildDir).join(
478 new Path('dart-sdk/lib/_internal/compiler/' 472 new Path('dart-sdk/lib/_internal/compiler/'
479 'implementation/dart2js.dart.snapshot'))).toString(); 473 'implementation/dart2js.dart.snapshot'))).toString();
480 return [new Uri.fromComponents(scheme: 'file', path: snapshotPath)]; 474 return [new Uri.fromComponents(scheme: 'file', path: snapshotPath)];
481 } 475 }
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 } 830 }
837 // Unreachable 831 // Unreachable
838 Except.fail('This should be unreachable.'); 832 Except.fail('This should be unreachable.');
839 } 833 }
840 834
841 void _getUriForBrowserTest(TestInformation info, 835 void _getUriForBrowserTest(TestInformation info,
842 String pathComponent, 836 String pathComponent,
843 subtestNames, 837 subtestNames,
844 subtestIndex) { 838 subtestIndex) {
845 // Note: If we run test.py with the "--list" option, no http servers 839 // Note: If we run test.py with the "--list" option, no http servers
846 // will be started. Therefore serverList is an empty list in this 840 // will be started. So we use PORT/CROSS_ORIGIN_PORT instead of real ports.
847 // case. So we use PORT/CROSS_ORIGIN_PORT instead of real ports.
848 var serverPort = "PORT"; 841 var serverPort = "PORT";
849 var crossOriginPort = "CROSS_ORIGIN_PORT"; 842 var crossOriginPort = "CROSS_ORIGIN_PORT";
850 if (!configuration['list']) { 843 if (!configuration['list']) {
851 serverPort = serverList[0].port.toString(); 844 Expect.isTrue(configuration.containsKey('_servers_'));
852 crossOriginPort = serverList[1].port.toString(); 845 serverPort = configuration['_servers_'].port;
846 crossOriginPort = configuration['_servers_'].crossOriginPort;
853 } 847 }
854 848
855 var url= 'http://127.0.0.1:$serverPort$pathComponent' 849 var url= 'http://127.0.0.1:$serverPort$pathComponent'
856 '?crossOriginPort=$crossOriginPort'; 850 '?crossOriginPort=$crossOriginPort';
857 if (info.optionsFromFile['isMultiHtmlTest'] && subtestNames.length > 0) { 851 if (info.optionsFromFile['isMultiHtmlTest'] && subtestNames.length > 0) {
858 url= '${url}&group=${subtestNames[subtestIndex]}'; 852 url= '${url}&group=${subtestNames[subtestIndex]}';
859 } 853 }
860 return url; 854 return url;
861 } 855 }
862 856
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 * $pass tests are expected to pass 1935 * $pass tests are expected to pass
1942 * $failOk tests are expected to fail that we won't fix 1936 * $failOk tests are expected to fail that we won't fix
1943 * $fail tests are expected to fail that we should fix 1937 * $fail tests are expected to fail that we should fix
1944 * $crash tests are expected to crash that we should fix 1938 * $crash tests are expected to crash that we should fix
1945 * $timeout tests are allowed to timeout 1939 * $timeout tests are allowed to timeout
1946 * $compileErrorSkip tests are skipped on browsers due to compile-time error 1940 * $compileErrorSkip tests are skipped on browsers due to compile-time error
1947 """; 1941 """;
1948 print(report); 1942 print(report);
1949 } 1943 }
1950 } 1944 }
OLDNEW
« tools/testing/dart/http_server.dart ('K') | « tools/testing/dart/test_runner.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698