##// END OF EJS Templates
run-tests: refactor filtering logic for --retest flag...
Sushil khanchi -
r45967:de9ec12e default
parent child Browse files
Show More
@@ -2336,7 +2336,6 b' class TestSuite(unittest.TestSuite):'
2336 jobs=1,
2336 jobs=1,
2337 whitelist=None,
2337 whitelist=None,
2338 blacklist=None,
2338 blacklist=None,
2339 retest=False,
2340 keywords=None,
2339 keywords=None,
2341 loop=False,
2340 loop=False,
2342 runs_per_test=1,
2341 runs_per_test=1,
@@ -2364,9 +2363,6 b' class TestSuite(unittest.TestSuite):'
2364 backwards compatible behavior which reports skipped tests as part
2363 backwards compatible behavior which reports skipped tests as part
2365 of the results.
2364 of the results.
2366
2365
2367 retest denotes whether to retest failed tests. This arguably belongs
2368 outside of TestSuite.
2369
2370 keywords denotes key words that will be used to filter which tests
2366 keywords denotes key words that will be used to filter which tests
2371 to execute. This arguably belongs outside of TestSuite.
2367 to execute. This arguably belongs outside of TestSuite.
2372
2368
@@ -2377,7 +2373,6 b' class TestSuite(unittest.TestSuite):'
2377 self._jobs = jobs
2373 self._jobs = jobs
2378 self._whitelist = whitelist
2374 self._whitelist = whitelist
2379 self._blacklist = blacklist
2375 self._blacklist = blacklist
2380 self._retest = retest
2381 self._keywords = keywords
2376 self._keywords = keywords
2382 self._loop = loop
2377 self._loop = loop
2383 self._runs_per_test = runs_per_test
2378 self._runs_per_test = runs_per_test
@@ -2407,10 +2402,6 b' class TestSuite(unittest.TestSuite):'
2407 result.addSkip(test, 'blacklisted')
2402 result.addSkip(test, 'blacklisted')
2408 continue
2403 continue
2409
2404
2410 if self._retest and not os.path.exists(test.errpath):
2411 result.addIgnore(test, 'not retesting')
2412 continue
2413
2414 if self._keywords:
2405 if self._keywords:
2415 with open(test.path, 'rb') as f:
2406 with open(test.path, 'rb') as f:
2416 t = f.read().lower() + test.bname.lower()
2407 t = f.read().lower() + test.bname.lower()
@@ -3253,6 +3244,22 b' class TestRunner(object):'
3253 tests.append({'path': t})
3244 tests.append({'path': t})
3254 else:
3245 else:
3255 tests.append({'path': t})
3246 tests.append({'path': t})
3247
3248 if self.options.retest:
3249 retest_args = []
3250 for test in tests:
3251 if 'case' in test:
3252 # for multiple dimensions test cases
3253 casestr = b'#'.join(test['case'])
3254 errpath = b'%s#%s.err' % (test['path'], casestr)
3255 else:
3256 errpath = b'%s.err' % test['path']
3257 if self.options.outputdir:
3258 errpath = os.path.join(self.options.outputdir, errpath)
3259
3260 if os.path.exists(errpath):
3261 retest_args.append(test)
3262 tests = retest_args
3256 return tests
3263 return tests
3257
3264
3258 def _runtests(self, testdescs):
3265 def _runtests(self, testdescs):
@@ -3298,7 +3305,6 b' class TestRunner(object):'
3298 jobs=jobs,
3305 jobs=jobs,
3299 whitelist=self.options.whitelisted,
3306 whitelist=self.options.whitelisted,
3300 blacklist=self.options.blacklist,
3307 blacklist=self.options.blacklist,
3301 retest=self.options.retest,
3302 keywords=kws,
3308 keywords=kws,
3303 loop=self.options.loop,
3309 loop=self.options.loop,
3304 runs_per_test=self.options.runs_per_test,
3310 runs_per_test=self.options.runs_per_test,
@@ -497,7 +497,7 b' test for --retest'
497 ====================
497 ====================
498
498
499 $ rt --retest
499 $ rt --retest
500 running 2 tests using 1 parallel processes
500 running 1 tests using 1 parallel processes
501
501
502 --- $TESTTMP/test-failure.t
502 --- $TESTTMP/test-failure.t
503 +++ $TESTTMP/test-failure.t.err
503 +++ $TESTTMP/test-failure.t.err
@@ -512,7 +512,7 b' test for --retest'
512 ERROR: test-failure.t output changed
512 ERROR: test-failure.t output changed
513 !
513 !
514 Failed test-failure.t: output changed
514 Failed test-failure.t: output changed
515 # Ran 2 tests, 1 skipped, 1 failed.
515 # Ran 1 tests, 0 skipped, 1 failed.
516 python hash seed: * (glob)
516 python hash seed: * (glob)
517 [1]
517 [1]
518
518
@@ -521,7 +521,7 b' test for --retest'
521 $ mkdir output
521 $ mkdir output
522 $ mv test-failure.t.err output
522 $ mv test-failure.t.err output
523 $ rt --retest --outputdir output
523 $ rt --retest --outputdir output
524 running 2 tests using 1 parallel processes
524 running 1 tests using 1 parallel processes
525
525
526 --- $TESTTMP/test-failure.t
526 --- $TESTTMP/test-failure.t
527 +++ $TESTTMP/output/test-failure.t.err
527 +++ $TESTTMP/output/test-failure.t.err
@@ -536,7 +536,7 b' test for --retest'
536 ERROR: test-failure.t output changed
536 ERROR: test-failure.t output changed
537 !
537 !
538 Failed test-failure.t: output changed
538 Failed test-failure.t: output changed
539 # Ran 2 tests, 1 skipped, 1 failed.
539 # Ran 1 tests, 0 skipped, 1 failed.
540 python hash seed: * (glob)
540 python hash seed: * (glob)
541 [1]
541 [1]
542
542
@@ -975,7 +975,7 b' When using multiple dimensions of "#test'
975 [1]
975 [1]
976
976
977 $ rt --retest
977 $ rt --retest
978 running 5 tests using 1 parallel processes
978 running 1 tests using 1 parallel processes
979
979
980 --- $TESTTMP/test-cases.t
980 --- $TESTTMP/test-cases.t
981 +++ $TESTTMP/test-cases.t#b#c.err
981 +++ $TESTTMP/test-cases.t#b#c.err
@@ -990,7 +990,7 b' When using multiple dimensions of "#test'
990 ERROR: test-cases.t#b#c output changed
990 ERROR: test-cases.t#b#c output changed
991 !
991 !
992 Failed test-cases.t#b#c: output changed
992 Failed test-cases.t#b#c: output changed
993 # Ran 5 tests, 4 skipped, 1 failed.
993 # Ran 1 tests, 0 skipped, 1 failed.
994 python hash seed: * (glob)
994 python hash seed: * (glob)
995 [1]
995 [1]
996 $ rm test-cases.t#b#c.err
996 $ rm test-cases.t#b#c.err
General Comments 0
You need to be logged in to leave comments. Login now