buildRustPackage: Add cargoTestFlags
This makes it possible to pass flags to `cargo test`, which is needed if a crate is compiled with custom feature flags.
This commit is contained in:
parent
fa62f37160
commit
ebe3ae4d4d
|
@ -193,6 +193,13 @@ rustPlatform.buildRustPackage {
|
||||||
Please note that the code will be compiled twice here: once in `release` mode
|
Please note that the code will be compiled twice here: once in `release` mode
|
||||||
for the `buildPhase`, and again in `debug` mode for the `checkPhase`.
|
for the `buildPhase`, and again in `debug` mode for the `checkPhase`.
|
||||||
|
|
||||||
|
Test flags, e.g., `--features xxx/yyy`, can be passed to `cargo test` via the
|
||||||
|
`cargoTestFlags` attribute.
|
||||||
|
|
||||||
|
Another attribute, called `checkFlags`, is used to pass arguments to the test
|
||||||
|
binary itself, as stated
|
||||||
|
(here)[https://doc.rust-lang.org/cargo/commands/cargo-test.html].
|
||||||
|
|
||||||
#### Tests relying on the structure of the `target/` directory
|
#### Tests relying on the structure of the `target/` directory
|
||||||
|
|
||||||
Some tests may rely on the structure of the `target/` directory. Those tests
|
Some tests may rely on the structure of the `target/` directory. Those tests
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
declare -a checkFlags
|
declare -a checkFlags
|
||||||
|
declare -a cargoTestFlags
|
||||||
|
|
||||||
cargoCheckHook() {
|
cargoCheckHook() {
|
||||||
echo "Executing cargoCheckHook"
|
echo "Executing cargoCheckHook"
|
||||||
|
@ -15,7 +16,7 @@ cargoCheckHook() {
|
||||||
threads=1
|
threads=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
argstr="--${cargoCheckType} --target @rustTargetPlatformSpec@ --frozen";
|
argstr="--${cargoCheckType} --target @rustTargetPlatformSpec@ --frozen ${cargoTestFlags}";
|
||||||
|
|
||||||
(
|
(
|
||||||
set -x
|
set -x
|
||||||
|
|
Loading…
Reference in a new issue