[compiler-rt] r299738 - [lit] Fix Darwin pickling errors with process pools

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 6 18:23:15 PDT 2017


Author: rnk
Date: Thu Apr  6 20:23:15 2017
New Revision: 299738

URL: http://llvm.org/viewvc/llvm-project?rev=299738&view=rev
Log:
[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.

Added:
    compiler-rt/trunk/unittests/lit_unittest_cfg_utils.py
Modified:
    compiler-rt/trunk/unittests/lit.common.unit.cfg

Modified: compiler-rt/trunk/unittests/lit.common.unit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/unittests/lit.common.unit.cfg?rev=299738&r1=299737&r2=299738&view=diff
==============================================================================
--- compiler-rt/trunk/unittests/lit.common.unit.cfg (original)
+++ compiler-rt/trunk/unittests/lit.common.unit.cfg Thu Apr  6 20:23:15 2017
@@ -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

Added: compiler-rt/trunk/unittests/lit_unittest_cfg_utils.py
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/unittests/lit_unittest_cfg_utils.py?rev=299738&view=auto
==============================================================================
--- compiler-rt/trunk/unittests/lit_unittest_cfg_utils.py (added)
+++ compiler-rt/trunk/unittests/lit_unittest_cfg_utils.py Thu Apr  6 20:23:15 2017
@@ -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 ""




More information about the llvm-commits mailing list