diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 607d5dc45..e63aa4585 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -573,8 +573,7 @@ fn test_du_bytes() { #[cfg(all( not(target_vendor = "apple"), not(target_os = "windows"), - not(target_os = "freebsd"), - not(target_os = "linux") + not(target_os = "freebsd") ))] result.stdout_contains("21529\t./subdir\n"); } diff --git a/tests/by-util/test_groups.rs b/tests/by-util/test_groups.rs index 14e5a356d..73837235f 100644 --- a/tests/by-util/test_groups.rs +++ b/tests/by-util/test_groups.rs @@ -3,6 +3,8 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. +//spell-checker: ignore coreutil + use crate::common::util::*; const VERSION_MIN_MULTIPLE_USERS: &str = "8.31"; // this feature was introduced in GNU's coreutils 8.31 diff --git a/tests/by-util/test_whoami.rs b/tests/by-util/test_whoami.rs index cba941558..0afe94161 100644 --- a/tests/by-util/test_whoami.rs +++ b/tests/by-util/test_whoami.rs @@ -3,6 +3,7 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. +#[cfg(unix)] use crate::common::util::*; #[test] @@ -39,7 +40,9 @@ fn test_normal_compare_env() { if whoami == "nobody" { println!("test skipped:"); return; - } else { + } else if !is_ci() { new_ucmd!().succeeds().stdout_is(format!("{}\n", whoami)); + } else { + println!("test skipped:"); } } diff --git a/tests/common/util.rs b/tests/common/util.rs index acffaca13..7a641a353 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -10,6 +10,7 @@ use pretty_assertions::assert_eq; #[cfg(target_os = "linux")] use rlimit::{prlimit, rlim}; +#[cfg(unix)] use std::borrow::Cow; use std::env; #[cfg(not(windows))] @@ -1456,9 +1457,10 @@ mod tests { #[cfg(unix)] fn test_check_coreutil_version() { match check_coreutil_version("id", VERSION_MIN) { - Ok(s) => s.starts_with("uutils-tests-"), - Err(s) => s.starts_with("uutils-tests-warning"), + Ok(s) => assert!(s.starts_with("uutils-tests-")), + Err(s) => assert!(s.starts_with("uutils-tests-warning")), }; + #[cfg(target_os = "linux")] std::assert_eq!( check_coreutil_version("no test name", VERSION_MIN), Err("uutils-tests-warning: 'no test name' \ @@ -1471,7 +1473,11 @@ mod tests { #[cfg(unix)] fn test_expected_result() { let ts = TestScenario::new("id"); - assert!(expected_result(&ts, &[]).is_ok()); + // assert!(expected_result(&ts, &[]).is_ok()); + match expected_result(&ts, &[]) { + Ok(r) => assert!(r.succeeded()), + Err(s) => assert!(s.starts_with("uutils-tests-warning")), + } let ts = TestScenario::new("no test name"); assert!(expected_result(&ts, &[]).is_err()); }