mirror of
https://github.com/uutils/coreutils
synced 2024-07-23 19:04:18 +00:00
fix a test on cp counting the number of fd:
The testsuite runs in parallel, we have pipe, sockets opened by other tests. So, we take in account the various fd to increase the limit
This commit is contained in:
parent
987479d601
commit
a8d1d73465
474
Cargo.lock
generated
474
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
# coreutils (uutils)
|
||||
# * see the repository LICENSE, README, and CONTRIBUTING files for more information
|
||||
|
||||
# spell-checker:ignore (libs) libselinux gethostid
|
||||
# spell-checker:ignore (libs) libselinux gethostid procfs
|
||||
|
||||
[package]
|
||||
name = "coreutils"
|
||||
|
@ -401,6 +401,7 @@ atty = "0.2"
|
|||
hex-literal = "0.3.1"
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dev-dependencies]
|
||||
procfs = "0.14"
|
||||
rlimit = "0.8.3"
|
||||
|
||||
[target.'cfg(unix)'.dev-dependencies]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// spell-checker:ignore (flags) reflink (fs) tmpfs (linux) rlimit Rlim NOFILE clob btrfs ROOTDIR USERDIR
|
||||
// spell-checker:ignore (flags) reflink (fs) tmpfs (linux) rlimit Rlim NOFILE clob btrfs ROOTDIR USERDIR procfs
|
||||
|
||||
use crate::common::util::*;
|
||||
#[cfg(not(windows))]
|
||||
|
@ -1379,12 +1379,27 @@ fn test_cp_reflink_insufficient_permission() {
|
|||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
#[test]
|
||||
fn test_closes_file_descriptors() {
|
||||
use procfs::process::Process;
|
||||
let me = Process::myself().unwrap();
|
||||
|
||||
// The test suite runs in parallel, we have pipe, sockets
|
||||
// opened by other tests.
|
||||
// So, we take in account the various fd to increase the limit
|
||||
let number_file_already_opened: u64 = me.fd_count().unwrap().try_into().unwrap();
|
||||
let limit_fd: u64 = number_file_already_opened + 9;
|
||||
|
||||
// For debugging purposes:
|
||||
for f in me.fd().unwrap() {
|
||||
let fd = f.unwrap();
|
||||
println!("{:?} {:?}", fd, fd.mode());
|
||||
}
|
||||
|
||||
new_ucmd!()
|
||||
.arg("-r")
|
||||
.arg("--reflink=auto")
|
||||
.arg("dir_with_10_files/")
|
||||
.arg("dir_with_10_files_new/")
|
||||
.with_limit(Resource::NOFILE, 9, 9)
|
||||
.with_limit(Resource::NOFILE, limit_fd, limit_fd)
|
||||
.succeeds();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue