Hello!
We have a C project which is wrapped by Python interfaces using SWIG. We have both C/C++ and Python tests and want to test all of them with TSan enabled. After some investigation we discovered that after compiling our dynamic library with -fsanitize=thread we have the following picture:
- Our dynamic library uses many
__tsan_... symbols but doesn't contain this symbols and doesn't have explicit dependency on libtsan.so so it seems like it should load all these symbols at runtime
- Our C/C++ tests which are binary executables contains all these
__tsan_... symbols which are required by library, so when we run C/C++ tests everything works fine (library uses symbols from test)
- When we test our Python wrapper, we need to set
LD_PRELOAD=<path_to_libtsan.so> before running the tests since in this case we have no executable which provides us all the required symbols. But it can be tricky to understand what exact libtsan.so was used during the compilation if we have several of them in the environment.
So here come the questions:
- Is it correct way to run our Python tests (setting
LD_PRELOAD=<path_to_libtsan.so>) ?
- Is there a more native way to do this?
- Is there any way to determine exactly which libasan.so was used during compilation?
Hello!
We have a C project which is wrapped by Python interfaces using SWIG. We have both C/C++ and Python tests and want to test all of them with TSan enabled. After some investigation we discovered that after compiling our dynamic library with
-fsanitize=threadwe have the following picture:__tsan_...symbols but doesn't contain this symbols and doesn't have explicit dependency onlibtsan.soso it seems like it should load all these symbols at runtime__tsan_...symbols which are required by library, so when we run C/C++ tests everything works fine (library uses symbols from test)LD_PRELOAD=<path_to_libtsan.so>before running the tests since in this case we have no executable which provides us all the required symbols. But it can be tricky to understand what exact libtsan.so was used during the compilation if we have several of them in the environment.So here come the questions:
LD_PRELOAD=<path_to_libtsan.so>) ?