You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All examples in documentation should be built by scripts/build.sh, but that currently does cargo build only, not cargo test.
cargo test needs the test crate, which isn't available on Cortex-M. Which means we need to compile the tests on the host machine, which is fine, since we don't need to run them. The problem is, the target is set in .cargo/config, and there's no way (as far as I can tell) to say "ignore that, I want the target to be the host".
This leaves us with several options, none of which are ideal:
Not set the target in .cargo/config. This means we'll have to pass --target=thumbv6m-none-eabi to everything. This would suck, as I'm doing a lot of cargo run --example during development.
Override the target by passing --target to cargo test. We could just pass x86_64-unknown-linux-gnu, which would be good enough for me and for CI, but not for the general case.
Auto-detect target in build.rs and pass that via --target to cargo test. Maybe we can write the target triple into a file in target/, and read that in scripts/build.sh.
Write a Rust program that prints the current target (using build.rs, as in the linked Stack Overflow answer), cargo install that in scripts/build.sh. Maybe something like that even exists?
Run rustdoc --test src/lib.rs directly. That doesn't require the test crate (I think), but we need to pass it all the info that Cargo would otherwise take care of.
hannobraun
changed the title
CI doens't run examples in documentation
CI doens't compile examples in documentation
Mar 19, 2020
hannobraun
changed the title
CI doens't compile examples in documentation
CI doesn't build examples in documentation
Mar 19, 2020
All examples in documentation should be built by
scripts/build.sh
, but that currently doescargo build
only, notcargo test
.cargo test
needs thetest
crate, which isn't available on Cortex-M. Which means we need to compile the tests on the host machine, which is fine, since we don't need to run them. The problem is, the target is set in.cargo/config
, and there's no way (as far as I can tell) to say "ignore that, I want the target to be the host".This leaves us with several options, none of which are ideal:
.cargo/config
. This means we'll have to pass--target=thumbv6m-none-eabi
to everything. This would suck, as I'm doing a lot ofcargo run --example
during development.--target
tocargo test
. We could just passx86_64-unknown-linux-gnu
, which would be good enough for me and for CI, but not for the general case.build.rs
and pass that via--target
tocargo test
. Maybe we can write the target triple into a file intarget/
, and read that inscripts/build.sh
.build.rs
, as in the linked Stack Overflow answer),cargo install
that inscripts/build.sh
. Maybe something like that even exists?cargo build
andcargo test
? rust-lang/cargo#6784 and use that new capability once it's released.The text was updated successfully, but these errors were encountered: