Currently when running kernel tests using cargo build-all --tests dev dependencies are not included into the build. Dev dependencies are useful for separating out dependencies which are exclusively used for testing so that they are not included in non-test builds.
Current Behavior
Dev dependencies are not included in the test build generated from running cargo build-all --tests.
Expected Behavior
Dev dependencies should be included in the test build generated from cargo build-all --tests.
Example Cargo.toml & test module from src/kernel/src/crypto.rs
mod test {
use hex_literal::hex;
use twizzler_kernel_macros::kernel_test;
use super::*;
#[kernel_test]
fn test_hashing() {
let expected = hex!("09ca7e4eaa6e8ae9c7d261167129184883644d07dfba7cbfbc4c8a2e08360d5b");
let hash = sha256(b"hello, world");
assert_eq!(hash[..], expected);
}
}
Currently the line [dev-dependencies] is commented out within the kernel's Cargo.toml file. Ideally hex-literal would be a dev dependency as it is only used in the test_hashing test harness to provide the hex! macro. To test that this issue is resolved, uncommenting the [dev-dependencies] line which is right above hex-literal shouldn't break either the test compilation (cargo build-all --tests) of a normal cargo build-all. Note that currently all builds of the kernel with the dev-dependency line uncommented returns a build error if hex-literal is a dev dependency:
error[E0432]: unresolved import `hex_literal`
--> src/kernel/src/crypto.rs:35:9
|
35 | use hex_literal::hex;
| ^^^^^^^^^^^ use of undeclared crate or module `hex_literal`
Currently when running kernel tests using
cargo build-all --tests
dev dependencies are not included into the build. Dev dependencies are useful for separating out dependencies which are exclusively used for testing so that they are not included in non-test builds.Current Behavior
Dev dependencies are not included in the test build generated from running
cargo build-all --tests
.Expected Behavior
Dev dependencies should be included in the test build generated from
cargo build-all --tests
.Example
Cargo.toml
& test module fromsrc/kernel/src/crypto.rs
Currently the line
[dev-dependencies]
is commented out within the kernel'sCargo.toml
file. Ideally hex-literal would be a dev dependency as it is only used in thetest_hashing
test harness to provide thehex!
macro. To test that this issue is resolved, uncommenting the[dev-dependencies]
line which is right abovehex-literal
shouldn't break either the test compilation (cargo build-all --tests
) of a normalcargo build-all
. Note that currently all builds of the kernel with the dev-dependency line uncommented returns a build error ifhex-literal
is a dev dependency: