mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 02:25:23 +00:00
A few files were missing license blurbs at the top, so update them all to include them. BUG=none TEST=none Change-Id: Ida101be2e5c255b8cffeb15f5b93f63bfd1b130b Reviewed-on: https://chromium-review.googlesource.com/1577900 Commit-Ready: Stephen Barber <smbarber@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org>
38 lines
895 B
Rust
38 lines
895 B
Rust
// Copyright 2019 The Chromium OS Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
use sys_util::EventFd;
|
|
|
|
use msg_socket::*;
|
|
|
|
#[derive(MsgOnSocket)]
|
|
struct Request {
|
|
field0: u8,
|
|
field1: EventFd,
|
|
field2: u32,
|
|
field3: bool,
|
|
}
|
|
|
|
#[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,
|
|
field3: true,
|
|
})
|
|
.unwrap();
|
|
let r = res.recv().unwrap();
|
|
assert_eq!(r.field0, 2);
|
|
assert_eq!(r.field2, 0xf0f0);
|
|
assert_eq!(r.field3, true);
|
|
r.field1.write(0x0f0f).unwrap();
|
|
assert_eq!(e1.read().unwrap(), 0x0f0f);
|
|
}
|