From aa6a4d4630e05e50782ec6880ada116ac4fbe795 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Wed, 12 Dec 2018 19:11:22 +0000 Subject: Add parallelism limit to C and builtins test Spawning a process for every test and running every test in parallel is quite RAM intensive (up to about 8gb) especially when running valgrind on every test in parallel. Now we only run up to TEST_PAR tests in parallel (default 4). --- test/builtins/run_tests.py | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'test/builtins/run_tests.py') diff --git a/test/builtins/run_tests.py b/test/builtins/run_tests.py index e1f2927e..b20d4224 100755 --- a/test/builtins/run_tests.py +++ b/test/builtins/run_tests.py @@ -13,9 +13,10 @@ from sailtest import * def test_c_builtins(name, sail_opts): banner('Testing builtins: {} Sail options: {}'.format(name, sail_opts)) - tests = {} - for filename in os.listdir('.'): - if re.match('.+\.sail', filename): + results = Results(name) + for filenames in chunks(os.listdir('.'), parallel()): + tests = {} + for filename in filenames: basename = os.path.splitext(os.path.basename(filename))[0] tests[filename] = os.fork() if tests[filename] == 0: @@ -26,13 +27,16 @@ def test_c_builtins(name, sail_opts): step('rm {}'.format(basename)) print '{} {}{}{}'.format(filename, color.PASS, 'ok', color.END) sys.exit() + results.collect(tests) + return results.finish() return collect_results(name, tests) def test_ocaml_builtins(name, sail_opts): banner('Testing builtins: {} Sail options: {}'.format(name, sail_opts)) - tests = {} - for filename in os.listdir('.'): - if re.match('.+\.sail', filename): + results = Results(name) + for filenames in chunks(os.listdir('.'), parallel()): + tests = {} + for filename in filenames: basename = os.path.splitext(os.path.basename(filename))[0] tests[filename] = os.fork() if tests[filename] == 0: @@ -42,13 +46,16 @@ def test_ocaml_builtins(name, sail_opts): step('rm {}'.format(basename)) print '{} {}{}{}'.format(filename, color.PASS, 'ok', color.END) sys.exit() + results.collect(tests) + return results.finish() return collect_results(name, tests) def test_lem_builtins(name): banner('Testing builtins: {}'.format(name)) - tests = {} - for filename in os.listdir('.'): - if re.match('.+\.sail', filename): + results = Results(name) + for filenames in chunks(os.listdir('.'), parallel()): + tests = {} + for filename in filenames: basename = os.path.splitext(os.path.basename(filename))[0] tests[filename] = os.fork() if tests[filename] == 0: @@ -76,7 +83,8 @@ def test_lem_builtins(name): print '{} {}{}{}'.format(filename, color.PASS, 'ok', color.END) sys.exit() - return collect_results(name, tests) + results.collect(tests) + return results.finish() xml = '\n' -- cgit v1.2.3