touch: accept Unix permission errors in test

This commit is contained in:
Daniel Syauqi authored and Sylvestre Ledru committed 2026-10-08 22:09:09 +02:00
1 parent b43c45a9fa
commit cb4392c25e
1 file changed
+6 -4
+6 -4
View File
@@ -985,10 +985,12 @@ fn test_touch_existing_unwritable_file_error_msg() {
.args(&["-d", "2000-01-01", path])
.fails()
.stderr_only("touch: cannot touch '/etc/passwd': Permission denied\n");
new_ucmd!()
.args(&["-c", path])
.fails()
.stderr_only("touch: setting times of '/etc/passwd': Permission denied\n");
let result = new_ucmd!().args(&["-c", path]).fails();
assert!(matches!(
result.stderr_str(),
"touch: setting times of '/etc/passwd': Permission denied\n"
| "touch: setting times of '/etc/passwd': Operation not permitted\n"
));
}
#[test]