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
Netlink extensions (issue #32) #33
Conversation
Ah, there is one annoyance: There can only be one netlink socket per PID, so when running multiple tests, one has to pass --test-threads 1 to cargo. At the moment (this I did not change from the old code) a NL socket is created on-demand per request. It would be reasonable to use an RAII wrapper for this, but it does not solve the threading issue. There could also be a process-wide global, but that kinda sits wrong with me. |
@jreppnow Thanks for getting on this!
OK. But please do not use any equipment that is owned by the company you work for, or any other company. I would not want any company claiming ownership of this code based on something like that! We can get this PR merged and then try to do the bit rates in one of several ways:
|
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.
Ah, there is one annoyance: There can only be one netlink socket per PID, so when running multiple tests, one has to pass --test-threads 1 to cargo.
Ah, yeah, I've had a few crates that need to serialize tests. The problem with requiring it to be done manually with --test-threads=1
is that you always forget. (I know from experience!)
But there's a crate to help with this: serial_test.
Just add to Cargo.toml
:
[dev-dependencies]
serial_test = "0.9"
and then tag any tests that need to run in isolation as #[serial]
, like:
#[test]
#[serial]
fn test_something() { ... }
c8e0b54
to
4f770bf
Compare
Hi @fpagliughi, I'll address the remarks in order:
I rebased the PR to the most recent version of the master branch. |
That all sounds good. I was actually out sick from work the last week+, so got more done than I thought on this, but I'm back so mostly relegated to nights and weekends going forward. But I may have time over Christmas as well. Anyway, the main upstream crates we use ( I currently have two PR's in to the I'll have a look at the PR this evening, and most likely just land it and keep moving forward. Thanks again. |
I've already forked Edit: rust-lang/libc#3035 |
Hi everyone,
this is a first step towards the requirements in #32. Specifically, it implements:
All of the tests added here need to be run as root and/or with CAP_NET_ADMIN capability. As such, I hid them behind another feature flag. They work locally for me.
I did not get to bitrate and such because that actually does not work with vcan out-of-the-box; and I don't have a physical CAN device at home atm.
For follow-up changes it might be interesting to know where I got the information from (which was quite painful as they documentation leaves some things to be desired..):
strace
with theip link
commands I was interested in