This patch enables building and running TSan unit tests on OS X. There are several changes:
- Move the detection of OSX_SYSROOT_FLAG to config-ix.cmake so it becomes a global-scope variable.
- Add building a static version of the runtime and link it with the unit tests.
- Modify tsan_test_util_linux.cc to be Darwin-compatible and add it into the OS X build. In a subsequent commit, I'll rename the file to tsan_test_util_posix.cc.
- Use symbolize=false:abort_on_error=0 as default TSAN_OPTIONS to speed up the unit tests significantly.
- In tsan_clock_test.cc, replace CLOCK_MONOTONIC with gettimeofday, which is available on OS X.
Tests can rely on the fact that this is an actual mutex that provides actual synchronization. You turn it into no-op. It's probably not super important (as no tests fail and we do not add any more of these tests), but I think it is better to define Spin to Normal on mac:
#ifndef APPLE
#else
#endif
This way it is still a mutex from point of view of both execution and tsan.