From 587d5fab3d15168c429e0424306a9b25063c21e2 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 13 Jul 2023 12:25:42 -0700 Subject: [PATCH] vm_control: move send_recv_event test to base This test is unrelated to vm_control; it is testing base::Event and base::Tube functionality, so move it next to the existing Tube tests. The test module was also in the middle of the file for some reason, which caused clippy warnings in Rust 1.71. Change-Id: I52858e71df8aa3e092b3b7d12e1232454b61c4d4 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4684827 Reviewed-by: Dennis Kempin Commit-Queue: Daniel Verkamp --- base/tests/tube.rs | 11 +++++++++++ vm_control/src/lib.rs | 18 ------------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/base/tests/tube.rs b/base/tests/tube.rs index 9c53906f1d..83acbc28be 100644 --- a/base/tests/tube.rs +++ b/base/tests/tube.rs @@ -75,6 +75,17 @@ fn send_recv_one_fd() { test_event_pair(test_msg.b, recv_msg.b); } +#[test] +fn send_recv_event() { + let (req, res) = Tube::pair().unwrap(); + let e1 = Event::new().unwrap(); + res.send(&e1).unwrap(); + + let recv_event: Event = req.recv().unwrap(); + recv_event.signal().unwrap(); + e1.wait().unwrap(); +} + /// Send messages to a Tube with the given identifier (see `consume_messages`; we use this to /// track different message producers). #[track_caller] diff --git a/vm_control/src/lib.rs b/vm_control/src/lib.rs index d72cc25b62..ab3de25f35 100644 --- a/vm_control/src/lib.rs +++ b/vm_control/src/lib.rs @@ -2347,24 +2347,6 @@ pub enum Ac97Control { Mute(bool), } -#[cfg(test)] -mod tests { - use base::Event; - - use super::*; - - #[test] - fn sock_send_recv_event() { - let (req, res) = Tube::pair().unwrap(); - let e1 = Event::new().unwrap(); - res.send(&e1).unwrap(); - - let recv_event: Event = req.recv().unwrap(); - recv_event.signal().unwrap(); - e1.wait().unwrap(); - } -} - #[sorted] #[derive(Error, Debug)] pub enum VirtioIOMMUVfioError {