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

Side by Side Diff: utils/testrunner/pipeline_task.dart

Issue 10977069: New testrunner that runs the test pipleine in an isolate. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /**
6 * A test execution pipeline is made up of a list of tasks. Each task is a
7 * subclass of [PipelineTask].
8 */
9 abstract class PipelineTask {
10
11 abstract execute(Path testfile, List stdout, List stderr,
12 bool logging, Function exitHandler);
13
14 void cleanup(Path testfile, List stdout, List stderr,
15 bool verboseLogging, bool keepTestFiles) {
16 }
17
18 void deleteFiles(List templates, Path testfile, bool logging, bool keepFiles,
19 List stdout) {
20 if (!keepFiles) {
21 for (var template in templates) {
22 var fname = expandMacros(template, testfile);
23 if (deleteFile(fname)) {
24 if (logging) {
25 stdout.add('Removed $fname');
26 }
27 } else {
28 if (logging) {
29 stdout.add('Failed to remove $fname');
30 }
31 }
32 }
33 }
34 }
35
36 String flattenPath(String path) {
37 return makePathAbsolute(path).
38 replaceAll(Platform.pathSeparator, "_").
39 replaceAll(":","");
40 }
41
42 // This takes a string used in a template and does macro expansion for
43 // a specific test file.
44 String expandMacros(String template, Path testfile) {
45 String path = makePathAbsolute(testfile.directoryPath.toString());
46 return template.
47 replaceAll(Macros.fullFilePath, testfile.toNativePath()).
48 replaceAll(Macros.filenameNoExtension,
49 testfile.filenameWithoutExtension).
50 replaceAll(Macros.filename, testfile.filename).
51 replaceAll(Macros.directory, path).
52 replaceAll(Macros.flattenedDirectory, flattenPath(path));
53 }
54 }
55
56
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698