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

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

Issue 8589020: Enable language and isolate tests using the dart test runner. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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 | « tools/test.dart ('k') | tools/testing/dart/test_options.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/test_config_utils.dart
diff --git a/tools/testing/dart/test_config_utils.dart b/tools/testing/dart/test_config_utils.dart
deleted file mode 100644
index 9e54863de32df99a2f10d55302678552e26f9010..0000000000000000000000000000000000000000
--- a/tools/testing/dart/test_config_utils.dart
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// 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.
-
-#library("test_config_utils");
-
-/**
- * TestUtils is a collection of utility methods used to write
- * test_config.dart scripts for test suites.
- */
-class TestUtils {
-
- /**
- * Get a list of argument lists for the dart shell command.
- */
- static List<List<String>> argumentLists(String filename,
- Map optionsFromFile,
- Map configuration) {
- List args = ["--ignore-unrecognized-flags"];
- if (configuration["checked"]) {
- args.add("--enable_type_checks");
- }
- if (configuration["component"] == "leg") {
- args.add("--enable_leg");
- }
- if (configuration["component"] == "dartc") {
- if (configuration["mode"] == "release") {
- args.add("--optimize");
- }
- }
-
- List<String> dartOptions = optionsFromFile["dartOptions"];
- args.addAll(dartOptions == null ? [filename] : dartOptions);
-
- var result = new List<List<String>>();
- List<List<String>> vmOptionsList = optionsFromFile["vmOptions"];
- if (vmOptionsList.isEmpty()) {
- result.add(args);
- } else {
- for (var vmOptions in vmOptionsList) {
- vmOptions.addAll(args);
- result.add(vmOptions);
- }
- }
-
- return result;
- }
-
- /**
- * Extract test options from the test file itself.
- */
- static Map optionsFromFile(String filename, Map configuration) {
- RegExp testOptionsRegExp = const RegExp(@"// VMOptions=(.*)");
- RegExp dartOptionsRegExp = const RegExp(@"// DartOptions=(.*)");
-
- // Read the entire file into a byte buffer and transform it to a
- // String. This will treat the file as ascii but the only parts
- // we are interested in will be ascii in any case.
- File file = new File(filename);
- file.openSync();
- List chars = new List(file.lengthSync());
- var offset = 0;
- while (offset != chars.length) {
- offset += file.readListSync(chars, offset, chars.length - offset);
- }
- file.closeSync();
- String contents = new String.fromCharCodes(chars);
- chars = null;
-
- // Find the options in the file.
- List<List> result = new List<List>();
- List<String> dartOptions;
- bool isNegative = false;
-
- Iterable<Match> matches = testOptionsRegExp.allMatches(contents);
- for (var match in matches) {
- result.add(match[1].split(' ').filter((e) => e != ''));
- }
-
- matches = dartOptionsRegExp.allMatches(contents);
- for (var match in matches) {
- if (dartOptions != null) {
- throw new Exception(
- 'More than one "// DartOptions=" line in test $filename');
- }
- dartOptions = match[1].split(' ').filter((e) => e != '');
- }
-
- if (contents.contains("@compile-error") ||
- contents.contains("@runtime-error")) {
- isNegative = true;
- } else if (contents.contains("@dynamic-type-error") &&
- configuration['checked']) {
- isNegative = true;
- }
-
- return { "vmOptions": result,
- "dartOptions": dartOptions,
- "isNegative" : isNegative };
- }
-}
« no previous file with comments | « tools/test.dart ('k') | tools/testing/dart/test_options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698