From f6e857c40291ec1bc2a211d7d90d7d3d543a2f45 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Fri, 7 Apr 2017 01:23:15 +0000 Subject: [lit] Fix Darwin pickling errors with process pools For a function to be pickle-able, it has to be in the top-level of a real Python module. So, I made one for this code snippet. llvm-svn: 299738 --- compiler-rt/unittests/lit.common.unit.cfg | 11 ++++++++--- compiler-rt/unittests/lit_unittest_cfg_utils.py | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 compiler-rt/unittests/lit_unittest_cfg_utils.py (limited to 'compiler-rt') diff --git a/compiler-rt/unittests/lit.common.unit.cfg b/compiler-rt/unittests/lit.common.unit.cfg index 475b22d41ce..42df60433bc 100644 --- a/compiler-rt/unittests/lit.common.unit.cfg +++ b/compiler-rt/unittests/lit.common.unit.cfg @@ -35,6 +35,11 @@ if config.host_os == 'Darwin': # of large mmap'd regions (terabytes) by the kernel. lit_config.parallelism_groups["darwin-64bit-sanitizer"] = 3 - def darwin_sanitizer_parallelism_group_func(test): - return "darwin-64bit-sanitizer" if "x86_64" in test.file_path else "" - config.darwin_sanitizer_parallelism_group_func = darwin_sanitizer_parallelism_group_func + # The test config gets pickled and sent to multiprocessing workers, and that + # only works for code if it is stored at the top level of some module. + # Therefore, we have to put the code in a .py file, add it to path, and import + # it to store it in the config. + site.addsitedir(os.path.dirname(__file__)) + import lit_unittest_cfg_utils + config.darwin_sanitizer_parallelism_group_func = \ + lit_unittest_cfg_utils.darwin_sanitizer_parallelism_group_func diff --git a/compiler-rt/unittests/lit_unittest_cfg_utils.py b/compiler-rt/unittests/lit_unittest_cfg_utils.py new file mode 100644 index 00000000000..ff7b1ee0140 --- /dev/null +++ b/compiler-rt/unittests/lit_unittest_cfg_utils.py @@ -0,0 +1,4 @@ +# Put all 64-bit sanitizer tests in the darwin-64bit-sanitizer parallelism +# group. This will only run three of them concurrently. +def darwin_sanitizer_parallelism_group_func(test): + return "darwin-64bit-sanitizer" if "x86_64" in test.file_path else "" -- cgit v1.2.3