Move fuzzing code out of utils

This commit is contained in:
Sebastian Geisler 2018-12-03 16:31:13 -08:00
parent 944c840460
commit 79a88e1612
8 changed files with 11 additions and 7 deletions

View File

@ -38,7 +38,7 @@ use util::hash::Hash160;
#[cfg(feature="bitcoinconsensus")] use std::convert; #[cfg(feature="bitcoinconsensus")] use std::convert;
#[cfg(feature="bitcoinconsensus")] use util::hash::Sha256dHash; #[cfg(feature="bitcoinconsensus")] use util::hash::Sha256dHash;
#[cfg(feature="fuzztarget")] use util::sha2::Sha256; #[cfg(feature="fuzztarget")] use fuzz_util::sha2::Sha256;
#[cfg(not(feature="fuzztarget"))] use crypto::sha2::Sha256; #[cfg(not(feature="fuzztarget"))] use crypto::sha2::Sha256;
#[derive(Clone, Default, PartialOrd, Ord, PartialEq, Eq, Hash)] #[derive(Clone, Default, PartialOrd, Ord, PartialEq, Eq, Hash)]

4
src/fuzz_util/mod.rs Normal file
View File

@ -0,0 +1,4 @@
//! This module contains all mocks that are used for fuzz testing. Never use anything from this
//! module in production.
pub mod sha2;

View File

@ -80,3 +80,6 @@ pub use util::hash::BitcoinHash;
pub use util::privkey::Privkey; pub use util::privkey::Privkey;
pub use util::decimal::Decimal; pub use util::decimal::Decimal;
pub use util::decimal::UDecimal; pub use util::decimal::UDecimal;
#[cfg(feature = "fuzztarget")]
pub mod fuzz_util;

View File

@ -33,7 +33,7 @@ use secp256k1::{self, Secp256k1};
use network::constants::Network; use network::constants::Network;
use util::base58; use util::base58;
#[cfg(feature="fuzztarget")] use util::sha2::{Sha256, Sha512}; #[cfg(feature="fuzztarget")] use fuzz_util::sha2::{Sha256, Sha512};
#[cfg(not(feature="fuzztarget"))] use crypto::sha2::{Sha256, Sha512}; #[cfg(not(feature="fuzztarget"))] use crypto::sha2::{Sha256, Sha512};
/// A chain code /// A chain code

View File

@ -29,7 +29,7 @@ use std::{error, fmt};
use network::constants::Network; use network::constants::Network;
use util::{address, hash}; use util::{address, hash};
#[cfg(feature="fuzztarget")] use util::sha2; #[cfg(feature="fuzztarget")] use fuzz_util::sha2;
#[cfg(not(feature="fuzztarget"))] use crypto::sha2; #[cfg(not(feature="fuzztarget"))] use crypto::sha2;
/// Encoding of "pubkey here" in script; from bitcoin core `src/script/script.h` /// Encoding of "pubkey here" in script; from bitcoin core `src/script/script.h`

View File

@ -30,7 +30,7 @@ use crypto::ripemd160::Ripemd160;
use consensus::encode::{Encodable, Decodable}; use consensus::encode::{Encodable, Decodable};
use util::uint::Uint256; use util::uint::Uint256;
#[cfg(feature="fuzztarget")] use util::sha2::Sha256; #[cfg(feature="fuzztarget")] use fuzz_util::sha2::Sha256;
#[cfg(not(feature="fuzztarget"))] use crypto::sha2::Sha256; #[cfg(not(feature="fuzztarget"))] use crypto::sha2::Sha256;
use std::str::FromStr; use std::str::FromStr;

View File

@ -28,9 +28,6 @@ pub mod iter;
pub mod misc; pub mod misc;
pub mod uint; pub mod uint;
#[cfg(feature = "fuzztarget")]
pub mod sha2;
use std::{error, fmt}; use std::{error, fmt};
use secp256k1; use secp256k1;