1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

dd: misc gnu test (#6084)

* dd: check file is a dir for iflag directory

* Improve english

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* dd: stderr output checking for "iflag directory" testcase

* dd: replace #[cfg(unix)] with #[test]

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
This commit is contained in:
sreehari prasad 2024-03-20 11:25:54 +05:30 committed by GitHub
parent 08172c28c0
commit 660014e532
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View file

@ -1715,6 +1715,20 @@ fn test_reading_partial_blocks_from_fifo_unbuffered() {
assert!(output.stderr.starts_with(expected));
}
#[test]
#[cfg(any(target_os = "linux", target_os = "android"))]
fn test_iflag_directory_fails_when_file_is_passed_via_std_in() {
let ts = TestScenario::new(util_name!());
let at = &ts.fixtures;
at.make_file("input");
let filename = at.plus_as_string("input");
new_ucmd!()
.args(&["iflag=directory", "count=0"])
.set_stdin(std::process::Stdio::from(File::open(filename).unwrap()))
.fails()
.stderr_contains("standard input: not a directory");
}
#[test]
fn test_stdin_stdout_not_rewound_even_when_connected_to_seekable_file() {
use std::process::Stdio;