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

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

Issue 22326004: test.py: Fix in CommandQueue to make sure we finish up correctly if an intermediate command failed (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | no next file » | 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 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.
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 } else { 1566 } else {
1567 newState = dgraph.NodeState.UnableToRun; 1567 newState = dgraph.NodeState.UnableToRun;
1568 } 1568 }
1569 } 1569 }
1570 if (node.state != newState) { 1570 if (node.state != newState) {
1571 _graph.changeState(node, newState); 1571 _graph.changeState(node, newState);
1572 } 1572 }
1573 } 1573 }
1574 } 1574 }
1575 1575
1576 // TODO(kustermann): Add support for '--list' and '--verbose'!
1577
1578 /* 1576 /*
1579 * [CommandQueue] will listen for nodes entering the NodeState.ENQUEUING state, 1577 * [CommandQueue] will listen for nodes entering the NodeState.ENQUEUING state,
1580 * queue them up and run them. While nodes are processed they will be in the 1578 * queue them up and run them. While nodes are processed they will be in the
1581 * NodeState.PROCESSING state. After running a command, the node will change 1579 * NodeState.PROCESSING state. After running a command, the node will change
1582 * to a state of NodeState.Successfull or NodeState.Failed. 1580 * to a state of NodeState.Successfull or NodeState.Failed.
1583 * 1581 *
1584 * It provides a synchronous stream [completedCommands] which provides the 1582 * It provides a synchronous stream [completedCommands] which provides the
1585 * [CommandOutputs] for the finished commands. 1583 * [CommandOutputs] for the finished commands.
1586 * 1584 *
1587 * It provides a [done] future, which will complete once there are no more 1585 * It provides a [done] future, which will complete once there are no more
(...skipping 27 matching lines...) Expand all
1615 graph.changeState(event.node, dgraph.NodeState.Processing); 1613 graph.changeState(event.node, dgraph.NodeState.Processing);
1616 var command = event.node.userData; 1614 var command = event.node.userData;
1617 if (event.node.dependencies.length > 0) { 1615 if (event.node.dependencies.length > 0) {
1618 _runQueue.addFirst(command); 1616 _runQueue.addFirst(command);
1619 } else { 1617 } else {
1620 _runQueue.add(command); 1618 _runQueue.add(command);
1621 } 1619 }
1622 Timer.run(() => _tryRunNextCommand()); 1620 Timer.run(() => _tryRunNextCommand());
1623 } 1621 }
1624 }); 1622 });
1625 eventCondition((event) => event is dgraph.GraphSealedEvent).listen((_) { 1623 // We're finished if the graph is sealed and all nodes are in a finished
1626 _checkDone(); 1624 // state (Successfull, Failed or UnableToRun).
1625 // So we're calling '_checkDone()' to check whether that condition is met
1626 // and we can cleanup.
1627 graph.events.listen((dgraph.GraphEvent event) {
1628 if (event is dgraph.GraphSealedEvent) {
1629 _checkDone();
1630 } else if (event is dgraph.StateChangedEvent) {
1631 if (event.to == dgraph.NodeState.UnableToRun) {
1632 _checkDone();
1633 }
1634 }
1627 }); 1635 });
1628 } 1636 }
1629 1637
1630 Stream<CommandOutput> get completedCommands => _commandOutputStream.stream; 1638 Stream<CommandOutput> get completedCommands => _commandOutputStream.stream;
1631 1639
1632 Future get done => _completer.future; 1640 Future get done => _completer.future;
1633 1641
1634 void _tryRunNextCommand() { 1642 void _tryRunNextCommand() {
1635 _checkDone(); 1643 _checkDone();
1636 1644
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1972 // [TestCase.isFinished] will return true if all commands were executed 1980 // [TestCase.isFinished] will return true if all commands were executed
1973 // or if a previous one failed. 1981 // or if a previous one failed.
1974 if (testCase.isFinished) { 1982 if (testCase.isFinished) {
1975 completeTestCase(testCase); 1983 completeTestCase(testCase);
1976 } 1984 }
1977 } 1985 }
1978 } 1986 }
1979 } 1987 }
1980 1988
1981 1989
1982
1983 class ProcessQueue { 1990 class ProcessQueue {
1984 Map _globalConfiguration; 1991 Map _globalConfiguration;
1985 1992
1986 bool _allTestsWereEnqueued = false; 1993 bool _allTestsWereEnqueued = false;
1987 1994
1988 bool _listTests; 1995 bool _listTests;
1989 Function _allDone; 1996 Function _allDone;
1990 final dgraph.Graph _graph = new dgraph.Graph(); 1997 final dgraph.Graph _graph = new dgraph.Graph();
1991 List<EventListener> _eventListener; 1998 List<EventListener> _eventListener;
1992 1999
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2073 } 2080 }
2074 } 2081 }
2075 2082
2076 void eventAllTestsDone() { 2083 void eventAllTestsDone() {
2077 for (var listener in _eventListener) { 2084 for (var listener in _eventListener) {
2078 listener.allDone(); 2085 listener.allDone();
2079 } 2086 }
2080 _allDone(); 2087 _allDone();
2081 } 2088 }
2082 } 2089 }
OLDNEW
« 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