summaryrefslogtreecommitdiff
path: root/test/sys/test_ioctl.rs
diff options
context:
space:
mode:
authorCostin-Robert Sin <sin.costinrobert@gmail.com>2022-06-21 15:36:05 +0300
committerCostin-Robert Sin <sin.costinrobert@gmail.com>2022-06-24 00:35:52 +0300
commit3e6cb639f0d9afde57d9cc03526c2e488641231b (patch)
treec882f2947fa5b22e67a58918c45012655b892b30 /test/sys/test_ioctl.rs
parent8f08a69c28fad5ee875d69e4c8a1b8eed2203cb4 (diff)
downloadnix-3e6cb639f0d9afde57d9cc03526c2e488641231b.zip
Fix all formating problems to pass CI formating test
Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
Diffstat (limited to 'test/sys/test_ioctl.rs')
-rw-r--r--test/sys/test_ioctl.rs83
1 files changed, 57 insertions, 26 deletions
diff --git a/test/sys/test_ioctl.rs b/test/sys/test_ioctl.rs
index 236d2426..7a603c5b 100644
--- a/test/sys/test_ioctl.rs
+++ b/test/sys/test_ioctl.rs
@@ -32,7 +32,12 @@ ioctl_readwrite_buf!(readwritebuf_test, 0, 0, u32);
mod linux {
#[test]
fn test_op_none() {
- if cfg!(any(target_arch = "mips", target_arch = "mips64", target_arch="powerpc", target_arch="powerpc64")){
+ if cfg!(any(
+ target_arch = "mips",
+ target_arch = "mips64",
+ target_arch = "powerpc",
+ target_arch = "powerpc64"
+ )) {
assert_eq!(request_code_none!(b'q', 10) as u32, 0x2000_710A);
assert_eq!(request_code_none!(b'a', 255) as u32, 0x2000_61FF);
} else {
@@ -43,7 +48,12 @@ mod linux {
#[test]
fn test_op_write() {
- if cfg!(any(target_arch = "mips", target_arch = "mips64", target_arch="powerpc", target_arch="powerpc64")){
+ if cfg!(any(
+ target_arch = "mips",
+ target_arch = "mips64",
+ target_arch = "powerpc",
+ target_arch = "powerpc64"
+ )) {
assert_eq!(request_code_write!(b'z', 10, 1) as u32, 0x8001_7A0A);
assert_eq!(request_code_write!(b'z', 10, 512) as u32, 0x8200_7A0A);
} else {
@@ -55,19 +65,27 @@ mod linux {
#[cfg(target_pointer_width = "64")]
#[test]
fn test_op_write_64() {
- if cfg!(any(target_arch = "mips64", target_arch="powerpc64")){
- assert_eq!(request_code_write!(b'z', 10, 1u64 << 32) as u32,
- 0x8000_7A0A);
+ if cfg!(any(target_arch = "mips64", target_arch = "powerpc64")) {
+ assert_eq!(
+ request_code_write!(b'z', 10, 1u64 << 32) as u32,
+ 0x8000_7A0A
+ );
} else {
- assert_eq!(request_code_write!(b'z', 10, 1u64 << 32) as u32,
- 0x4000_7A0A);
+ assert_eq!(
+ request_code_write!(b'z', 10, 1u64 << 32) as u32,
+ 0x4000_7A0A
+ );
}
-
}
#[test]
fn test_op_read() {
- if cfg!(any(target_arch = "mips", target_arch = "mips64", target_arch="powerpc", target_arch="powerpc64")){
+ if cfg!(any(
+ target_arch = "mips",
+ target_arch = "mips64",
+ target_arch = "powerpc",
+ target_arch = "powerpc64"
+ )) {
assert_eq!(request_code_read!(b'z', 10, 1) as u32, 0x4001_7A0A);
assert_eq!(request_code_read!(b'z', 10, 512) as u32, 0x4200_7A0A);
} else {
@@ -79,12 +97,16 @@ mod linux {
#[cfg(target_pointer_width = "64")]
#[test]
fn test_op_read_64() {
- if cfg!(any(target_arch = "mips64", target_arch="powerpc64")){
- assert_eq!(request_code_read!(b'z', 10, 1u64 << 32) as u32,
- 0x4000_7A0A);
+ if cfg!(any(target_arch = "mips64", target_arch = "powerpc64")) {
+ assert_eq!(
+ request_code_read!(b'z', 10, 1u64 << 32) as u32,
+ 0x4000_7A0A
+ );
} else {
- assert_eq!(request_code_read!(b'z', 10, 1u64 << 32) as u32,
- 0x8000_7A0A);
+ assert_eq!(
+ request_code_read!(b'z', 10, 1u64 << 32) as u32,
+ 0x8000_7A0A
+ );
}
}
@@ -97,17 +119,21 @@ mod linux {
#[cfg(target_pointer_width = "64")]
#[test]
fn test_op_read_write_64() {
- assert_eq!(request_code_readwrite!(b'z', 10, 1u64 << 32) as u32,
- 0xC000_7A0A);
+ assert_eq!(
+ request_code_readwrite!(b'z', 10, 1u64 << 32) as u32,
+ 0xC000_7A0A
+ );
}
}
-#[cfg(any(target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd"))]
+#[cfg(any(
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "netbsd",
+ target_os = "openbsd"
+))]
mod bsd {
#[test]
fn test_op_none() {
@@ -164,8 +190,8 @@ mod linux_ioctls {
use std::mem;
use std::os::unix::io::AsRawFd;
+ use libc::{termios, TCGETS, TCSBRK, TCSETS, TIOCNXCL};
use tempfile::tempfile;
- use libc::{TCGETS, TCSBRK, TCSETS, TIOCNXCL, termios};
use nix::errno::Errno;
@@ -255,7 +281,7 @@ mod linux_ioctls {
}
// From linux/videodev2.h
- ioctl_readwrite!(enum_audio, b'V', 65, v4l2_audio);
+ ioctl_readwrite!(enum_audio, b'V', 65, v4l2_audio);
#[test]
fn test_ioctl_readwrite() {
let file = tempfile().unwrap();
@@ -281,7 +307,12 @@ mod linux_ioctls {
}
// From linux/spi/spidev.h
- ioctl_write_buf!(spi_ioc_message, super::SPI_IOC_MAGIC, super::SPI_IOC_MESSAGE, spi_ioc_transfer);
+ ioctl_write_buf!(
+ spi_ioc_message,
+ super::SPI_IOC_MAGIC,
+ super::SPI_IOC_MESSAGE,
+ spi_ioc_transfer
+ );
#[test]
fn test_ioctl_write_buf() {
let file = tempfile().unwrap();
@@ -298,8 +329,8 @@ mod freebsd_ioctls {
use std::mem;
use std::os::unix::io::AsRawFd;
- use tempfile::tempfile;
use libc::termios;
+ use tempfile::tempfile;
use nix::errno::Errno;