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

Side by Side Diff: tools/testing/dart/test_suite.dart

Issue 11883033: Fixed utf8 encoding/decoding issues in the testing scripts (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/testing/dart/test_runner.dart ('k') | tools/testing/dart/utils.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** 5 /**
6 * Classes and methods for enumerating and preparing tests. 6 * Classes and methods for enumerating and preparing tests.
7 * 7 *
8 * This library includes: 8 * This library includes:
9 * 9 *
10 * - Creating tests by listing all the Dart files in certain directories, 10 * - Creating tests by listing all the Dart files in certain directories,
11 * and creating [TestCase]s for those files that meet the relevant criteria. 11 * and creating [TestCase]s for those files that meet the relevant criteria.
12 * - Preparing tests, including copying files and frameworks to temporary 12 * - Preparing tests, including copying files and frameworks to temporary
13 * directories, and computing the command line and arguments to be run. 13 * directories, and computing the command line and arguments to be run.
14 */ 14 */
15 library test_suite; 15 library test_suite;
16 16
17 import "dart:async"; 17 import "dart:async";
18 import "dart:io"; 18 import "dart:io";
19 import "dart:isolate"; 19 import "dart:isolate";
20 import "dart:uri";
21 import "drt_updater.dart";
22 import "multitest.dart";
20 import "status_file_parser.dart"; 23 import "status_file_parser.dart";
21 import "test_runner.dart"; 24 import "test_runner.dart";
22 import "multitest.dart"; 25 import "utils.dart";
23 import "drt_updater.dart";
24 import "dart:uri";
25 import '../../../pkg/path/lib/path.dart' as pathLib; 26 import '../../../pkg/path/lib/path.dart' as pathLib;
26 27
27 part "browser_test.dart"; 28 part "browser_test.dart";
28 29
29 30
30 // TODO(rnystrom): Add to dart:core? 31 // TODO(rnystrom): Add to dart:core?
31 /** 32 /**
32 * A simple function that tests [arg] and returns `true` or `false`. 33 * A simple function that tests [arg] and returns `true` or `false`.
33 */ 34 */
34 typedef bool Predicate<T>(T arg); 35 typedef bool Predicate<T>(T arg);
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 RegExp leadingHashRegExp = new RegExp(r"^#", multiLine: true); 1303 RegExp leadingHashRegExp = new RegExp(r"^#", multiLine: true);
1303 RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)"); 1304 RegExp isolateStubsRegExp = new RegExp(r"// IsolateStubs=(.*)");
1304 // TODO(gram) Clean these up once the old directives are not supported. 1305 // TODO(gram) Clean these up once the old directives are not supported.
1305 RegExp domImportRegExp = 1306 RegExp domImportRegExp =
1306 new RegExp(r"^[#]?import.*dart:html", multiLine: true); 1307 new RegExp(r"^[#]?import.*dart:html", multiLine: true);
1307 RegExp libraryDefinitionRegExp = 1308 RegExp libraryDefinitionRegExp =
1308 new RegExp(r"^[#]?library[\( ]", multiLine: true); 1309 new RegExp(r"^[#]?library[\( ]", multiLine: true);
1309 RegExp sourceOrImportRegExp = 1310 RegExp sourceOrImportRegExp =
1310 new RegExp("^(#source|#import|part)[ \t]+[\('\"]", multiLine: true); 1311 new RegExp("^(#source|#import|part)[ \t]+[\('\"]", multiLine: true);
1311 1312
1312 // Read the entire file into a byte buffer and transform it to a 1313 var bytes = new File.fromPath(filePath).readAsBytesSync();
1313 // String. This will treat the file as ascii but the only parts 1314 String contents = decodeUtf8(bytes);
1314 // we are interested in will be ascii in any case. 1315 bytes = null;
1315 RandomAccessFile file = new File.fromPath(filePath).openSync(FileMode.READ);
1316 List chars = new List(file.lengthSync());
1317 var offset = 0;
1318 while (offset != chars.length) {
1319 offset += file.readListSync(chars, offset, chars.length - offset);
1320 }
1321 file.closeSync();
1322 String contents = new String.fromCharCodes(chars);
1323 chars = null;
1324 1316
1325 // Find the options in the file. 1317 // Find the options in the file.
1326 List<List> result = new List<List>(); 1318 List<List> result = new List<List>();
1327 List<String> dartOptions; 1319 List<String> dartOptions;
1328 String packageRoot; 1320 String packageRoot;
1329 bool hasCompileError = contents.contains("@compile-error"); 1321 bool hasCompileError = contents.contains("@compile-error");
1330 bool hasRuntimeError = contents.contains("@runtime-error"); 1322 bool hasRuntimeError = contents.contains("@runtime-error");
1331 bool isStaticClean = false; 1323 bool isStaticClean = false;
1332 1324
1333 Iterable<Match> matches = testOptionsRegExp.allMatches(contents); 1325 Iterable<Match> matches = testOptionsRegExp.allMatches(contents);
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 * $pass tests are expected to pass 1831 * $pass tests are expected to pass
1840 * $failOk tests are expected to fail that we won't fix 1832 * $failOk tests are expected to fail that we won't fix
1841 * $fail tests are expected to fail that we should fix 1833 * $fail tests are expected to fail that we should fix
1842 * $crash tests are expected to crash that we should fix 1834 * $crash tests are expected to crash that we should fix
1843 * $timeout tests are allowed to timeout 1835 * $timeout tests are allowed to timeout
1844 * $compileErrorSkip tests are skipped on browsers due to compile-time error 1836 * $compileErrorSkip tests are skipped on browsers due to compile-time error
1845 """; 1837 """;
1846 print(report); 1838 print(report);
1847 } 1839 }
1848 } 1840 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_runner.dart ('k') | tools/testing/dart/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698