summaryrefslogtreecommitdiff
path: root/bisect_crashes.py
diff options
context:
space:
mode:
authorscoder <none@none>2010-08-08 17:52:02 +0200
committerscoder <none@none>2010-08-08 17:52:02 +0200
commit054ccccd8605e4fe0c5cc2ae8dbf8efa9644c724 (patch)
treeba241d623f25a81098d8bb81b0709a0cd0ecc239 /bisect_crashes.py
parent8f1b9e255e67c83071e955add82ffbfb3a568323 (diff)
downloadpython-lxml-054ccccd8605e4fe0c5cc2ae8dbf8efa9644c724.tar.gz
[svn r4447] better test output
--HG-- branch : trunk
Diffstat (limited to 'bisect_crashes.py')
-rw-r--r--bisect_crashes.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/bisect_crashes.py b/bisect_crashes.py
index 1015e7e1..b345996d 100644
--- a/bisect_crashes.py
+++ b/bisect_crashes.py
@@ -13,16 +13,25 @@ sys.path.insert(1, test_base_path)
import test
cfg = test.Options()
-cfg.verbosity = 1
+cfg.verbosity = 0
cfg.basedir = test_base_path
cfg.unit_tests = True
+def write(line, *args):
+ if args:
+ line = line % args
+ sys.stderr.write(line + '\n')
+
+
def find_tests():
test_files = test.get_test_files(cfg)
return test.get_test_cases(test_files, cfg)
def run_tests(test_cases):
- print('Running subset of %d tests' % len(test_cases))
+ if not test_cases:
+ return True
+ write('Running subset of %d tests [%s .. %s]',
+ len(test_cases), test_cases[0].id(), test_cases[-1].id())
pid = os.fork()
if not pid:
# child executes tests
@@ -36,25 +45,29 @@ def run_tests(test_cases):
def bisect_tests():
tests = find_tests()
- print('Found %d tests' % len(tests))
+ write('Found %d tests', len(tests))
shift = len(tests) // 4
+ last_failed = False
while len(tests) > 1 and shift > 0:
mid = len(tests) // 2 + 1
left, right = tests[:mid], tests[mid:]
if not run_tests(left):
+ last_failed = True
tests = left
shift = len(tests) // 4 + 1
break
if not run_tests(right):
+ last_failed = True
tests = right
shift = len(tests) // 4 + 1
break
+ last_failed = False
shift //= 2
tests = tests[shift:] + tests[:shift]
# looks like we can't make the set of tests any smaller
- return tests
+ return last_failed and tests or []
if __name__ == '__main__':
- print('\n'.join([test.id() for test in bisect_tests()]))
+ write('Failing tests:\n%s', '\n'.join([test.id() for test in bisect_tests()]))