Skip to content

Commit

Permalink
uapi: adding shminfo SentryExchange test
Browse files Browse the repository at this point in the history
  • Loading branch information
pthierry-ledger committed Dec 12, 2024
1 parent 40ed4d4 commit d1509d9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 27 additions & 0 deletions uapi/src/exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,30 @@ where T:SentryExchangeable
{
to.from_kernel()
}


#[cfg(test)]
mod tests {
use super::*;

#[test]
fn back_to_back_shminfo() {
let src = ShmInfo {
handle: 2,
label: 42,
base: 0x123456,
len: 64,
perms: 0x1,
};
let mut dst = ShmInfo {
handle: 0,
label: 0,
base: 0,
len: 0,
perms: 0,
};
let _ = src.to_kernel();
let _ = dst.from_kernel();
assert_eq!(src, dst);
}
}
2 changes: 1 addition & 1 deletion uapi/src/systypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ pub mod dev {
pub mod shm {

#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[derive(PartialEq, Debug, Copy, Clone)]
pub struct ShmInfo {
pub handle: crate::systypes::ShmHandle,
pub label: u32,
Expand Down

0 comments on commit d1509d9

Please sign in to comment.