Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find: Implement -newerXY #342

Merged
merged 24 commits into from
Apr 3, 2024
Merged

find: Implement -newerXY #342

merged 24 commits into from
Apr 3, 2024

Conversation

hanbings
Copy link
Collaborator

link: #307

@cakebaker cakebaker linked an issue Mar 27, 2024 that may be closed by this pull request
Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 78.50467% with 23 lines in your changes are missing coverage. Please review.

Project coverage is 59.12%. Comparing base (450c4ae) to head (aea6b66).

❗ Current head aea6b66 differs from pull request most recent head dcbf986. Consider uploading reports for the commit dcbf986 to get more accurate results

Files Patch % Lines
src/find/matchers/mod.rs 71.42% 1 Missing and 13 partials ⚠️
src/find/matchers/time.rs 84.48% 1 Missing and 8 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #342      +/-   ##
==========================================
+ Coverage   58.59%   59.12%   +0.53%     
==========================================
  Files          30       30              
  Lines        3712     3736      +24     
  Branches      840      847       +7     
==========================================
+ Hits         2175     2209      +34     
+ Misses       1223     1218       -5     
+ Partials      314      309       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sylvestre
Copy link
Contributor

Could you please add unit and integration tests? Thanks

@hanbings
Copy link
Collaborator Author

Okay, I will add the test code as soon as possible.

@sylvestre
Copy link
Contributor

Thanks

@cakebaker
Copy link
Contributor

@hanbings apart from the tests, is the code ready for review?

@hanbings
Copy link
Collaborator Author

hanbings commented Mar 27, 2024

@hanbings apart from the tests, is the code ready for review?

I'm sorry I just saw the message.
I've added some test code, but there seems to be something wrong with the Github Actions being tested, and I'm not quite sure the test code meets the coverage requirements.
In addition, there is another piece of file system compatibility code that is not yet ready.

But yeah, ready to review. Thank you.

src/find/matchers/mod.rs Outdated Show resolved Hide resolved
@hanbings hanbings requested a review from cakebaker March 30, 2024 14:53
@hanbings hanbings requested a review from cakebaker March 30, 2024 17:41
src/find/mod.rs Outdated Show resolved Hide resolved
src/find/mod.rs Outdated Show resolved Hide resolved
src/find/matchers/mod.rs Outdated Show resolved Hide resolved
// accessed time test
let accessed_matcher = NewerTimeMatcher::new(NewerOptionType::Accessed, time);

thread::sleep(Duration::from_secs(2));
Copy link
Contributor

Choose a reason for hiding this comment

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

why sleep ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is my oversight, sleep() is not really needed here, and there are two other codes with the same problem. They have been modified in the commit. Thanks!


let created_matcher = NewerTimeMatcher::new(NewerOptionType::Birthed, time);

thread::sleep(Duration::from_secs(2));
Copy link
Contributor

Choose a reason for hiding this comment

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

same, is this sleep needed?

Copy link
Collaborator Author

@hanbings hanbings Apr 3, 2024

Choose a reason for hiding this comment

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

This sleep() is used to ensure that there is a small distance between the time when assert() is executed and the time when the file was created. In fact, this code fails the test on my machine after removing the sleep().

and...
Currently the i64 type millisecond timestamp is used to determine the time. I have noticed that it is not accurate enough and I am going to change it to microsecond.
because the time parameter input does not support microsecond or even millisecond input, millisecond seem to be sufficient.

Copy link
Contributor

Choose a reason for hiding this comment

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

two seconds is long, try 0.1 ?

Copy link
Collaborator Author

@hanbings hanbings Apr 3, 2024

Choose a reason for hiding this comment

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

OK, committed. Thanks!

@sylvestre sylvestre merged commit 49d870d into uutils:main Apr 3, 2024
11 checks passed
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.

Implement -newerXY
3 participants