Skip to content

find: Implement -newerXY - #342

Merged
sylvestre merged 24 commits into
uutils:mainfrom
hanbings:main
Apr 3, 2024
Merged

sylvestre merged 24 commits into
uutils:mainfrom
hanbings:main

Conversation

@hanbings

Copy link
Copy Markdown
Collaborator

link: #307

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

codecov Bot commented Mar 27, 2024 •

Copy link
Copy Markdown

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
Copy Markdown
Contributor

Could you please add unit and integration tests? Thanks

@hanbings

Copy link
Copy Markdown
Collaborator Author

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

@sylvestre

Copy link
Copy Markdown
Contributor

Thanks

@cakebaker

Copy link
Copy Markdown
Contributor

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

@hanbings

hanbings commented Mar 27, 2024 •

Copy link
Copy Markdown
Collaborator Author

@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.

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

thread::sleep(Duration::from_secs(2));

Copy link
Copy Markdown
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
Copy Markdown
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!

Comment thread src/find/matchers/time.rs Outdated

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

thread::sleep(Duration::from_secs(2));

Copy link
Copy Markdown
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?

@hanbings hanbings Apr 3, 2024 •

Copy link
Copy Markdown
Collaborator Author

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
Copy Markdown
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 ?

@hanbings hanbings Apr 3, 2024 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

OK, committed. Thanks!

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