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

Side by Side Diff: pkg/compiler/tool/status_files/log_parser.dart

Issue 2999753002: Collate stacks in test output (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library status_files.log_parser; 5 library status_files.log_parser;
6 6
7 import 'record.dart'; 7 import 'record.dart';
8 8
9 final RegExp _stackRE = new RegExp('#[0-9]* ');
10
9 /// Extracts test records from a test.py [log]. 11 /// Extracts test records from a test.py [log].
10 List<Record> parse(String log) { 12 List<Record> parse(String log) {
11 var records = []; 13 var records = [];
12 var suite; 14 var suite;
13 var test; 15 var test;
14 var config; 16 var config;
15 var expected; 17 var expected;
16 var actual; 18 var actual;
17 var reason; 19 var reason;
20 var fullReason; // lines before stack, usually multiline reason.
21 var stack = [];
22 var paragraph = []; // collector forlines
Siggi Cherem (dart-lang) 2017/08/09 18:08:02 forlines? for fullReason?
sra1 2017/08/09 20:15:13 Done.
18 bool reproIsNext = false; 23 bool reproIsNext = false;
19 for (var line in log.split('\n')) { 24 for (var line in log.split('\n')) {
20 if (line.startsWith("FAILED: ")) { 25 if (line.startsWith("FAILED: ")) {
21 int space = line.lastIndexOf(' '); 26 int space = line.lastIndexOf(' ');
22 test = line.substring(space + 1).trim(); 27 test = line.substring(space + 1).trim();
23 suite = ''; 28 suite = '';
24 var slash = test.indexOf('/'); 29 var slash = test.indexOf('/');
25 if (slash > 0) { 30 if (slash > 0) {
26 suite = test.substring(0, slash).trim(); 31 suite = test.substring(0, slash).trim();
27 test = test.substring(slash + 1).trim(); 32 test = test.substring(slash + 1).trim();
28 } 33 }
29 config = line 34 config = line
30 .substring("FAILED: ".length, space) 35 .substring("FAILED: ".length, space)
31 .replaceAll('release_ia32', '') 36 .replaceAll('release_ia32', '')
32 .replaceAll('release_x64', ''); 37 .replaceAll('release_x64', '');
33 } 38 }
34 if (line.startsWith("Expected: ")) { 39 if (line.startsWith("Expected: ")) {
35 expected = line.substring("Expected: ".length).trim(); 40 expected = line.substring("Expected: ".length).trim();
36 } 41 }
37 if (line.startsWith("Actual: ")) { 42 if (line.startsWith("Actual: ")) {
38 actual = line.substring("Actual: ".length).trim(); 43 actual = line.substring("Actual: ".length).trim();
39 } 44 }
40 if (line.startsWith("The compiler crashed:")) { 45 if (line.startsWith("The compiler crashed:")) {
41 reason = line.substring("The compiler crashed:".length).trim(); 46 reason = line.substring("The compiler crashed:".length).trim();
47 paragraph.clear();
42 } 48 }
49
50 if (line.startsWith(_stackRE)) {
51 stack.add(line);
52 fullReason ??= paragraph.take(5).join('\n');
53 paragraph.clear();
54 } else {
55 paragraph.add(line);
56 }
57
43 if (reproIsNext) { 58 if (reproIsNext) {
44 records.add(new Record( 59 records.add(new Record(suite, test, config, expected, actual, reason,
45 suite, test, config, expected, actual, reason, line.trim())); 60 line.trim(), fullReason, stack));
46 suite = test = config = expected = actual = reason = null; 61 suite = test = config = expected = actual = reason = null;
62 stack = [];
63 fullReason = null;
64 paragraph.clear();
47 reproIsNext = false; 65 reproIsNext = false;
48 } 66 }
49 if (line.startsWith("Short reproduction command (experimental):")) { 67 if (line.startsWith("Short reproduction command (experimental):")) {
50 reproIsNext = true; 68 reproIsNext = true;
51 } 69 }
52 } 70 }
53 return records; 71 return records;
54 } 72 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/tool/status_files/record.dart » ('j') | pkg/compiler/tool/status_files/stacks.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698