From 7310c7fca183c1dca3d83a059788671ff409afde Mon Sep 17 00:00:00 2001 From: Maxim Date: Thu, 19 Jun 2025 00:35:53 +0900 Subject: [PATCH 1/2] tests/tee: enable no_more_writable test --- tests/by-util/test_tee.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/by-util/test_tee.rs b/tests/by-util/test_tee.rs index e20a22326..e6caa9628 100644 --- a/tests/by-util/test_tee.rs +++ b/tests/by-util/test_tee.rs @@ -137,27 +137,26 @@ fn test_readonly() { #[test] #[cfg(target_os = "linux")] fn test_tee_no_more_writeable_2() { - // should be equals to 'tee out1 out2 >/dev/full Date: Thu, 19 Jun 2025 00:37:26 +0900 Subject: [PATCH 2/2] tests/tee: move no_more_writable test to linux_only module --- tests/by-util/test_tee.rs | 49 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/tests/by-util/test_tee.rs b/tests/by-util/test_tee.rs index e6caa9628..1c42faef3 100644 --- a/tests/by-util/test_tee.rs +++ b/tests/by-util/test_tee.rs @@ -134,31 +134,6 @@ fn test_readonly() { assert_eq!(at.read(writable_file), content_tee); } -#[test] -#[cfg(target_os = "linux")] -fn test_tee_no_more_writeable_2() { - use std::fs::File; - let (at, mut ucmd) = at_and_ucmd!(); - let content = (1..=10).fold(String::new(), |mut output, x| { - let _ = writeln!(output, "{x}"); - output - }); - let file_out_a = "tee_file_out_a"; - let file_out_b = "tee_file_out_b"; - let dev_full = File::options().append(true).open("/dev/full").unwrap(); - - let result = ucmd - .arg(file_out_a) - .arg(file_out_b) - .set_stdout(dev_full) - .pipe_in(content.as_bytes()) - .fails(); - - assert_eq!(at.read(file_out_a), content); - assert_eq!(at.read(file_out_b), content); - assert!(result.stderr_str().contains("No space left on device")); -} - #[cfg(target_os = "linux")] mod linux_only { use uutests::util::{AtPath, CmdResult, TestScenario, UCommand}; @@ -580,4 +555,28 @@ mod linux_only { expect_success(&output); expect_correct(file_out_a, &at, content.as_str()); } + + #[test] + fn test_tee_no_more_writeable_2() { + use std::fs::File; + let (at, mut ucmd) = at_and_ucmd!(); + let content = (1..=10).fold(String::new(), |mut output, x| { + let _ = writeln!(output, "{x}"); + output + }); + let file_out_a = "tee_file_out_a"; + let file_out_b = "tee_file_out_b"; + let dev_full = File::options().append(true).open("/dev/full").unwrap(); + + let result = ucmd + .arg(file_out_a) + .arg(file_out_b) + .set_stdout(dev_full) + .pipe_in(content.as_bytes()) + .fails(); + + assert_eq!(at.read(file_out_a), content); + assert_eq!(at.read(file_out_b), content); + assert!(result.stderr_str().contains("No space left on device")); + } }