From b69070fdffa0601f111edc6a37da80897d2b3493 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:12 +0200 Subject: [PATCH 01/16] tests: disable failed tests for cat on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_cat.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_cat.rs b/tests/by-util/test_cat.rs index d67ecb0b1..ce0843b50 100644 --- a/tests/by-util/test_cat.rs +++ b/tests/by-util/test_cat.rs @@ -601,6 +601,7 @@ fn test_write_to_self() { #[test] #[cfg(unix)] +#[cfg(not(target_os = "openbsd"))] fn test_error_loop() { let (at, mut ucmd) = at_and_ucmd!(); at.symlink_file("2", "1"); From 62ec71d6fac04e22f0bc1b6a627644242665f45b Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:12 +0200 Subject: [PATCH 02/16] tests: disable failed tests for chown on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_chown.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/by-util/test_chown.rs b/tests/by-util/test_chown.rs index 3fb6d69c3..f503ec02e 100644 --- a/tests/by-util/test_chown.rs +++ b/tests/by-util/test_chown.rs @@ -218,7 +218,7 @@ fn test_chown_failed_stdout() { #[test] // FixME: Fails on freebsd because of chown: invalid group: 'root:root' -#[cfg(not(target_os = "freebsd"))] +#[cfg(all(not(target_os = "freebsd"), not(target_os = "openbsd")))] fn test_chown_owner_group() { // test chown username:group file.txt @@ -283,7 +283,7 @@ fn test_chown_owner_group() { #[test] // FixME: Fails on freebsd because of chown: invalid group: 'root:root' -#[cfg(not(target_os = "freebsd"))] +#[cfg(all(not(target_os = "freebsd"), not(target_os = "openbsd")))] fn test_chown_various_input() { // test chown username:group file.txt @@ -346,7 +346,10 @@ fn test_chown_various_input() { // FixME: on macos & freebsd group name is not recognized correctly: "chown: invalid group: ':groupname' #[cfg(any( windows, - all(unix, not(any(target_os = "macos", target_os = "freebsd"))) + all( + unix, + not(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd")) + ) ))] fn test_chown_only_group() { // test chown :group file.txt @@ -481,7 +484,7 @@ fn test_chown_only_user_id_nonexistent_user() { #[test] // FixME: stderr = chown: ownership of 'test_chown_file1' retained as cuuser:wheel -#[cfg(not(target_os = "freebsd"))] +#[cfg(all(not(target_os = "freebsd"), not(target_os = "openbsd")))] fn test_chown_only_group_id() { // test chown :1111 file.txt @@ -546,6 +549,7 @@ fn test_chown_only_group_id_nonexistent_group() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_chown_owner_group_id() { // test chown 1111:1111 file.txt @@ -606,7 +610,7 @@ fn test_chown_owner_group_id() { #[test] // FixME: Fails on freebsd because of chown: invalid group: '0:root' -#[cfg(not(target_os = "freebsd"))] +#[cfg(all(not(target_os = "freebsd"), not(target_os = "openbsd")))] fn test_chown_owner_group_mix() { // test chown 1111:group file.txt @@ -773,6 +777,7 @@ fn test_chown_no_change_to_user() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_chown_no_change_to_group() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; @@ -805,6 +810,7 @@ fn test_chown_no_change_to_group() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_chown_no_change_to_user_group() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; From 91f5533bc5d0f3ef186b105ca0726e2692554f44 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:14 +0200 Subject: [PATCH 03/16] tests: disable failed tests for cp on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_cp.rs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 053e015f4..c831bb08f 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -488,7 +488,7 @@ fn test_cp_arg_interactive() { } #[test] -#[cfg(not(any(target_os = "android", target_os = "freebsd")))] +#[cfg(not(any(target_os = "android", target_os = "freebsd", target_os = "openbsd")))] fn test_cp_arg_interactive_update_overwrite_newer() { // -u -i won't show the prompt to validate the override or not // Therefore, the error code will be 0 @@ -1285,6 +1285,7 @@ fn test_cp_parents_dest_not_directory() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_cp_parents_with_permissions_copy_file() { let (at, mut ucmd) = at_and_ucmd!(); @@ -1325,6 +1326,7 @@ fn test_cp_parents_with_permissions_copy_file() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_cp_parents_with_permissions_copy_dir() { let (at, mut ucmd) = at_and_ucmd!(); @@ -1382,6 +1384,7 @@ fn test_cp_issue_1665() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_cp_preserve_no_args() { let (at, mut ucmd) = at_and_ucmd!(); let src_file = "a"; @@ -1409,6 +1412,7 @@ fn test_cp_preserve_no_args() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_cp_preserve_no_args_before_opts() { let (at, mut ucmd) = at_and_ucmd!(); let src_file = "a"; @@ -1463,7 +1467,7 @@ fn test_cp_preserve_all() { } #[test] -#[cfg(all(unix, not(target_os = "android")))] +#[cfg(all(unix, not(any(target_os = "android", target_os = "openbsd"))))] fn test_cp_preserve_xattr() { let (at, mut ucmd) = at_and_ucmd!(); let src_file = "a"; @@ -2558,6 +2562,7 @@ fn test_copy_symlink_force() { #[test] #[cfg(unix)] +#[cfg(not(target_os = "openbsd"))] fn test_no_preserve_mode() { use std::os::unix::prelude::MetadataExt; @@ -2588,6 +2593,7 @@ fn test_no_preserve_mode() { #[test] #[cfg(unix)] +#[cfg(not(target_os = "openbsd"))] fn test_preserve_mode() { use std::os::unix::prelude::MetadataExt; @@ -2745,7 +2751,7 @@ fn test_cp_dangling_symlink_inside_directory() { } /// Test for copying a dangling symbolic link and its permissions. -#[cfg(not(target_os = "freebsd"))] // FIXME: fix this test for FreeBSD +#[cfg(not(any(target_os = "freebsd", target_os = "openbsd")))] // FIXME: fix this test for FreeBSD/OpenBSD #[test] fn test_copy_through_dangling_symlink_no_dereference_permissions() { let (at, mut ucmd) = at_and_ucmd!(); @@ -2963,7 +2969,7 @@ fn test_copy_same_symlink_no_dereference_dangling() { } // TODO: enable for Android, when #3477 solved -#[cfg(not(any(windows, target_os = "android")))] +#[cfg(not(any(windows, target_os = "android", target_os = "openbsd")))] #[test] fn test_cp_parents_2_dirs() { let (at, mut ucmd) = at_and_ucmd!(); @@ -3193,7 +3199,7 @@ fn test_copy_nested_directory_to_itself_disallowed() { } /// Test for preserving permissions when copying a directory. -#[cfg(all(not(windows), not(target_os = "freebsd")))] +#[cfg(all(not(windows), not(target_os = "freebsd"), not(target_os = "openbsd")))] #[test] fn test_copy_dir_preserve_permissions() { // Create a directory that has some non-default permissions. @@ -3223,7 +3229,7 @@ fn test_copy_dir_preserve_permissions() { /// Test for preserving permissions when copying a directory, even in /// the face of an inaccessible file in that directory. -#[cfg(all(not(windows), not(target_os = "freebsd")))] +#[cfg(all(not(windows), not(target_os = "freebsd"), not(target_os = "openbsd")))] #[test] fn test_copy_dir_preserve_permissions_inaccessible_file() { // Create a directory that has some non-default permissions and @@ -3293,7 +3299,7 @@ fn test_same_file_force_backup() { } /// Test for copying the contents of a FIFO as opposed to the FIFO object itself. -#[cfg(all(unix, not(target_os = "freebsd")))] +#[cfg(all(unix, not(target_os = "freebsd"), not(target_os = "openbsd")))] #[test] fn test_copy_contents_fifo() { // TODO this test should work on FreeBSD, but the command was @@ -3353,7 +3359,7 @@ fn test_reflink_never_sparse_always() { /// Test for preserving attributes of a hard link in a directory. #[test] -#[cfg(not(target_os = "android"))] +#[cfg(not(any(target_os = "android", target_os = "openbsd")))] fn test_preserve_hardlink_attributes_in_directory() { let (at, mut ucmd) = at_and_ucmd!(); @@ -5476,6 +5482,7 @@ mod link_deref { // disable these excessive permissions. #[test] #[cfg(unix)] +#[cfg(not(target_os = "openbsd"))] fn test_dir_perm_race_with_preserve_mode_and_ownership() { const SRC_DIR: &str = "src"; const DEST_DIR: &str = "dest"; From 584a9d290f97298422bb424154d7b72cc92bbc84 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:16 +0200 Subject: [PATCH 04/16] tests: disable failed tests for du on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_du.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index c1cd356a1..103a504b4 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -19,6 +19,7 @@ const SUB_FILE: &str = "subdir/links/subwords.txt"; const SUB_LINK: &str = "subdir/links/sublink.txt"; #[test] +#[cfg(not(target_os = "openbsd"))] fn test_du_basics() { let ts = TestScenario::new(util_name!()); @@ -77,6 +78,7 @@ fn test_invalid_arg() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_du_basics_subdir() { let ts = TestScenario::new(util_name!()); @@ -184,6 +186,7 @@ fn test_du_non_existing_files() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_du_soft_link() { let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; @@ -230,7 +233,7 @@ fn _du_soft_link(s: &str) { } } -#[cfg(not(target_os = "android"))] +#[cfg(all(not(target_os = "android"), not(target_os = "openbsd")))] #[test] fn test_du_hard_link() { let ts = TestScenario::new(util_name!()); @@ -279,6 +282,7 @@ fn _du_hard_link(s: &str) { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_du_d_flag() { let ts = TestScenario::new(util_name!()); @@ -322,6 +326,7 @@ fn _du_d_flag(s: &str) { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_du_dereference() { let ts = TestScenario::new(util_name!()); let at = &ts.fixtures; @@ -393,7 +398,12 @@ fn _du_dereference(s: &str) { } } -#[cfg(not(any(target_os = "windows", target_os = "android", target_os = "freebsd")))] +#[cfg(not(any( + target_os = "windows", + target_os = "android", + target_os = "freebsd", + target_os = "openbsd" +)))] #[test] fn test_du_no_dereference() { let ts = TestScenario::new(util_name!()); @@ -641,7 +651,7 @@ fn birth_supported() -> bool { m.created().is_ok() } -#[cfg(not(target_os = "windows"))] +#[cfg(not(any(target_os = "windows", target_os = "openbsd")))] #[cfg(feature = "chmod")] #[test] fn test_du_no_permission() { @@ -695,6 +705,7 @@ fn _du_no_permission(s: &str) { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_du_one_file_system() { let ts = TestScenario::new(util_name!()); @@ -712,6 +723,7 @@ fn test_du_one_file_system() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_du_threshold() { let ts = TestScenario::new(util_name!()); @@ -1007,6 +1019,7 @@ fn test_du_symlink_fail() { } #[cfg(not(windows))] +#[cfg(not(target_os = "openbsd"))] #[test] fn test_du_symlink_multiple_fail() { let ts = TestScenario::new(util_name!()); From 643f93be2f3782257f3ef52685c9598fd4e179df Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:16 +0200 Subject: [PATCH 05/16] tests: disable failed tests for head on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_head.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_head.rs b/tests/by-util/test_head.rs index 11a18f34c..296d7dab7 100644 --- a/tests/by-util/test_head.rs +++ b/tests/by-util/test_head.rs @@ -379,7 +379,8 @@ fn test_presume_input_pipe_5_chars() { not(target_os = "windows"), not(target_os = "macos"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] #[test] fn test_read_backwards_bytes_proc_fs_version() { @@ -394,7 +395,8 @@ fn test_read_backwards_bytes_proc_fs_version() { not(target_os = "windows"), not(target_os = "macos"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] #[test] fn test_read_backwards_bytes_proc_fs_modules() { @@ -409,7 +411,8 @@ fn test_read_backwards_bytes_proc_fs_modules() { not(target_os = "windows"), not(target_os = "macos"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] #[test] fn test_read_backwards_lines_proc_fs_modules() { @@ -424,7 +427,8 @@ fn test_read_backwards_lines_proc_fs_modules() { not(target_os = "windows"), not(target_os = "macos"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] #[test] fn test_read_backwards_bytes_sys_kernel_profiling() { From a425da0a1280d87119ebaa31ea28777242827e97 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:16 +0200 Subject: [PATCH 06/16] tests: disable failed tests for install on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_install.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index b07da43dc..a21cc52fd 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -523,6 +523,7 @@ fn test_install_failing_no_such_file() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_install_copy_then_compare_file() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; @@ -1598,6 +1599,7 @@ fn test_install_chown_directory_invalid() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_install_compare_option() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; From 00cca34a9c097898f1419ef238a2c72bc0e96f7a Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:17 +0200 Subject: [PATCH 07/16] tests: disable failed tests for ls on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_ls.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 396a499eb..386e81e79 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -158,7 +158,11 @@ fn test_ls_ordering() { .stdout_matches(&Regex::new("some-dir1:\\ntotal 0").unwrap()); } -#[cfg(all(unix, feature = "df", not(target_os = "freebsd")))] +#[cfg(all( + unix, + feature = "df", + not(any(target_os = "freebsd", target_os = "openbsd")) +))] fn get_filesystem_type(scene: &TestScenario, path: &Path) -> String { let mut cmd = scene.ccmd("df"); cmd.args(&["-PT"]).arg(path); @@ -174,7 +178,8 @@ fn get_filesystem_type(scene: &TestScenario, path: &Path) -> String { } #[cfg(all(feature = "truncate", feature = "dd"))] -#[test] // FIXME: fix this test for FreeBSD +#[test] // FIXME: fix this test for FreeBSD and OpenBSD +#[cfg(not(target_os = "openbsd"))] fn test_ls_allocation_size() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; @@ -1421,6 +1426,7 @@ fn test_ls_long_dangling_symlink_color() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_ls_long_total_size() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; @@ -2440,7 +2446,7 @@ fn test_ls_indicator_style() { } } -#[cfg(not(any(target_vendor = "apple", target_os = "windows")))] // Truncate not available on mac or win +#[cfg(not(any(target_vendor = "apple", target_os = "windows", target_os = "openbsd")))] // Truncate not available on mac or win #[test] fn test_ls_human_si() { let scene = TestScenario::new(util_name!()); @@ -4310,6 +4316,7 @@ fn test_ls_cf_output_should_be_delimited_by_tab() { #[cfg(all(unix, feature = "dd"))] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_posixly_correct_and_block_size_env_vars() { let scene = TestScenario::new(util_name!()); @@ -4363,6 +4370,7 @@ fn test_posixly_correct_and_block_size_env_vars() { #[cfg(all(unix, feature = "dd"))] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_posixly_correct_and_block_size_env_vars_with_k() { let scene = TestScenario::new(util_name!()); @@ -4423,6 +4431,7 @@ fn test_ls_invalid_block_size() { #[cfg(all(unix, feature = "dd"))] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_ls_invalid_block_size_in_env_var() { let scene = TestScenario::new(util_name!()); @@ -4461,6 +4470,7 @@ fn test_ls_invalid_block_size_in_env_var() { #[cfg(all(unix, feature = "dd"))] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_ls_block_size_override() { let scene = TestScenario::new(util_name!()); From 26da94687fd43c7cf2c23d09b2c790ccc96f1793 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:18 +0200 Subject: [PATCH 08/16] tests: disable failed tests for split on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_split.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_split.rs b/tests/by-util/test_split.rs index 79c515172..e2390dba0 100644 --- a/tests/by-util/test_split.rs +++ b/tests/by-util/test_split.rs @@ -347,6 +347,7 @@ fn test_filter_command_fails() { #[test] #[cfg(unix)] +#[cfg(not(target_os = "openbsd"))] fn test_filter_broken_pipe() { let (at, mut ucmd) = at_and_ucmd!(); let name = "filter-big-input"; From 6bce1626b3671ad584c1aa08746d0198d8e19359 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:18 +0200 Subject: [PATCH 09/16] tests: disable failed tests for stat on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_stat.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 0efb82c9a..8cb4493f0 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -134,6 +134,7 @@ fn test_normal_format() { } #[cfg(unix)] +#[cfg(not(target_os = "openbsd"))] #[test] fn test_symlinks() { let ts = TestScenario::new(util_name!()); @@ -263,7 +264,10 @@ fn test_pipe_fifo() { } #[test] -#[cfg(all(unix, not(any(target_os = "android", target_os = "freebsd"))))] +#[cfg(all( + unix, + not(any(target_os = "android", target_os = "freebsd", target_os = "openbsd")) +))] fn test_stdin_pipe_fifo1() { // $ echo | stat - // File: - @@ -318,7 +322,12 @@ fn test_stdin_with_fs_option() { #[test] #[cfg(all( unix, - not(any(target_os = "android", target_os = "macos", target_os = "freebsd")) + not(any( + target_os = "android", + target_os = "macos", + target_os = "freebsd", + target_os = "openbsd" + )) ))] fn test_stdin_redirect() { // $ touch f && stat - < f From c96e639f2f1303c054e9327ee9cfee6c711665f5 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:19 +0200 Subject: [PATCH 10/16] tests: disable failed tests for stdbuf on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_stdbuf.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/by-util/test_stdbuf.rs b/tests/by-util/test_stdbuf.rs index b2fd33f77..da2f7390b 100644 --- a/tests/by-util/test_stdbuf.rs +++ b/tests/by-util/test_stdbuf.rs @@ -5,7 +5,7 @@ #[cfg(not(target_os = "windows"))] use crate::common::util::TestScenario; -#[cfg(not(target_os = "windows"))] +#[cfg(all(not(target_os = "windows"), not(target_os = "openbsd")))] #[test] fn test_stdbuf_unbuffered_stdout() { // This is a basic smoke test @@ -16,7 +16,7 @@ fn test_stdbuf_unbuffered_stdout() { .stdout_is("The quick brown fox jumps over the lazy dog."); } -#[cfg(not(target_os = "windows"))] +#[cfg(all(not(target_os = "windows"), not(target_os = "openbsd")))] #[test] fn test_stdbuf_line_buffered_stdout() { new_ucmd!() @@ -37,7 +37,7 @@ fn test_stdbuf_no_buffer_option_fails() { .stderr_contains("the following required arguments were not provided:"); } -#[cfg(not(target_os = "windows"))] +#[cfg(all(not(target_os = "windows"), not(target_os = "openbsd")))] #[test] fn test_stdbuf_trailing_var_arg() { new_ucmd!() From de742e905be06c2b1d5626620438817228324ee8 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:19 +0200 Subject: [PATCH 11/16] tests: disable failed tests for tail on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_tail.rs | 57 +++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index e7207b7da..07f49196e 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -30,7 +30,8 @@ use std::io::{Seek, SeekFrom}; not(target_vendor = "apple"), not(target_os = "android"), not(target_os = "windows"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] use std::path::Path; use std::process::Stdio; @@ -39,7 +40,8 @@ use tail::chunks::BUFFER_SIZE as CHUNK_BUFFER_SIZE; not(target_vendor = "apple"), not(target_os = "android"), not(target_os = "windows"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] use tail::text; @@ -294,7 +296,8 @@ fn test_follow_redirect_stdin_name_retry() { not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_stdin_redirect_dir() { // $ mkdir dir @@ -1214,7 +1217,8 @@ fn test_retry2() { not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_retry3() { // inspired by: gnu/tests/tail-2/retry.sh @@ -1258,7 +1262,8 @@ fn test_retry3() { not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_retry4() { // inspired by: gnu/tests/tail-2/retry.sh @@ -1315,7 +1320,8 @@ fn test_retry4() { not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_retry5() { // inspired by: gnu/tests/tail-2/retry.sh @@ -1401,7 +1407,8 @@ fn test_retry6() { not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_retry7() { // inspired by: gnu/tests/tail-2/retry.sh @@ -1475,7 +1482,8 @@ fn test_retry7() { not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_retry8() { // Ensure that inotify will switch to polling mode if directory @@ -1543,7 +1551,8 @@ fn test_retry8() { not(target_vendor = "apple"), not(target_os = "android"), not(target_os = "windows"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_retry9() { // inspired by: gnu/tests/tail-2/inotify-dir-recreate.sh @@ -1624,7 +1633,8 @@ fn test_retry9() { not(target_vendor = "apple"), not(target_os = "android"), not(target_os = "windows"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_follow_descriptor_vs_rename1() { // inspired by: gnu/tests/tail-2/descriptor-vs-rename.sh @@ -1687,7 +1697,8 @@ fn test_follow_descriptor_vs_rename1() { not(target_vendor = "apple"), not(target_os = "android"), not(target_os = "windows"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_follow_descriptor_vs_rename2() { // Ensure the headers are correct for --verbose. @@ -1739,7 +1750,8 @@ fn test_follow_descriptor_vs_rename2() { not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_follow_name_retry_headers() { // inspired by: "gnu/tests/tail-2/F-headers.sh" @@ -2073,7 +2085,8 @@ fn test_follow_truncate_fast() { not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_follow_name_move_create1() { // This test triggers a move/create event while `tail --follow=name file` is running. @@ -2128,7 +2141,8 @@ fn test_follow_name_move_create1() { not(target_vendor = "apple"), not(target_os = "android"), not(target_os = "windows"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_follow_name_move_create2() { // inspired by: "gnu/tests/tail-2/inotify-hash-abuse.sh" @@ -2207,7 +2221,8 @@ fn test_follow_name_move_create2() { not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_follow_name_move1() { // This test triggers a move event while `tail --follow=name file` is running. @@ -2268,7 +2283,8 @@ fn test_follow_name_move1() { not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_follow_name_move2() { // Like test_follow_name_move1, but move to a name that's already monitored. @@ -2355,7 +2371,8 @@ fn test_follow_name_move2() { not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_follow_name_move_retry1() { // Similar to test_follow_name_move1 but with `--retry` (`-F`) @@ -2414,7 +2431,8 @@ fn test_follow_name_move_retry1() { not(target_vendor = "apple"), not(target_os = "windows"), not(target_os = "android"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] // FIXME: for currently not working platforms fn test_follow_name_move_retry2() { // inspired by: "gnu/tests/tail-2/F-vs-rename.sh" @@ -4423,7 +4441,8 @@ fn test_args_when_directory_given_shorthand_big_f_together_with_retry() { #[cfg(all( not(target_vendor = "apple"), not(target_os = "windows"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] fn test_follow_when_files_are_pointing_to_same_relative_file_and_file_stays_same_size() { let scene = TestScenario::new(util_name!()); From de4d91bedaf3a3ebfd0381dc3dd9bc0d05105f77 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:19 +0200 Subject: [PATCH 12/16] tests: disable failed tests for test on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_test.rs b/tests/by-util/test_test.rs index c5e06d4c8..ebabbf9b1 100644 --- a/tests/by-util/test_test.rs +++ b/tests/by-util/test_test.rs @@ -553,9 +553,9 @@ fn test_nonexistent_file_is_not_symlink() { } #[test] -// Only the superuser is allowed to set the sticky bit on files on FreeBSD. +// Only the superuser is allowed to set the sticky bit on files on FreeBSD/OpenBSD. // Windows has no concept of sticky bit -#[cfg(not(any(windows, target_os = "freebsd")))] +#[cfg(not(any(windows, target_os = "freebsd", target_os = "openbsd")))] fn test_file_is_sticky() { let scenario = TestScenario::new(util_name!()); let mut ucmd = scenario.ucmd(); From c25ba39ce62a91c70181fcbf8f8df47f7b180592 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:20 +0200 Subject: [PATCH 13/16] tests: disable failed tests for touch on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_touch.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_touch.rs b/tests/by-util/test_touch.rs index 51731b9ff..a0d51c208 100644 --- a/tests/by-util/test_touch.rs +++ b/tests/by-util/test_touch.rs @@ -721,7 +721,7 @@ fn test_touch_no_such_file_error_msg() { } #[test] -#[cfg(not(target_os = "freebsd"))] +#[cfg(not(any(target_os = "freebsd", target_os = "openbsd")))] fn test_touch_changes_time_of_file_in_stdout() { // command like: `touch - 1< ./c` // should change the timestamp of c @@ -864,6 +864,7 @@ fn test_touch_no_dereference_dangling() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_touch_dash() { let (_, mut ucmd) = at_and_ucmd!(); From 008dd38a0da00d698230e422afa2a0e39f41c397 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:20 +0200 Subject: [PATCH 14/16] tests: fix warnings on OpenBSD for unused imports in by-util/test_* Signed-off-by: Laurent Cheylus --- tests/by-util/test_du.rs | 3 +++ tests/by-util/test_install.rs | 1 + tests/by-util/test_ls.rs | 1 + tests/by-util/test_nohup.rs | 1 + tests/by-util/test_pinky.rs | 4 ++++ 5 files changed, 10 insertions(+) diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 103a504b4..ef6179e02 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -11,11 +11,14 @@ use regex::Regex; use crate::common::util::expected_result; use crate::common::util::TestScenario; +#[cfg(not(target_os = "openbsd"))] const SUB_DIR: &str = "subdir/deeper"; const SUB_DEEPER_DIR: &str = "subdir/deeper/deeper_dir"; const SUB_DIR_LINKS: &str = "subdir/links"; const SUB_DIR_LINKS_DEEPER_SYM_DIR: &str = "subdir/links/deeper_dir"; +#[cfg(not(target_os = "openbsd"))] const SUB_FILE: &str = "subdir/links/subwords.txt"; +#[cfg(not(target_os = "openbsd"))] const SUB_LINK: &str = "subdir/links/sublink.txt"; #[test] diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index a21cc52fd..c00c5a5db 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -5,6 +5,7 @@ // spell-checker:ignore (words) helloworld nodir objdump n'source use crate::common::util::{is_ci, run_ucmd_as_root, TestScenario}; +#[cfg(not(target_os = "openbsd"))] use filetime::FileTime; use std::fs; use std::os::unix::fs::{MetadataExt, PermissionsExt}; diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 386e81e79..2e3f31290 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -15,6 +15,7 @@ use crate::common::util::TestScenario; #[cfg(all(unix, feature = "chmod"))] use nix::unistd::{close, dup}; use regex::Regex; +#[cfg(not(target_os = "openbsd"))] use std::collections::HashMap; #[cfg(target_os = "linux")] use std::ffi::OsStr; diff --git a/tests/by-util/test_nohup.rs b/tests/by-util/test_nohup.rs index db19114b6..028e29166 100644 --- a/tests/by-util/test_nohup.rs +++ b/tests/by-util/test_nohup.rs @@ -4,6 +4,7 @@ // file that was distributed with this source code. // spell-checker:ignore winsize Openpty openpty xpixel ypixel ptyprocess use crate::common::util::TestScenario; +#[cfg(not(target_os = "openbsd"))] use std::thread::sleep; // General observation: nohup.out will not be created in tests run by cargo test diff --git a/tests/by-util/test_pinky.rs b/tests/by-util/test_pinky.rs index 0fff402df..93f265cc7 100644 --- a/tests/by-util/test_pinky.rs +++ b/tests/by-util/test_pinky.rs @@ -3,8 +3,12 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. +#[cfg(target_os = "openbsd")] +use crate::common::util::TestScenario; +#[cfg(not(target_os = "openbsd"))] use crate::common::util::{expected_result, TestScenario}; use pinky::Capitalize; +#[cfg(not(target_os = "openbsd"))] use uucore::entries::{Locate, Passwd}; #[test] From f731b4e7799bbc3fc07560da59d08916fa3261a9 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:21 +0200 Subject: [PATCH 15/16] tests: disable common::util::tests::test_altering_umask on OpenBSD Signed-off-by: Laurent Cheylus --- tests/common/util.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/common/util.rs b/tests/common/util.rs index 82f49556b..546694001 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -3899,6 +3899,7 @@ mod tests { } #[cfg(unix)] + #[cfg(not(target_os = "openbsd"))] #[test] fn test_altering_umask() { use uucore::mode::get_umask; From 2f7c8cc18fb7f179c95561cf86a2e8fcd5ab7556 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 6 Jul 2024 22:29:23 +0200 Subject: [PATCH 16/16] tests: disable tests for features/fsxattr on OpenBSD Signed-off-by: Laurent Cheylus --- src/uucore/src/lib/features/fsxattr.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/uucore/src/lib/features/fsxattr.rs b/src/uucore/src/lib/features/fsxattr.rs index 3cb00edc0..41dfb8838 100644 --- a/src/uucore/src/lib/features/fsxattr.rs +++ b/src/uucore/src/lib/features/fsxattr.rs @@ -88,6 +88,8 @@ pub fn has_acl>(file: P) -> bool { } } +// FIXME: 3 tests failed on OpenBSD +#[cfg(not(target_os = "openbsd"))] #[cfg(test)] mod tests { use super::*;