Skip to content

Commit

Permalink
tests: don't fail del_dev_async() isn't supported
Browse files Browse the repository at this point in the history
DEL_DEV_ASYNC may not be supported on old kernel, so don't fail
such situation.

Signed-off-by: Ming Lei <[email protected]>
  • Loading branch information
ming1 committed Nov 19, 2024
1 parent 0a95b84 commit ba3babe
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ctrl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,7 @@ impl UblkCtrl {
mod tests {
use crate::ctrl::UblkCtrlBuilder;
use crate::io::{UblkDev, UblkIOCtx, UblkQueue};
use crate::UblkError;
use crate::{ctrl::UblkCtrl, UblkFlags, UblkIORes};
use std::cell::Cell;
use std::path::Path;
Expand Down Expand Up @@ -1569,7 +1570,14 @@ mod tests {
)
.unwrap();

ctrl.del_dev_async().expect("fail to del_dev_async");
match ctrl.del_dev_async() {
Ok(_res) => {}
Err(UblkError::UringIOError(res)) => {
/* -ENOSUPP */
assert!(res == -524 || res == -libc::EOPNOTSUPP);
}
_ => assert!(false),
}
}

/// minimized unprivileged ublk test, may just run in root privilege
Expand Down

0 comments on commit ba3babe

Please sign in to comment.