Skip to content

Commit

Permalink
Merge pull request #3806 from jhscheer/fix_3778
Browse files Browse the repository at this point in the history
tests: ignore failing tests for FreeBSD (#3778)
  • Loading branch information
sylvestre authored Aug 13, 2022
2 parents fc14c6e + 391709c commit 9ad582a
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 14 deletions.
6 changes: 5 additions & 1 deletion tests/by-util/test_cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::os::unix::fs;

#[cfg(unix)]
use std::os::unix::fs::symlink as symlink_file;
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "freebsd")))]
use std::os::unix::fs::MetadataExt;
#[cfg(all(unix, not(target_os = "freebsd")))]
use std::os::unix::fs::PermissionsExt;
Expand All @@ -22,7 +22,9 @@ use filetime::FileTime;
use rlimit::Resource;
#[cfg(any(target_os = "linux", target_os = "android"))]
use std::fs as std_fs;
#[cfg(not(target_os = "freebsd"))]
use std::thread::sleep;
#[cfg(not(target_os = "freebsd"))]
use std::time::Duration;
use uucore::display::Quotable;

Expand Down Expand Up @@ -1581,6 +1583,7 @@ fn test_copy_dir_symlink() {
}

#[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
fn test_copy_dir_with_symlinks() {
let (at, mut ucmd) = at_and_ucmd!();
at.mkdir("dir");
Expand Down Expand Up @@ -1725,6 +1728,7 @@ fn test_copy_through_dangling_symlink_no_dereference() {
}

/// Test for copying a dangling symbolic link and its permissions.
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
#[test]
fn test_copy_through_dangling_symlink_no_dereference_permissions() {
let (at, mut ucmd) = at_and_ucmd!();
Expand Down
9 changes: 8 additions & 1 deletion tests/by-util/test_df.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ fn test_precedence_of_human_readable_header_over_output_header() {
}

#[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
fn test_total_option_with_single_dash() {
// These should fail because `-total` should have two dashes,
// not just one.
Expand All @@ -201,7 +202,7 @@ fn test_order_same() {
}

/// Test of mount point begin repeated
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "freebsd")))] // FIXME: fix this test for FreeBSD
#[test]
fn test_output_mp_repeat() {
let output1 = new_ucmd!().arg("/").arg("/").succeeds().stdout_move_str();
Expand All @@ -228,6 +229,7 @@ fn test_output_option() {
}

#[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
fn test_output_option_without_equals_sign() {
new_ucmd!().arg("--output").arg(".").succeeds();
}
Expand All @@ -251,6 +253,7 @@ fn test_type_option() {
}

#[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
fn test_type_option_with_file() {
let fs_type = new_ucmd!()
.args(&["--output=fstype", "."])
Expand Down Expand Up @@ -369,6 +372,7 @@ fn test_total() {
///
/// The "total" label should appear in the "source" column, or in the
/// "target" column if "source" is not visible.
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
#[test]
fn test_total_label_in_correct_column() {
let output = new_ucmd!()
Expand Down Expand Up @@ -797,6 +801,7 @@ fn test_output_file_all_filesystems() {
}

#[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
fn test_output_file_specific_files() {
// Create three files.
let (at, mut ucmd) = at_and_ucmd!();
Expand All @@ -815,6 +820,7 @@ fn test_output_file_specific_files() {
}

#[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
fn test_file_column_width_if_filename_contains_unicode_chars() {
let (at, mut ucmd) = at_and_ucmd!();
at.touch("äöü.txt");
Expand All @@ -837,6 +843,7 @@ fn test_output_field_no_more_than_once() {
}

#[test]
#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD
fn test_nonexistent_file() {
new_ucmd!()
.arg("does-not-exist")
Expand Down
15 changes: 14 additions & 1 deletion tests/by-util/test_ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fn test_ls_ordering() {
}

#[cfg(all(feature = "truncate", feature = "dd"))]
#[test]
#[test] // FIXME: fix this test for FreeBSD
fn test_ls_allocation_size() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
Expand Down Expand Up @@ -114,6 +114,7 @@ fn test_ls_allocation_size() {
.succeeds()
.stdout_matches(&Regex::new("[^ ] 2 [^ ]").unwrap());

#[cfg(not(target_os = "freebsd"))]
scene
.ucmd()
.arg("-s1")
Expand All @@ -129,6 +130,7 @@ fn test_ls_allocation_size() {
// block size is 0 whereas size/len is 4194304
.stdout_contains("4194304");

#[cfg(not(target_os = "freebsd"))]
scene
.ucmd()
.arg("-s1")
Expand Down Expand Up @@ -162,6 +164,7 @@ fn test_ls_allocation_size() {

assert_eq!(empty_file_len, file_with_holes_len);

#[cfg(not(target_os = "freebsd"))]
scene
.ucmd()
.env("LS_BLOCK_SIZE", "8K")
Expand All @@ -174,6 +177,7 @@ fn test_ls_allocation_size() {
.stdout_contains("0 file-with-holes")
.stdout_contains("512 zero-file");

#[cfg(not(target_os = "freebsd"))]
scene
.ucmd()
.env("BLOCK_SIZE", "4K")
Expand All @@ -185,6 +189,7 @@ fn test_ls_allocation_size() {
.stdout_contains("0 file-with-holes")
.stdout_contains("1024 zero-file");

#[cfg(not(target_os = "freebsd"))]
scene
.ucmd()
.env("BLOCK_SIZE", "4K")
Expand All @@ -197,6 +202,7 @@ fn test_ls_allocation_size() {
.stdout_contains("0 file-with-holes")
.stdout_contains("4.2M zero-file");

#[cfg(not(target_os = "freebsd"))]
scene
.ucmd()
.env("BLOCK_SIZE", "4096")
Expand All @@ -208,6 +214,7 @@ fn test_ls_allocation_size() {
.stdout_contains("0 file-with-holes")
.stdout_contains("1024 zero-file");

#[cfg(not(target_os = "freebsd"))]
scene
.ucmd()
.env("POSIXLY_CORRECT", "true")
Expand All @@ -220,6 +227,7 @@ fn test_ls_allocation_size() {
.stdout_contains("8192 zero-file");

// -k should make 'ls' ignore the env var
#[cfg(not(target_os = "freebsd"))]
scene
.ucmd()
.env("BLOCK_SIZE", "4K")
Expand All @@ -232,6 +240,7 @@ fn test_ls_allocation_size() {
.stdout_contains("4096 zero-file");

// but manually specified blocksize overrides -k
#[cfg(not(target_os = "freebsd"))]
scene
.ucmd()
.arg("-s1k")
Expand All @@ -243,6 +252,7 @@ fn test_ls_allocation_size() {
.stdout_contains("0 file-with-holes")
.stdout_contains("1024 zero-file");

#[cfg(not(target_os = "freebsd"))]
scene
.ucmd()
.arg("-s1")
Expand All @@ -255,6 +265,7 @@ fn test_ls_allocation_size() {
.stdout_contains("1024 zero-file");

// si option should always trump the human-readable option
#[cfg(not(target_os = "freebsd"))]
scene
.ucmd()
.arg("-s1h")
Expand All @@ -266,6 +277,7 @@ fn test_ls_allocation_size() {
.stdout_contains("0 file-with-holes")
.stdout_contains("4.2M zero-file");

#[cfg(not(target_os = "freebsd"))]
scene
.ucmd()
.arg("-s1")
Expand All @@ -277,6 +289,7 @@ fn test_ls_allocation_size() {
.stdout_contains("0 file-with-holes")
.stdout_contains("4.0M zero-file");

#[cfg(not(target_os = "freebsd"))]
scene
.ucmd()
.arg("-s1")
Expand Down
7 changes: 5 additions & 2 deletions tests/by-util/test_stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ fn test_pipe_fifo() {
}

#[test]
#[cfg(all(unix, not(target_os = "android")))]
#[cfg(all(unix, not(any(target_os = "android", target_os = "freebsd"))))]
fn test_stdin_pipe_fifo1() {
// $ echo | stat -
// File: -
Expand Down Expand Up @@ -400,7 +400,10 @@ fn test_stdin_pipe_fifo2() {
}

#[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() {
// $ touch f && stat - < f
// File: -
Expand Down
16 changes: 8 additions & 8 deletions tests/by-util/test_tail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ fn test_follow_redirect_stdin_name_retry() {
}

#[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() {
// $ mkdir dir
// $ tail < dir, $ tail - < dir
Expand Down Expand Up @@ -1913,7 +1913,7 @@ fn test_follow_truncate_fast() {
}

#[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() {
// 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
Expand Down Expand Up @@ -1958,7 +1958,7 @@ fn test_follow_name_move_create1() {
}

#[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() {
// inspired by: "gnu/tests/tail-2/inotify-hash-abuse.sh"
// Exercise an abort-inducing flaw in inotify-enabled tail -F
Expand Down Expand Up @@ -2029,7 +2029,7 @@ fn test_follow_name_move_create2() {
}

#[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() {
// 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
Expand Down Expand Up @@ -2074,7 +2074,7 @@ fn test_follow_name_move1() {
}

#[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() {
// Like test_follow_name_move1, but move to a name that's already monitored.

Expand Down Expand Up @@ -2155,7 +2155,7 @@ fn test_follow_name_move2() {
}

#[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() {
// 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.
Expand Down Expand Up @@ -2206,7 +2206,7 @@ fn test_follow_name_move_retry1() {
}
}
#[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() {
// inspired by: "gnu/tests/tail-2/F-vs-rename.sh"
// Similar to test_follow_name_move2 (move to a name that's already monitored)
Expand Down Expand Up @@ -2304,7 +2304,7 @@ fn test_follow_name_move_retry2() {
}

#[test]
#[cfg(unix)]
#[cfg(all(unix, not(target_os = "freebsd")))] // FIXME: fix this test for FreeBSD
fn test_follow_inotify_only_regular() {
// 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.
Expand Down
2 changes: 1 addition & 1 deletion tests/by-util/test_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ fn test_file_not_owned_by_euid() {
}

#[test]
#[cfg(not(windows))]
#[cfg(all(not(windows), not(target_os = "freebsd")))]
fn test_file_owned_by_egid() {
new_ucmd!().args(&["-G", "regular_file"]).succeeds();
}
Expand Down
1 change: 1 addition & 0 deletions tests/by-util/test_touch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ fn test_touch_no_such_file_error_msg() {
}

#[test]
#[cfg(not(target_os = "freebsd"))]
fn test_touch_changes_time_of_file_in_stdout() {
// command like: `touch - 1< ./c`
// should change the timestamp of c
Expand Down

0 comments on commit 9ad582a

Please sign in to comment.