From: Eli Bendersky Date: Sun, 22 Mar 2020 13:42:27 +0000 (-0700) Subject: Fix --parallel readelf test after previous commit X-Git-Tag: v0.27~36 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b9129cef4d41ef1e1f19f92b7aabaaafef8060ce;p=pyelftools.git Fix --parallel readelf test after previous commit Previous commit broke them because lambdas can't be picked by multiprocessing --- diff --git a/test/run_readelf_tests.py b/test/run_readelf_tests.py index 5f9a8ae..f4d06ae 100755 --- a/test/run_readelf_tests.py +++ b/test/run_readelf_tests.py @@ -48,7 +48,7 @@ def discover_testfiles(rootdir): yield os.path.join(rootdir, filename) -def run_test_on_file(filename, verbose, opt): +def run_test_on_file(filename, verbose=False, opt=None): """ Runs a test on the given input filename. Return True if all test runs succeeded. If opt is specified, rather that going over the whole @@ -57,13 +57,17 @@ def run_test_on_file(filename, verbose, opt): """ success = True testlog.info("Test file '%s'" % filename) - options = [opt] if opt else [ + if opt is None: + options = [ '-e', '-d', '-s', '-n', '-r', '-x.text', '-p.shstrtab', '-V', '--debug-dump=info', '--debug-dump=decodedline', '--debug-dump=frames', '--debug-dump=frames-interp', '--debug-dump=aranges', '--debug-dump=pubtypes', '--debug-dump=pubnames' ] + else: + options = [opt] + for option in options: if verbose: testlog.info("..option='%s'" % option) @@ -229,9 +233,7 @@ def main(): if len(filenames) > 1 and args.parallel: pool = Pool() - results = pool.map( - lambda filename: run_test_on_file(filename, False, args.opt), - filenames) + results = pool.map(run_test_on_file, filenames) failures = results.count(False) else: failures = 0