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

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

Issue 9003017: Use blocking file access in tools/test.dart for multitest creation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/multitest.dart
diff --git a/tools/testing/dart/multitest.dart b/tools/testing/dart/multitest.dart
index 04a040c954d0d2f1d55fe3a268d190a8876a8798..1ebbe847db07a77a3f1e2675b02e42510f33171f 100644
--- a/tools/testing/dart/multitest.dart
+++ b/tools/testing/dart/multitest.dart
@@ -113,7 +113,6 @@ void ExtractTestsFromMultitest(String filename,
}
}
Bill Hesse 2011/12/30 16:12:23 Oops.
-
void DoMultitest(String filename,
String outputDir,
String testDir,
@@ -131,62 +130,26 @@ void DoMultitest(String filename,
int start = filename.lastIndexOf(pathSeparator) + 1;
int end = filename.indexOf('.dart', start);
String baseFilename = filename.substring(start, end);
- Iterator currentKey = tests.getKeys().iterator();
- WriteMultitestToFileAndQueueIt(tests,
- outcomes,
- currentKey,
- '$directory$pathSeparator$baseFilename',
- doTest,
- multitestDone);
-}
-
+ for (String key in tests.getKeys()) {
+ final String filename = '$directory/${baseFilename}_$key.dart';
+ final File file = new File(filename);
-// Write multiple tests to files, using tail recursion in a callback
-// to serialize the file operations, rather than opening all files at once.
-WriteMultitestToFileAndQueueIt(Map<String, String> tests,
- Map<String, String> outcomes,
- Iterator currentKey,
- String basePath,
- Function doTest,
- Function done) {
- if (!currentKey.hasNext()) {
- done();
- return;
- }
- final String key = currentKey.next();
- final String filename = '${basePath}_$key.dart';
- final File file = new File(filename);
- file.errorHandler = (error) {
- Expect.fail("Error creating temp file: $error");
- };
- file.createHandler = () {
- file.open(writable: true);
- };
- file.openHandler = (RandomAccessFile openedFile) {
- openedFile.noPendingWriteHandler =() {
- openedFile.close();
- };
- openedFile.closeHandler = () {
- var outcome = outcomes[key];
- bool enableFatalTypeErrors = outcome.contains('static type error');
- bool isNegative = (outcome.contains('compile-time error') ||
- outcome.contains('runtime error'));
- bool isNegativeIfChecked = outcome.contains('dynamic type error');
- doTest(filename,
- isNegative,
- isNegativeIfChecked,
- enableFatalTypeErrors);
- WriteMultitestToFileAndQueueIt(tests,
- outcomes,
- currentKey,
- basePath,
- doTest,
- done);
- };
+ file.createSync();
+ RandomAccessFile openedFile = file.openSync(writable: true);
var bytes = tests[key].charCodes();
- openedFile.writeList(bytes, 0, bytes.length);
- };
- file.create();
+ openedFile.writeListSync(bytes, 0, bytes.length);
+ openedFile.closeSync();
+ var outcome = outcomes[key];
+ bool enableFatalTypeErrors = outcome.contains('static type error');
+ bool isNegative = (outcome.contains('compile-time error') ||
+ outcome.contains('runtime error'));
+ bool isNegativeIfChecked = outcome.contains('dynamic type error');
+ doTest(filename,
+ isNegative,
+ isNegativeIfChecked,
+ enableFatalTypeErrors);
+ }
+ multitestDone();
}
String CreateMultitestDirectory(String outputDir, String testDir) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698