Skip to content

Commit 112f646

Browse files
committed
fix: remove duplicate tests and trivial comments per PR feedback
- Remove test_cp_readonly_dest_regression (duplicate of test_cp_dest_no_permissions) - Remove test_cp_readonly_dest_with_force (duplicate of test_cp_arg_force) - Remove test_cp_readonly_dest_with_remove_destination (duplicate of test_cp_arg_remove_destination) - Remove test_cp_macos_clonefile_readonly (duplicate of test_cp_existing_target) - Remove test_cp_normal_copy_still_works (duplicate of test_cp_existing_target) - Remove trivial performance comments from readonly tests - Keep existing proven tests per maintainer preferences - Keep unique readonly tests that provide additional coverage
1 parent d4c91c1 commit 112f646

File tree

1 file changed

+0
-103
lines changed

1 file changed

+0
-103
lines changed

tests/by-util/test_cp.rs

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -4068,72 +4068,13 @@ fn test_cp_dest_no_permissions() {
40684068
.stderr_contains("denied");
40694069
}
40704070

4071-
/// Regression test for macOS readonly file behavior (issue #5257, PR #5261)
4072-
#[test]
4073-
fn test_cp_readonly_dest_regression() {
4074-
let ts = TestScenario::new(util_name!());
4075-
let at = &ts.fixtures;
4076-
4077-
// Batch file operations to reduce I/O overhead
4078-
at.write("source.txt", "source content");
4079-
at.write("readonly_dest.txt", "original content");
4080-
at.set_readonly("readonly_dest.txt");
4081-
4082-
ts.ucmd()
4083-
.args(&["source.txt", "readonly_dest.txt"])
4084-
.fails()
4085-
.stderr_contains("readonly_dest.txt")
4086-
.stderr_contains("denied");
4087-
4088-
assert_eq!(at.read("readonly_dest.txt"), "original content");
4089-
}
4090-
4091-
/// Test readonly destination behavior with --force flag (should succeed)
4092-
#[cfg(not(windows))]
4093-
#[test]
4094-
fn test_cp_readonly_dest_with_force() {
4095-
let ts = TestScenario::new(util_name!());
4096-
let at = &ts.fixtures;
4097-
4098-
// Use consistent file operations and batch setup
4099-
at.write("source.txt", "source content");
4100-
at.write("readonly_dest.txt", "original content");
4101-
at.set_readonly("readonly_dest.txt");
4102-
4103-
ts.ucmd()
4104-
.args(&["--force", "source.txt", "readonly_dest.txt"])
4105-
.succeeds();
4106-
4107-
assert_eq!(at.read("readonly_dest.txt"), "source content");
4108-
}
4109-
4110-
/// Test readonly destination behavior with --remove-destination flag (should succeed)
4111-
#[cfg(not(windows))]
4112-
#[test]
4113-
fn test_cp_readonly_dest_with_remove_destination() {
4114-
let ts = TestScenario::new(util_name!());
4115-
let at = &ts.fixtures;
4116-
4117-
// Batch file operations for better performance
4118-
at.write("source.txt", "source content");
4119-
at.write("readonly_dest.txt", "original content");
4120-
at.set_readonly("readonly_dest.txt");
4121-
4122-
ts.ucmd()
4123-
.args(&["--remove-destination", "source.txt", "readonly_dest.txt"])
4124-
.succeeds();
4125-
4126-
assert_eq!(at.read("readonly_dest.txt"), "source content");
4127-
}
4128-
41294071
/// Test readonly destination behavior with reflink options
41304072
#[cfg(any(target_os = "linux", target_os = "macos"))]
41314073
#[test]
41324074
fn test_cp_readonly_dest_with_reflink() {
41334075
let ts = TestScenario::new(util_name!());
41344076
let at = &ts.fixtures;
41354077

4136-
// Batch all file setup operations to minimize I/O
41374078
at.write("source.txt", "source content");
41384079
at.write("readonly_dest_auto.txt", "original content");
41394080
at.write("readonly_dest_always.txt", "original content");
@@ -4152,7 +4093,6 @@ fn test_cp_readonly_dest_with_reflink() {
41524093
.fails()
41534094
.stderr_contains("readonly_dest_always.txt");
41544095

4155-
// Batch verification operations
41564096
assert_eq!(at.read("readonly_dest_auto.txt"), "original content");
41574097
assert_eq!(at.read("readonly_dest_always.txt"), "original content");
41584098
}
@@ -4163,7 +4103,6 @@ fn test_cp_readonly_dest_recursive() {
41634103
let ts = TestScenario::new(util_name!());
41644104
let at = &ts.fixtures;
41654105

4166-
// Batch directory and file creation
41674106
at.mkdir("source_dir");
41684107
at.mkdir("dest_dir");
41694108
at.write("source_dir/file.txt", "source content");
@@ -4181,7 +4120,6 @@ fn test_cp_readonly_dest_with_existing_file() {
41814120
let ts = TestScenario::new(util_name!());
41824121
let at = &ts.fixtures;
41834122

4184-
// Batch all file operations to reduce I/O overhead
41854123
at.write("source.txt", "source content");
41864124
at.write("readonly_dest.txt", "original content");
41874125
at.write("other_file.txt", "other content");
@@ -4193,7 +4131,6 @@ fn test_cp_readonly_dest_with_existing_file() {
41934131
.stderr_contains("readonly_dest.txt")
41944132
.stderr_contains("denied");
41954133

4196-
// Batch verification operations
41974134
assert_eq!(at.read("readonly_dest.txt"), "original content");
41984135
assert_eq!(at.read("other_file.txt"), "other content");
41994136
}
@@ -4204,7 +4141,6 @@ fn test_cp_readonly_source() {
42044141
let ts = TestScenario::new(util_name!());
42054142
let at = &ts.fixtures;
42064143

4207-
// Batch file operations for better performance
42084144
at.write("readonly_source.txt", "source content");
42094145
at.write("dest.txt", "dest content");
42104146
at.set_readonly("readonly_source.txt");
@@ -4222,7 +4158,6 @@ fn test_cp_readonly_source_and_dest() {
42224158
let ts = TestScenario::new(util_name!());
42234159
let at = &ts.fixtures;
42244160

4225-
// Batch all file setup operations
42264161
at.write("readonly_source.txt", "source content");
42274162
at.write("readonly_dest.txt", "original content");
42284163
at.set_readonly("readonly_source.txt");
@@ -4237,44 +4172,6 @@ fn test_cp_readonly_source_and_dest() {
42374172
assert_eq!(at.read("readonly_dest.txt"), "original content");
42384173
}
42394174

4240-
/// Test macOS-specific clonefile behavior with readonly files
4241-
#[cfg(target_os = "macos")]
4242-
#[test]
4243-
fn test_cp_macos_clonefile_readonly() {
4244-
let ts = TestScenario::new(util_name!());
4245-
let at = &ts.fixtures;
4246-
4247-
// Batch file operations for consistency
4248-
at.write("source.txt", "source content");
4249-
at.write("readonly_dest.txt", "original content");
4250-
at.set_readonly("readonly_dest.txt");
4251-
4252-
// On macOS, clonefile should still fail on readonly destination
4253-
ts.ucmd()
4254-
.args(&["source.txt", "readonly_dest.txt"])
4255-
.fails()
4256-
.stderr_contains("readonly_dest.txt")
4257-
.stderr_contains("denied");
4258-
4259-
// Verify content unchanged
4260-
assert_eq!(at.read("readonly_dest.txt"), "original content");
4261-
}
4262-
4263-
/// Test that the fix doesn't break normal copy operations
4264-
#[test]
4265-
fn test_cp_normal_copy_still_works() {
4266-
let ts = TestScenario::new(util_name!());
4267-
let at = &ts.fixtures;
4268-
4269-
// Batch file operations for consistency with other tests
4270-
at.write("source.txt", "source content");
4271-
at.write("dest.txt", "dest content");
4272-
4273-
ts.ucmd().args(&["source.txt", "dest.txt"]).succeeds();
4274-
4275-
assert_eq!(at.read("dest.txt"), "source content");
4276-
}
4277-
42784175
#[test]
42794176
#[cfg(all(unix, not(target_os = "freebsd")))]
42804177
fn test_cp_attributes_only() {

0 commit comments

Comments
 (0)