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

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

Issue 10911205: Print error output from DumpRenderTree updater in test.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Do not commit injected error. Created 8 years, 3 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 | « no previous file | tools/testing/dart/test_suite.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 #library("drt_updater"); 5 #library("drt_updater");
6 6
7 #import("dart:io"); 7 #import("dart:io");
8 8
9 class _DartiumUpdater { 9 class _DartiumUpdater {
10 String name; 10 String name;
11 String script; 11 String script;
12 String option; 12 String option;
13 13
14 bool isActive = false; 14 bool isActive = false;
15 bool updated = false; 15 bool updated = false;
16 List onUpdated; 16 List onUpdated;
17 17
18 Process _updatingProcess; 18 Future<ProcessResult> _updatingProcess;
19 19
20 _DartiumUpdater(this.name, this.script, [this.option = null]); 20 _DartiumUpdater(this.name, this.script, [this.option = null]);
21 21
22 void update() { 22 void update() {
23 if (!isActive) { 23 if (!isActive) {
24 isActive = true; 24 isActive = true;
25 print('Updating $name.'); 25 print('Updating $name.');
26 onUpdated = [() {updated = true;} ]; 26 onUpdated = [() {updated = true;} ];
27 _updatingProcess = Process.start('python', _getUpdateCommand); 27 _updatingProcess = Process.run('python', _getUpdateCommand);
28 _updatingProcess.onExit = _onUpdatedHandler; 28 _updatingProcess.handleException((e) {
29 _updatingProcess.onError = (error) { 29 print("Error starting $script process: $e");
30 print("Error starting $script process: $error"); 30 return false;
31 _onUpdatedHandler(-1); // Continue anyway. 31 });
32 }; 32 _updatingProcess.then(_onUpdatedHandler);
33 } 33 }
34 } 34 }
35 35
36 List<String> get _getUpdateCommand { 36 List<String> get _getUpdateCommand {
37 String scriptPath = new Options().script.replaceAll('\\', '/'); 37 Path testScriptPath = new Path.fromNative(new Options().script);
38 String toolsDir = scriptPath.substring(0, scriptPath.lastIndexOf('/')); 38 Path updateScriptPath = testScriptPath.directoryPath.append(script);
39 List<String> command = ['$toolsDir/$script']; 39 List<String> command = [updateScriptPath.toNativePath()];
40 if (null !== option) { 40 if (null !== option) {
41 command.add(option); 41 command.add(option);
42 } 42 }
43 return command; 43 return command;
44 } 44 }
45 45
46 void _onUpdatedHandler(int exit_code) { 46 void _onUpdatedHandler(ProcessResult result) {
47 print('$name updated ($exit_code)'); 47 if (result.exitCode == 0) {
48 print('$name updated');
49 } else {
50 print('Failure updating $name');
51 print(' Exit code: ${result.exitCode}');
52 print(result.stdout);
53 print(result.stderr);
54 exit(1);
55 }
48 for (var callback in onUpdated ) callback(); 56 for (var callback in onUpdated ) callback();
49 } 57 }
50 } 58 }
51 59
52 _DartiumUpdater _dumpRenderTreeUpdater; 60 _DartiumUpdater _dumpRenderTreeUpdater;
53 _DartiumUpdater _dartiumUpdater; 61 _DartiumUpdater _dartiumUpdater;
54 62
55 _DartiumUpdater runtimeUpdater(Map configuration) { 63 _DartiumUpdater runtimeUpdater(Map configuration) {
56 String runtime = configuration['runtime']; 64 String runtime = configuration['runtime'];
57 if (runtime == 'drt' && configuration['drt'] == '') { 65 if (runtime == 'drt' && configuration['drt'] == '') {
58 // Download the default DumpRenderTree from Google Storage. 66 // Download the default DumpRenderTree from Google Storage.
59 if (_dumpRenderTreeUpdater === null) { 67 if (_dumpRenderTreeUpdater === null) {
60 _dumpRenderTreeUpdater = new _DartiumUpdater('DumpRenderTree', 68 _dumpRenderTreeUpdater = new _DartiumUpdater('DumpRenderTree',
61 'get_archive.py', 'drt'); 69 'get_archive.py', 'drt');
62 } 70 }
63 return _dumpRenderTreeUpdater; 71 return _dumpRenderTreeUpdater;
64 } else if (runtime == 'dartium' && configuration['dartium'] == '') { 72 } else if (runtime == 'dartium' && configuration['dartium'] == '') {
65 // Download the default Dartium from Google Storage. 73 // Download the default Dartium from Google Storage.
66 if (_dartiumUpdater === null) { 74 if (_dartiumUpdater === null) {
67 _dartiumUpdater = new _DartiumUpdater('Dartium Chrome', 'get_archive.py', 75 _dartiumUpdater = new _DartiumUpdater('Dartium Chrome', 'get_archive.py',
68 'dartium'); 76 'dartium');
69 } 77 }
70 return _dartiumUpdater; 78 return _dartiumUpdater;
71 } else { 79 } else {
72 return null; 80 return null;
73 } 81 }
74 } 82 }
OLDNEW
« no previous file with comments | « no previous file | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698