mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-12-26 13:10:56 +00:00
2bac1e7a9c
We updated the production toolchain from 1.30 to 1.31 in CL:1366446. This CL does the same upgrade for the local developer toolchain and Kokoro. The relevant changes are in rust-toolchain and kokoro/Dockerfile. The rest are from rustfmt. TEST=cargo fmt --all -- --check TEST=as described in kokoro/README.md Change-Id: I3b4913f3e237baa36c664b4953be360c09efffd4 Reviewed-on: https://chromium-review.googlesource.com/1374376 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: David Tolnay <dtolnay@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
35 lines
738 B
Rust
35 lines
738 B
Rust
extern crate msg_on_socket_derive;
|
|
extern crate msg_socket;
|
|
extern crate sys_util;
|
|
|
|
use sys_util::EventFd;
|
|
|
|
use msg_socket::*;
|
|
|
|
#[derive(MsgOnSocket)]
|
|
struct Request {
|
|
field0: u8,
|
|
field1: EventFd,
|
|
field2: u32,
|
|
}
|
|
|
|
#[derive(MsgOnSocket)]
|
|
struct DummyResponse {}
|
|
|
|
#[test]
|
|
fn sock_send_recv_struct() {
|
|
let (req, res) = pair::<Request, DummyResponse>().unwrap();
|
|
let e0 = EventFd::new().unwrap();
|
|
let e1 = e0.try_clone().unwrap();
|
|
req.send(&Request {
|
|
field0: 2,
|
|
field1: e0,
|
|
field2: 0xf0f0,
|
|
})
|
|
.unwrap();
|
|
let r = res.recv().unwrap();
|
|
assert_eq!(r.field0, 2);
|
|
assert_eq!(r.field2, 0xf0f0);
|
|
r.field1.write(0x0f0f).unwrap();
|
|
assert_eq!(e1.read().unwrap(), 0x0f0f);
|
|
}
|