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

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

Issue 28533003: Capture and report stdout/stderr of the browser while running a test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
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 executing tests. 6 * Classes and methods for executing tests.
7 * 7 *
8 * This module includes: 8 * This module includes:
9 * - Managing parallel execution of tests, including timeout checks. 9 * - Managing parallel execution of tests, including timeout checks.
10 * - Evaluating the output of each test as pass/fail/crash/timeout. 10 * - Evaluating the output of each test as pass/fail/crash/timeout.
11 */ 11 */
12 library test_runner; 12 library test_runner;
13 13
14 import "dart:async"; 14 import "dart:async";
15 import "dart:collection" show Queue; 15 import "dart:collection" show Queue;
16 import "dart:convert" show LineSplitter, UTF8; 16 import "dart:convert" show LineSplitter, UTF8;
17 // We need to use the 'io' prefix here, otherwise io.exitCode will shadow 17 // We need to use the 'io' prefix here, otherwise io.exitCode will shadow
18 // CommandOutput.exitCode in subclasses of CommandOutput. 18 // CommandOutput.exitCode in subclasses of CommandOutput.
19 import "dart:io" as io; 19 import "dart:io" as io;
20 import "dart:isolate";
21 import "dart:math" as math; 20 import "dart:math" as math;
22 import 'dependency_graph.dart' as dgraph; 21 import 'dependency_graph.dart' as dgraph;
23 import "browser_controller.dart"; 22 import "browser_controller.dart";
24 import "http_server.dart" as http_server;
25 import "status_file_parser.dart"; 23 import "status_file_parser.dart";
26 import "test_progress.dart"; 24 import "test_progress.dart";
27 import "test_suite.dart"; 25 import "test_suite.dart";
28 import "utils.dart"; 26 import "utils.dart";
29 import 'record_and_replay.dart'; 27 import 'record_and_replay.dart';
30 28
31 const int CRASHING_BROWSER_EXITCODE = -10; 29 const int CRASHING_BROWSER_EXITCODE = -10;
32 const int SLOW_TIMEOUT_MULTIPLIER = 4; 30 const int SLOW_TIMEOUT_MULTIPLIER = 4;
33 31
34 const MESSAGE_CANNOT_OPEN_DISPLAY = 'Gtk-WARNING **: cannot open display'; 32 const MESSAGE_CANNOT_OPEN_DISPLAY = 'Gtk-WARNING **: cannot open display';
(...skipping 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after
1987 for (var runner in runners) { 1985 for (var runner in runners) {
1988 if (!runner._currentlyRunning) return runner; 1986 if (!runner._currentlyRunning) return runner;
1989 } 1987 }
1990 throw new Exception('Unable to find inactive batch runner.'); 1988 throw new Exception('Unable to find inactive batch runner.');
1991 } 1989 }
1992 1990
1993 Future<CommandOutput> _startBrowserControllerTest( 1991 Future<CommandOutput> _startBrowserControllerTest(
1994 BrowserTestCommand browserCommand, int timeout) { 1992 BrowserTestCommand browserCommand, int timeout) {
1995 var completer = new Completer<CommandOutput>(); 1993 var completer = new Completer<CommandOutput>();
1996 1994
1997 var callback = (output, delayUntilTestStarted, duration) { 1995 var callback = (BrowserTestOutput output) {
1998 bool timedOut = output == "TIMEOUT"; 1996 bool timedOut = output.didTimeout;
1999 String stderr = ""; 1997 String stderr = "";
2000 if (timedOut) { 1998 if (timedOut) {
2001 if (delayUntilTestStarted != null) { 1999 if (output.delayUntilTestStarted != null) {
2002 stderr = "This test timed out. The delay until the test was actually " 2000 stderr = "This test timed out. The delay until the test actually "
2003 "started was: $delayUntilTestStarted."; 2001 "started was: ${output.delayUntilTestStarted}.";
2004 } else { 2002 } else {
2005 stderr = "This test has not notified test.py that it started running." 2003 stderr = "This test has not notified test.py that it started running."
2006 " This could be a bug in test.py! " 2004 " This could be a bug in test.py! "
2007 "Please contact ricow/kustermann"; 2005 "Please contact ricow/kustermann";
2008 } 2006 }
2009 } 2007 }
2008 stderr = [stderr, '',
2009 'BrowserOutput while running the test (this may be incorrect):',
ricow1 2013/10/18 14:00:42 I would prefix this line with * EXPERIMENTAL * ins
kustermann 2013/10/18 15:28:27 Done.
2010 'BrowserOutput.stdout:', output.browserOutput.stdout.toString(),
2011 'BrowserOutput.stderr:', output.browserOutput.stderr.toString()]
2012 .join('\n');
ricow1 2013/10/18 14:00:42 why do you create an array here, why don't you jus
kustermann 2013/10/18 15:28:27 Done.
2010 var commandOutput = createCommandOutput(browserCommand, 2013 var commandOutput = createCommandOutput(browserCommand,
2011 0, 2014 0,
2012 timedOut, 2015 timedOut,
2013 encodeUtf8(output), 2016 encodeUtf8(output.dom),
2014 encodeUtf8(stderr), 2017 encodeUtf8(stderr),
2015 duration, 2018 output.duration,
2016 false); 2019 false);
2017 completer.complete(commandOutput); 2020 completer.complete(commandOutput);
2018 }; 2021 };
2019 BrowserTest browserTest = new BrowserTest(browserCommand.url, 2022 BrowserTest browserTest = new BrowserTest(browserCommand.url,
2020 callback, 2023 callback,
2021 timeout); 2024 timeout);
2022 _getBrowserTestRunner(browserCommand.browser).then((testRunner) { 2025 _getBrowserTestRunner(browserCommand.browser).then((testRunner) {
2023 testRunner.queueTest(browserTest); 2026 testRunner.queueTest(browserTest);
2024 }); 2027 });
2025 2028
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
2352 } 2355 }
2353 } 2356 }
2354 2357
2355 void eventAllTestsDone() { 2358 void eventAllTestsDone() {
2356 for (var listener in _eventListener) { 2359 for (var listener in _eventListener) {
2357 listener.allDone(); 2360 listener.allDone();
2358 } 2361 }
2359 _allDone(); 2362 _allDone();
2360 } 2363 }
2361 } 2364 }
OLDNEW
« tools/testing/dart/browser_controller.dart ('K') | « tools/testing/dart/browser_controller.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698