OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library status_files.log_parser; |
| 6 |
| 7 import 'record.dart'; |
| 8 |
| 9 /// Extracts test records from a test.py [log]. |
| 10 List<Record> parse(String log) { |
| 11 var records = []; |
| 12 var suite; |
| 13 var test; |
| 14 var config; |
| 15 var expected; |
| 16 var actual; |
| 17 bool reproIsNext = false; |
| 18 for (var line in log.split('\n')) { |
| 19 if (line.startsWith("FAILED: ")) { |
| 20 int space = line.lastIndexOf(' '); |
| 21 test = line.substring(space + 1).trim(); |
| 22 suite = ''; |
| 23 var slash = test.indexOf('/'); |
| 24 if (slash > 0) { |
| 25 suite = test.substring(0, slash).trim(); |
| 26 test = test.substring(slash + 1).trim(); |
| 27 } |
| 28 config = line |
| 29 .substring("FAILED: ".length, space) |
| 30 .replaceAll('release_ia32', '') |
| 31 .replaceAll('release_x64', ''); |
| 32 } |
| 33 if (line.startsWith("Expected: ")) { |
| 34 expected = line.substring("Expected: ".length).trim(); |
| 35 } |
| 36 if (line.startsWith("Actual: ")) { |
| 37 actual = line.substring("Actual: ".length).trim(); |
| 38 } |
| 39 if (reproIsNext) { |
| 40 records |
| 41 .add(new Record(suite, test, config, expected, actual, line.trim())); |
| 42 suite = test = config = expected = actual = null; |
| 43 reproIsNext = false; |
| 44 } |
| 45 if (line.startsWith("Short reproduction command (experimental):")) { |
| 46 reproIsNext = true; |
| 47 } |
| 48 } |
| 49 return records; |
| 50 } |
OLD | NEW |