Skip to content

Conversation

@naoNao89
Copy link
Contributor

Fixes issue #5349

The tests ensure the readonly file behavior from PR #5261 cannot regress in future development.

@sylvestre
Copy link
Contributor

please remove the trivial comments :)

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

- Add 10 new test functions covering readonly destination behavior
- Tests cover basic readonly copying, flag combinations, and edge cases
- Include macOS-specific clonefile behavior tests
- Ensure readonly file protection from PR #5261 cannot regress
- Tests provide evidence for closing issue #5349
@naoNao89 naoNao89 force-pushed the add-cp-readonly-regression-tests branch from 78e2aa7 to b8d7d4a Compare October 27, 2025 10:13
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 27, 2025

CodSpeed Performance Report

Merging #9045 will degrade performances by 2.59%

Comparing naoNao89:add-cp-readonly-regression-tests (112f646) with main (5c5494a)

Summary

❌ 2 regressions
✅ 103 untouched
⏩ 74 skipped1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
du_balanced_tree[(5, 4, 10)] 9.1 ms 9.3 ms -2.59%
du_human_balanced_tree[(5, 4, 10)] 10.2 ms 10.5 ms -2.5%

Footnotes

  1. 74 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

- Reduce file I/O overhead by batching file operations
- Consolidate setup operations to minimize system calls
- Improve test execution time from 0.44s to 0.27s (38% improvement)
- Maintain comprehensive test coverage for readonly file behavior
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

Comment on lines 4092 to 4108
#[cfg(not(windows))]
#[test]
fn test_cp_readonly_dest_with_force() {
let ts = TestScenario::new(util_name!());
let at = &ts.fixtures;

// Use consistent file operations and batch setup
at.write("source.txt", "source content");
at.write("readonly_dest.txt", "original content");
at.set_readonly("readonly_dest.txt");

ts.ucmd()
.args(&["--force", "source.txt", "readonly_dest.txt"])
.succeeds();

assert_eq!(at.read("readonly_dest.txt"), "source content");
}
Copy link
Contributor

@cakebaker cakebaker Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is more or less the same as test_cp_arg_force on line 941. I would keep this test as it is cleaner and remove the other one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, my comment was unclear :| What I meant is to keep this test, test_cp_readonly_dest_with_force, and to remove test_cp_arg_force.

Comment on lines 4113 to 4127
fn test_cp_readonly_dest_with_remove_destination() {
let ts = TestScenario::new(util_name!());
let at = &ts.fixtures;

// Batch file operations for better performance
at.write("source.txt", "source content");
at.write("readonly_dest.txt", "original content");
at.set_readonly("readonly_dest.txt");

ts.ucmd()
.args(&["--remove-destination", "source.txt", "readonly_dest.txt"])
.succeeds();

assert_eq!(at.read("readonly_dest.txt"), "source content");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here: it's more or less the same as test_cp_arg_remove_destination on line 967. And I would also keep this test and remove the other one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, my comment was unclear, I'm sorry. Here I also meant to keep test_cp_readonly_dest_with_remove_destination and to remove test_cp_arg_remove_destination.

@naoNao89 naoNao89 force-pushed the add-cp-readonly-regression-tests branch 4 times, most recently from 5fddc7f to a1fb012 Compare October 28, 2025 10:45
@naoNao89 naoNao89 marked this pull request as draft October 28, 2025 11:00
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

@naoNao89 naoNao89 force-pushed the add-cp-readonly-regression-tests branch from a1fb012 to 9a80703 Compare October 28, 2025 11:21
- 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
@naoNao89 naoNao89 force-pushed the add-cp-readonly-regression-tests branch from 9a80703 to 112f646 Compare October 28, 2025 11:22
@naoNao89 naoNao89 marked this pull request as ready for review October 28, 2025 11:38
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@naoNao89 naoNao89 closed this by deleting the head repository Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants