| OLD | NEW |
| 1 #!/usr/bin/env dart_bin | 1 #!/usr/bin/env dart_bin |
| 2 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 #library("test"); | 6 #library("test"); |
| 7 | 7 |
| 8 #import("testing/dart/test_runner.dart"); | 8 #import("testing/dart/test_runner.dart"); |
| 9 #import("testing/dart/test_options.dart"); | 9 #import("testing/dart/test_options.dart"); |
| 10 | 10 |
| 11 #import("../tests/standalone/test_config.dart"); | 11 #import("../tests/standalone/test_config.dart"); |
| 12 #import("../tests/corelib/test_config.dart"); | 12 #import("../tests/corelib/test_config.dart"); |
| 13 | 13 |
| 14 | |
| 15 // TODO(ager): This activity tracking is temporary until stdout is | 14 // TODO(ager): This activity tracking is temporary until stdout is |
| 16 // closed implicitly when nothing more can happen. | 15 // closed implicitly when nothing more can happen. |
| 17 int pendingActivities = 0; | 16 int pendingActivities = 0; |
| 18 | 17 |
| 19 void onExit() { | |
| 20 stdout.write('\n'.charCodes()); | |
| 21 stdout.close(); | |
| 22 } | |
| 23 | |
| 24 void activityStarted() { | 18 void activityStarted() { |
| 25 pendingActivities++; | 19 ++pendingActivities; |
| 26 } | 20 } |
| 27 | 21 |
| 28 void activityCompleted() { | 22 void activityCompleted() { |
| 29 if (--pendingActivities == 0) onExit(); | 23 --pendingActivities; |
| 24 } |
| 25 |
| 26 void exitIfLastActivity() { |
| 27 if (pendingActivities == 1) { |
| 28 stdout.write('\n'.charCodes()); |
| 29 stdout.close(); |
| 30 } |
| 30 } | 31 } |
| 31 | 32 |
| 32 main() { | 33 main() { |
| 33 var optionsParser = new TestOptionsParser(); | 34 var optionsParser = new TestOptionsParser(); |
| 34 var configurations = optionsParser.parse(new Options().arguments); | 35 var configurations = optionsParser.parse(new Options().arguments); |
| 35 if (configurations == null) return; | 36 if (configurations == null) return; |
| 36 activityStarted(); | 37 activityStarted(); |
| 37 var queue = new ProcessQueue(configurations[0], activityCompleted); | 38 var queue = new ProcessQueue(configurations[0], exitIfLastActivity); |
| 38 for (var conf in configurations) { | 39 for (var conf in configurations) { |
| 39 activityStarted(); | 40 activityStarted(); |
| 40 new StandaloneTestSuite(conf).forEachTest(queue.runTest, activityCompleted); | 41 new StandaloneTestSuite(conf).forEachTest(queue.runTest, activityCompleted); |
| 41 activityStarted(); | 42 activityStarted(); |
| 42 new CorelibTestSuite(conf).forEachTest(queue.runTest, activityCompleted); | 43 new CorelibTestSuite(conf).forEachTest(queue.runTest, activityCompleted); |
| 43 } | 44 } |
| 44 } | 45 } |
| OLD | NEW |