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

Unified Diff: tools/testing/dart/test_suite.dart

Issue 1290623002: Add tests for simple packages scenarios (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/standalone/standalone.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/test_suite.dart
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index 2304b5c5479e8ddd7c8ca8b310c5d39daddb2be4..aef5b3f2a06421b5484ed83c6e2ef5c1354ddfd2 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -1468,6 +1468,8 @@ class StandardTestSuite extends TestSuite {
String packageRoot =
packageRootArgument(optionsFromFile['packageRoot']);
if (packageRoot != null) args.add(packageRoot);
+ String packages = packagesArgument(optionsFromFile['packages']);
+ if (packages != null) args.add(packages);
args.add('--out=$outputFile');
args.add(inputFile);
List<String> options = optionsFromFile['sharedOptions'];
@@ -1483,6 +1485,8 @@ class StandardTestSuite extends TestSuite {
List<String> args = [];
String packageRoot = packageRootArgument(optionsFromFile['packageRoot']);
if (packageRoot != null) args.add(packageRoot);
+ String packages = packagesArgument(optionsFromFile['packages']);
+ if (packages != null) args.add(packages);
args..add('package:polymer/deploy.dart')
..add('--test')..add(inputFile)
..add('--out')..add(outputDir)
@@ -1537,6 +1541,10 @@ class StandardTestSuite extends TestSuite {
if (packageRoot != null) {
args.add(packageRoot);
}
+ String packages = packagesArgument(optionsFromFile['packages']);
+ if (packages != null) {
+ args.add(packages);
+ }
args.addAll(additionalOptions(filePath));
if (configuration['analyzer']) {
args.add('--machine');
@@ -1581,6 +1589,13 @@ class StandardTestSuite extends TestSuite {
return "--package-root=$packageRootPath";
}
+ String packagesArgument(String packagesFromFile) {
+ if (packagesFromFile == null || packagesFromFile == "none") {
+ return null;
+ }
+ return "--packages=$packagesFromFile";
+ }
+
/**
* Special options for individual tests are currently specified in various
* ways: with comments directly in test files, by using certain imports, or by
@@ -1655,6 +1670,7 @@ class StandardTestSuite extends TestSuite {
RegExp dartOptionsRegExp = new RegExp(r"// DartOptions=(.*)");
RegExp otherScriptsRegExp = new RegExp(r"// OtherScripts=(.*)");
RegExp packageRootRegExp = new RegExp(r"// PackageRoot=(.*)");
+ RegExp packagesRegExp = new RegExp(r"// Packages=(.*)");
RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)");
// TODO(gram) Clean these up once the old directives are not supported.
RegExp domImportRegExp =
@@ -1670,6 +1686,7 @@ class StandardTestSuite extends TestSuite {
List<String> dartOptions;
List<String> sharedOptions;
String packageRoot;
+ String packages;
Iterable<Match> matches = testOptionsRegExp.allMatches(contents);
for (var match in matches) {
@@ -1708,6 +1725,19 @@ class StandardTestSuite extends TestSuite {
}
}
+ matches = packagesRegExp.allMatches(contents);
+ for (var match in matches) {
+ if (packages != null) {
+ throw new Exception(
+ 'More than one "// Packages=" line in test $filePath');
+ }
+ packages = match[1];
+ if (packages != 'none') {
+ // Packages=none means that no packages option should be given.
+ packages = '${filePath.directoryPath.join(new Path(packages))}';
+ }
+ }
+
List<String> otherScripts = new List<String>();
matches = otherScriptsRegExp.allMatches(contents);
for (var match in matches) {
@@ -1732,6 +1762,7 @@ class StandardTestSuite extends TestSuite {
"sharedOptions": sharedOptions == null ? [] : sharedOptions,
"dartOptions": dartOptions,
"packageRoot": packageRoot,
+ "packages": packages,
"hasCompileError": false,
"hasRuntimeError": false,
"hasStaticWarning" : false,
« no previous file with comments | « tests/standalone/standalone.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698