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 <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Daniel Verkamp 2023-07-13 12:25:42 -07:00 committed by crosvm LUCI
parent 14b7dda9f9
commit 587d5fab3d
2 changed files with 11 additions and 18 deletions

View file

@ -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]

View file

@ -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 {