This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Make tsan_test_util_posix.cc call pthread interceptors on OS X
ClosedPublic

Authored by kubamracek on Nov 19 2015, 11:08 AM.

Details

Summary

The tsan_test_util_posix.cc implementation of mutexes call pthread APIs directly, which on OS X don't end up calling the intercepted versions and we miss the synchronization. This patch changes the unit tests to directly call the intercepted versions. This fixes several test failures on OS X.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek retitled this revision from to [tsan] Make tsan_test_util_posix.cc call pthread interceptors on OS X.
kubamracek updated this object.
kubamracek added reviewers: dvyukov, kcc, glider, samsonov.
dvyukov edited edge metadata.Nov 20 2015, 11:18 AM

I wonder what's the difference between this test and user code? Normal user code does not call interceptors directly, but still we [hopefully] intercept these calls. Can we make this test behave more like user code instead? There is always value in tests doing exactly the same thing as real system.

I wonder what's the difference between this test and user code? Normal user code does not call interceptors directly, but still we [hopefully] intercept these calls. Can we make this test behave more like user code instead? There is always value in tests doing exactly the same thing as real system.

In unit tests (not lit tests) we want to call internal functions (not exported by the dylib), so we build a static library instead of the dylib. In a static library, interceptors don't work on OS X. User code always uses the dylib -- that's the difference.

dvyukov accepted this revision.Nov 20 2015, 11:46 AM
dvyukov edited edge metadata.

okay

This revision is now accepted and ready to land.Nov 20 2015, 11:46 AM
This revision was automatically updated to reflect the committed changes.