File tree Expand file tree Collapse file tree 4 files changed +25
-2
lines changed Expand file tree Collapse file tree 4 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 11language : rust
22rust :
33 - stable
4- - beta
4+ - nightly
55 - 1.22.0
66 - 1.34.2
77cache : cargo
@@ -22,6 +22,14 @@ script:
2222 - if [ "$(rustup show | grep default | grep 1.22.0)" != "" ]; then RUSTFLAGS="-C link-dead-code" cargo test --verbose -p lightning; fi
2323 # Run lightning workspace fuzz tests for Rust 1.34.2
2424 - if [ "$(rustup show | grep default | grep 1.34.2)" != "" ]; then cd fuzz && cargo test --verbose && ./travis-fuzz.sh; fi
25+ # Run mutagen on nightly with TheBlueMatt's fork which exits with non-0 status
26+ # if any mutations resulted in anything except test failures to prevent regressions.
27+ - if [ "$(rustup show | grep default | grep nightly)" != "" ]; then
28+ rm -rf mutagen && git clone https://github.com/TheBlueMatt/mutagen &&
29+ cargo install --force --path mutagen/mutagen-runner &&
30+ cd lightning &&
31+ ~/.cargo/bin/cargo-mutagen --features mutation_testing; fi
32+ # Generate codecov on stable
2533 - if [ "$(rustup show | grep default | grep stable)" != "" ]; then
2634 wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz &&
2735 tar xzf master.tar.gz &&
Original file line number Diff line number Diff line change @@ -13,18 +13,22 @@ Still missing tons of error-handling. See GitHub issues for suggested projects i
1313[features ]
1414# Supports tracking channels with a non-bitcoin chain hashes. Currently enables all kinds of fun DoS attacks.
1515non_bitcoin_chain_hash_routing = []
16- fuzztarget = [" secp256k1/fuzztarget" , " bitcoin/fuzztarget" , " bitcoin_hashes/fuzztarget" ]
1716# Unlog messages superior at targeted level.
1817max_level_off = []
1918max_level_error = []
2019max_level_warn = []
2120max_level_info = []
2221max_level_debug = []
2322
23+ # Testing only features, don't enable these unless you want to run rust-lightning tests!
24+ fuzztarget = [" secp256k1/fuzztarget" , " bitcoin/fuzztarget" , " bitcoin_hashes/fuzztarget" ]
25+ mutation_testing = [" mutagen" ]
26+
2427[dependencies ]
2528bitcoin = " 0.21"
2629bitcoin_hashes = " 0.7"
2730secp256k1 = " 0.15"
31+ mutagen = { git = " https://github.com/TheBlueMatt/mutagen" , optional = true }
2832
2933[dev-dependencies .bitcoin ]
3034version = " 0.21"
Original file line number Diff line number Diff line change @@ -23,8 +23,15 @@ extern crate bitcoin_hashes;
2323extern crate secp256k1;
2424#[ cfg( test) ] extern crate rand;
2525#[ cfg( test) ] extern crate hex;
26+ #[ cfg( all( test, feature = "mutation_testing" ) ) ] extern crate mutagen;
2627
2728#[ macro_use]
2829pub mod util;
2930pub mod chain;
3031pub mod ln;
32+
33+ #[ cfg( all(
34+ any( feature = "mutation_testing" , feature = "fuzztarget" ) ,
35+ not( any( test, debug_assertions) )
36+ ) ) ]
37+ const ERR : ( ) = "You should never be building with feature = mutation_testing or feature = fuzztarget! They are used to compile with broken code for testing only!" ;
Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ use std::default::Default;
3636use std:: { cmp, mem, fmt} ;
3737use std:: sync:: { Arc } ;
3838
39+ #[ cfg( all( test, feature = "mutation_testing" ) ) ]
40+ use mutagen:: mutate;
41+
3942#[ cfg( test) ]
4043pub struct ChannelValueStat {
4144 pub value_to_self_msat : u64 ,
@@ -2369,6 +2372,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
23692372 Ok ( ( ) )
23702373 }
23712374
2375+ #[ cfg_attr( all( test, feature = "mutation_testing" ) , mutate) ]
23722376 fn get_last_revoke_and_ack ( & self ) -> msgs:: RevokeAndACK {
23732377 let next_per_commitment_point = PublicKey :: from_secret_key ( & self . secp_ctx , & self . build_local_commitment_secret ( self . cur_local_commitment_transaction_number ) ) ;
23742378 let per_commitment_secret = chan_utils:: build_commitment_secret ( self . local_keys . commitment_seed ( ) , self . cur_local_commitment_transaction_number + 2 ) ;
You can’t perform that action at this time.
0 commit comments