Without this change, if `testsuite/src/lib.rs` will be crated and `cargo
test` is invoked, cargo will try to link libtest with the crate.
As this crate is `no_std` and will usually be run for targets, where no
std library exists and therefor also no libtest, this will fail with an
error similar to this:
error[E0463]: can't find crate for `test`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0463`.
error: could not compile `testsuite`
To circumvent this issue, disable the harness for lib as well.
Because the crates lib.rs is handled as a binary for test mode,
rust will look for a main function.
Add a minimal lib.rs, so that it will compile and run, when
test is invoked.
40 lines
707 B
TOML
40 lines
707 B
TOML
[package]
|
|
# TODO(1) fix `authors` if you didn't use `cargo-generate`
|
|
authors = ["{{authors}}"]
|
|
name = "testsuite"
|
|
publish = false
|
|
edition = "2018"
|
|
version = "0.1.0"
|
|
|
|
[lib]
|
|
harness = false
|
|
|
|
[[test]]
|
|
name = "test"
|
|
harness = false
|
|
|
|
[dependencies]
|
|
{{project-name}} = { path = ".." }
|
|
cortex-m = "0.7.1"
|
|
cortex-m-rt = "0.6.12"
|
|
defmt = "0.2.0"
|
|
defmt-rtt = "0.2.0"
|
|
defmt-test = "0.2.0"
|
|
panic-probe = { version = "0.2.0", features = ["print-defmt"] }
|
|
|
|
[features]
|
|
# set logging levels here
|
|
default = [
|
|
# in tests, enable all logs
|
|
"defmt-trace",
|
|
# "dependency-a/defmt-trace",
|
|
]
|
|
|
|
# do NOT modify these features
|
|
defmt-default = []
|
|
defmt-trace = []
|
|
defmt-debug = []
|
|
defmt-info = []
|
|
defmt-warn = []
|
|
defmt-error = []
|