mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Fix broken test in certain Linux containers
This commit is contained in:
parent
463c1ac2ff
commit
8b6c1337aa
1 changed files with 34 additions and 18 deletions
|
@ -191,25 +191,41 @@ fn test_ls_io_errors() {
|
||||||
// dup and close work on the mac, but doesn't work in some linux containers
|
// dup and close work on the mac, but doesn't work in some linux containers
|
||||||
// so check to see that return values are non-error before proceeding
|
// so check to see that return values are non-error before proceeding
|
||||||
if rv1.is_ok() && rv2.is_ok() {
|
if rv1.is_ok() && rv2.is_ok() {
|
||||||
scene
|
// on the mac and in certain Linux containers bad fds are typed as dirs,
|
||||||
.ucmd()
|
// however sometimes bad fds are typed as links and directory entry on links won't fail
|
||||||
.arg("-alR")
|
if PathBuf::from(format!("/dev/fd/{fd}", fd = fd2)).is_dir() {
|
||||||
.arg(format!("/dev/fd/{}", fd = fd2))
|
scene
|
||||||
.fails()
|
.ucmd()
|
||||||
.stderr_contains(format!(
|
.arg("-alR")
|
||||||
"cannot open directory '/dev/fd/{fd}': Bad file descriptor",
|
.arg(format!("/dev/fd/{fd}", fd = fd2))
|
||||||
fd = fd2
|
.fails()
|
||||||
))
|
.stderr_contains(format!(
|
||||||
.stdout_does_not_contain(format!("{fd}:\n", fd = fd2));
|
"cannot open directory '/dev/fd/{fd}': Bad file descriptor",
|
||||||
|
fd = fd2
|
||||||
|
))
|
||||||
|
.stdout_does_not_contain(format!("{fd}:\n", fd = fd2));
|
||||||
|
|
||||||
scene
|
scene
|
||||||
.ucmd()
|
.ucmd()
|
||||||
.arg("-RiL")
|
.arg("-RiL")
|
||||||
.arg(format!("/dev/fd/{fd}", fd = fd2))
|
.arg(format!("/dev/fd/{fd}", fd = fd2))
|
||||||
.fails()
|
.fails()
|
||||||
.stderr_contains(format!("cannot open directory '/dev/fd/{fd}': Bad file descriptor", fd = fd2))
|
.stderr_contains(format!("cannot open directory '/dev/fd/{fd}': Bad file descriptor", fd = fd2))
|
||||||
// don't double print bad fd errors
|
// don't double print bad fd errors
|
||||||
.stderr_does_not_contain(format!("ls: cannot open directory '/dev/fd/{fd}': Bad file descriptor\nls: cannot open directory '/dev/fd/{fd}': Bad file descriptor", fd = fd2));
|
.stderr_does_not_contain(format!("ls: cannot open directory '/dev/fd/{fd}': Bad file descriptor\nls: cannot open directory '/dev/fd/{fd}': Bad file descriptor", fd = fd2));
|
||||||
|
} else {
|
||||||
|
scene
|
||||||
|
.ucmd()
|
||||||
|
.arg("-alR")
|
||||||
|
.arg(format!("/dev/fd/{fd}", fd = fd2))
|
||||||
|
.succeeds();
|
||||||
|
|
||||||
|
scene
|
||||||
|
.ucmd()
|
||||||
|
.arg("-RiL")
|
||||||
|
.arg(format!("/dev/fd/{fd}", fd = fd2))
|
||||||
|
.succeeds();
|
||||||
|
}
|
||||||
|
|
||||||
scene
|
scene
|
||||||
.ucmd()
|
.ucmd()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue