Skip to content

Add SocketCan J1939 constants and structs #2706

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

Merged
merged 6 commits into from
Mar 11, 2022
Merged

Conversation

abalmos
Copy link
Contributor

@abalmos abalmos commented Mar 3, 2022

Add SocketCan J1939 constants and structs.

Blocking a PR to nix to wrap SocketCan's j1939 module.

Signed-off-by: Andrew Balmos <andrew@balmos.org>
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Amanieu (or someone else) soon.

Please see the contribution instructions for more information.

@abalmos
Copy link
Contributor Author

abalmos commented Mar 3, 2022

Looks like

enum {
	J1939_NLA_PAD,
	J1939_NLA_BYTES_ACKED,
	J1939_NLA_TOTAL_SIZE,
	J1939_NLA_PGN,
	J1939_NLA_SRC_NAME,
	J1939_NLA_DEST_NAME,
	J1939_NLA_SRC_ADDR,
	J1939_NLA_DEST_ADDR,
};

wasn't added to the kernel until 5.15.

I actually don't need these for my work. Should I just remove them from the PR or is there another way to deal with the CI being on an older kernel?

@Amanieu
Copy link
Member

Amanieu commented Mar 3, 2022

Signed-off-by: Andrew Balmos <Andrew Balmos>
@abalmos
Copy link
Contributor Author

abalmos commented Mar 3, 2022

@Amanieu Thanks! I think I pushed the fix. I am on 5.15, so the tests ran okay for me before this change

@abalmos
Copy link
Contributor Author

abalmos commented Mar 3, 2022

@Amanieu I might need help with this error. It seems unrelated to this PR.

@Amanieu
Copy link
Member

Amanieu commented Mar 3, 2022

bad J1939_NO_ADDR value at byte 0: rust: 0 (0x0) != c 255 (0xff)

This means that the Rust value of the constant doesn't match the C value.

Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
@abalmos
Copy link
Contributor Author

abalmos commented Mar 3, 2022

Thanks @Amanieu! I'm not sure why libc-test worked on my machine from the get-go, but glad to see the CI passing now.

@Amanieu
Copy link
Member

Amanieu commented Mar 3, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Mar 3, 2022

📌 Commit 02042f0 has been approved by Amanieu

bors added a commit that referenced this pull request Mar 3, 2022
Add SocketCan J1939 constants and structs

Add SocketCan J1939 constants and structs.

Blocking a PR to `nix` to wrap SocketCan's j1939 module.
@bors
Copy link
Contributor

bors commented Mar 3, 2022

⌛ Testing commit 02042f0 with merge 42232d8...

@bors
Copy link
Contributor

bors commented Mar 3, 2022

💔 Test failed - checks-actions

Signed-off-by: Andrew Balmos <andrew@balmos.org>
@abalmos
Copy link
Contributor Author

abalmos commented Mar 3, 2022

@Amanieu Re-added.

Sorry about that, I didn't realize there was more test environments then what was in GitHub actions.

@Amanieu
Copy link
Member

Amanieu commented Mar 4, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Mar 4, 2022

📌 Commit 99045cd has been approved by Amanieu

@bors
Copy link
Contributor

bors commented Mar 4, 2022

⌛ Testing commit 99045cd with merge 99294b2...

@abalmos
Copy link
Contributor Author

abalmos commented Mar 4, 2022

@Amanieu how do I check the error for this CI?

@Amanieu
Copy link
Member

Amanieu commented Mar 4, 2022

Click on the checks-actions link from bors. Ignore the semver tests, we allow failure for those.

@abalmos
Copy link
Contributor Author

abalmos commented Mar 4, 2022

I had tried that but I don't have any meaningful output. I just see that it failed:

SmartSelect_20220304-182632_Chrome

@Amanieu
Copy link
Member

Amanieu commented Mar 5, 2022

