From 508332feaf99ada12037c3a7fa77eab8516bb69e Mon Sep 17 00:00:00 2001 From: Isis Lovecruft Date: Mon, 18 Jun 2018 18:57:38 +0000 Subject: rust: Add "test-c-from-rust" feature-gate. Due to linker issues (#25386) when testing Rust code which calls C, all tests which touch FFI code should now be feature-gated behind the "test-c-from-rust" flag. To run this test code, cargo must be called with `cargo test --features="test-c-from-rust"`. * FIXES #26398: https://bugs.torproject.org/26398 --- src/rust/crypto/digests/sha2.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/rust/crypto/digests/sha2.rs') diff --git a/src/rust/crypto/digests/sha2.rs b/src/rust/crypto/digests/sha2.rs index 1cbb6c581e..bb610ed9e2 100644 --- a/src/rust/crypto/digests/sha2.rs +++ b/src/rust/crypto/digests/sha2.rs @@ -165,15 +165,19 @@ impl FixedOutput for Sha512 { #[cfg(test)] mod test { + #[cfg(feature = "test-c-from-rust")] use digest::Digest; + #[cfg(feature = "test-c-from-rust")] use super::*; + #[cfg(feature = "test-c-from-rust")] #[test] fn sha256_default() { let _: Sha256 = Sha256::default(); } + #[cfg(feature = "test-c-from-rust")] #[test] fn sha256_digest() { let mut h: Sha256 = Sha256::new(); @@ -190,11 +194,13 @@ mod test { assert_eq!(&result[..], &b"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"[..]); } + #[cfg(feature = "test-c-from-rust")] #[test] fn sha512_default() { let _: Sha512 = Sha512::default(); } + #[cfg(feature = "test-c-from-rust")] #[test] fn sha512_digest() { let mut h: Sha512 = Sha512::new(); -- cgit v1.2.3-54-g00ecf