final release preparations

This commit is contained in:
Robin Müller 2024-06-01 18:59:27 +02:00
parent cdf5441c41
commit d8d3fbe15a
Signed by: muellerr
GPG Key ID: A649FB78196E3849
9 changed files with 132 additions and 37 deletions

1
examples/src/lib.rs Normal file
View File

@ -0,0 +1 @@

View File

@ -0,0 +1,22 @@
Checklist for new releases
=======
# Pre-Release
1. Make sure any new modules are documented sufficiently enough and check docs with
`cargo +nightly doc --all-features --config 'build.rustdocflags=["--cfg", "docs_rs"]' --open`.
2. Bump version specifier in `Cargo.toml`.
3. Update `CHANGELOG.md`: Convert `unreleased` section into version section with date and add new
`unreleased` section.
4. Run `cargo test --all-features` or `cargo nextest r --all-features`.
5. Run `cargo fmt` and `cargo clippy`.
6. Wait for CI/CD results for EGit and Github. These also check cross-compilation for bare-metal
targets.
# Release
1. `cargo publish`
# Post-Release
1. Create a new release on `EGit` based on the release branch.

View File

@ -14,3 +14,6 @@ links = "csp"
[dependencies] [dependencies]
libc = "0.2" libc = "0.2"
[package.metadata.docs.rs]
rustdoc-args = ["--cfg", "docs_rs"]

View File

