diff --git a/.travis.yml b/.travis.yml index f7718d283..726bfdf8f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,3 @@ script: - ./.travis_fixup.sh - cargo build - cargo test --no-fail-fast -matrix: - allow_failures: - - os: osx diff --git a/src/chmod/chmod.rs b/src/chmod/chmod.rs index e711e46f5..f8bd824ab 100644 --- a/src/chmod/chmod.rs +++ b/src/chmod/chmod.rs @@ -300,12 +300,12 @@ fn parse_change(mode: &str, fperm: libc::mode_t, file: &Path) -> (libc::mode_t, fn change_file(fperm: libc::mode_t, mode: libc::mode_t, file: &Path, path: &CString, verbose: bool, changes: bool, quiet: bool) -> Result<(), i32> { if fperm == mode { if verbose && !changes { - show_info!("mode of \"{}\" retained as {:o}", file.display(), fperm); + show_info!("mode of '{}' retained as {:o}", file.display(), fperm); } Ok(()) } else if unsafe { libc::chmod(path.as_ptr(), mode) } == 0 { if verbose || changes { - show_info!("mode of \"{}\" changed from {:o} to {:o}", file.display(), fperm, mode); + show_info!("mode of '{}' changed from {:o} to {:o}", file.display(), fperm, mode); } Ok(()) } else { @@ -313,7 +313,7 @@ fn change_file(fperm: libc::mode_t, mode: libc::mode_t, file: &Path, path: &CStr show_error!("{}", io::Error::last_os_error()); } if verbose { - show_info!("failed to change mode of file \"{}\" from {:o} to {:o}", file.display(), fperm, mode); + show_info!("failed to change mode of file '{}' from {:o} to {:o}", file.display(), fperm, mode); } return Err(1); } diff --git a/tests/common/util.rs b/tests/common/util.rs index 7b7f970c4..716e5aeae 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -53,6 +53,16 @@ pub struct CmdResult { pub stderr: String, } +#[cfg(target_os = "macos")] +pub fn trim_private(input: &str) -> &str { + input.trim_left_matches("/private") +} + +#[cfg(not(target_os = "macos"))] +pub fn trim_private(input: &str) -> &str { + input +} + pub fn log_info, U: AsRef>(msg: T, par: U) { println!("{}: {}", msg.as_ref(), par.as_ref()); } diff --git a/tests/pwd.rs b/tests/pwd.rs index b813548f8..7d389c979 100644 --- a/tests/pwd.rs +++ b/tests/pwd.rs @@ -12,5 +12,5 @@ fn test_default() { let out = ucmd.run().stdout; let expected = at.root_dir(); - assert_eq!(out.trim_right(), expected); + assert_eq!(trim_private(out.trim_right()), expected); } diff --git a/tests/readlink.rs b/tests/readlink.rs index 27d76a583..15bee26c0 100644 --- a/tests/readlink.rs +++ b/tests/readlink.rs @@ -16,7 +16,7 @@ fn test_canonicalize() { .run() .stdout; - assert_eq!(out.trim_right(), at.root_dir()); + assert_eq!(trim_private(out.trim_right()), at.root_dir()); } #[test] @@ -27,7 +27,7 @@ fn test_canonicalize_existing() { .run() .stdout; - assert_eq!(out.trim_right(), at.root_dir()); + assert_eq!(trim_private(out.trim_right()), at.root_dir()); } #[test] @@ -42,7 +42,7 @@ fn test_canonicalize_missing() { .run() .stdout; - assert_eq!(out.trim_right(), expected); + assert_eq!(trim_private(out.trim_right()), expected); } #[test] @@ -56,7 +56,7 @@ fn test_long_redirection_to_current_dir() { .run() .stdout; - assert_eq!(out, at.root_dir()); + assert_eq!(trim_private(&out), at.root_dir()); } #[test] diff --git a/tests/realpath.rs b/tests/realpath.rs index 8eafe0e2d..cf3c20a28 100644 --- a/tests/realpath.rs +++ b/tests/realpath.rs @@ -10,7 +10,7 @@ fn test_current_directory() { let (at, mut ucmd) = testing(UTIL_NAME); let out = ucmd.arg(".").run().stdout; - assert_eq!(out.trim_right(), at.root_dir()); + assert_eq!(trim_private(out.trim_right()), at.root_dir()); } #[test] @@ -20,7 +20,7 @@ fn test_long_redirection_to_current_dir() { let dir = repeat_str("./", 128); let out = ucmd.arg(dir).run().stdout; - assert_eq!(out.trim_right(), at.root_dir()); + assert_eq!(trim_private(out.trim_right()), at.root_dir()); } #[test]