Skip to content

Commit

Permalink
tests/head: add test to write to /dev/full
Browse files Browse the repository at this point in the history
  • Loading branch information
DaringCuteSeal committed Jan 5, 2025
1 parent 5fe6706 commit 9202f23
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/by-util/test_head.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,3 +475,25 @@ fn test_all_but_last_lines() {
.succeeds()
.stdout_is_fixture("lorem_ipsum_backwards_15_lines.expected");
}

#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))]
#[test]
fn test_write_to_dev_full() {
use std::fs::OpenOptions;

for append in [true, false] {
{
let dev_full = OpenOptions::new()
.write(true)
.append(append)
.open("/dev/full")
.unwrap();

new_ucmd!()
.pipe_in_fixture(INPUT)
.set_stdout(dev_full)
.run()
.stderr_contains("No space left on device");
}
}
}

0 comments on commit 9202f23

Please sign in to comment.