crosvm/msg_socket/tests/tuple.rs
Michael Hoyle 685316f0bd base: EventFd -> Event renaming
Note the CL size is large entirely due to the rename,
the changes are mostly negligible.

Also making a few small additional changes in sys_util
areas that don't need much attention in base. This includes
typedefing and adding specific imports for areas that don't
require significant interface changes.

BUG=b:162363783
TEST=./build_test

Change-Id: I4a2c9c4cdce7565806ed338e241c6b8c82c855c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2415180
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Michael Hoyle <mikehoyle@google.com>
2020-10-06 13:50:09 +00:00

22 lines
638 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 base::Event;
use msg_socket::*;
#[derive(MsgOnSocket)]
struct Message(u8, u16, Event);
#[test]
fn sock_send_recv_tuple() {
let (req, res) = pair::<Message, Message>().unwrap();
let e0 = Event::new().unwrap();
let e1 = e0.try_clone().unwrap();
req.send(&Message(1, 0x12, e0)).unwrap();
let r = res.recv().unwrap();
assert_eq!(r.0, 1);
assert_eq!(r.1, 0x12);
r.2.write(0x0f0f).unwrap();
assert_eq!(e1.read().unwrap(), 0x0f0f);
}