diff options
author | SteveLau <stevelauc@outlook.com> | 2022-08-12 08:57:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-12 08:57:10 +0800 |
commit | 9161a294d767367a5a34c3584e142cb37c80ed89 (patch) | |
tree | fa77ae7d6c074dfe9a72b2db70d218143a3aed8b /test | |
parent | 4d5e5d83f824f0ff2368636753e68ec189cf3a52 (diff) | |
parent | d96436e04e081a46648b66b6336db06e7083111f (diff) | |
download | nix-9161a294d767367a5a34c3584e142cb37c80ed89.zip |
Merge branch 'nix-rust:master' into remove-deprecated-items
Diffstat (limited to 'test')
-rw-r--r-- | test/sys/test_aio.rs | 12 | ||||
-rw-r--r-- | test/sys/test_termios.rs | 2 | ||||
-rw-r--r-- | test/test_time.rs | 10 |
3 files changed, 10 insertions, 14 deletions
diff --git a/test/sys/test_aio.rs b/test/sys/test_aio.rs index 12749b1d..6a36f3e7 100644 --- a/test/sys/test_aio.rs +++ b/test/sys/test_aio.rs @@ -101,8 +101,7 @@ mod aio_fsync { 0, SigevNotify::SigevNone, )); - let err = aiof.as_mut().submit(); - err.expect("assert failed"); + aiof.as_mut().submit().unwrap(); poll_aio!(&mut aiof).unwrap(); aiof.as_mut().aio_return().unwrap(); } @@ -148,8 +147,7 @@ mod aio_read { Box::pin(AioRead::new(fd, 2, &mut rbuf, 0, SigevNotify::SigevNone)); aior.as_mut().submit().unwrap(); - let cancelstat = aior.as_mut().cancel(); - cancelstat.expect("assert failed"); + aior.as_mut().cancel().unwrap(); // Wait for aiow to complete, but don't care whether it succeeded let _ = poll_aio!(&mut aior); @@ -341,8 +339,7 @@ mod aio_write { let err = aiow.as_mut().error(); assert!(err == Ok(()) || err == Err(Errno::EINPROGRESS)); - let cancelstat = aiow.as_mut().cancel(); - cancelstat.expect("assert failed"); + aiow.as_mut().cancel().unwrap(); // Wait for aiow to complete, but don't care whether it succeeded let _ = poll_aio!(&mut aiow); @@ -564,8 +561,7 @@ fn test_aio_cancel_all() { let err = aiocb.as_mut().error(); assert!(err == Ok(()) || err == Err(Errno::EINPROGRESS)); - let cancelstat = aio_cancel_all(f.as_raw_fd()); - cancelstat.expect("assert failed"); + aio_cancel_all(f.as_raw_fd()).unwrap(); // Wait for aiocb to complete, but don't care whether it succeeded let _ = poll_aio!(&mut aiocb); diff --git a/test/sys/test_termios.rs b/test/sys/test_termios.rs index 11a08cb5..aaf00084 100644 --- a/test/sys/test_termios.rs +++ b/test/sys/test_termios.rs @@ -22,7 +22,7 @@ fn test_tcgetattr_pty() { let _m = crate::PTSNAME_MTX.lock(); let pty = openpty(None, None).expect("openpty failed"); - termios::tcgetattr(pty.slave).expect("assert failed"); + termios::tcgetattr(pty.slave).unwrap(); close(pty.master).expect("closing the master failed"); close(pty.slave).expect("closing the slave failed"); } diff --git a/test/test_time.rs b/test/test_time.rs index 3e8af653..5f76e61a 100644 --- a/test/test_time.rs +++ b/test/test_time.rs @@ -29,18 +29,18 @@ pub fn test_clock_gettime() { #[test] pub fn test_clock_getcpuclockid() { let clock_id = clock_getcpuclockid(nix::unistd::Pid::this()).unwrap(); - clock_gettime(clock_id).expect("assert failed"); + clock_gettime(clock_id).unwrap(); } #[cfg(not(target_os = "redox"))] #[test] pub fn test_clock_id_res() { - ClockId::CLOCK_REALTIME.res().expect("assert failed"); + ClockId::CLOCK_REALTIME.res().unwrap(); } #[test] pub fn test_clock_id_now() { - ClockId::CLOCK_REALTIME.now().expect("assert failed"); + ClockId::CLOCK_REALTIME.now().unwrap(); } #[cfg(any( @@ -54,6 +54,6 @@ pub fn test_clock_id_now() { pub fn test_clock_id_pid_cpu_clock_id() { ClockId::pid_cpu_clock_id(nix::unistd::Pid::this()) .map(ClockId::now) - .expect("assert failed") - .expect("assert failed"); + .unwrap() + .unwrap(); } |