##// END OF EJS Templates
run-tests: add "debug" mode: don't capture child output, just show it....
Greg Ward -
r9707:38deec40 default
parent child Browse files
Show More
@@ -97,6 +97,9 b' def parseargs():'
97 97 parser.add_option("--tmpdir", type="string",
98 98 help="run tests in the given temporary directory"
99 99 " (implies --keep-tmpdir)")
100 parser.add_option("-d", "--debug", action="store_true",
101 help="debug mode: write output of test scripts to console"
102 " rather than capturing and diff'ing it (disables timeout)")
100 103 parser.add_option("-R", "--restart", action="store_true",
101 104 help="restart at last error")
102 105 parser.add_option("-p", "--port", type="int",
@@ -168,6 +171,7 b' def parseargs():'
168 171 for m in msg:
169 172 print m,
170 173 print
174 sys.stdout.flush()
171 175 else:
172 176 vlog = lambda *msg: None
173 177
@@ -179,6 +183,13 b' def parseargs():'
179 183 if options.interactive and options.jobs > 1:
180 184 print '(--interactive overrides --jobs)'
181 185 options.jobs = 1
186 if options.interactive and options.debug:
187 parser.error("-i/--interactive and -d/--debug are incompatible")
188 if options.debug:
189 if options.timeout != defaults['timeout']:
190 sys.stderr.write(
191 'warning: --timeout option ignored with --debug\n')
192 options.timeout = 0
182 193 if options.py3k_warnings:
183 194 if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0):
184 195 parser.error('--py3k-warnings can only be used on Python 2.6+')
@@ -374,8 +385,13 b' def alarmed(signum, frame):'
374 385
375 386 def run(cmd, options):
376 387 """Run command in a sub-process, capturing the output (stdout and stderr).
377 Return the exist code, and output."""
388 Return a tuple (exitcode, output). output is None in debug mode."""
378 389 # TODO: Use subprocess.Popen if we're running on Python 2.4
390 if options.debug:
391 proc = subprocess.Popen(cmd, shell=True)
392 ret = proc.wait()
393 return (ret, None)
394
379 395 if os.name == 'nt' or sys.platform.startswith('java'):
380 396 tochild, fromchild = os.popen4(cmd)
381 397 tochild.close()
@@ -487,16 +503,24 b' def runone(options, test, skips, fails):'
487 503 mark = '.'
488 504
489 505 skipped = (ret == SKIPPED_STATUS)
490 # If reference output file exists, check test output against it
491 if os.path.exists(ref):
506 # If we're not in --debug mode and reference output file exists,
507 # check test output against it.
508 if options.debug:
509 refout = None # to match out == None
510 elif os.path.exists(ref):
492 511 f = open(ref, "r")
493 512 refout = splitnewlines(f.read())
494 513 f.close()
495 514 else:
496 515 refout = []
516
497 517 if skipped:
498 518 mark = 's'
499 missing, failed = parsehghaveoutput(out)
519 if out is None: # debug mode: nothing to parse
520 missing = ['unknown']
521 failed = None
522 else:
523 missing, failed = parsehghaveoutput(out)
500 524 if not missing:
501 525 missing = ['irrelevant']
502 526 if failed:
@@ -521,7 +545,7 b' def runone(options, test, skips, fails):'
521 545 sys.stdout.write(mark)
522 546 sys.stdout.flush()
523 547
524 if ret != 0 and not skipped:
548 if ret != 0 and not skipped and not options.debug:
525 549 # Save errors to a file for diagnosis
526 550 f = open(err, "wb")
527 551 for line in out:
General Comments 0
You need to be logged in to leave comments. Login now