Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/by-util/test_cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/by-util/test_df.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!()
Expand Down
15 changes: 11 additions & 4 deletions tests/by-util/test_du.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions tests/by-util/test_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 11 additions & 2 deletions tests/by-util/test_nohup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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() {
Expand All @@ -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() {
Expand Down Expand Up @@ -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() {
Expand All @@ -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() {
Expand All @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 3 additions & 1 deletion tests/by-util/test_pinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Loading