Show More
@@ -97,6 +97,9 b' def parseargs():' | |||||
97 | parser.add_option("--tmpdir", type="string", |
|
97 | parser.add_option("--tmpdir", type="string", | |
98 | help="run tests in the given temporary directory" |
|
98 | help="run tests in the given temporary directory" | |
99 | " (implies --keep-tmpdir)") |
|
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 | parser.add_option("-R", "--restart", action="store_true", |
|
103 | parser.add_option("-R", "--restart", action="store_true", | |
101 | help="restart at last error") |
|
104 | help="restart at last error") | |
102 | parser.add_option("-p", "--port", type="int", |
|
105 | parser.add_option("-p", "--port", type="int", | |
@@ -168,6 +171,7 b' def parseargs():' | |||||
168 | for m in msg: |
|
171 | for m in msg: | |
169 | print m, |
|
172 | print m, | |
170 |
|
173 | |||
|
174 | sys.stdout.flush() | |||
171 | else: |
|
175 | else: | |
172 | vlog = lambda *msg: None |
|
176 | vlog = lambda *msg: None | |
173 |
|
177 | |||
@@ -179,6 +183,13 b' def parseargs():' | |||||
179 | if options.interactive and options.jobs > 1: |
|
183 | if options.interactive and options.jobs > 1: | |
180 | print '(--interactive overrides --jobs)' |
|
184 | print '(--interactive overrides --jobs)' | |
181 | options.jobs = 1 |
|
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 | if options.py3k_warnings: |
|
193 | if options.py3k_warnings: | |
183 | if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0): |
|
194 | if sys.version_info[:2] < (2, 6) or sys.version_info[:2] >= (3, 0): | |
184 | parser.error('--py3k-warnings can only be used on Python 2.6+') |
|
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 | def run(cmd, options): |
|
386 | def run(cmd, options): | |
376 | """Run command in a sub-process, capturing the output (stdout and stderr). |
|
387 | """Run command in a sub-process, capturing the output (stdout and stderr). | |
377 |
Return |
|
388 | Return a tuple (exitcode, output). output is None in debug mode.""" | |
378 | # TODO: Use subprocess.Popen if we're running on Python 2.4 |
|
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 | if os.name == 'nt' or sys.platform.startswith('java'): |
|
395 | if os.name == 'nt' or sys.platform.startswith('java'): | |
380 | tochild, fromchild = os.popen4(cmd) |
|
396 | tochild, fromchild = os.popen4(cmd) | |
381 | tochild.close() |
|
397 | tochild.close() | |
@@ -487,15 +503,23 b' def runone(options, test, skips, fails):' | |||||
487 | mark = '.' |
|
503 | mark = '.' | |
488 |
|
504 | |||
489 | skipped = (ret == SKIPPED_STATUS) |
|
505 | skipped = (ret == SKIPPED_STATUS) | |
490 | # If reference output file exists, check test output against it |
|
506 | # If we're not in --debug mode and reference output file exists, | |
491 | if os.path.exists(ref): |
|
507 | # check test output against it. | |
|
508 | if options.debug: | |||
|
509 | refout = None # to match out == None | |||
|
510 | elif os.path.exists(ref): | |||
492 | f = open(ref, "r") |
|
511 | f = open(ref, "r") | |
493 | refout = splitnewlines(f.read()) |
|
512 | refout = splitnewlines(f.read()) | |
494 | f.close() |
|
513 | f.close() | |
495 | else: |
|
514 | else: | |
496 | refout = [] |
|
515 | refout = [] | |
|
516 | ||||
497 | if skipped: |
|
517 | if skipped: | |
498 | mark = 's' |
|
518 | mark = 's' | |
|
519 | if out is None: # debug mode: nothing to parse | |||
|
520 | missing = ['unknown'] | |||
|
521 | failed = None | |||
|
522 | else: | |||
499 | missing, failed = parsehghaveoutput(out) |
|
523 | missing, failed = parsehghaveoutput(out) | |
500 | if not missing: |
|
524 | if not missing: | |
501 | missing = ['irrelevant'] |
|
525 | missing = ['irrelevant'] | |
@@ -521,7 +545,7 b' def runone(options, test, skips, fails):' | |||||
521 | sys.stdout.write(mark) |
|
545 | sys.stdout.write(mark) | |
522 | sys.stdout.flush() |
|
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 | # Save errors to a file for diagnosis |
|
549 | # Save errors to a file for diagnosis | |
526 | f = open(err, "wb") |
|
550 | f = open(err, "wb") | |
527 | for line in out: |
|
551 | for line in out: |
General Comments 0
You need to be logged in to leave comments.
Login now