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

Unified Diff: tests/standalone/test_config.dart

Issue 8574052: Start extracting common test_config.dart functionality into a utility library. (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
Index: tests/standalone/test_config.dart
diff --git a/tests/standalone/test_config.dart b/tests/standalone/test_config.dart
index 786c387381db380cb7169de290d5ec8cdd96adc4..71ced2f9a3dbdc531b3d40ef77eb2e40ad3d4d61 100644
--- a/tests/standalone/test_config.dart
+++ b/tests/standalone/test_config.dart
@@ -4,8 +4,9 @@
#library("standalone_test_config");
-#import("../../tools/testing/dart/test_runner.dart");
#import("../../tools/testing/dart/status_file_parser.dart");
+#import("../../tools/testing/dart/test_config_utils.dart");
+#import("../../tools/testing/dart/test_runner.dart");
class StandaloneTestSuite {
String directoryPath = "tests/standalone/src";
@@ -61,81 +62,22 @@ class StandaloneTestSuite {
if (expectations.contains(SKIP)) return;
- List args = ["--ignore-unrecognized-flags"];
- if (configuration["checked"]) {
- args.add("--enable_type_checks");
- }
- if (configuration["component"] == "leg") {
- args.add("--enable_leg");
- }
-
- var optionsFromFile = testOptions(filename);
- List<List<String>> optionsList = optionsFromFile["vmOptions"];
- List<String> dartOptions = optionsFromFile["dartOptions"];
- args.addAll(dartOptions == null ? [filename] : dartOptions);
-
- if (optionsList.isEmpty()) {
+ var optionsFromFile = TestUtils.optionsFromFile(filename, configuration);
+ var argumentLists =
+ TestUtils.argumentLists(filename, optionsFromFile, configuration);
+ for (var args in argumentLists) {
+ var timeout = configuration['timeout'];
+ var isNegative = optionsFromFile['isNegative'];
doTest(new TestCase(testName,
shellPath,
args,
- configuration["timeout"],
+ timeout,
completeHandler,
- expectations));
- } else {
- for (var options in optionsList) {
- options.addAll(args);
- doTest(new TestCase(testName,
- shellPath,
- options,
- configuration["timeout"],
- completeHandler,
- expectations));
- }
+ expectations,
+ isNegative));
}
}
- Map testOptions(String filename) {
- // Since '.*' does not match a newline these RegExps can be used
- // on the entire contents of files instead of individual lines.
- 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 != '');
- }
-
- return { "vmOptions": result, "dartOptions": dartOptions };
- }
-
void completeHandler(TestCase testCase) {
}
}

Powered by Google App Engine
This is Rietveld 408576698