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

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

Issue 239003002: Reduce test.dart memory usage. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added cleared check. Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/testing/dart/multitest.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/testing/dart/test_runner.dart
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index a3d59b9b560e4b082dacf3237ef39a2d5ce17c8e..5d8a1d8b6d1b41e27aac87c4d802d04213063a6d 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -576,10 +576,16 @@ class MakeSymlinkCommand extends ScriptCommand {
class CommandBuilder {
static final CommandBuilder instance = new CommandBuilder._();
+ bool _cleared = false;
final _cachedCommands = new Map<Command, Command>();
CommandBuilder._();
+ void clearCommandCache() {
+ _cachedCommands.clear();
+ _cleared = true;
+ }
+
ContentShellCommand getContentShellCommand(String executable,
String htmlFile,
List<String> options,
@@ -674,6 +680,10 @@ class CommandBuilder {
// We check if this command has already been built.
// If so, we return the cached one. Otherwise we
// store the one given as [command] argument.
+ if (_cleared) {
+ throw new Exception(
+ "CommandBuilder.get[type]Command called after cache cleared");
+ }
var cachedCommand = _cachedCommands[command];
if (cachedCommand != null) {
return cachedCommand;
@@ -824,7 +834,7 @@ class UnittestSuiteMessagesMixin {
return testOutput.contains("unittest-suite-wait-for-done");
}
- bool _isAsyncTestSuccessfull(String testOutput) {
+ bool _isAsyncTestSuccessful(String testOutput) {
return testOutput.contains("unittest-suite-success");
}
@@ -835,7 +845,7 @@ class UnittestSuiteMessagesMixin {
// TODO: maybe we should introduce a AsyncIncomplete marker or so
if (outcome == Expectation.PASS) {
if (_isAsyncTest(testOutput) &&
- !_isAsyncTestSuccessfull(testOutput)) {
+ !_isAsyncTestSuccessful(testOutput)) {
return Expectation.FAIL;
}
}
@@ -2278,7 +2288,7 @@ class CommandEnqueuer {
* [CommandQueue] will listen for nodes entering the NodeState.ENQUEUING state,
* queue them up and run them. While nodes are processed they will be in the
* NodeState.PROCESSING state. After running a command, the node will change
- * to a state of NodeState.Successfull or NodeState.Failed.
+ * to a state of NodeState.Successful or NodeState.Failed.
*
* It provides a synchronous stream [completedCommands] which provides the
* [CommandOutputs] for the finished commands.
@@ -2322,7 +2332,7 @@ class CommandQueue {
}
});
// We're finished if the graph is sealed and all nodes are in a finished
- // state (Successfull, Failed or UnableToRun).
+ // state (Successful, Failed or UnableToRun).
// So we're calling '_checkDone()' to check whether that condition is met
// and we can cleanup.
graph.events.listen((dgraph.GraphEvent event) {
@@ -2651,7 +2661,7 @@ bool shouldRetryCommand(CommandOutput output) {
/*
* [TestCaseCompleter] will listen for
- * NodeState.Processing -> NodeState.{Successfull,Failed} state changes and
+ * NodeState.Processing -> NodeState.{Successful,Failed} state changes and
* will complete a TestCase if it is finished.
*
* It provides a stream [finishedTestCases], which will stream all TestCases
@@ -2684,7 +2694,7 @@ class TestCaseCompleter {
_checkDone();
});
- // Listen for NodeState.Processing -> NodeState.{Successfull,Failed}
+ // Listen for NodeState.Processing -> NodeState.{Successful,Failed}
// changes.
eventCondition((event) => event is dgraph.StateChangedEvent)
.listen((dgraph.StateChangedEvent event) {
@@ -2755,8 +2765,6 @@ class TestCaseCompleter {
class ProcessQueue {
Map _globalConfiguration;
- bool _allTestsWereEnqueued = false;
-
bool _listTests;
Function _allDone;
final dgraph.Graph _graph = new dgraph.Graph();
@@ -2916,6 +2924,10 @@ class ProcessQueue {
testCaseEnqueuer.enqueueTestSuites(testSuites);
}
+ void freeEnqueueingStructures() {
+ CommandBuilder.instance.clearCommandCache();
+ }
+
void eventFinishedTestCase(TestCase testCase) {
for (var listener in _eventListener) {
listener.done(testCase);
@@ -2929,6 +2941,7 @@ class ProcessQueue {
}
void eventAllTestsKnown() {
+ freeEnqueueingStructures();
for (var listener in _eventListener) {
listener.allTestsKnown();
}
« no previous file with comments | « tools/testing/dart/multitest.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698