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 <auradkar@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
This commit is contained in:
Noah Gold 2023-02-03 13:29:32 -08:00 committed by crosvm LUCI
parent 3d01498e99
commit c7041e707c

View file

@ -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());
/// ```