From: Pierre-Marie de Rodat Date: Fri, 18 Aug 2017 01:33:44 +0000 (-0400) Subject: Minor testsuite improvements (#154) X-Git-Tag: v0.25~35 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c26453e6ee39f168fd7ce3a16bc2d96bf3e93bbb;p=pyelftools.git Minor testsuite improvements (#154) * run_readelf_tests.py: add an option to continue tests after a failure Also add a counter to display the number of failed tests over the number of tests run. * run_readelf_tests.py: run tests in alphabetical order This gives deterministic runs, which is handy to run edit/test development cycles. --- diff --git a/test/run_readelf_tests.py b/test/run_readelf_tests.py index f999174..7ccbb4d 100755 --- a/test/run_readelf_tests.py +++ b/test/run_readelf_tests.py @@ -195,6 +195,9 @@ def main(): optparser.add_option('-V', '--verbose', action='store_true', dest='verbose', help='Verbose output') + optparser.add_option('-k', '--keep-going', + action='store_true', dest='keep_going', + help="Run all tests, don't stop at the first failure") options, args = optparser.parse_args() if options.verbose: @@ -208,18 +211,22 @@ def main(): if len(args) > 0: filenames = args else: - filenames = list(discover_testfiles('test/testfiles_for_readelf')) + filenames = sorted(discover_testfiles('test/testfiles_for_readelf')) - success = True + failures = 0 for filename in filenames: - if success: - success = success and run_test_on_file( - filename, - verbose=options.verbose) + if not run_test_on_file(filename, verbose=options.verbose): + failures += 1 + if not options.keep_going: + break - if success: + if failures == 0: testlog.info('\nConclusion: SUCCESS') return 0 + elif options.keep_going: + testlog.info('\nConclusion: FAIL ({}/{})'.format( + failures, len(filenames))) + return 1 else: testlog.info('\nConclusion: FAIL') return 1