OLD | NEW |
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 /// Extracts test records from a test.py [log]. | 9 /// Extracts test records from a test.py [log]. |
10 List<Record> parse(String log) { | 10 List<Record> parse(String log) { |
11 var records = []; | 11 var records = []; |
12 var suite; | 12 var suite; |
13 var test; | 13 var test; |
14 var config; | 14 var config; |
15 var expected; | 15 var expected; |
16 var actual; | 16 var actual; |
| 17 var reason; |
17 bool reproIsNext = false; | 18 bool reproIsNext = false; |
18 for (var line in log.split('\n')) { | 19 for (var line in log.split('\n')) { |
19 if (line.startsWith("FAILED: ")) { | 20 if (line.startsWith("FAILED: ")) { |
20 int space = line.lastIndexOf(' '); | 21 int space = line.lastIndexOf(' '); |
21 test = line.substring(space + 1).trim(); | 22 test = line.substring(space + 1).trim(); |
22 suite = ''; | 23 suite = ''; |
23 var slash = test.indexOf('/'); | 24 var slash = test.indexOf('/'); |
24 if (slash > 0) { | 25 if (slash > 0) { |
25 suite = test.substring(0, slash).trim(); | 26 suite = test.substring(0, slash).trim(); |
26 test = test.substring(slash + 1).trim(); | 27 test = test.substring(slash + 1).trim(); |
27 } | 28 } |
28 config = line | 29 config = line |
29 .substring("FAILED: ".length, space) | 30 .substring("FAILED: ".length, space) |
30 .replaceAll('release_ia32', '') | 31 .replaceAll('release_ia32', '') |
31 .replaceAll('release_x64', ''); | 32 .replaceAll('release_x64', ''); |
32 } | 33 } |
33 if (line.startsWith("Expected: ")) { | 34 if (line.startsWith("Expected: ")) { |
34 expected = line.substring("Expected: ".length).trim(); | 35 expected = line.substring("Expected: ".length).trim(); |
35 } | 36 } |
36 if (line.startsWith("Actual: ")) { | 37 if (line.startsWith("Actual: ")) { |
37 actual = line.substring("Actual: ".length).trim(); | 38 actual = line.substring("Actual: ".length).trim(); |
38 } | 39 } |
| 40 if (line.startsWith("The compiler crashed:")) { |
| 41 reason = line.substring("The compiler crashed:".length).trim(); |
| 42 } |
39 if (reproIsNext) { | 43 if (reproIsNext) { |
40 records | 44 records.add(new Record( |
41 .add(new Record(suite, test, config, expected, actual, line.trim())); | 45 suite, test, config, expected, actual, reason, line.trim())); |
42 suite = test = config = expected = actual = null; | 46 suite = test = config = expected = actual = reason = null; |
43 reproIsNext = false; | 47 reproIsNext = false; |
44 } | 48 } |
45 if (line.startsWith("Short reproduction command (experimental):")) { | 49 if (line.startsWith("Short reproduction command (experimental):")) { |
46 reproIsNext = true; | 50 reproIsNext = true; |
47 } | 51 } |
48 } | 52 } |
49 return records; | 53 return records; |
50 } | 54 } |
OLD | NEW |