forked from OSchip/llvm-project
[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.
This commit is contained in:
parent
06c980df46
commit
4cfb71adba
|
@ -15,9 +15,10 @@ def run_reproducer(path):
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
reason = None
|
reason = None
|
||||||
try:
|
try:
|
||||||
|
success = proc.returncode == 0
|
||||||
outs, errs = proc.communicate(timeout=TIMEOUT)
|
outs, errs = proc.communicate(timeout=TIMEOUT)
|
||||||
result = 'PASSED' if proc.returncode == 0 else 'FAILED'
|
result = 'PASSED' if success else 'FAILED'
|
||||||
if proc.returncode != 0:
|
if not success:
|
||||||
outs = outs.decode()
|
outs = outs.decode()
|
||||||
errs = errs.decode()
|
errs = errs.decode()
|
||||||
# Do some pattern matching to find out the cause of the failure.
|
# 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}'
|
reason = f'Exit code {proc.returncode}'
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
proc.kill()
|
proc.kill()
|
||||||
|
success = False
|
||||||
outs, errs = proc.communicate()
|
outs, errs = proc.communicate()
|
||||||
result = 'TIMEOUT'
|
result = 'TIMEOUT'
|
||||||
|
|
||||||
reason_str = f' ({reason})' if reason else ''
|
if not FAILURE_ONLY or not success:
|
||||||
print(f'{result}: {path}{reason_str}')
|
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):
|
def find_reproducers(path):
|
||||||
|
@ -82,12 +90,23 @@ if __name__ == '__main__':
|
||||||
type=str,
|
type=str,
|
||||||
required=True,
|
required=True,
|
||||||
help='Path to the LLDB command line driver')
|
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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
global LLDB
|
global LLDB
|
||||||
global TIMEOUT
|
global TIMEOUT
|
||||||
|
global VERBOSE
|
||||||
|
global FAILURE_ONLY
|
||||||
LLDB = args.lldb
|
LLDB = args.lldb
|
||||||
TIMEOUT = args.timeout
|
TIMEOUT = args.timeout
|
||||||
|
VERBOSE = args.verbose
|
||||||
|
FAILURE_ONLY = args.failure_only
|
||||||
|
|
||||||
print(
|
print(
|
||||||
f'Replaying reproducers in {args.path} with {args.threads} threads and a {args.timeout} seconds timeout'
|
f'Replaying reproducers in {args.path} with {args.threads} threads and a {args.timeout} seconds timeout'
|
||||||
|
|
Loading…
Reference in New Issue