You need to use the bar on the left to select the actual build step that failed. Here is the failure:

  running: "musl-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-march=armv6" "-marm" "-mfpu=vfp" "-Wall" "-Wextra" "-Wall" "-Wextra" "-Werror" "-Wno-unused-parameter" "-Wno-type-limits" "-Wno-address-of-packed-member" "-Wno-unknown-warning-option" "-Wno-deprecated-declarations" "-D_GNU_SOURCE" "-D__GLIBC_USE_DEPRECATED_SCANF" "-o" "/checkout/target/arm-unknown-linux-musleabihf/debug/build/libc-test-87c193be97bba046/out/main.o" "-c" "/checkout/target/arm-unknown-linux-musleabihf/debug/build/libc-test-87c193be97bba046/out/main.c"
  cargo:warning=/checkout/target/arm-unknown-linux-musleabihf/debug/build/libc-test-87c193be97bba046/out/main.c:97:10: fatal error: linux/can/j1939.h: No such file or directory
  cargo:warning=   97 | #include <linux/can/j1939.h>
  cargo:warning=      |          ^~~~~~~~~~~~~~~~~~~
  cargo:warning=compilation terminated.
`

@abalmos
Copy link
Contributor Author

abalmos commented Mar 6, 2022

I am stumped by this one ... it looks like the linux/can/j1939.h header is not present in the CI, yet it is running 20.04 and should have it based on Ubuntu repos. We develop on an arm board running Debian Buster without problem.

Kernel headers too old.

Signed-off-by: Andrew Balmos <andrew@balmos.org>
@abalmos
Copy link
Contributor Author

abalmos commented Mar 7, 2022

@Amanieu Ah, I see. The test environment installs kernel headers cleaned for musl here:

"https://github.com/sabotage-linux/kernel-headers/archive/v${KERNEL_HEADER_VER}.tar.gz" | \

but that project uses headers for kernel 4.19.88. j1939 was not added until v5.4.1.

I just pushed a commit that I believe will disable tests for musl. These are all kernel defines and types, so the testing done in the gnu environments ought to be enough. -- Please do let me know if you would prefer a different fix.

@Amanieu
Copy link
Member

Amanieu commented Mar 7, 2022

I think we should just go ahead and upgrade the version of the kernel headers used when testing musl to the latest available version.

@abalmos
Copy link
Contributor Author

abalmos commented Mar 7, 2022

@Amanieu I would be happy to try to work on that, but the CI is using the latest set of headers available
here: https://github.com/sabotage-linux/kernel-headers

I don't know too much about musl and how all hooks with rust. Would you have any pointers on getting started with said upgrade?

@Amanieu
Copy link
Member

Amanieu commented Mar 7, 2022

Fair enough. In that case I think this is fine to land.

@bors r+

@bors
Copy link
Contributor

bors commented Mar 7, 2022

📌 Commit 6991bfa has been approved by Amanieu

bors added a commit that referenced this pull request Mar 7, 2022
Add SocketCan J1939 constants and structs

Add SocketCan J1939 constants and structs.

Blocking a PR to `nix` to wrap SocketCan's j1939 module.
@bors
Copy link
Contributor

bors commented Mar 7, 2022

⌛ Testing commit 6991bfa with merge 0ae4f07...

@bors
Copy link
Contributor

bors commented Mar 7, 2022

💔 Test failed - checks-actions

@abalmos
Copy link
Contributor Author

abalmos commented Mar 7, 2022

@Amanieu Is there any good way to run these tests locally?

Signed-off-by: Andrew Balmos <andrew@balmos.org>
@abalmos
Copy link
Contributor Author

abalmos commented Mar 8, 2022

I accidentally put typedefs into skip_struct rather then skip_types.

I also found a comment that explains that testing kernel definitions in glibc targets only is sufficient, so I cleaned up the additions a bit by moving my skipped constant into that block.

Hopefully this version will pass :)

@Amanieu
Copy link
Member

Amanieu commented Mar 11, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Mar 11, 2022

📌 Commit 06a74e0 has been approved by Amanieu

@bors
Copy link
Contributor

bors commented Mar 11, 2022

⌛ Testing commit 06a74e0 with merge bc9ea0b...

@bors
Copy link
Contributor

bors commented Mar 11, 2022

☀️ Test successful - checks-actions, checks-cirrus-freebsd-11, checks-cirrus-freebsd-12, checks-cirrus-freebsd-13
Approved by: Amanieu
Pushing bc9ea0b to master...

@bors bors merged commit bc9ea0b into rust-lang:master Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants