-
Notifications
You must be signed in to change notification settings - Fork 347
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
Add test process rlimits #2977
Add test process rlimits #2977
Conversation
Signed-off-by: sat0ken <[email protected]>
Signed-off-by: sat0ken <[email protected]>
Signed-off-by: sat0ken <[email protected]>
Signed-off-by: sat0ken <[email protected]>
…nto add-test-process-rlimits
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.
Clippy CI failing, also you are not setting the correct runtimetest arg as cmd in the process spec, so the internal validation won't run at all.
Also, are there any safe alternatives to get the rlimits, maybe via nix crate? https://docs.rs/nix/latest/nix/sys/resource/fn.getrlimit.html |
Signed-off-by: sat0ken <[email protected]>
Signed-off-by: sat0ken <[email protected]>
Signed-off-by: sat0ken <[email protected]>
I fixed the code, remove unsafe code and change to use nix. |
@YJDoc2 HI, I've fixed the code according to the comments. Could you please check the code? |
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.
two nitpicks, but not blocking change. I'll merge this PR by tom if you don't respond. (Even a comment not necessarily code change)
To be clear, the nitpicks are not major, so I'm fine for merging this as is, and will merge by tom unless you comment otherwise.
let (soft_limit, hard_limit) = getrlimit(change_resource_type(spec_rlimit.typ())).unwrap(); | ||
if spec_rlimit.hard() != hard_limit { | ||
eprintln!( | ||
"error type of {:?} hard rlimit expected {:?} , got {:?}", |
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.
"error type of {:?} hard rlimit expected {:?} , got {:?}", | |
"error: rlimit mismatch {:?} hard rlimit expected {:?} , got {:?}", |
Same for soft limit
} | ||
} | ||
|
||
fn change_resource_type(resource_type: PosixRlimitType) -> Resource { |
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.
fn change_resource_type(resource_type: PosixRlimitType) -> Resource { | |
fn to_nix_resource(resource_type: PosixRlimitType) -> Resource { |
my reasoning is change_resource_type
does not express what exactly we are changing it to, but from fn signature it is understandable, so not a strict change req.
Going ahead and merging |
This implements the process_rlimits validation in #361