Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3ca4db8

Browse files
author
Charles-François Natali
committed
Merge.
2 parents 239bb96 + 3019688 commit 3ca4db8

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

Lib/test/regrtest.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
-h/--help -- print this text and exit
2323
--timeout TIMEOUT
2424
-- dump the traceback and exit if a test takes more
25-
than TIMEOUT seconds (default: 30 minutes); disable
26-
the timeout if TIMEOUT is zero
25+
than TIMEOUT seconds
2726
--wait -- wait for user input, e.g., allow a debugger to be attached
2827
2928
Verbosity
@@ -269,11 +268,6 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
269268
# Display the Python traceback fatal errors (e.g. segfault)
270269
faulthandler.enable(all_threads=True)
271270

272-
if hasattr(faulthandler, 'dump_tracebacks_later'):
273-
timeout = 60*60
274-
else:
275-
timeout = None
276-
277271
replace_stdout()
278272

279273
support.record_original_stdout(sys.stdout)
@@ -295,6 +289,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
295289
use_resources = []
296290
debug = False
297291
start = None
292+
timeout = None
298293
for o, a in opts:
299294
if o in ('-h', '--help'):
300295
print(__doc__)
@@ -420,10 +415,13 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
420415
testdir = os.path.join(support.SAVEDCWD, a)
421416
elif o == '--timeout':
422417
if not hasattr(faulthandler, 'dump_tracebacks_later'):
423-
print("--timeout option requires "
418+
print("The timeout option requires "
424419
"faulthandler.dump_tracebacks_later", file=sys.stderr)
425420
sys.exit(1)
426421
timeout = float(a)
422+
if timeout <= 0:
423+
print("The timeout must be greater than 0", file=sys.stderr)
424+
sys.exit(1)
427425
elif o == '--wait':
428426
input("Press any key to continue...")
429427
else:
@@ -835,7 +833,7 @@ def runtest(test, verbose, quiet,
835833
support.verbose = verbose # Tell tests to be moderately quiet
836834
if use_resources is not None:
837835
support.use_resources = use_resources
838-
use_timeout = (timeout is not None and timeout > 0)
836+
use_timeout = (timeout is not None)
839837
if use_timeout:
840838
faulthandler.dump_tracebacks_later(timeout, exit=True)
841839
try:

Makefile.pre.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)
755755
# generated bytecode. This is sometimes a very shy bug needing a lot of
756756
# sample data.
757757

758-
TESTOPTS= -l $(EXTRATESTOPTS)
758+
TESTOPTS= -l --timeout=3600 $(EXTRATESTOPTS)
759759
TESTPROG= $(srcdir)/Lib/test/regrtest.py
760760
TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -Wd -E -bb $(TESTPYTHONOPTS)
761761
test: all platform

0 commit comments

Comments
 (0)