This is an archive of the discontinued LLVM Phabricator instance.

[tsan] Fix CallocOverflow unit test on OS X
ClosedPublic

Authored by kubamracek on Nov 23 2015, 5:05 AM.

Details

Summary

On OS X, interceptors don't work in unit tests, so calloc() calls the system allocator. We need to use user_calloc() instead.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek updated this revision to Diff 40914.Nov 23 2015, 5:05 AM
kubamracek retitled this revision from to [tsan] Fix CallocOverflow unit test on OS X.
kubamracek updated this object.
kubamracek added reviewers: dvyukov, kcc, glider, samsonov.
dvyukov edited edge metadata.Nov 23 2015, 5:27 AM

Can we use __interceptor_calloc instead like in other tests? Behavior in such case will be closer to user programs as the interceptor can also contain some logic.

Can we use __interceptor_calloc instead like in other tests? Behavior in such case will be closer to user programs as the interceptor can also contain some logic.

Sure, I'll update the patch. (I thought user_calloc is more consistent with the rest of this file, which uses user_alloc and user_free.)

Sure, I'll update the patch. (I thought user_calloc is more consistent with the rest of this file, which uses user_alloc and user_free.)

Then, you can submit it as is.

The story behind these tests is somewhat moot. We used them when output tests did not exist. Ideally, they are rewritten to output tests. For output tests the idea is clear: write what user will write, test what matters for user.

dvyukov accepted this revision.Nov 23 2015, 7:17 AM
dvyukov edited edge metadata.
This revision is now accepted and ready to land.Nov 23 2015, 7:17 AM
This revision was automatically updated to reflect the committed changes.