mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
date,comm,tty: add integration tests for write error handling
This commit is contained in:
committed by
Sylvestre Ledru
parent
01605c3955
commit
d15e762a90
@@ -727,3 +727,18 @@ fn test_read_error() {
|
||||
.fails()
|
||||
.stderr_contains("comm: /proc/self/mem: Input/output error");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_comm_write_error_dev_full() {
|
||||
use std::fs::OpenOptions;
|
||||
let scene = TestScenario::new(util_name!());
|
||||
scene.fixtures.write("a", "a\n");
|
||||
let dev_full = OpenOptions::new().write(true).open("/dev/full").unwrap();
|
||||
scene
|
||||
.ucmd()
|
||||
.args(&["a", "a"])
|
||||
.set_stdout(dev_full)
|
||||
.fails()
|
||||
.stderr_contains("No space left on device");
|
||||
}
|
||||
|
||||
@@ -2066,3 +2066,15 @@ fn test_percent_percent_not_replaced() {
|
||||
.stdout_is(expected);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_date_write_error_dev_full() {
|
||||
use std::fs::OpenOptions;
|
||||
let dev_full = OpenOptions::new().write(true).open("/dev/full").unwrap();
|
||||
new_ucmd!()
|
||||
.arg("+%s")
|
||||
.set_stdout(dev_full)
|
||||
.fails()
|
||||
.stderr_contains("write error");
|
||||
}
|
||||
|
||||
@@ -87,3 +87,11 @@ fn test_stdout_fail() {
|
||||
let status = proc.wait().unwrap();
|
||||
assert_eq!(status.code(), Some(3));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_version_pipe_no_stderr() {
|
||||
let mut child = new_ucmd!().arg("--version").run_no_wait();
|
||||
child.close_stdout();
|
||||
child.wait().unwrap().no_stderr();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user