mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 07:31:38 +00:00 
			
		
		
		
	Add a regrtest option to re-run in verbose mode immediately after a test fails, and use that option on the buildbots.
This commit is contained in:
		
							parent
							
								
									cb170100d4
								
							
						
					
					
						commit
						71a015ac1c
					
				
					 2 changed files with 18 additions and 11 deletions
				
			
		| 
						 | 
					@ -10,6 +10,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-v: verbose    -- run tests in verbose mode with output to stdout
 | 
					-v: verbose    -- run tests in verbose mode with output to stdout
 | 
				
			||||||
-w: verbose2   -- re-run failed tests in verbose mode
 | 
					-w: verbose2   -- re-run failed tests in verbose mode
 | 
				
			||||||
 | 
					-W: verbose3   -- re-run failed tests in verbose mode immediately
 | 
				
			||||||
-q: quiet      -- don't print anything except if a test fails
 | 
					-q: quiet      -- don't print anything except if a test fails
 | 
				
			||||||
-x: exclude    -- arguments are tests to *exclude*
 | 
					-x: exclude    -- arguments are tests to *exclude*
 | 
				
			||||||
-s: single     -- run only a single test (see below)
 | 
					-s: single     -- run only a single test (see below)
 | 
				
			||||||
| 
						 | 
					@ -195,7 +196,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
 | 
				
			||||||
         exclude=False, single=False, randomize=False, fromfile=None,
 | 
					         exclude=False, single=False, randomize=False, fromfile=None,
 | 
				
			||||||
         findleaks=False, use_resources=None, trace=False, coverdir='coverage',
 | 
					         findleaks=False, use_resources=None, trace=False, coverdir='coverage',
 | 
				
			||||||
         runleaks=False, huntrleaks=False, verbose2=False, print_slow=False,
 | 
					         runleaks=False, huntrleaks=False, verbose2=False, print_slow=False,
 | 
				
			||||||
         random_seed=None, use_mp=None):
 | 
					         random_seed=None, use_mp=None, verbose3=False):
 | 
				
			||||||
    """Execute a test suite.
 | 
					    """Execute a test suite.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    This also parses command-line options and modifies its behavior
 | 
					    This also parses command-line options and modifies its behavior
 | 
				
			||||||
| 
						 | 
					@ -220,14 +221,12 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    test_support.record_original_stdout(sys.stdout)
 | 
					    test_support.record_original_stdout(sys.stdout)
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsSrf:lu:t:TD:NLR:wM:j:',
 | 
					        opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsSrf:lu:t:TD:NLR:wWM:j:',
 | 
				
			||||||
                                   ['help', 'verbose', 'quiet', 'exclude',
 | 
					            ['help', 'verbose', 'verbose2', 'verbose3', 'quiet',
 | 
				
			||||||
                                    'single', 'slow', 'random', 'fromfile',
 | 
					             'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks',
 | 
				
			||||||
                                    'findleaks', 'use=', 'threshold=', 'trace',
 | 
					             'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir',
 | 
				
			||||||
                                    'coverdir=', 'nocoverdir', 'runleaks',
 | 
					             'runleaks', 'huntrleaks=', 'memlimit=', 'randseed=',
 | 
				
			||||||
                                    'huntrleaks=', 'verbose2', 'memlimit=',
 | 
					             'multiprocess=', 'slaveargs='])
 | 
				
			||||||
                                    'randseed=', 'multiprocess=', 'slaveargs=',
 | 
					 | 
				
			||||||
                                    ])
 | 
					 | 
				
			||||||
    except getopt.error, msg:
 | 
					    except getopt.error, msg:
 | 
				
			||||||
        usage(2, msg)
 | 
					        usage(2, msg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -243,6 +242,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
 | 
				
			||||||
            verbose += 1
 | 
					            verbose += 1
 | 
				
			||||||
        elif o in ('-w', '--verbose2'):
 | 
					        elif o in ('-w', '--verbose2'):
 | 
				
			||||||
            verbose2 = True
 | 
					            verbose2 = True
 | 
				
			||||||
 | 
					        elif o in ('-W', '--verbose3'):
 | 
				
			||||||
 | 
					            verbose3 = True
 | 
				
			||||||
        elif o in ('-q', '--quiet'):
 | 
					        elif o in ('-q', '--quiet'):
 | 
				
			||||||
            quiet = True;
 | 
					            quiet = True;
 | 
				
			||||||
            verbose = 0
 | 
					            verbose = 0
 | 
				
			||||||
| 
						 | 
					@ -396,14 +397,17 @@ def accumulate_result(test, result):
 | 
				
			||||||
        test_times.append((test_time, test))
 | 
					        test_times.append((test_time, test))
 | 
				
			||||||
        if ok > 0:
 | 
					        if ok > 0:
 | 
				
			||||||
            good.append(test)
 | 
					            good.append(test)
 | 
				
			||||||
 | 
					            return 'good'
 | 
				
			||||||
        elif -2 < ok <= 0:
 | 
					        elif -2 < ok <= 0:
 | 
				
			||||||
            bad.append(test)
 | 
					            bad.append(test)
 | 
				
			||||||
            if ok == -1:
 | 
					            if ok == -1:
 | 
				
			||||||
                environment_changed.append(test)
 | 
					                environment_changed.append(test)
 | 
				
			||||||
 | 
					            return 'bad'
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            skipped.append(test)
 | 
					            skipped.append(test)
 | 
				
			||||||
            if ok == -3:
 | 
					            if ok == -3:
 | 
				
			||||||
                resource_denieds.append(test)
 | 
					                resource_denieds.append(test)
 | 
				
			||||||
 | 
					            return 'skipped'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if use_mp:
 | 
					    if use_mp:
 | 
				
			||||||
        from threading import Thread
 | 
					        from threading import Thread
 | 
				
			||||||
| 
						 | 
					@ -479,7 +483,10 @@ def work():
 | 
				
			||||||
                try:
 | 
					                try:
 | 
				
			||||||
                    result = runtest(test, verbose, quiet,
 | 
					                    result = runtest(test, verbose, quiet,
 | 
				
			||||||
                                     testdir, huntrleaks)
 | 
					                                     testdir, huntrleaks)
 | 
				
			||||||
                    accumulate_result(test, result)
 | 
					                    which = accumulate_result(test, result)
 | 
				
			||||||
 | 
					                    if verbose3 and which == 'bad':
 | 
				
			||||||
 | 
					                        print "Re-running test %r in verbose mode" % test
 | 
				
			||||||
 | 
					                        runtest(test, True, quiet, testdir, huntrleaks)
 | 
				
			||||||
                except KeyboardInterrupt:
 | 
					                except KeyboardInterrupt:
 | 
				
			||||||
                    # print a newline separate from the ^C
 | 
					                    # print a newline separate from the ^C
 | 
				
			||||||
                    print
 | 
					                    print
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -716,7 +716,7 @@ buildbottest:	all platform
 | 
				
			||||||
		-@if which pybuildbot.identify >/dev/null 2>&1; then \
 | 
							-@if which pybuildbot.identify >/dev/null 2>&1; then \
 | 
				
			||||||
			pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
 | 
								pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
		$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rw
 | 
							$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall -rwW
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QUICKTESTOPTS=	$(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
 | 
					QUICKTESTOPTS=	$(TESTOPTS) -x test_subprocess test_io test_lib2to3 \
 | 
				
			||||||
		test_multibytecodec test_urllib2_localnet test_itertools \
 | 
							test_multibytecodec test_urllib2_localnet test_itertools \
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue