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

Side by Side Diff: tests/corelib/test_config.dart

Issue 8565006: tools/test.dart: Enable // DartOptions= lines in Dart test runner. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add filename to exception. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/standalone/test_config.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library("corelib_test_config"); 5 #library("corelib_test_config");
6 6
7 #import("../../tools/testing/dart/test_runner.dart"); 7 #import("../../tools/testing/dart/test_runner.dart");
8 #import("../../tools/testing/dart/status_file_parser.dart"); 8 #import("../../tools/testing/dart/status_file_parser.dart");
9 9
10 class CorelibTestSuite { 10 class CorelibTestSuite {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // until they are handled correctly. 54 // until they are handled correctly.
55 if (expectations.contains(SKIP)) return; 55 if (expectations.contains(SKIP)) return;
56 56
57 List args = ["--ignore-unrecognized-flags"]; 57 List args = ["--ignore-unrecognized-flags"];
58 if (configuration["checked"]) { 58 if (configuration["checked"]) {
59 args.add("--enable_type_checks"); 59 args.add("--enable_type_checks");
60 } 60 }
61 if (configuration["component"] == "leg") { 61 if (configuration["component"] == "leg") {
62 args.add("--enable_leg"); 62 args.add("--enable_leg");
63 } 63 }
64 args.add(filename);
65 64
66 List<List> optionsList = testOptions(filename); 65 var optionsFromFile = testOptions(filename);
66 List<List<String>> optionsList = optionsFromFile["vmOptions"];
67 List<String> dartOptions = optionsFromFile["dartOptions"];
68 args.addAll(dartOptions == null ? [filename] : dartOptions);
69
67 if (optionsList.isEmpty()) { 70 if (optionsList.isEmpty()) {
68 doTest(new TestCase(testName, 71 doTest(new TestCase(testName,
69 shellPath, 72 shellPath,
70 args, 73 args,
71 configuration["timeout"], 74 configuration["timeout"],
72 completeHandler, 75 completeHandler,
73 expectations)); 76 expectations));
74 } else { 77 } else {
75 for (var options in optionsList) { 78 for (var options in optionsList) {
76 options.addAll(args); 79 options.addAll(args);
77 doTest(new TestCase(testName, 80 doTest(new TestCase(testName,
78 shellPath, 81 shellPath,
79 options, 82 options,
80 configuration["timeout"], 83 configuration["timeout"],
81 completeHandler, 84 completeHandler,
82 expectations)); 85 expectations));
83 } 86 }
84 } 87 }
85 } 88 }
86 89
87 List<List> testOptions(String filename) { 90 Map testOptions(String filename) {
88 RegExp testOptionsRegExp = const RegExp(@"// VMOptions=(.*)"); 91 RegExp testOptionsRegExp = const RegExp(@"// VMOptions=(.*)");
92 RegExp dartOptionsRegExp = const RegExp(@"// DartOptions=(.*)");
89 File file = new File(filename); 93 File file = new File(filename);
90 FileInputStream fileStream = file.openInputStream(); 94 FileInputStream fileStream = file.openInputStream();
91 StringInputStream lines = new StringInputStream(fileStream); 95 StringInputStream lines = new StringInputStream(fileStream);
92 96
93 List<List> result = new List<List>(); 97 List<List> result = new List<List>();
98 List<String> dartOptions;
94 String line; 99 String line;
95 while ((line = lines.readLine()) != null) { 100 while ((line = lines.readLine()) != null) {
96 Match match = testOptionsRegExp.firstMatch(line); 101 Match match = testOptionsRegExp.firstMatch(line);
97 if (match != null) { 102 if (match != null) {
98 result.add(match[1].split(' ').filter((e) => e != '')); 103 result.add(match[1].split(' ').filter((e) => e != ''));
99 } 104 }
105
106 match = dartOptionsRegExp.firstMatch(line);
107 if (match != null) {
108 if (dartOptions != null) {
109 throw new Exception(
110 'More than one "// DartOptions=" line in test $filename');
111 }
112 dartOptions = match[1].split(' ').filter((e) => e != '');
113 }
100 } 114 }
101 return result; 115 return {"vmOptions": result, "dartOptions": dartOptions};
102 } 116 }
103 117
104 void completeHandler(TestCase testCase) { 118 void completeHandler(TestCase testCase) {
105 } 119 }
106 } 120 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/test_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698