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

Unified Diff: packages/charted/tool/hop_runner.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 | « packages/charted/tool/build_unicode_segmentation_data.dart ('k') | packages/cli_util/.gitignore » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/charted/tool/hop_runner.dart
diff --git a/packages/charted/tool/hop_runner.dart b/packages/charted/tool/hop_runner.dart
new file mode 100644
index 0000000000000000000000000000000000000000..36bdde210634ac3aa0f29534a138c304021f6305
--- /dev/null
+++ b/packages/charted/tool/hop_runner.dart
@@ -0,0 +1,48 @@
+//
+// Copyright 2014 Google Inc. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file or at
+// https://developers.google.com/open-source/licenses/bsd
+//
+
+library charted.tool.hop_runner;
+
+import 'package:hop/hop.dart';
+import 'dart:io';
+
+main(List<String> args) {
+ addTask('unit-test', createUnitTestsTask());
+ runHop(args);
+}
+
+Task createUnitTestsTask() =>
+ new Task((TaskContext context) {
+ context.info("Running tests...");
+ return Process.run('./content_shell',
+ ['--dump-render-tree','test/test_in_browser.html']).
+ then((ProcessResult process) =>
+ checkTestsOutput(context, process));
+ });
+
+/// Reads the output from content_shell and checks for number of tests
+/// passed/failed/erred. This method requires that the tests be done
+/// in simple html unit test configuration - useHtmlConfiguration().
+void checkTestsOutput(TaskContext context, ProcessResult process) {
+ var output = (process.stdout as String),
+ failRegEx = new RegExp(r"^[0-9]+\s+FAIL\s"),
+ errorRegEx = new RegExp(r"^[0-9]+\s+ERROR\s"),
+ failCount = 0,
+ errorCount = 0;
+
+ context.info(output);
+
+ for (var line in output.split('\n')) {
+ if (line.contains(failRegEx)) failCount++;
+ if (line.contains(errorRegEx)) errorCount++;
+ }
+
+ if (failCount + errorCount > 0) {
+ context.fail('FAIL: $failCount\nERROR: $errorCount');
+ }
+}
« no previous file with comments | « packages/charted/tool/build_unicode_segmentation_data.dart ('k') | packages/cli_util/.gitignore » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698