Chromium Code Reviews| Index: tools/testing/dart/test_runner.dart |
| diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart |
| index 8a720d6faf3f7f96e8231e0f5acefb5e49db981d..19cb37f9c1545a8c14db99f9809cfd6c19dfe6f8 100644 |
| --- a/tools/testing/dart/test_runner.dart |
| +++ b/tools/testing/dart/test_runner.dart |
| @@ -43,11 +43,12 @@ class TestCase { |
| String executablePath; |
| List<String> arguments; |
| String commandLine; |
| + String displayName; |
| TestOutput output; |
| Set<String> expectedOutcomes; |
| Function completedHandler; |
| - TestCase(this.executablePath, this.arguments, |
| + TestCase(this.displayName, this.executablePath, this.arguments, |
| this.completedHandler, this.expectedOutcomes) { |
| commandLine = executablePath; |
| for (var arg in arguments) { |
| @@ -154,3 +155,65 @@ class RunningProcess { |
| } |
| } |
| + |
| +class ProcessQueue { |
| + int numProcesses = 0; |
| + final int maxProcesses = 4; |
|
Mads Ager (google)
2011/11/08 08:26:06
Let's do this right and take this as an argument?
|
| + Queue<TestCase> tests; |
| + |
| + ProcessQueue(this.tests); |
| + |
| + runTests() { |
| + print(" ***"); |
|
Mads Ager (google)
2011/11/08 08:26:06
Remove.
Bill Hesse
2011/11/08 14:38:56
Done.
|
| + while (numProcesses < maxProcesses && !tests.isEmpty()) { |
| + TestCase test = tests.removeFirst(); |
| + print("running ${test.displayName}"); |
|
Mads Ager (google)
2011/11/08 08:26:06
Add a TODO here to refactor this into various test
Bill Hesse
2011/11/08 14:38:56
Done.
|
| + Function old_callback = test.completedHandler; |
|
Mads Ager (google)
2011/11/08 08:26:06
Why do you extract old_callback here? Why not just
Bill Hesse
2011/11/08 14:38:56
I think that won't work. We will call the current
|
| + Function wrapper = (TestCase test_arg) { |
| + numProcesses--; |
| + print("finished ${test_arg.displayName}"); |
| + runTests(); |
| + old_callback(test_arg); |
| + }; |
| + test.completedHandler = wrapper; |
| + |
| + new RunningProcess(test, 60).start(); |
|
Mads Ager (google)
2011/11/08 08:26:06
Add TODO here to take the actual timeout informati
Bill Hesse
2011/11/08 14:38:56
Done.
|
| + numProcesses++; |
| + } |
| + } |
| +} |
| + |
| + |
| +class AsyncProcessQueue { |
|
Mads Ager (google)
2011/11/08 08:26:06
Let's switch the names. This should be the Process
Bill Hesse
2011/11/08 14:38:56
Only Async version provided, called ProcessQueue.
|
| + int numProcesses = 0; |
| + final int maxProcesses = 4; |
|
Mads Ager (google)
2011/11/08 08:26:06
Let's pass in the actual number of processors?
Bill Hesse
2011/11/08 14:38:56
Done.
|
| + Queue<TestCase> tests; |
| + |
| + AsyncProcessQueue() : tests = new Queue<TestCase>(); |
| + |
| + runTests() { |
| + print(" ***"); |
|
Mads Ager (google)
2011/11/08 08:26:06
Remove.
Bill Hesse
2011/11/08 14:38:56
Done.
|
| + while (numProcesses < maxProcesses && !tests.isEmpty()) { |
|
Mads Ager (google)
2011/11/08 08:26:06
I don't think you need the while loop here. You ar
Bill Hesse
2011/11/08 14:38:56
Done.
|
| + TestCase test = tests.removeFirst(); |
| + print("running ${test.displayName}"); |
| + Function old_callback = test.completedHandler; |
| + Function wrapper = (TestCase test_arg) { |
| + numProcesses--; |
| + print("finished ${test_arg.displayName}"); |
| + runTests(); |
| + old_callback(test_arg); |
| + }; |
| + test.completedHandler = wrapper; |
| + |
| + new RunningProcess(test, 60).start(); |
| + numProcesses++; |
| + } |
| + } |
| + |
| + runTest(TestCase test) { |
| + tests.add(test); |
| + runTests(); |
| + } |
| + |
| +} |
| + |