summaryrefslogtreecommitdiff
path: root/lldb/scripts
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2020-04-20 08:52:07 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2020-04-20 09:03:48 -0700
commit4cfb71adba06037438e37dac84dbd9c3ac2b4319 (patch)
tree015f9f9ba6b84e1978888c864c28adf1cd0fc6e2 /lldb/scripts
parent06c980df46fb0490d71d5563281572d7e1d35321 (diff)
downloadllvm-4cfb71adba06037438e37dac84dbd9c3ac2b4319.tar.gz
[lldb/Scripts] Add verbose and failure only mode to replay script.
Add two modes to the reproducer replay script that make debugging a little easier. Verbose mode prints stdout and stderr, regardless of whether replay was successful. When --failure-only is passed, output is limited to tests that failed to replay.
Diffstat (limited to 'lldb/scripts')
-rwxr-xr-xlldb/scripts/reproducer-replay.py27
1 files changed, 23 insertions, 4 deletions
diff --git a/lldb/scripts/reproducer-replay.py b/lldb/scripts/reproducer-replay.py
index 5e9fab176ab6..f16d6e8b146c 100755
--- a/lldb/scripts/reproducer-replay.py
+++ b/lldb/scripts/reproducer-replay.py
@@ -15,9 +15,10 @@ def run_reproducer(path):
stderr=subprocess.PIPE)
reason = None
try:
+ success = proc.returncode == 0
outs, errs = proc.communicate(timeout=TIMEOUT)
- result = 'PASSED' if proc.returncode == 0 else 'FAILED'
- if proc.returncode != 0:
+ result = 'PASSED' if success else 'FAILED'
+ if not success:
outs = outs.decode()
errs = errs.decode()
# Do some pattern matching to find out the cause of the failure.
@@ -35,11 +36,18 @@ def run_reproducer(path):
reason = f'Exit code {proc.returncode}'
except subprocess.TimeoutExpired:
proc.kill()
+ success = False
outs, errs = proc.communicate()
result = 'TIMEOUT'
- reason_str = f' ({reason})' if reason else ''
- print(f'{result}: {path}{reason_str}')
+ if not FAILURE_ONLY or not success:
+ reason_str = f' ({reason})' if reason else ''
+ print(f'{result}: {path}{reason_str}')
+ if VERBOSE:
+ if outs:
+ print(outs)
+ if errs:
+ print(errs)
def find_reproducers(path):
@@ -82,12 +90,23 @@ if __name__ == '__main__':
type=str,
required=True,
help='Path to the LLDB command line driver')
+ parser.add_argument('-v',
+ '--verbose',
+ help='Print replay output.',
+ action='store_true')
+ parser.add_argument('--failure-only',
+ help='Only log failures.',
+ action='store_true')
args = parser.parse_args()
global LLDB
global TIMEOUT
+ global VERBOSE
+ global FAILURE_ONLY
LLDB = args.lldb
TIMEOUT = args.timeout
+ VERBOSE = args.verbose
+ FAILURE_ONLY = args.failure_only
print(
f'Replaying reproducers in {args.path} with {args.threads} threads and a {args.timeout} seconds timeout'