From a7d1886067e361eb6bdad691638660f66a640db7 Mon Sep 17 00:00:00 2001 From: Dylan Reid Date: Wed, 11 Nov 2020 16:57:04 -0800 Subject: [PATCH] cros_async: fix unittest for uring It was broken by the RawFd removal from GuestMemory. Change-Id: Ifa927fb7f6a84db55ca27e0f8ffa42475a3f8c58 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2533723 Reviewed-by: Daniel Verkamp Reviewed-by: Michael Hoyle Tested-by: Dylan Reid Tested-by: kokoro Commit-Queue: Dylan Reid --- cros_async/src/uring_futures/uring_source.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cros_async/src/uring_futures/uring_source.rs b/cros_async/src/uring_futures/uring_source.rs index 15b88b8230..1d6a1a21e4 100644 --- a/cros_async/src/uring_futures/uring_source.rs +++ b/cros_async/src/uring_futures/uring_source.rs @@ -299,17 +299,15 @@ mod tests { #[test] fn read_to_mem() { - use vm_memory::{GuestAddress, GuestMemory}; - use crate::uring_mem::VecIoWrapper; + use std::io::Write; + use tempfile::tempfile; let io_obj = Box::pin({ // Use guest memory as a test file, it implements AsRawFd. - let source = GuestMemory::new(&[(GuestAddress(0), 8192)]).unwrap(); - source - .get_slice_at_addr(GuestAddress(0), 8192) - .unwrap() - .write_bytes(0x55); + let mut source = tempfile().unwrap(); + let data = vec![0x55; 8192]; + source.write(&data).unwrap(); UringSource::new(source).unwrap() });