There are two things that make running MLIR tests with ASan on a mac tedious: 1. The `DYLD_INSERT_LIBRARIES` environment variable needs to be set to point to `libclang_rt.asan_osx_dynamic.dylib` 2. Mac is wrapping Python, which means that the `DYLD_INSERT_LIBRARIES` environment variable is not being respected in the Python tests. The solution is to find and use a non-wrapped Python binary. With the above two changes, ASan works out of the box on mac's by setting the `-DLLVM_USE_SANITIZER=Address` cmake flag. I have stolen most of the code in this PR from other LLVM projects. It may be a good idea to reconcile it somewhere.
774 B
774 B