From c7041e707cd5e0fcc75c657ceaf55661cf84f719 Mon Sep 17 00:00:00 2001 From: Noah Gold Date: Fri, 3 Feb 2023 13:29:32 -0800 Subject: [PATCH] base: fix mmap doc test on Windows. MemoryMappingBuilder on Windows has to be built from SharedMemory. On Linux we can build without one. We should fix this API discrepency at some point, but for the moment let's get the test working again. BUG=b:267219257 TEST=the fixed test passes downstream. Change-Id: If9728f2b73465a30aa324549fbc10e189737b420 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4220528 Reviewed-by: Vikram Auradkar Commit-Queue: Noah Gold --- base/src/mmap.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base/src/mmap.rs b/base/src/mmap.rs index 8f1bb30af0..a42447b693 100644 --- a/base/src/mmap.rs +++ b/base/src/mmap.rs @@ -144,7 +144,9 @@ impl MemoryMapping { /// /// ``` /// # use base::MemoryMappingBuilder; - /// # let mut mem_map = MemoryMappingBuilder::new(1024).build().unwrap(); + /// # use base::SharedMemory; + /// # let shm = SharedMemory::new("test", 1024).unwrap(); + /// # let mut mem_map = MemoryMappingBuilder::new(1024).from_shared_memory(&shm).build().unwrap(); /// let res = mem_map.write_obj(55u64, 16); /// assert!(res.is_ok()); /// ```