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

tests: ignore failing tests for FreeBSD (#3778)

This commit is contained in:
Jan Scheer 2022-08-12 23:51:28 +02:00
parent fc14c6e7a9
commit 391709c911
No known key found for this signature in database
GPG key ID: C62AD4C29E2B9828
7 changed files with 42 additions and 14 deletions

View file

@ -9,7 +9,7 @@ use std::os::unix::fs;
#[cfg(unix)] #[cfg(unix)]
use std::os::unix::fs::symlink as symlink_file; use std::os::unix::fs::symlink as symlink_file;
#[cfg(unix)] #[cfg(all(unix, not(target_os = "freebsd")))]
use std::os::unix::fs::MetadataExt; use std::os::unix::fs::MetadataExt;
#[cfg(all(unix, not(target_os = "freebsd")))] #[cfg(all(unix, not(target_os = "freebsd")))]
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
@ -22,7 +22,9 @@ use filetime::FileTime;
use rlimit::Resource; use rlimit::Resource;
#[cfg(any(target_os = "linux", target_os = "android"))] #[cfg(any(target_os = "linux", target_os = "android"))]
use std::fs as std_fs; use std::fs as std_fs;
#[cfg(not(target_os = "freebsd"))]
use std::thread::sleep; use std::thread::sleep;
#[cfg(not(target_os = "freebsd"))]
use std::time::Duration; use std::time::Duration;
use uucore::display::Quotable; use uucore::display::Quotable;
@ -1581,6 +1583,7 @@ fn test_copy_dir_symlink() {
} }
#[test] #[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
fn test_copy_dir_with_symlinks() { fn test_copy_dir_with_symlinks() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
at.mkdir("dir"); at.mkdir("dir");
@ -1725,6 +1728,7 @@ fn test_copy_through_dangling_symlink_no_dereference() {
} }
/// Test for copying a dangling symbolic link and its permissions. /// Test for copying a dangling symbolic link and its permissions.
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
#[test] #[test]
fn test_copy_through_dangling_symlink_no_dereference_permissions() { fn test_copy_through_dangling_symlink_no_dereference_permissions() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();

View file

@ -180,6 +180,7 @@ fn test_precedence_of_human_readable_header_over_output_header() {
} }
#[test] #[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
fn test_total_option_with_single_dash() { fn test_total_option_with_single_dash() {
// These should fail because `-total` should have two dashes, // These should fail because `-total` should have two dashes,
// not just one. // not just one.
@ -201,7 +202,7 @@ fn test_order_same() {
} }
/// Test of mount point begin repeated /// Test of mount point begin repeated
#[cfg(unix)] #[cfg(all(unix, not(target_os = "freebsd")))] // FIXME: fix this test for FreeBSD
#[test] #[test]
fn test_output_mp_repeat() { fn test_output_mp_repeat() {
let output1 = new_ucmd!().arg("/").arg("/").succeeds().stdout_move_str(); let output1 = new_ucmd!().arg("/").arg("/").succeeds().stdout_move_str();
@ -228,6 +229,7 @@ fn test_output_option() {
} }
#[test] #[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
fn test_output_option_without_equals_sign() { fn test_output_option_without_equals_sign() {
new_ucmd!().arg("--output").arg(".").succeeds(); new_ucmd!().arg("--output").arg(".").succeeds();
} }
@ -251,6 +253,7 @@ fn test_type_option() {
} }
#[test] #[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
fn test_type_option_with_file() { fn test_type_option_with_file() {
let fs_type = new_ucmd!() let fs_type = new_ucmd!()
.args(&["--output=fstype", "."]) .args(&["--output=fstype", "."])
@ -369,6 +372,7 @@ fn test_total() {
/// ///
/// The "total" label should appear in the "source" column, or in the /// The "total" label should appear in the "source" column, or in the
/// "target" column if "source" is not visible. /// "target" column if "source" is not visible.
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
#[test] #[test]
fn test_total_label_in_correct_column() { fn test_total_label_in_correct_column() {
let output = new_ucmd!() let output = new_ucmd!()
@ -797,6 +801,7 @@ fn test_output_file_all_filesystems() {
} }
#[test] #[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
fn test_output_file_specific_files() { fn test_output_file_specific_files() {
// Create three files. // Create three files.
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
@ -815,6 +820,7 @@ fn test_output_file_specific_files() {
} }
#[test] #[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
fn test_file_column_width_if_filename_contains_unicode_chars() { fn test_file_column_width_if_filename_contains_unicode_chars() {
let (at, mut ucmd) = at_and_ucmd!(); let (at, mut ucmd) = at_and_ucmd!();
at.touch("äöü.txt"); at.touch("äöü.txt");
@ -837,6 +843,7 @@ fn test_output_field_no_more_than_once() {
} }
#[test] #[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
fn test_nonexistent_file() { fn test_nonexistent_file() {
new_ucmd!() new_ucmd!()
.arg("does-not-exist") .arg("does-not-exist")

View file

@ -73,7 +73,7 @@ fn test_ls_ordering() {
} }
#[cfg(all(feature = "truncate", feature = "dd"))] #[cfg(all(feature = "truncate", feature = "dd"))]
#[test] #[test] // FIXME: fix this test for FreeBSD
fn test_ls_allocation_size() { fn test_ls_allocation_size() {
let scene = TestScenario::new(util_name!()); let scene = TestScenario::new(util_name!());
let at = &scene.fixtures; let at = &scene.fixtures;
@ -114,6 +114,7 @@ fn test_ls_allocation_size() {
.succeeds() .succeeds()
.stdout_matches(&Regex::new("[^ ] 2 [^ ]").unwrap()); .stdout_matches(&Regex::new("[^ ] 2 [^ ]").unwrap());
#[cfg(not(target_os = "freebsd"))]
scene scene
.ucmd() .ucmd()
.arg("-s1") .arg("-s1")
@ -129,6 +130,7 @@ fn test_ls_allocation_size() {
// block size is 0 whereas size/len is 4194304 // block size is 0 whereas size/len is 4194304
.stdout_contains("4194304"); .stdout_contains("4194304");
#[cfg(not(target_os = "freebsd"))]
scene scene
.ucmd() .ucmd()
.arg("-s1") .arg("-s1")
@ -162,6 +164,7 @@ fn test_ls_allocation_size() {
assert_eq!(empty_file_len, file_with_holes_len); assert_eq!(empty_file_len, file_with_holes_len);
#[cfg(not(target_os = "freebsd"))]
scene scene
.ucmd() .ucmd()
.env("LS_BLOCK_SIZE", "8K") .env("LS_BLOCK_SIZE", "8K")
@ -174,6 +177,7 @@ fn test_ls_allocation_size() {
.stdout_contains("0 file-with-holes") .stdout_contains("0 file-with-holes")
.stdout_contains("512 zero-file"); .stdout_contains("512 zero-file");
#[cfg(not(target_os = "freebsd"))]
scene scene
.ucmd() .ucmd()
.env("BLOCK_SIZE", "4K") .env("BLOCK_SIZE", "4K")
@ -185,6 +189,7 @@ fn test_ls_allocation_size() {
.stdout_contains("0 file-with-holes") .stdout_contains("0 file-with-holes")
.stdout_contains("1024 zero-file"); .stdout_contains("1024 zero-file");
#[cfg(not(target_os = "freebsd"))]
scene scene
.ucmd() .ucmd()
.env("BLOCK_SIZE", "4K") .env("BLOCK_SIZE", "4K")
@ -197,6 +202,7 @@ fn test_ls_allocation_size() {
.stdout_contains("0 file-with-holes") .stdout_contains("0 file-with-holes")
.stdout_contains("4.2M zero-file"); .stdout_contains("4.2M zero-file");
#[cfg(not(target_os = "freebsd"))]
scene scene
.ucmd() .ucmd()
.env("BLOCK_SIZE", "4096") .env("BLOCK_SIZE", "4096")
@ -208,6 +214,7 @@ fn test_ls_allocation_size() {
.stdout_contains("0 file-with-holes") .stdout_contains("0 file-with-holes")
.stdout_contains("1024 zero-file"); .stdout_contains("1024 zero-file");
#[cfg(not(target_os = "freebsd"))]
scene scene
.ucmd() .ucmd()
.env("POSIXLY_CORRECT", "true") .env("POSIXLY_CORRECT", "true")
@ -220,6 +227,7 @@ fn test_ls_allocation_size() {
.stdout_contains("8192 zero-file"); .stdout_contains("8192 zero-file");
// -k should make 'ls' ignore the env var // -k should make 'ls' ignore the env var
#[cfg(not(target_os = "freebsd"))]
scene scene
.ucmd() .ucmd()
.env("BLOCK_SIZE", "4K") .env("BLOCK_SIZE", "4K")
@ -232,6 +240,7 @@ fn test_ls_allocation_size() {
.stdout_contains("4096 zero-file"); .stdout_contains("4096 zero-file");
// but manually specified blocksize overrides -k // but manually specified blocksize overrides -k
#[cfg(not(target_os = "freebsd"))]
scene scene
.ucmd() .ucmd()
.arg("-s1k") .arg("-s1k")
@ -243,6 +252,7 @@ fn test_ls_allocation_size() {
.stdout_contains("0 file-with-holes") .stdout_contains("0 file-with-holes")
.stdout_contains("1024 zero-file"); .stdout_contains("1024 zero-file");
#[cfg(not(target_os = "freebsd"))]
scene scene
.ucmd() .ucmd()
.arg("-s1") .arg("-s1")
@ -255,6 +265,7 @@ fn test_ls_allocation_size() {
.stdout_contains("1024 zero-file"); .stdout_contains("1024 zero-file");
// si option should always trump the human-readable option // si option should always trump the human-readable option
#[cfg(not(target_os = "freebsd"))]
scene scene
.ucmd() .ucmd()
.arg("-s1h") .arg("-s1h")
@ -266,6 +277,7 @@ fn test_ls_allocation_size() {
.stdout_contains("0 file-with-holes") .stdout_contains("0 file-with-holes")
.stdout_contains("4.2M zero-file"); .stdout_contains("4.2M zero-file");
#[cfg(not(target_os = "freebsd"))]
scene scene
.ucmd() .ucmd()
.arg("-s1") .arg("-s1")
@ -277,6 +289,7 @@ fn test_ls_allocation_size() {
.stdout_contains("0 file-with-holes") .stdout_contains("0 file-with-holes")
.stdout_contains("4.0M zero-file"); .stdout_contains("4.0M zero-file");
#[cfg(not(target_os = "freebsd"))]
scene scene
.ucmd() .ucmd()
.arg("-s1") .arg("-s1")

View file

@ -360,7 +360,7 @@ fn test_pipe_fifo() {
} }
#[test] #[test]
#[cfg(all(unix, not(target_os = "android")))] #[cfg(all(unix, not(any(target_os = "android", target_os = "freebsd"))))]
fn test_stdin_pipe_fifo1() { fn test_stdin_pipe_fifo1() {
// $ echo | stat - // $ echo | stat -
// File: - // File: -
@ -400,7 +400,10 @@ fn test_stdin_pipe_fifo2() {
} }
#[test] #[test]
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))] #[cfg(all(
unix,
not(any(target_os = "android", target_os = "macos", target_os = "freebsd"))
))]
fn test_stdin_redirect() { fn test_stdin_redirect() {
// $ touch f && stat - < f // $ touch f && stat - < f
// File: - // File: -

View file

@ -211,7 +211,7 @@ fn test_follow_redirect_stdin_name_retry() {
} }
#[test] #[test]
#[cfg(all(unix, not(target_os = "android")))] // FIXME: fix this test for Android #[cfg(all(unix, not(any(target_os = "android", target_os = "freebsd"))))] // FIXME: fix this test for Android/FreeBSD
fn test_stdin_redirect_dir() { fn test_stdin_redirect_dir() {
// $ mkdir dir // $ mkdir dir
// $ tail < dir, $ tail - < dir // $ tail < dir, $ tail - < dir
@ -1913,7 +1913,7 @@ fn test_follow_truncate_fast() {
} }
#[test] #[test]
#[cfg(all(unix, not(any(target_os = "android", target_vendor = "apple"))))] // FIXME: make this work not just on Linux #[cfg(target_os = "linux")] // FIXME: make this work not just on Linux
fn test_follow_name_move_create1() { fn test_follow_name_move_create1() {
// This test triggers a move/create event while `tail --follow=name file` is running. // This test triggers a move/create event while `tail --follow=name file` is running.
// ((sleep 2 && mv file backup && sleep 2 && cp backup file &)>/dev/null 2>&1 &) ; tail --follow=name file // ((sleep 2 && mv file backup && sleep 2 && cp backup file &)>/dev/null 2>&1 &) ; tail --follow=name file
@ -1958,7 +1958,7 @@ fn test_follow_name_move_create1() {
} }
#[test] #[test]
#[cfg(all(unix, not(any(target_os = "android", target_vendor = "apple"))))] // FIXME: make this work not just on Linux #[cfg(target_os = "linux")] // FIXME: make this work not just on Linux
fn test_follow_name_move_create2() { fn test_follow_name_move_create2() {
// inspired by: "gnu/tests/tail-2/inotify-hash-abuse.sh" // inspired by: "gnu/tests/tail-2/inotify-hash-abuse.sh"
// Exercise an abort-inducing flaw in inotify-enabled tail -F // Exercise an abort-inducing flaw in inotify-enabled tail -F
@ -2029,7 +2029,7 @@ fn test_follow_name_move_create2() {
} }
#[test] #[test]
#[cfg(all(unix, not(any(target_os = "android", target_vendor = "apple"))))] // FIXME: make this work not just on Linux #[cfg(target_os = "linux")] // FIXME: make this work not just on Linux
fn test_follow_name_move1() { fn test_follow_name_move1() {
// This test triggers a move event while `tail --follow=name file` is running. // This test triggers a move event while `tail --follow=name file` is running.
// ((sleep 2 && mv file backup &)>/dev/null 2>&1 &) ; tail --follow=name file // ((sleep 2 && mv file backup &)>/dev/null 2>&1 &) ; tail --follow=name file
@ -2074,7 +2074,7 @@ fn test_follow_name_move1() {
} }
#[test] #[test]
#[cfg(all(unix, not(any(target_os = "android", target_vendor = "apple"))))] // FIXME: make this work not just on Linux #[cfg(target_os = "linux")] // FIXME: make this work not just on Linux
fn test_follow_name_move2() { fn test_follow_name_move2() {
// Like test_follow_name_move1, but move to a name that's already monitored. // Like test_follow_name_move1, but move to a name that's already monitored.
@ -2155,7 +2155,7 @@ fn test_follow_name_move2() {
} }
#[test] #[test]
#[cfg(all(unix, not(any(target_os = "android", target_vendor = "apple"))))] // FIXME: make this work not just on Linux #[cfg(target_os = "linux")] // FIXME: make this work not just on Linux
fn test_follow_name_move_retry1() { fn test_follow_name_move_retry1() {
// Similar to test_follow_name_move1 but with `--retry` (`-F`) // Similar to test_follow_name_move1 but with `--retry` (`-F`)
// This test triggers two move/rename events while `tail --follow=name --retry file` is running. // This test triggers two move/rename events while `tail --follow=name --retry file` is running.
@ -2206,7 +2206,7 @@ fn test_follow_name_move_retry1() {
} }
} }
#[test] #[test]
#[cfg(all(unix, not(any(target_os = "android", target_vendor = "apple"))))] // FIXME: make this work not just on Linux #[cfg(target_os = "linux")] // FIXME: make this work not just on Linux
fn test_follow_name_move_retry2() { fn test_follow_name_move_retry2() {
// inspired by: "gnu/tests/tail-2/F-vs-rename.sh" // inspired by: "gnu/tests/tail-2/F-vs-rename.sh"
// Similar to test_follow_name_move2 (move to a name that's already monitored) // Similar to test_follow_name_move2 (move to a name that's already monitored)
@ -2304,7 +2304,7 @@ fn test_follow_name_move_retry2() {
} }
#[test] #[test]
#[cfg(unix)] #[cfg(all(unix, not(target_os = "freebsd")))] // FIXME: fix this test for FreeBSD
fn test_follow_inotify_only_regular() { fn test_follow_inotify_only_regular() {
// The GNU test inotify-only-regular.sh uses strace to ensure that `tail -f` // The GNU test inotify-only-regular.sh uses strace to ensure that `tail -f`
// doesn't make inotify syscalls and only uses inotify for regular files or fifos. // doesn't make inotify syscalls and only uses inotify for regular files or fifos.

View file

@ -667,7 +667,7 @@ fn test_file_not_owned_by_euid() {
} }
#[test] #[test]
#[cfg(not(windows))] #[cfg(all(not(windows), not(target_os = "freebsd")))]
fn test_file_owned_by_egid() { fn test_file_owned_by_egid() {
new_ucmd!().args(&["-G", "regular_file"]).succeeds(); new_ucmd!().args(&["-G", "regular_file"]).succeeds();
} }

View file

@ -621,6 +621,7 @@ fn test_touch_no_such_file_error_msg() {
} }
#[test] #[test]
#[cfg(not(target_os = "freebsd"))]
fn test_touch_changes_time_of_file_in_stdout() { fn test_touch_changes_time_of_file_in_stdout() {
// command like: `touch - 1< ./c` // command like: `touch - 1< ./c`
// should change the timestamp of c // should change the timestamp of c