Conversation
|
Hey @sat0ken thanks for the PR! I missed replying to your message on the issue, but I would have requested you to wait a bit before opening the PR. There is another PR which makes some refactor on test code, and that has been waiting for sometime to get merged. I plan to get that merged first and then ask authors of open test PRs to rebase on the main for the changes. I'll ping you once that is done, so you can rebase, and then I'll review this one. I also request you to hold off on the relative_devices PR till that is done, but I have assigned that to you on the issue. |
|
@YJDoc2 OK! I got it. thank you. |
|
Hey @sat0ken , that PR is merged, so you can rebase this once and also work on the relative devices. However, in future I will request to only work on one PR at a time 😅 |
|
@YJDoc2 Thank you for notify.
I'm sorry, I'll be careful from now on. |
There is no need to apologize; @YJDoc2 has just suggested a smooth way to develop. I often make this mistake myself 🙃 |
YJDoc2
left a comment
There was a problem hiding this comment.
Hey, there are some changes needed. Also can you confirm this is impl of linux_cgroups_devices and not linux_cgroups_relative_devices ?
| .access(allow.to_string()) | ||
| .typ(dev_type) | ||
| .major(major) | ||
| .minor(minor) | ||
| .access(access) |
There was a problem hiding this comment.
Why are we setting access twice? Is one of them supposed to be allow instead?
There was a problem hiding this comment.
It's my mistake. I fixed it.
| linux_device_build(true, LinuxDeviceType::C, 10, 229, "rwm".to_string()), | ||
| linux_device_build(true, LinuxDeviceType::B, 8, 20, "rw".to_string()), | ||
| linux_device_build(true, LinuxDeviceType::B, 10, 200, "r".to_string()), |
There was a problem hiding this comment.
If we are setting true in all three, we can instead directly set true in the function, and not pass the parameter at all.
There was a problem hiding this comment.
I fixed it.
| test_result!(check_container_created(&data)); | ||
| TestResult::Passed |
There was a problem hiding this comment.
I fixed about like original test, read devices.list file, and compare to spec.
| if let TestResult::Failed(_) = test_result { | ||
| return test_result; | ||
| } | ||
| test_result |
There was a problem hiding this comment.
This is no-op, we can simply return the test_outside_container here as the last statement in the function block
There was a problem hiding this comment.
I fixed it.
| let spec = SpecBuilder::default() | ||
| .linux( | ||
| LinuxBuilder::default() | ||
| .cgroups_path(Path::new("/runtime-test").join(cgroup_name)) |
There was a problem hiding this comment.
I think this is incorrect. For absolute cgroups path, it should be single level at root like /cgrouptest . Joining another path here would make it relative.
There was a problem hiding this comment.
Becouse, I check linux_cgroups_blkio test code, this code look like join path.
For absolute cgroups test, Shouldn't we join path?
https://github.com/youki-dev/youki/blob/main/tests/contest/contest/src/tests/cgroups/blkio.rs#L95
Hey, as @utam0k mentioned, no need to apologize, in fact I apologies if my comment seemed too harsh. We haven't mentioned this in the main issue as well, which we should, and I was suggesting that so it would be easier for us to review the PRs. 😅 😄 |
|
Hey @sat0ken , apologies I haven't been able to take a look at this. I had been quite busy, and then got a bit sick, and currently just have a lot of things I need to work on 😅 I'll try my best to take a look at this as soon as possible. Sincere apologies, I should have done better managing this 🙏 |
|
@YJDoc2 |
|
@sat0ken I'll start the review. But please rebase from the main branch before starting to review. |
|
@utam0k |
It looks like you made a mistake when rebasing. |
8979a4c to
bab0815
Compare
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
Signed-off-by: sat0ken <15720506+sat0ken@users.noreply.github.com>
92f1eaa to
5a8cf64
Compare
OMG. Sorry, I fix it. |
| // read major, minor number | ||
| let major_minor: Vec<&str> = parts[1].split(':').collect(); | ||
| if major_minor.len() != 2 { | ||
| // ignore invalid format |
There was a problem hiding this comment.
Why can we ignore invalid formats?
| for spec_linux_device in spec_linux_devices { | ||
| if spec_linux_device.allow() { | ||
| let mut found = false; | ||
| for linux_device in linux_devices.clone() { |
| let major = if major_minor[0] == "*" { | ||
| None | ||
| } else { | ||
| major_minor[0].parse::<i64>().ok() | ||
| }; | ||
| let minor = if major_minor[1] == "*" { | ||
| None | ||
| } else { | ||
| major_minor[1].parse::<i64>().ok() | ||
| }; | ||
| // read access string | ||
| let access = parts[2].to_string(); | ||
| devices.push(linux_device_build( | ||
| device_type, | ||
| major.unwrap(), | ||
| minor.unwrap(), |
There was a problem hiding this comment.
If * comes into this logic, I guess it will cause panic.
| // read major, minor number | ||
| let major_minor: Vec<&str> = parts[1].split(':').collect(); | ||
| if major_minor.len() != 2 { | ||
| // ignore invalid format |
There was a problem hiding this comment.
Why can we ignore invalid formats?
| for spec_linux_device in spec_linux_devices { | ||
| if spec_linux_device.allow() { | ||
| let mut found = false; | ||
| for linux_device in linux_devices.clone() { |
| let major = if major_minor[0] == "*" { | ||
| None | ||
| } else { | ||
| major_minor[0].parse::<i64>().ok() | ||
| }; | ||
| let minor = if major_minor[1] == "*" { | ||
| None | ||
| } else { | ||
| major_minor[1].parse::<i64>().ok() | ||
| }; | ||
| // read access string | ||
| let access = parts[2].to_string(); | ||
| devices.push(linux_device_build( | ||
| device_type, | ||
| major.unwrap(), | ||
| minor.unwrap(), |
There was a problem hiding this comment.
If * comes into this logic, I guess it will cause panic.
This implements the linux_cgroups_devices validation in #361