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 1
1
language : rust
2
2
rust :
3
3
- stable
4
- - beta
4
+ - nightly
5
5
- 1.22.0
6
6
- 1.34.2
7
7
cache : cargo
@@ -22,6 +22,14 @@ script:
22
22
- if [ "$(rustup show | grep default | grep 1.22.0)" != "" ]; then RUSTFLAGS="-C link-dead-code" cargo test --verbose -p lightning; fi
23
23
# Run lightning workspace fuzz tests for Rust 1.34.2
24
24
- 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 mutagen --features mutation_testing; fi
32
+ # Generate codecov on stable
25
33
- if [ "$(rustup show | grep default | grep stable)" != "" ]; then
26
34
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz &&
27
35
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
13
13
[features ]
14
14
# Supports tracking channels with a non-bitcoin chain hashes. Currently enables all kinds of fun DoS attacks.
15
15
non_bitcoin_chain_hash_routing = []
16
- fuzztarget = [" secp256k1/fuzztarget" , " bitcoin/fuzztarget" , " bitcoin_hashes/fuzztarget" ]
17
16
# Unlog messages superior at targeted level.
18
17
max_level_off = []
19
18
max_level_error = []
20
19
max_level_warn = []
21
20
max_level_info = []
22
21
max_level_debug = []
23
22
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
+
24
27
[dependencies ]
25
28
bitcoin = " 0.21"
26
29
bitcoin_hashes = " 0.7"
27
30
secp256k1 = " 0.15"
31
+ mutagen = { git = " https://github.com/TheBlueMatt/mutagen" , optional = true }
28
32
29
33
[dev-dependencies .bitcoin ]
30
34
version = " 0.21"
Original file line number Diff line number Diff line change @@ -23,8 +23,15 @@ extern crate bitcoin_hashes;
23
23
extern crate secp256k1;
24
24
#[ cfg( test) ] extern crate rand;
25
25
#[ cfg( test) ] extern crate hex;
26
+ #[ cfg( all( test, feature = "mutation_testing" ) ) ] extern crate mutagen;
26
27
27
28
#[ macro_use]
28
29
pub mod util;
29
30
pub mod chain;
30
31
pub 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;
36
36
use std:: { cmp, mem, fmt} ;
37
37
use std:: sync:: { Arc } ;
38
38
39
+ #[ cfg( all( test, feature = "mutation_testing" ) ) ]
40
+ use mutagen:: mutate;
41
+
39
42
#[ cfg( test) ]
40
43
pub struct ChannelValueStat {
41
44
pub value_to_self_msat : u64 ,
@@ -2369,6 +2372,7 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
2369
2372
Ok ( ( ) )
2370
2373
}
2371
2374
2375
+ #[ cfg_attr( all( test, feature = "mutation_testing" ) , mutate) ]
2372
2376
fn get_last_revoke_and_ack ( & self ) -> msgs:: RevokeAndACK {
2373
2377
let next_per_commitment_point = PublicKey :: from_secret_key ( & self . secp_ctx , & self . build_local_commitment_secret ( self . cur_local_commitment_transaction_number ) ) ;
2374
2378
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