mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Merge pull request #9200 from lcheylus/openbsd-fix_tests
Fix tests on OpenBSD for unix feature
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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!()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user