-
Notifications
You must be signed in to change notification settings - Fork 17
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
implement free features #70
Conversation
wait im stupid i forgot to test whether it works for count = 1 🥴 |
i dont know how important that is but our free doesnt throw an error for count is 0 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #70 +/- ##
==========================================
- Coverage 49.00% 45.98% -3.03%
==========================================
Files 18 18
Lines 2216 2279 +63
Branches 309 325 +16
==========================================
- Hits 1086 1048 -38
+ Misses 1082 1057 -25
- Partials 48 174 +126
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
i just realized that swap and total have no human output, gotta fix that |
please add tests in https://github.com/uutils/procps/blob/main/tests/by-util/test_free.rs |
@sylvestre i added some basic tests but they dont cover combinations such as -th |
@sylvestre will this pr get merged? |
probably but please be a bit patient :) |
|
||
#[test] | ||
fn test_free_count() { | ||
let result = new_ucmd!().args(&["-c", "2", "-s", "0"]).succeeds(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is about -c
, so I would omit the -s
as it's not necessary.
let result = new_ucmd!().args(&["-c", "2", "-s", "0"]).succeeds(); | |
let result = new_ucmd!().args(&["-c", "2"]).succeeds(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i did that so i have to wait less 😂
@sylvestre sry xD i was just a bit bored so i cleaned up the code a bit and implemented --lohi, committing after i tested it a bit :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there are at least two tests missing: what happens if you pass 0
as a value to -c
or -s
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if -s is 0 the original throws an error for some reason but doesnt for very small values above 0 (that dont get rounded down to 0). if -c is 0 it also throws an error but if -s is defined and -c is undefined it just runs forever.
i implemented --lohi so that it actually works unlike the original which doesnt (at least free from procps-ng 4.0.4 from archlinux) |
Why do you think I have my doubts that your implementation works because when I look at your changes, I see no changes made to |
parse_meminfo is called in the match |
According to code coverage, it seems that a bunch of lines aren't covered by tests. could you please extend the tests ? thanks |
@D3V1LC0D3R yes, I think it is easy to mistake the output of
Obviously, the "High" values must be incorrect, they must be greater or equal to the "Low" values. However, "Low" and "High" refer to different memory regions and as there is no high memory on my machine (and the aforementioned keys are not in |
@cakebaker i thought --lohi was just info about the highest and lowest the memory has been while running free |
add suggestion by @sylvestre Co-authored-by: Sylvestre Ledru <[email protected]>
@sylvestre anything else? |
src/uu/free/src/free.rs
Outdated
let si = matches.get_flag("si"); | ||
let total = matches.get_flag("total"); | ||
let minmax = matches.get_flag("minmax"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see minmax in my free binary
free --help|grep min
doesn't return anything ?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--minmax is a new feature i implemented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry but for now, we want free to be a dropped in replacement
New features should be done in a separate PR and discussed :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so i should remove this feature? ok :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it needs to be discussed first
thanks
Code coverage seems to complain that a few lines aren't covered by test, could you please add a few tests? thanks |
@sylvestre i think that is out of date. how can i check that locally? cargo test only tests and doesnt provide any coverage info as far as i know. |
i found the problem. i forgot to remove the test of --minmax |
I think there is still some misunderstanding about Here's what I get on my machine:
In the code, you read |
small change to comment Co-authored-by: Daniel Hofstetter <[email protected]>
@cakebaker it should be fixed now from what i understand |
i totally forgot about the macos part |
Thanks for your PR :) |
No description provided.