[PATCH] D56207: Update allocator unit tests to test the `RemoteAddressSpaceView` template instantiation.

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 16 14:18:14 PST 2019


vitalybuka added inline comments.


================
Comment at: lib/sanitizer_common/tests/sanitizer_allocator_test.cc:696
+        AllocatorRemoteView *a_remote_view =
+            reinterpret_cast<AllocatorRemoteView *>(a);
+        // Create in-process VMReadContext object.
----------------
delcypher wrote:
> vitalybuka wrote:
> > How are we going init AllocatorRemoteView in production code?
> It's not too far from what's in the test. In production we will use `VMReadContext::read(...)` to copy an in-use allocator from the target sanitizer process into the local process and then perform the `reinterpret_cast` just like this test does.
> 
> We can't write this test to actually use a remote allocator very easily so we just use a local one and check that `RemoteAddressSpaceView` works as expected with local memory.
> 
> A different test that tests the production workflow will be submitted in a different patch.
I don't like this reinterpret of two complex unrelated classes.
We should probably add code to load needed state from Allocator into AllocatorRemoteView


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56207/new/

https://reviews.llvm.org/D56207





More information about the llvm-commits mailing list