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

Unified Diff: pkg/unittest/lib/compact_vm_config.dart

Issue 18811008: Tweak unittest compact config a bit and don't use it on bots. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | « pkg/barback/test/utils.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/compact_vm_config.dart
diff --git a/pkg/unittest/lib/compact_vm_config.dart b/pkg/unittest/lib/compact_vm_config.dart
index 7c4b0d696907051173f1dbcdeaddff409db1ad26..35bf19023310b0ed66c92e2a7ef34b7692a9370a 100644
--- a/pkg/unittest/lib/compact_vm_config.dart
+++ b/pkg/unittest/lib/compact_vm_config.dart
@@ -17,6 +17,7 @@ import 'vm_config.dart';
const String _GREEN = '\u001b[32m';
const String _RED = '\u001b[31m';
const String _NONE = '\u001b[0m';
+
const int MAX_LINE = 80;
class CompactVMConfiguration extends VMConfiguration {
@@ -25,11 +26,12 @@ class CompactVMConfiguration extends VMConfiguration {
int _fail = 0;
void onInit() {
- super.onInit();
+ // On the bots, we need to output the "unittest-suite-..."
+ // boilerplate that the bots look for. On local machines, don't print it.
+ if (_runningOnBuildbot) super.onInit();
}
void onStart() {
- super.onStart();
_start = new DateTime.now();
}
@@ -57,21 +59,31 @@ class CompactVMConfiguration extends VMConfiguration {
}
}
+ void onDone(bool success) {
+ // On the bots, we need to output the "unittest-suite-..."
+ // boilerplate that the bots look for. On local machines, don't print it.
+ if (_runningOnBuildbot) super.onDone(success);
Siggi Cherem (dart-lang) 2013/07/11 00:26:31 we should at least exit with an appropriate exit c
Bob Nystrom 2013/07/11 16:42:15 Done.
+ }
+
String _indent(String str) {
return str.split("\n").map((line) => " $line").join("\n");
}
+ /// Returns whether we're running on a Dart build bot.
+ bool get _runningOnBuildbot =>
+ Platform.environment.containsKey('BUILDBOT_BUILDERNAME');
+
void onSummary(int passed, int failed, int errors, List<TestCase> results,
String uncaughtError) {
var success = false;
if (passed == 0 && failed == 0 && errors == 0 && uncaughtError == null) {
print('\nNo tests ran.');
} else if (failed == 0 && errors == 0 && uncaughtError == null) {
- _progressLine(_start, _pass, _fail, 'All tests pass', _GREEN);
- print('\nAll $passed tests passed.');
+ _progressLine(_start, _pass, _fail, 'All tests passed!', _NONE);
+ print('');
success = true;
} else {
- _progressLine(_start, _pass, _fail, 'Some tests fail', _RED);
+ _progressLine(_start, _pass, _fail, 'Some tests failed.', _RED);
print('');
if (uncaughtError != null) {
print('Top-level uncaught error: $uncaughtError');
@@ -94,10 +106,12 @@ class CompactVMConfiguration extends VMConfiguration {
buffer.write('+');
buffer.write(passed);
buffer.write(_NONE);
- if (failed != 0) buffer.write(_RED);
- buffer.write(' -');
- buffer.write(failed);
- if (failed != 0) buffer.write(_NONE);
+ if (failed != 0) {
+ buffer.write(_RED);
+ buffer.write(' -');
+ buffer.write(failed);
+ buffer.write(_NONE);
+ }
buffer.write(': ');
buffer.write(color);
@@ -171,6 +185,12 @@ class CompactVMConfiguration extends VMConfiguration {
}
void useCompactVMConfiguration() {
+ // If the test is running on the Dart buildbots, we don't want to use this
+ // config since it's output may not be what the bots expect.
+ if (Platform.environment.containsKey('BUILDBOT_BUILDERNAME')) {
Siggi Cherem (dart-lang) 2013/07/11 00:26:31 if we don't set it altogether in the build bots, d
Bob Nystrom 2013/07/11 16:42:15 Oh, no. That was old stale code. Removed.
+ return;
+ }
+
unittestConfiguration = _singleton;
}
« no previous file with comments | « pkg/barback/test/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698