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

Unified Diff: pkg/compiler/tool/status_files/log_parser.dart

Issue 2996533002: Add utility tool to update .status files automatically (Closed)
Patch Set: remove editbuffer Created 3 years, 4 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 | « no previous file | pkg/compiler/tool/status_files/record.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/tool/status_files/log_parser.dart
diff --git a/pkg/compiler/tool/status_files/log_parser.dart b/pkg/compiler/tool/status_files/log_parser.dart
new file mode 100644
index 0000000000000000000000000000000000000000..964fba380b803a970a4813cee89ef2af993fe5f8
--- /dev/null
+++ b/pkg/compiler/tool/status_files/log_parser.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library status_files.log_parser;
+
+import 'record.dart';
+
+/// Extracts test records from a test.py [log].
+List<Record> parse(String log) {
+ var records = [];
+ var suite;
+ var test;
+ var config;
+ var expected;
+ var actual;
+ bool reproIsNext = false;
+ for (var line in log.split('\n')) {
+ if (line.startsWith("FAILED: ")) {
+ int space = line.lastIndexOf(' ');
+ test = line.substring(space + 1).trim();
+ suite = '';
+ var slash = test.indexOf('/');
+ if (slash > 0) {
+ suite = test.substring(0, slash).trim();
+ test = test.substring(slash + 1).trim();
+ }
+ config = line
+ .substring("FAILED: ".length, space)
+ .replaceAll('release_ia32', '')
+ .replaceAll('release_x64', '');
+ }
+ if (line.startsWith("Expected: ")) {
+ expected = line.substring("Expected: ".length).trim();
+ }
+ if (line.startsWith("Actual: ")) {
+ actual = line.substring("Actual: ".length).trim();
+ }
+ if (reproIsNext) {
+ records
+ .add(new Record(suite, test, config, expected, actual, line.trim()));
+ suite = test = config = expected = actual = null;
+ reproIsNext = false;
+ }
+ if (line.startsWith("Short reproduction command (experimental):")) {
+ reproIsNext = true;
+ }
+ }
+ return records;
+}
« no previous file with comments | « no previous file | pkg/compiler/tool/status_files/record.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698