Skip to content

Commit

Permalink
[1.8>1.9] [MERGE #4671 @obastemur] lldb-out: improve testing with lld…
Browse files Browse the repository at this point in the history
…b debugger attached

Merge pull request #4671 from obastemur:easier_flaky_detect

Trying to get the stack trace for a flaky test. Having the output corrupted for each test run is making things a lot complicated
  • Loading branch information
obastemur committed Feb 13, 2018
2 parents e4156a1 + ee5ffb3 commit db6afe6
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions test/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
parser.add_argument('--swb', action='store_true',
help='use binary from VcBuild.SWB to run the test')
parser.add_argument('--lldb', default=None,
help='run a single test in lldb batch mode to get call stack and crash logs', action='store_true')
help='run test suit with lldb batch mode to get call stack for crashing processes (ignores baseline matching)', action='store_true')
parser.add_argument('-l', '--logfile', metavar='logfile',
help='file to log results to', default=None)
parser.add_argument('--x86', action='store_true',
Expand Down Expand Up @@ -469,17 +469,28 @@ def timeout_func(timeout_data):
timeout_data[1] = True
timeout = test.get('timeout', args.timeout) # test override or default
timer = Timer(timeout, timeout_func, [timeout_data])
skip_baseline_match = False
try:
timer.start()
js_output = normalize_new_line(proc.communicate()[0])
exit_code = proc.wait()
# if -lldb was set; check if test was crashed before corrupting the output
search_for = " exited with status = 0 (0x00000000)"
if args.lldb != None and exit_code == 0 and js_output.index(search_for) > 0:
js_output = js_output[0:js_output.index(search_for)]
exit_pos = js_output.rfind('\nProcess ')
if exit_pos > len(js_output) - 20: # if [Process ????? <seach for>]
if 'baseline' not in test:
js_output = "pass"
else:
skip_baseline_match = True
finally:
timer.cancel()
test.done()

# shared _show_failed args
fail_args = { 'test': test, 'flags': flags,
'exit_code': exit_code, 'output': js_output };
'exit_code': exit_code, 'output': js_output }

# check timed out
if (timeout_data[1]):
Expand All @@ -498,7 +509,7 @@ def timeout_func(timeout_data):
return self._show_failed(**fail_args)
else:
baseline = test.get('baseline')
if baseline:
if not skip_baseline_match and baseline:
# perform baseline comparison
baseline = self._check_file(folder, baseline)
with open(baseline, 'rb') as bs_file:
Expand Down

0 comments on commit db6afe6

Please sign in to comment.