@ -19,3 +19,17 @@ The user has to provide the path to a directory containing this `autoconfig.rs`
It is recommended to read the [main workspace README](https://egit.irs.uni-stuttgart.de/rust/libcsp-rust) It is recommended to read the [main workspace README](https://egit.irs.uni-stuttgart.de/rust/libcsp-rust)
for more information to make the generation and specification of this auto-configuration file for more information to make the generation and specification of this auto-configuration file
as conveniently and easy as possible. as conveniently and easy as possible.
## Run unittests
Running unittests required the `RUN_TESTS` environmental variable to be set to 1. This is because
the actual `libcsp` library might be built and linked in a separate crate, so the linker is not
able to process `-l csp` when running the tests.
You can use
```sh
RUN_TESTS=1 cargo test
```
to run the unittests.

View File

@ -1,9 +1,19 @@
use std::{env, path::PathBuf}; use std::{env, path::PathBuf};
pub const ENV_KEY_CSP_CONFIG_DIR: &str = "CSP_CONFIG_DIR"; pub const ENV_KEY_CSP_CONFIG_DIR: &str = "CSP_CONFIG_DIR";
pub const ENV_KEY_TEST: &str = "RUN_TESTS";
fn main() { fn main() {
println!("cargo:rustc-link-lib=csp"); // libcsp is built in a separate project, so linking it for tests will fail.
// For tests, we do not want to have the link directive to csp.
let run_tests = if let Ok(val) = env::var(ENV_KEY_TEST) {
val == "1"
} else {
false
};
if !run_tests {
println!("cargo:rustc-link-lib=csp");
}
let out_path = env::var("OUT_DIR").unwrap(); let out_path = env::var("OUT_DIR").unwrap();
let csp_conf_dir = match env::var(ENV_KEY_CSP_CONFIG_DIR) { let csp_conf_dir = match env::var(ENV_KEY_CSP_CONFIG_DIR) {

View File

@ -0,0 +1,22 @@
Checklist for new releases
=======
# Pre-Release
1. Make sure any new modules are documented sufficiently enough and check docs with
`cargo +nightly doc --all-features --config 'build.rustdocflags=["--cfg", "docs_rs"]' --open`.
2. Bump version specifier in `Cargo.toml`.
3. Update `CHANGELOG.md`: Convert `unreleased` section into version section with date and add new
`unreleased` section.
4. Run `cargo test --all-features` or `cargo nextest r --all-features`.
5. Run `cargo fmt` and `cargo clippy`.
6. Wait for CI/CD results for EGit and Github. These also check cross-compilation for bare-metal
targets.
# Release
1. `cargo publish`
# Post-Release
1. Create a new release on `EGit` based on the release branch.

View File

@ -14,6 +14,8 @@
//! [here](https://egit.irs.uni-stuttgart.de/rust/libcsp-rust/src/branch/main/examples/autoconfig.rs). //! [here](https://egit.irs.uni-stuttgart.de/rust/libcsp-rust/src/branch/main/examples/autoconfig.rs).
//! The user has to provide the path to a directory containing this `autoconfig.rs` file using the //! The user has to provide the path to a directory containing this `autoconfig.rs` file using the
//! `CSP_CONFIG_DIR` environmental variable. //! `CSP_CONFIG_DIR` environmental variable.
#![no_std]
#![cfg_attr(docs_rs, feature(doc_auto_cfg))]
#![allow(non_upper_case_globals)] #![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![allow(non_snake_case)] #![allow(non_snake_case)]
@ -549,8 +551,7 @@ pub mod hooks {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use core::mem::{align_of, size_of}; use core::mem::{align_of, size_of, MaybeUninit};
use std::mem::MaybeUninit;
#[test] #[test]
fn bindgen_test_layout_csp_timestamp_t() { fn bindgen_test_layout_csp_timestamp_t() {
@ -562,12 +563,12 @@ mod tests {
concat!("Size of: ", stringify!(csp_timestamp_t)) concat!("Size of: ", stringify!(csp_timestamp_t))
); );
assert_eq!( assert_eq!(
std::mem::align_of::<csp_timestamp_t>(), core::mem::align_of::<csp_timestamp_t>(),
4usize, 4usize,
concat!("Alignment of ", stringify!(csp_timestamp_t)) concat!("Alignment of ", stringify!(csp_timestamp_t))
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize }, unsafe { ::core::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize },
0usize, 0usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -577,7 +578,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize }, unsafe { ::core::ptr::addr_of!((*ptr).tv_nsec) as usize - ptr as usize },
4usize, 4usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -603,7 +604,7 @@ mod tests {
concat!("Alignment of ", stringify!(__packed)) concat!("Alignment of ", stringify!(__packed))
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).pri) as usize - ptr as usize }, unsafe { ::core::ptr::addr_of!((*ptr).pri) as usize - ptr as usize },
0usize, 0usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -613,7 +614,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).flags) as usize - ptr as usize },
1usize, 1usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -623,7 +624,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).src) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).src) as usize - ptr as usize },
2usize, 2usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -633,7 +634,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).dst) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).dst) as usize - ptr as usize },
4usize, 4usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -643,7 +644,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).dport) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).dport) as usize - ptr as usize },
6usize, 6usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -653,7 +654,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).sport) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).sport) as usize - ptr as usize },
7usize, 7usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -685,7 +686,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).rdp_quarantine) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).rdp_quarantine) as usize - ptr as usize },
0usize, 0usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -695,7 +696,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).timestamp_tx) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).timestamp_tx) as usize - ptr as usize },
4usize, 4usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -705,7 +706,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).timestamp_rx) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).timestamp_rx) as usize - ptr as usize },
8usize, 8usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -715,7 +716,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).conn) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).conn) as usize - ptr as usize },
16usize, 16usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -747,7 +748,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).rx_count) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).rx_count) as usize - ptr as usize },
0usize, 0usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -757,7 +758,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).remain) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).remain) as usize - ptr as usize },
2usize, 2usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -767,7 +768,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).cfpid) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).cfpid) as usize - ptr as usize },
4usize, 4usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -777,7 +778,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).last_used) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).last_used) as usize - ptr as usize },
8usize, 8usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -787,7 +788,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).frame_begin) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).frame_begin) as usize - ptr as usize },
16usize, 16usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -797,7 +798,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).frame_length) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).frame_length) as usize - ptr as usize },
24usize, 24usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -836,7 +837,7 @@ mod tests {
concat!("Alignment of ", stringify!(csp_packet_s__bindgen_ty_2)) concat!("Alignment of ", stringify!(csp_packet_s__bindgen_ty_2))
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).data) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize, 0usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -846,7 +847,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).data16) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).data16) as usize - ptr as usize },
0usize, 0usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -856,7 +857,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).data32) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).data32) as usize - ptr as usize },
0usize, 0usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -881,7 +882,7 @@ mod tests {
concat!("Alignment of ", stringify!(csp_packet_s)) concat!("Alignment of ", stringify!(csp_packet_s))
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).length) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).length) as usize - ptr as usize },
32usize, 32usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -891,7 +892,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).id) as usize - ptr as usize },
34usize, 34usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -901,7 +902,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).next) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).next) as usize - ptr as usize },
48usize, 48usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -911,7 +912,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).header) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).header) as usize - ptr as usize },
56usize, 56usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -924,20 +925,20 @@ mod tests {
#[test] #[test]
fn bindgen_test_layout_csp_socket_s() { fn bindgen_test_layout_csp_socket_s() {
const UNINIT: ::std::mem::MaybeUninit<csp_socket_s> = ::std::mem::MaybeUninit::uninit(); const UNINIT: core::mem::MaybeUninit<csp_socket_s> = core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr(); let ptr = UNINIT.as_ptr();
assert_eq!( assert_eq!(
::std::mem::size_of::<csp_socket_s>(), core::mem::size_of::<csp_socket_s>(),
152usize, 152usize,
concat!("Size of: ", stringify!(csp_socket_s)) concat!("Size of: ", stringify!(csp_socket_s))
); );
assert_eq!( assert_eq!(
::std::mem::align_of::<csp_socket_s>(), core::mem::align_of::<csp_socket_s>(),
8usize, 8usize,
concat!("Alignment of ", stringify!(csp_socket_s)) concat!("Alignment of ", stringify!(csp_socket_s))
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).rx_queue) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).rx_queue) as usize - ptr as usize },
0usize, 0usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -947,7 +948,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).rx_queue_static) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).rx_queue_static) as usize - ptr as usize },
8usize, 8usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -957,7 +958,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).rx_queue_static_data) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).rx_queue_static_data) as usize - ptr as usize },
16usize, 16usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",
@ -967,7 +968,7 @@ mod tests {
) )
); );
assert_eq!( assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).opts) as usize - ptr as usize }, unsafe { core::ptr::addr_of!((*ptr).opts) as usize - ptr as usize },
144usize, 144usize,
concat!( concat!(
"Offset of field: ", "Offset of field: ",

View File

@ -15,4 +15,4 @@ categories = ["aerospace", "external-ffi-bindings", "no-std", "hardware-support"
bitflags = "2" bitflags = "2"
num_enum = "0.7" num_enum = "0.7"
libc = "0.2" libc = "0.2"
libcsp-sys = { path = "../libcsp-sys" } libcsp-sys = { version = "0.1", path = "../libcsp-sys" }

View File

@ -0,0 +1,22 @@
Checklist for new releases
=======
# Pre-Release
1. Make sure any new modules are documented sufficiently enough and check docs with
`cargo +nightly doc --all-features --config 'build.rustdocflags=["--cfg", "docs_rs"]' --open`.
2. Bump version specifier in `Cargo.toml`.
3. Update `CHANGELOG.md`: Convert `unreleased` section into version section with date and add new
`unreleased` section.
4. Run `cargo test --all-features` or `cargo nextest r --all-features`.
5. Run `cargo fmt` and `cargo clippy`.
6. Wait for CI/CD results for EGit and Github. These also check cross-compilation for bare-metal
targets.
# Release
1. `cargo publish`
# Post-Release
1. Create a new release on `EGit` based on the release branch.