From 3638d6c6012135141a8ecd6e37720500850fc3e0 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 8 Nov 2025 17:10:55 +0100 Subject: [PATCH 1/6] pinky: fix warnings for tests on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_pinky.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_pinky.rs b/tests/by-util/test_pinky.rs index 977647de8ba..cb52bff23f8 100644 --- a/tests/by-util/test_pinky.rs +++ b/tests/by-util/test_pinky.rs @@ -5,9 +5,11 @@ #[cfg(not(target_os = "openbsd"))] use uucore::entries::{Locate, Passwd}; +use uutests::new_ucmd; #[cfg(not(target_os = "openbsd"))] use uutests::util::{TestScenario, expected_result}; -use uutests::{new_ucmd, unwrap_or_return, util_name}; +#[cfg(not(target_os = "openbsd"))] +use uutests::{unwrap_or_return, util_name}; #[test] fn test_invalid_arg() { From 61f9cd82678184b611f2e190b17929ba9bf5700f Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 8 Nov 2025 17:11:37 +0100 Subject: [PATCH 2/6] nohup: fix warnings for tests on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_nohup.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_nohup.rs b/tests/by-util/test_nohup.rs index f224abe84b7..2349b2dc2a8 100644 --- a/tests/by-util/test_nohup.rs +++ b/tests/by-util/test_nohup.rs @@ -3,7 +3,6 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. // spell-checker:ignore winsize Openpty openpty xpixel ypixel ptyprocess -#[cfg(not(target_os = "openbsd"))] use std::thread::sleep; use uutests::at_and_ucmd; use uutests::new_ucmd; @@ -24,6 +23,7 @@ fn test_invalid_arg() { target_os = "linux", target_os = "android", target_os = "freebsd", + target_os = "openbsd", target_vendor = "apple" ))] fn test_nohup_multiple_args_and_flags() { @@ -42,6 +42,7 @@ fn test_nohup_multiple_args_and_flags() { target_os = "linux", target_os = "android", target_os = "freebsd", + target_os = "openbsd", target_vendor = "apple" ))] fn test_nohup_with_pseudo_terminal_emulation_on_stdin_stdout_stderr_get_replaced() { @@ -77,6 +78,7 @@ fn test_nohup_with_pseudo_terminal_emulation_on_stdin_stdout_stderr_get_replaced target_os = "linux", target_os = "android", target_os = "freebsd", + target_os = "openbsd", target_vendor = "apple" ))] fn test_nohup_creates_output_in_cwd() { @@ -103,6 +105,7 @@ fn test_nohup_creates_output_in_cwd() { target_os = "linux", target_os = "android", target_os = "freebsd", + target_os = "openbsd", target_vendor = "apple" ))] fn test_nohup_appends_to_existing_file() { @@ -128,7 +131,12 @@ fn test_nohup_appends_to_existing_file() { // Test that nohup falls back to $HOME/nohup.out when cwd is not writable // Skipped on macOS as the permissions test is unreliable #[test] -#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd"))] +#[cfg(any( + target_os = "linux", + target_os = "android", + target_os = "freebsd", + target_os = "openbsd" +))] fn test_nohup_fallback_to_home() { use std::fs; use std::os::unix::fs::PermissionsExt; @@ -204,6 +212,7 @@ fn test_nohup_command_not_found() { target_os = "linux", target_os = "android", target_os = "freebsd", + target_os = "openbsd", target_vendor = "apple" ))] fn test_nohup_stderr_to_stdout() { From 384102cd203632514bb81f480ad3980792c36fd4 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 8 Nov 2025 17:12:32 +0100 Subject: [PATCH 3/6] du: fix warnings for tests on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_du.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index adcf8bfdec6..224626b210a 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -69,7 +69,11 @@ fn du_basics(s: &str) { assert_eq!(s, answer); } -#[cfg(all(not(target_vendor = "apple"), not(target_os = "windows")))] +#[cfg(all( + not(target_vendor = "apple"), + not(target_os = "windows"), + not(target_os = "openbsd") +))] fn du_basics(s: &str) { let answer = concat!( "8\t./subdir/deeper/deeper_dir\n", @@ -119,7 +123,8 @@ fn du_basics_subdir(s: &str) { #[cfg(all( not(target_vendor = "apple"), not(target_os = "windows"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] fn du_basics_subdir(s: &str) { // MS-WSL linux has altered expected output @@ -447,7 +452,8 @@ fn du_d_flag(s: &str) { #[cfg(all( not(target_vendor = "apple"), not(target_os = "windows"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] fn du_d_flag(s: &str) { // MS-WSL linux has altered expected output @@ -520,7 +526,8 @@ fn du_dereference(s: &str) { #[cfg(all( not(target_vendor = "apple"), not(target_os = "windows"), - not(target_os = "freebsd") + not(target_os = "freebsd"), + not(target_os = "openbsd") ))] fn du_dereference(s: &str) { // MS-WSL linux has altered expected output From b6ad527d2295ea575c415e564d15207bdd28165b Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 8 Nov 2025 17:13:45 +0100 Subject: [PATCH 4/6] cp: disable test_cp_current_directory_verbose on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_cp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index aa91e4c4c04..27f8228459e 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -6949,7 +6949,7 @@ fn test_cp_current_directory_verbose() { // Test copying current directory (.) with preserve attributes. // This ensures attributes are preserved when copying the current directory. #[test] -#[cfg(all(not(windows), not(target_os = "freebsd")))] +#[cfg(all(not(windows), not(target_os = "freebsd"), not(target_os = "openbsd")))] fn test_cp_current_directory_preserve_attributes() { use filetime::FileTime; use std::os::unix::prelude::MetadataExt; From 0fabf825e18734f4cc50a831ff5218b0cb799a48 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 8 Nov 2025 17:14:54 +0100 Subject: [PATCH 5/6] df: disable test_type_option_with_file on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_df.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/by-util/test_df.rs b/tests/by-util/test_df.rs index 149148699ba..9b57d6020e5 100644 --- a/tests/by-util/test_df.rs +++ b/tests/by-util/test_df.rs @@ -326,7 +326,7 @@ fn test_type_option() { } #[test] -#[cfg(not(any(target_os = "freebsd", target_os = "windows")))] // FIXME: fix test for FreeBSD & Win +#[cfg(not(any(target_os = "freebsd", target_os = "openbsd", target_os = "windows")))] // FIXME: fix test for FreeBSD, OpenBSD & Win #[cfg(not(feature = "feat_selinux"))] fn test_type_option_with_file() { let fs_type = new_ucmd!() From 6130a334f22ade5455f4fa6c9cc289986f7fef29 Mon Sep 17 00:00:00 2001 From: Laurent Cheylus Date: Sat, 8 Nov 2025 17:15:35 +0100 Subject: [PATCH 6/6] expr: fix crash for test_long_input on OpenBSD Signed-off-by: Laurent Cheylus --- tests/by-util/test_expr.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_expr.rs b/tests/by-util/test_expr.rs index 6320fe00b23..adf1cd4fdf8 100644 --- a/tests/by-util/test_expr.rs +++ b/tests/by-util/test_expr.rs @@ -582,11 +582,17 @@ fn test_eager_evaluation() { #[test] fn test_long_input() { // Giving expr an arbitrary long expression should succeed rather than end with a segfault due to a stack overflow. - #[cfg(not(windows))] + #[cfg(all(not(windows), not(target_os = "openbsd")))] const MAX_NUMBER: usize = 40000; - #[cfg(not(windows))] + #[cfg(all(not(windows), not(target_os = "openbsd")))] const RESULT: &str = "800020000\n"; + // On OpenBSD, crash with default MAX_NUMBER + #[cfg(target_os = "openbsd")] + const MAX_NUMBER: usize = 10000; + #[cfg(target_os = "openbsd")] + const RESULT: &str = "50005000\n"; + // On windows there is 8192 characters input limit #[cfg(windows)] const MAX_NUMBER: usize = 1300; // 7993 characters (with spaces)