From 37c986b005d772a7ebb117db7c84a341c4fecf79 Mon Sep 17 00:00:00 2001 From: Syukron Rifail M Date: Mon, 19 Jul 2021 06:55:11 +0700 Subject: [PATCH] test_du: ignore unsupported --time=birth --- tests/by-util/test_du.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_du.rs b/tests/by-util/test_du.rs index 607d5dc45..efc097773 100644 --- a/tests/by-util/test_du.rs +++ b/tests/by-util/test_du.rs @@ -398,8 +398,7 @@ fn test_du_time() { let result = ts.ucmd().arg("--time=ctime").arg("date_test").succeeds(); result.stdout_only("0\t2016-06-16 00:00\tdate_test\n"); - #[cfg(not(target_env = "musl"))] - { + if birth_supported() { use regex::Regex; let re_birth = @@ -409,6 +408,16 @@ fn test_du_time() { } } +#[cfg(feature = "touch")] +fn birth_supported() -> bool { + let ts = TestScenario::new(util_name!()); + let m = match std::fs::metadata(ts.fixtures.subdir) { + Ok(m) => m, + Err(e) => panic!("{}", e), + }; + m.created().is_ok() +} + #[cfg(not(target_os = "windows"))] #[cfg(feature = "chmod")] #[test]