(args)
| 33 | |
| 34 | |
| 35 | def main(args): |
| 36 | def allocation_str(stdout): |
| 37 | for line in reversed((stdout or '').splitlines()): |
| 38 | if maybe_decode(line).startswith('### Allocations = '): |
| 39 | return line |
| 40 | return None |
| 41 | |
| 42 | cmd = command.Command( |
| 43 | args[0], args[1:], timeout=TIMEOUT, handle_sigterm=True) |
| 44 | |
| 45 | previous_allocations = None |
| 46 | for run in range(1, MAX_TRIES + 1): |
| 47 | print('### Predictable run #%d' % run) |
| 48 | output = cmd.execute() |
| 49 | if output.stdout: |
| 50 | print('### Stdout:') |
| 51 | print(output.stdout) |
| 52 | if output.stderr: |
| 53 | print('### Stderr:') |
| 54 | print(output.stderr) |
| 55 | print('### Return code: %s' % output.exit_code) |
| 56 | if output.HasTimedOut(): |
| 57 | # If we get a timeout in any run, we are in an unpredictable state. Just |
| 58 | # report it as a failure and don't rerun. |
| 59 | print('### Test timed out') |
| 60 | return 1 |
| 61 | allocations = allocation_str(output.stdout) |
| 62 | if not allocations: |
| 63 | print ('### Test had no allocation output. Ensure this is built ' |
| 64 | 'with v8_enable_verify_predictable and that ' |
| 65 | '--verify-predictable is passed at the cmd line.') |
| 66 | return 2 |
| 67 | if previous_allocations and previous_allocations != allocations: |
| 68 | print('### Allocations differ') |
| 69 | return 3 |
| 70 | if run >= MAX_TRIES: |
| 71 | # No difference on the last run -> report a success. |
| 72 | return 0 |
| 73 | previous_allocations = allocations |
| 74 | # Unreachable. |
| 75 | assert False |
| 76 | |
| 77 | |
| 78 | if __name__ == '__main__': |
no test coverage detected
searching dependent graphs…