Skip to content

Commit 99e8a9f

Browse files
munificentcommit-bot@chromium.org
authored andcommitted
Move the test runner (i.e. "test.dart"/"test.py") to pkg/.
This makes it an actual Pub package like most other code inside the SDK repo. The main goal is to make it easier to write tests for the test runner itself. This change: - Moves all of the code from tools/testing/dart/ over to pkg/test_runner. Most of it ends up under test_runner/lib/src. - Move tools/testing/dart/main.dart to pkg/test_runner/bin/test_runner.dart. - Move standalone_2/io/test_runner_test.dart to pkg/test_runner/test/test_runner_test.dart. I don't think it currently works, but it wasn't being run in its old location either. - Add test_runner to the analysis-server bot. This ensures the test_runner package is static error clean. - Remove standalone_2/io/test_runner_analyze_test.dart which used to attempt to do the above and is no longer needed. - Update test.py to look for the test runner at its new location. - Add test_runner to the repo .packages file and remove the weird test_dart pseudo-package. (I think this fixes #35279.) - Remove status file entries for the removed standalone_2 tests. There are no code changes to the test runner itself aside from fixing up import paths. Change-Id: I3d05d50d222b291848fa5a30de2846e803bc81e6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105821 Commit-Queue: Bob Nystrom <[email protected]> Reviewed-by: Jonas Termansen <[email protected]>
1 parent 3bacc84 commit 99e8a9f

80 files changed

Lines changed: 201 additions & 636 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.packages

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ term_glyph:third_party/pkg/term_glyph/lib
9494
test:third_party/pkg/test/pkgs/test/lib
9595
test_api:third_party/pkg/test/pkgs/test_api/lib
9696
test_core:third_party/pkg/test/pkgs/test_core/lib
97-
test_dart:tools/testing/dart
9897
test_descriptor:third_party/pkg/test_descriptor/lib
9998
test_process:third_party/pkg/test_process/lib
10099
test_reflective_loader:third_party/pkg/test_reflective_loader/lib
100+
test_runner:pkg/test_runner/lib
101101
testing:pkg/testing/lib
102102
typed_data:third_party/pkg/typed_data/lib
103103
unittest:third_party/pkg/unittest/lib

pkg/dev_compiler/test/sourcemap/ddc_common.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ String getWrapperContent(
163163

164164
void createHtmlWrapper(File sdkJsFile, Uri outputFile, String jsContent,
165165
String outputFilename, Uri outDir) {
166-
// For debugging via HTML, Chrome and ./tools/testing/dart/http_server.dart.
166+
// For debugging via HTML, Chrome and ./pkg/test_runner/bin/http_server.dart.
167167
var sdkFile = File(path.relative(sdkJsFile.path, from: sdkRoot.path));
168168
String jsRootDart = "/root_dart/${sdkFile.uri}";
169169
File.fromUri(outputFile.resolve("$outputFilename.html.js")).writeAsStringSync(
@@ -173,7 +173,7 @@ void createHtmlWrapper(File sdkJsFile, Uri outputFile, String jsContent,
173173
jsRootDart, "/root_build/$outputFilename.html.js"));
174174

175175
print("You should now be able to run\n\n"
176-
"dart ${sdkRoot.path}/tools/testing/dart/http_server.dart -p 39550 "
176+
"dart ${sdkRoot.path}/pkg/test_runner/bin/http_server.dart -p 39550 "
177177
"--network 127.0.0.1 "
178178
"--build-directory=${outDir.toFilePath()}"
179179
"\n\nand go to\n\n"

pkg/pkg.status

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ status_file/test/normalize_test: SkipByDesign # Uses dart:io
8484
status_file/test/parse_and_normalize_test: SkipByDesign # Uses dart:io
8585
status_file/test/repo_status_files_test: SkipByDesign # Uses dart:io
8686
telemetry/test/*: SkipByDesign # Only meant to run on vm
87+
test_runner/test/*: SkipByDesign # Only meant to run on vm
8788
testing/*: SkipByDesign # Only meant to run on vm
8889
typed_data/test/typed_buffers_test/01: Fail # Not supporting Int64List, Uint64List.
8990

pkg/smith/pubspec.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: smith
22
author: Dart Team <[email protected]>
33
description: Shared code for working with the Dart SDK's tests and test runner.
44
homepage: http://www.dartlang.org
5+
# This package is not intended to be published.
6+
publish_to: none
7+
environment:
8+
sdk: "^2.3.0"
59
dev_dependencies:
610
expect:
711
path: ../expect

pkg/status_file/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: status_file
22
# This package is not intended to be published.
33
publish_to: none
4-
4+
environment:
5+
sdk: "^2.3.0"
56
dependencies:
67
path: "^1.4.0"
78
args: "^1.4.4"
8-
99
dev_dependencies:
1010
expect:
1111
path: ../expect

pkg/status_file/test/data/standalone_2_vm.status

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ no_lazy_dispatchers_test: SkipByDesign # SIMDBC interpreter doesn't support --no
3535
io/web_socket_test: Pass, RuntimeError # Issue 26814.
3636

3737
[ $system == windows ]
38-
io/skipping_dart2js_compilations_test: Skip # Issue 19551.
3938
verbose_gc_to_bmu_test: Skip
4039
io/process_sync_test: Pass, Timeout # Issue 24596
4140
io/sleep_test: Pass, Fail # Issue 25757

pkg/test_runner/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Don’t commit the following files and directories created by pub.
2+
.packages
3+
pubspec.lock
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4+
5+
import 'package:test_runner/src/configuration.dart';
6+
import 'package:test_runner/src/testing_servers.dart';
7+
import 'package:test_runner/src/utils.dart';
8+
import 'package:test_runner/src/vendored_pkg/args/args.dart';
9+
10+
void main(List<String> arguments) {
11+
var parser = new ArgParser();
12+
parser.addOption('port',
13+
abbr: 'p',
14+
help: 'The main server port we wish to respond to requests.',
15+
defaultsTo: '0');
16+
parser.addOption('crossOriginPort',
17+
abbr: 'c',
18+
help: 'A different port that accepts request from the main server port.',
19+
defaultsTo: '0');
20+
parser.addFlag('help',
21+
abbr: 'h', negatable: false, help: 'Print this usage information.');
22+
parser.addOption('build-directory', help: 'The build directory to use.');
23+
parser.addOption('package-root', help: 'The package root to use.');
24+
parser.addOption('packages', help: 'The package spec file to use.');
25+
parser.addOption('network',
26+
help: 'The network interface to use.', defaultsTo: '0.0.0.0');
27+
parser.addFlag('csp',
28+
help: 'Use Content Security Policy restrictions.', defaultsTo: false);
29+
parser.addOption('runtime',
30+
help: 'The runtime we are using (for csp flags).', defaultsTo: 'none');
31+
32+
var args = parser.parse(arguments);
33+
if (args['help'] as bool) {
34+
print(parser.getUsage());
35+
} else {
36+
var servers = new TestingServers(
37+
args['build-directory'] as String,
38+
args['csp'] as bool,
39+
Runtime.find(args['runtime'] as String),
40+
null,
41+
args['package-root'] as String,
42+
args['packages'] as String);
43+
var port = int.parse(args['port'] as String);
44+
var crossOriginPort = int.parse(args['crossOriginPort'] as String);
45+
servers
46+
.startServers(args['network'] as String,
47+
port: port, crossOriginPort: crossOriginPort)
48+
.then((_) {
49+
DebugLogger.info('Server listening on port ${servers.port}');
50+
DebugLogger.info('Server listening on port ${servers.crossOriginPort}');
51+
});
52+
}
53+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
* DARTBIN should be the checked in stable binary.
1111
*/
1212

13-
import 'browser_controller.dart';
14-
import 'configuration.dart';
13+
import 'package:test_runner/src/browser_controller.dart';
14+
import 'package:test_runner/src/configuration.dart';
1515

1616
void printHelp() {
1717
print("Usage pattern:");

tools/testing/dart/package_testing_support.dart renamed to pkg/test_runner/bin/package_testing_support.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE.md file.
44

5-
import 'configuration.dart';
6-
import 'options.dart';
7-
import 'repository.dart';
8-
import 'test_configurations.dart';
5+
import 'package:test_runner/src/configuration.dart';
6+
import 'package:test_runner/src/options.dart';
7+
import 'package:test_runner/src/repository.dart';
8+
import 'package:test_runner/src/test_configurations.dart';
99

1010
void main(List<String> arguments) {
1111
Repository.uri = Uri.base;

0 commit comments

Comments
 (0)