mirror of
https://github.com/dart-lang/sdk
synced 2024-07-25 04:15:45 +00:00
Fix test.py and tests to use an explicit --packages flag.
BUG=https://github.com/dart-lang/sdk/issues/27412 R=johnmccutchan@google.com Review URL: https://codereview.chromium.org/2361813003 .
This commit is contained in:
parent
7a570f1b80
commit
92cd3e10f5
|
@ -636,6 +636,9 @@ class Server {
|
|||
if (Platform.packageRoot != null) {
|
||||
arguments.add('--package-root=${Platform.packageRoot}');
|
||||
}
|
||||
if (Platform.packageConfig != null) {
|
||||
arguments.add('--packages=${Platform.packageConfig}');
|
||||
}
|
||||
if (checked) {
|
||||
arguments.add('--checked');
|
||||
}
|
||||
|
|
|
@ -156,9 +156,11 @@ ${generateGraphData()}
|
|||
context = AnalysisEngine.instance.createAnalysisContext();
|
||||
ContextBuilder builder = new ContextBuilder(resourceProvider, null, null);
|
||||
if (Platform.packageRoot != null) {
|
||||
builder.defaultPackagesDirectoryPath = Uri.parse(Platform.packageRoot).toFilePath();
|
||||
builder.defaultPackagesDirectoryPath =
|
||||
Uri.parse(Platform.packageRoot).toFilePath();
|
||||
} else if (Platform.packageConfig != null) {
|
||||
builder.defaultPackageFilePath = Platform.packageConfig;
|
||||
builder.defaultPackageFilePath =
|
||||
Uri.parse(Platform.packageConfig).toFilePath();
|
||||
} else {
|
||||
// Let the context builder use the default algorithm for package
|
||||
// resolution.
|
||||
|
|
|
@ -5,9 +5,6 @@
|
|||
[ $browser == false || $runtime == drt || $fast_startup]
|
||||
*: SkipByDesign
|
||||
|
||||
[ $runtime == dartium || $runtime == chrome || $runtime == ff ]
|
||||
vm_connect/element_test: Skip # Times out. Issue 27397
|
||||
|
||||
[ $runtime == dartium ]
|
||||
isolate/*: Skip
|
||||
allocation_profile: Skip
|
||||
|
|
|
@ -165,6 +165,9 @@ runner.Command makeCompilationCommand(String testName, FileUtils fileUtils) {
|
|||
}
|
||||
|
||||
void main() {
|
||||
// This script is in [sdk]/tests/standalone/io.
|
||||
suite.TestUtils.setDartDirUri(Platform.script.resolve('../../..'));
|
||||
|
||||
var fs_noTestJs = new FileUtils(createJs: false,
|
||||
createJsDeps: true,
|
||||
createDart: true,
|
||||
|
|
|
@ -141,6 +141,8 @@ class EventListener extends progress.EventListener{
|
|||
}
|
||||
|
||||
void main(List<String> arguments) {
|
||||
// This script is in [sdk]/tests/standalone/io.
|
||||
TestUtils.setDartDirUri(Platform.script.resolve('../../..'));
|
||||
// Run the test_runner_test if there are no command-line options.
|
||||
// Otherwise, run one of the component tests that always pass,
|
||||
// fail, or timeout.
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// PackageRoot=none
|
||||
// Packages=.packages
|
||||
|
||||
// We expect this to not cause any errors. An empty packages file is valid,
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// PackageRoot=none
|
||||
// Packages=.packages
|
||||
|
||||
library empty_packages_file_option_test;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// PackageRoot=none
|
||||
// Packages=invalid_package_name.packages
|
||||
|
||||
library invalid_package_name_test;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// PackageRoot=none
|
||||
// Packages=invalid_utf8.packages
|
||||
|
||||
library invalid_utf8_test;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// PackageRoot=none
|
||||
// Packages=non_existent.packages
|
||||
|
||||
library non_existent_packages_file_test;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// PackageRoot=none
|
||||
// Packages=same_package_twice.packages
|
||||
|
||||
library same_package_twice_test;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// PackageRoot=none
|
||||
// Packages=empty_lines.packages
|
||||
|
||||
library empty_lines_test;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// PackageRoot=none
|
||||
// Packages=empty_package_dir.packages
|
||||
|
||||
// In this test, we give a packages file that associates the package 'foo' with
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// PackageRoot=none
|
||||
// Packages=mixed_line_ends.packages
|
||||
|
||||
library mixed_line_ends_test;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// PackageRoot=none
|
||||
// Packages=sub/.packages
|
||||
|
||||
library packages_option_only_noimports_test;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
// PackageRoot=none
|
||||
// Packages=sub/.packages
|
||||
|
||||
library packages_option_only_test;
|
||||
|
|
|
@ -56,7 +56,7 @@ Future _deleteTemporaryDartDirectories() {
|
|||
}
|
||||
|
||||
void main(List<String> arguments) {
|
||||
// This script is in [dart]/tools.
|
||||
// This script is in [sdk]/tools.
|
||||
TestUtils.setDartDirUri(Platform.script.resolve('..'));
|
||||
_deleteTemporaryDartDirectories().then((_) {
|
||||
var optionsParser = new TestOptionsParser();
|
||||
|
|
|
@ -808,6 +808,40 @@ Note: currently only implemented for dart2js.''',
|
|||
configuration['selectors'] = selectorMap;
|
||||
}
|
||||
|
||||
// Put observatory_ui in a configuration with its own packages override.
|
||||
// Only one value in the configuration map is mutable:
|
||||
selectors = configuration['selectors'];
|
||||
if (selectors.containsKey('observatory_ui')) {
|
||||
if (selectors.length == 1) {
|
||||
configuration['packages'] = TestUtils.dartDirUri
|
||||
.resolve('runtime/observatory/.packages').toFilePath();
|
||||
} else {
|
||||
// Make a new configuration whose selectors map only contains
|
||||
// observatory_ui, and remove the key from the original selectors.
|
||||
// The only mutable value in the map is the selectors, so a
|
||||
// shallow copy is safe.
|
||||
var observatoryConfiguration = new Map.from(configuration);
|
||||
observatoryConfiguration['selectors'] =
|
||||
{'observatory_ui': selectors['observatory_ui']};
|
||||
selectors.remove('observatory_ui');
|
||||
|
||||
// Set the packages flag.
|
||||
observatoryConfiguration['packages'] = TestUtils.dartDirUri
|
||||
.resolve('runtime/observatory/.packages').toFilePath();
|
||||
|
||||
// Return the expansions of both configurations. Neither will reach
|
||||
// this line in the recursive call to _expandConfigurations.
|
||||
return _expandConfigurations(configuration)
|
||||
..addAll(_expandConfigurations(observatoryConfiguration));
|
||||
}
|
||||
}
|
||||
// Set the default package spec explicitly.
|
||||
if (configuration['package_root'] == null &&
|
||||
configuration['packages'] == null) {
|
||||
configuration['packages'] =
|
||||
TestUtils.dartDirUri.resolve('.packages').toFilePath();
|
||||
}
|
||||
|
||||
// Expand the architectures.
|
||||
if (configuration['arch'].contains(',')) {
|
||||
return _expandHelper('arch', configuration);
|
||||
|
|
|
@ -970,15 +970,17 @@ class StandardTestSuite extends TestSuite {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (configuration['package_root'] != null) {
|
||||
packageRoot = new Path(configuration['package_root']);
|
||||
optionsFromFile['packageRoot'] = packageRoot.toNativePath();
|
||||
if (optionsFromFile['packageRoot'] == null &&
|
||||
optionsFromFile['packages'] == null) {
|
||||
if (configuration['package_root'] != null) {
|
||||
packageRoot = new Path(configuration['package_root']);
|
||||
optionsFromFile['packageRoot'] = packageRoot.toNativePath();
|
||||
}
|
||||
if (configuration['packages'] != null) {
|
||||
Path packages = new Path(configuration['packages']);
|
||||
optionsFromFile['packages'] = packages.toNativePath();
|
||||
}
|
||||
}
|
||||
if (configuration['packages'] != null) {
|
||||
Path packages = new Path(configuration['packages']);
|
||||
optionsFromFile['packages'] = packages.toNativePath();
|
||||
}
|
||||
|
||||
if (new CompilerConfiguration(configuration).hasCompiler &&
|
||||
expectCompileError(info)) {
|
||||
// If a compile-time error is expected, and we're testing a
|
||||
|
@ -1585,9 +1587,12 @@ class StandardTestSuite extends TestSuite {
|
|||
|
||||
String packagesArgument(String packageRootFromFile,
|
||||
String packagesFromFile) {
|
||||
if (packagesFromFile != null) {
|
||||
if (packageRootFromFile == 'none' ||
|
||||
packagesFromFile == 'none') {
|
||||
return null;
|
||||
} else if (packagesFromFile != null) {
|
||||
return '--packages=$packagesFromFile';
|
||||
} else if (packageRootFromFile != null && packageRootFromFile != 'none') {
|
||||
} else if (packageRootFromFile != null) {
|
||||
return '--package-root=$packageRootFromFile';
|
||||
} else {
|
||||
return null;
|
||||
|
@ -1712,26 +1717,30 @@ class StandardTestSuite extends TestSuite {
|
|||
|
||||
matches = packageRootRegExp.allMatches(contents);
|
||||
for (var match in matches) {
|
||||
if (packageRoot != null) {
|
||||
if (packageRoot != null || packages != null) {
|
||||
throw new Exception(
|
||||
'More than one "// PackageRoot=" line in test $filePath');
|
||||
'More than one "// Package... line in test $filePath');
|
||||
}
|
||||
packageRoot = match[1];
|
||||
if (packageRoot != 'none') {
|
||||
// PackageRoot=none means that no package-root option should be given.
|
||||
// PackageRoot=none means that no packages or package-root option
|
||||
// should be given. Any other value overrides package-root and
|
||||
// removes any packages option. Don't use with // Packages=.
|
||||
packageRoot = '${filePath.directoryPath.join(new Path(packageRoot))}';
|
||||
}
|
||||
}
|
||||
|
||||
matches = packagesRegExp.allMatches(contents);
|
||||
for (var match in matches) {
|
||||
if (packages != null) {
|
||||
if (packages != null || packageRoot != null) {
|
||||
throw new Exception(
|
||||
'More than one "// Packages=" line in test $filePath');
|
||||
'More than one "// Package..." line in test $filePath');
|
||||
}
|
||||
packages = match[1];
|
||||
if (packages != 'none') {
|
||||
// Packages=none means that no packages option should be given.
|
||||
// Packages=none means that no packages or package-root option
|
||||
// should be given. Any other value overrides packages and removes
|
||||
// any package-root option. Don't use with // PackageRoot=.
|
||||
packages = '${filePath.directoryPath.join(new Path(packages))}';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue