Rico Wind | b215938 | 2019-10-01 10:57:50 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file |
| 3 | # for details. All rights reserved. Use of this source code is governed by a |
| 4 | # BSD-style license that can be found in the LICENSE file. |
| 5 | |
| 6 | import argparse |
| 7 | import sys |
| 8 | import urllib |
| 9 | |
| 10 | def ParseOptions(): |
| 11 | parser = argparse.ArgumentParser( |
| 12 | description = 'Find tests started but not done from bot stdout.') |
| 13 | return parser.parse_known_args() |
| 14 | |
| 15 | def get_started(stdout): |
| 16 | # Lines look like: |
| 17 | # Start executing test runBigInteger_ZERO_A01 [com.android.tools.r8.jctf.r8cf.math.BigInteger.ZERO.BigInteger_ZERO_A01] |
| 18 | start_lines = [] |
| 19 | for line in stdout: |
| 20 | if line.startswith('Start executing test'): |
| 21 | split = line.split(' ') |
| 22 | start_lines.append('%s %s' % (split[3], split[4].strip())) |
| 23 | return start_lines |
| 24 | |
| 25 | def get_ended(stdout): |
| 26 | # Lines look like: |
| 27 | # Done executing test runBigInteger_subtract_A01 [com.android.tools.r8.jctf.r8cf.math.BigInteger.subtractLjava_math_BigInteger.BigInteger_subtract_A01] with result: SUCCESS |
| 28 | done_lines = [] |
| 29 | for line in stdout: |
| 30 | if line.startswith('Done executing test'): |
| 31 | split = line.split(' ') |
| 32 | done_lines.append('%s %s' % (split[3], split[4].strip())) |
| 33 | return done_lines |
| 34 | |
| 35 | def Main(): |
| 36 | (options, args) = ParseOptions() |
| 37 | if len(args) != 1: |
| 38 | raise "fail" |
| 39 | |
| 40 | with open(args[0], 'r') as f: |
| 41 | lines = f.readlines() |
| 42 | started = get_started(lines) |
| 43 | ended = get_ended(lines) |
| 44 | for test in started: |
| 45 | if not test in ended: |
| 46 | print 'Test %s started but did not end' % test |
| 47 | |
| 48 | |
| 49 | if __name__ == '__main__': |
| 50 | sys.exit(Main()) |