mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-09 03:17:55 +00:00
testing: add a fake_crypto feature
This commit is contained in:
19
eth2/utils/bls/build.rs
Normal file
19
eth2/utils/bls/build.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
// This build script is symlinked from each project that requires BLS's "fake crypto",
|
||||
// so that the `fake_crypto` feature of every sub-crate can be turned on by running
|
||||
// with FAKE_CRYPTO=1 from the top-level workspace.
|
||||
// At some point in the future it might be possible to do:
|
||||
// $ cargo test --all --release --features fake_crypto
|
||||
// but at the present time this doesn't work.
|
||||
// Related: https://github.com/rust-lang/cargo/issues/5364
|
||||
fn main() {
|
||||
if let Ok(fake_crypto) = std::env::var("FAKE_CRYPTO") {
|
||||
if fake_crypto == "1" {
|
||||
println!("cargo:rustc-cfg=feature=\"fake_crypto\"");
|
||||
println!("cargo:rerun-if-env-changed=FAKE_CRYPTO");
|
||||
println!(
|
||||
"cargo:warning=[{}]: Compiled with fake BLS cryptography. DO NOT USE, TESTING ONLY",
|
||||
std::env::var("CARGO_PKG_NAME").unwrap()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user