Skip to content

Commit 512c4ff

Browse files
committed
chore: disable tests via flag to streamline ide warnings
1 parent ec94f82 commit 512c4ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+220
-202
lines changed

fuzz/src/full_stack.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ pub extern "C" fn full_stack_run(data: *const u8, datalen: usize) {
812812
do_test(unsafe { std::slice::from_raw_parts(data, datalen) }, &logger);
813813
}
814814

815-
#[cfg(test)]
815+
#[cfg(test_force_enabled)]
816816
mod tests {
817817
use bitcoin::hashes::hex::FromHex;
818818
use lightning::util::logger::{Logger, Record};

fuzz/src/onion_message.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ impl SignerProvider for KeyProvider {
218218
fn get_shutdown_scriptpubkey(&self) -> Result<ShutdownScript, ()> { unreachable!() }
219219
}
220220

221-
#[cfg(test)]
221+
#[cfg(test_force_enabled)]
222222
mod tests {
223223
use bitcoin::hashes::hex::FromHex;
224224
use lightning::util::logger::{Logger, Record};

lightning-background-processor/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ rustdoc-args = ["--cfg", "docsrs"]
1717
futures = [ ]
1818
std = ["bitcoin/std", "lightning/std", "lightning-rapid-gossip-sync/std"]
1919
no-std = ["bitcoin/no-std", "lightning/no-std", "lightning-rapid-gossip-sync/no-std"]
20+
test_force_enabled = []
2021

2122
default = ["std"]
2223

lightning-background-processor/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,7 @@ impl Drop for BackgroundProcessor {
916916
self.stop_and_join_thread().unwrap();
917917
}
918918
}
919-
920-
#[cfg(all(feature = "std", test))]
919+
#[cfg(all(feature = "std", test_force_enabled))]
921920
mod tests {
922921
use bitcoin::{ScriptBuf, Txid};
923922
use bitcoin::blockdata::constants::{genesis_block, ChainHash};

lightning-block-sync/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ rustdoc-args = ["--cfg", "docsrs"]
1616
[features]
1717
rest-client = [ "serde_json", "chunked_transfer" ]
1818
rpc-client = [ "serde_json", "chunked_transfer" ]
19+
test_force_enabled = []
1920

2021
[dependencies]
2122
bitcoin = "0.30.2"

lightning-block-sync/src/convert.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ impl TryInto<GetUtxosResponse> for JsonResponse {
272272
}
273273
}
274274

275-
#[cfg(test)]
275+
#[cfg(test_force_enabled)]
276276
pub(crate) mod tests {
277277
use super::*;
278278
use bitcoin::blockdata::constants::genesis_block;

lightning-block-sync/src/http.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ impl TryFrom<Vec<u8>> for JsonResponse {
477477
}
478478
}
479479

480-
#[cfg(test)]
480+
#[cfg(test_force_enabled)]
481481
mod endpoint_tests {
482482
use super::HttpEndpoint;
483483

@@ -529,7 +529,7 @@ mod endpoint_tests {
529529
}
530530
}
531531

532-
#[cfg(test)]
532+
#[cfg(test_force_enabled)]
533533
pub(crate) mod client_tests {
534534
use super::*;
535535
use std::io::BufRead;

lightning-block-sync/src/init.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ struct ChainListenerSet<'a, L: chain::Listen + ?Sized>(Vec<(u32, &'a L)>);
225225

226226
impl<'a, L: chain::Listen + ?Sized> chain::Listen for ChainListenerSet<'a, L> {
227227
// Needed to differentiate test expectations.
228-
#[cfg(test)]
228+
#[cfg(test_force_enabled)]
229229
fn block_connected(&self, block: &bitcoin::Block, height: u32) {
230230
for (starting_height, chain_listener) in self.0.iter() {
231231
if height > *starting_height {
@@ -247,7 +247,7 @@ impl<'a, L: chain::Listen + ?Sized> chain::Listen for ChainListenerSet<'a, L> {
247247
}
248248
}
249249

250-
#[cfg(test)]
250+
#[cfg(test_force_enabled)]
251251
mod tests {
252252
use crate::test_utils::{Blockchain, MockChainListener};
253253
use super::*;

lightning-block-sync/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub mod rpc;
3838
#[cfg(any(feature = "rest-client", feature = "rpc-client"))]
3939
mod convert;
4040

41-
#[cfg(test)]
41+
#[cfg(test_force_enabled)]
4242
mod test_utils;
4343

4444
#[cfg(any(feature = "rest-client", feature = "rpc-client"))]
@@ -434,7 +434,7 @@ impl<'a, C: Cache, L: Deref> ChainNotifier<'a, C, L> where L::Target: chain::Lis
434434
}
435435
}
436436

437-
#[cfg(test)]
437+
#[cfg(test_force_enabled)]
438438
mod spv_client_tests {
439439
use crate::test_utils::{Blockchain, NullChainListener};
440440
use super::*;
@@ -561,7 +561,7 @@ mod spv_client_tests {
561561
}
562562
}
563563

564-
#[cfg(test)]
564+
#[cfg(test_force_enabled)]
565565
mod chain_notifier_tests {
566566
use crate::test_utils::{Blockchain, MockChainListener};
567567
use super::*;

lightning-block-sync/src/poll.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ impl<B: Deref<Target=T> + Sized + Send + Sync, T: BlockSource + ?Sized> Poll for
257257
}
258258
}
259259

260-
#[cfg(test)]
260+
#[cfg(test_force_enabled)]
261261
mod tests {
262262
use crate::*;
263263
use crate::test_utils::Blockchain;

lightning-block-sync/src/rest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl UtxoSource for RestClient {
8080
}
8181
}
8282

83-
#[cfg(test)]
83+
#[cfg(test_force_enabled)]
8484
mod tests {
8585
use super::*;
8686
use crate::http::BinaryResponse;

lightning-block-sync/src/rpc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl UtxoSource for RpcClient {
159159
}
160160
}
161161

162-
#[cfg(test)]
162+
#[cfg(test_force_enabled)]
163163
mod tests {
164164
use super::*;
165165
use crate::http::client_tests::{HttpServer, MessageBody};

lightning-block-sync/src/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub fn hex_to_work(hex: &str) -> Result<Work, bitcoin::hashes::hex::Error> {
66
Ok(Work::from_be_bytes(bytes))
77
}
88

9-
#[cfg(test)]
9+
#[cfg(test_force_enabled)]
1010
mod tests {
1111
use super::*;
1212
use bitcoin::pow::Work;

lightning-custom-message/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ rustdoc-args = ["--cfg", "docsrs"]
1616
[dependencies]
1717
bitcoin = "0.30.2"
1818
lightning = { version = "0.0.123", path = "../lightning" }
19+
20+
[features]
21+
test_force_enabled = []

lightning-invoice/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ rustdoc-args = ["--cfg", "docsrs"]
1818
default = ["std"]
1919
no-std = ["lightning/no-std"]
2020
std = ["bitcoin/std", "lightning/std", "bech32/std"]
21+
test_force_enabled = []
2122

2223
[dependencies]
2324
bech32 = { version = "0.9.0", default-features = false }

lightning-invoice/fuzz/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ cargo-fuzz = true
1111
[features]
1212
afl_fuzz = ["afl"]
1313
honggfuzz_fuzz = ["honggfuzz"]
14+
test_force_enabled = []
1415

1516
[dependencies]
1617
honggfuzz = { version = "0.5", optional = true, default-features = false }

lightning-invoice/fuzz/fuzz_targets/serde_data_part.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn main() {
4141
}
4242
}
4343

44-
#[cfg(test)]
44+
#[cfg(test_force_enabled)]
4545
mod tests {
4646
fn extend_vec_from_hex(hex: &str, out: &mut Vec<u8>) {
4747
let mut b = 0;

lightning-invoice/src/de.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ impl From<crate::Bolt11SemanticError> for ParseOrSemanticError {
760760
}
761761
}
762762

763-
#[cfg(test)]
763+
#[cfg(test_force_enabled)]
764764
mod test {
765765
use crate::de::Bolt11ParseError;
766766
use secp256k1::PublicKey;

lightning-invoice/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1807,7 +1807,7 @@ impl<'de> Deserialize<'de> for Bolt11Invoice {
18071807
}
18081808
}
18091809

1810-
#[cfg(test)]
1810+
#[cfg(test_force_enabled)]
18111811
mod test {
18121812
use bitcoin::ScriptBuf;
18131813
use bitcoin::hashes::sha256;

lightning-invoice/src/payment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn params_from_invoice(invoice: &Bolt11Invoice, amount_msat: u64)
8282
(payment_hash, recipient_onion, route_params)
8383
}
8484

85-
#[cfg(test)]
85+
#[cfg(test_force_enabled)]
8686
mod tests {
8787
use super::*;
8888
use crate::{InvoiceBuilder, Currency};

lightning-invoice/src/ser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ impl ToBase32 for Bolt11InvoiceSignature {
496496
}
497497
}
498498

499-
#[cfg(test)]
499+
#[cfg(test_force_enabled)]
500500
mod test {
501501
use bech32::CheckBase32;
502502

lightning-invoice/src/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ impl<'a, 'b, L: Deref> WithChannelDetails<'a, 'b, L> where L::Target: Logger {
826826
}
827827
}
828828

829-
#[cfg(test)]
829+
#[cfg(test_force_enabled)]
830830
mod test {
831831
use core::time::Duration;
832832
use crate::{Currency, Description, Bolt11InvoiceDescription, SignOrCreationError, CreationError};

lightning-invoice/tests/ser_de.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use secp256k1::ecdsa::{RecoverableSignature, RecoveryId};
1414
use std::collections::HashSet;
1515
use std::time::Duration;
1616
use std::str::FromStr;
17-
17+
#[cfg(test_force_enabled)]
1818
fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
1919
vec![
2020
(
@@ -381,6 +381,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
381381
]
382382
}
383383

384+
#[cfg(test_force_enabled)]
384385
#[test]
385386
fn invoice_deserialize() {
386387
for (serialized, deserialized, ignore_feature_diff, ignore_unknown_fields) in get_test_tuples() {

lightning-net-tokio/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ tokio = { version = "1.35", features = [ "rt", "sync", "net", "time" ] }
2222
[dev-dependencies]
2323
tokio = { version = "1.35", features = [ "macros", "rt", "rt-multi-thread", "sync", "net", "time" ] }
2424
lightning = { version = "0.0.123", path = "../lightning", features = ["_test_utils"] }
25+
26+
[features]
27+
test_force_enabled = []

lightning-net-tokio/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ pub fn setup_inbound<PM: Deref + 'static + Send + Sync + Clone>(
304304
where PM::Target: APeerManager<Descriptor = SocketDescriptor> {
305305
let remote_addr = get_addr_from_stream(&stream);
306306
let (reader, write_receiver, read_receiver, us) = Connection::new(stream);
307-
#[cfg(test)]
307+
#[cfg(test)]
308308
let last_us = Arc::clone(&us);
309309

310310
let handle_opt = if peer_manager.as_ref().new_inbound_connection(SocketDescriptor::new(us.clone()), remote_addr).is_ok() {
@@ -325,7 +325,7 @@ where PM::Target: APeerManager<Descriptor = SocketDescriptor> {
325325
// socket shutdown(). Still, as a check during testing, to make sure tokio doesn't
326326
// keep too many wakers around, this makes sense. The race should be rare (we do
327327
// some work after shutdown()) and an error would be a major memory leak.
328-
#[cfg(test)]
328+
#[cfg(test_force_enabled)]
329329
debug_assert!(Arc::try_unwrap(last_us).is_ok());
330330
}
331331
}
@@ -347,7 +347,7 @@ pub fn setup_outbound<PM: Deref + 'static + Send + Sync + Clone>(
347347
where PM::Target: APeerManager<Descriptor = SocketDescriptor> {
348348
let remote_addr = get_addr_from_stream(&stream);
349349
let (reader, mut write_receiver, read_receiver, us) = Connection::new(stream);
350-
#[cfg(test)]
350+
#[cfg(test)]
351351
let last_us = Arc::clone(&us);
352352
let handle_opt = if let Ok(initial_send) = peer_manager.as_ref().new_outbound_connection(their_node_id, SocketDescriptor::new(us.clone()), remote_addr) {
353353
Some(tokio::spawn(async move {
@@ -393,7 +393,7 @@ where PM::Target: APeerManager<Descriptor = SocketDescriptor> {
393393
// socket shutdown(). Still, as a check during testing, to make sure tokio doesn't
394394
// keep too many wakers around, this makes sense. The race should be rare (we do
395395
// some work after shutdown()) and an error would be a major memory leak.
396-
#[cfg(test)]
396+
#[cfg(test_force_enabled)]
397397
debug_assert!(Arc::try_unwrap(last_us).is_ok());
398398
}
399399
}
@@ -556,7 +556,7 @@ impl Hash for SocketDescriptor {
556556
}
557557
}
558558

559-
#[cfg(test)]
559+
#[cfg(test_force_enabled)]
560560
mod tests {
561561
use lightning::ln::features::*;
562562
use lightning::ln::msgs::*;

lightning-persister/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ criterion = { version = "0.4", optional = true, default-features = false }
2626
[dev-dependencies]
2727
lightning = { version = "0.0.123", path = "../lightning", features = ["_test_utils"] }
2828
bitcoin = { version = "0.30.2", default-features = false }
29+
30+
[features]
31+
test_force_enabled = []

lightning-persister/src/fs_store.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ impl KVStore for FilesystemStore {
364364
}
365365
}
366366

367-
#[cfg(test)]
367+
#[cfg(test_force_enabled)]
368368
mod tests {
369369
use super::*;
370370
use crate::test_utils::{do_read_write_remove_list_persist, do_test_store};

lightning-persister/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ pub mod fs_store;
1515

1616
mod utils;
1717

18-
#[cfg(test)]
18+
#[cfg(test_force_enabled)]
1919
mod test_utils;

lightning-rapid-gossip-sync/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Utility to process gossip routing data from Rapid Gossip Sync Server.
1313
default = ["std"]
1414
no-std = ["lightning/no-std"]
1515
std = ["lightning/std"]
16+
test_force_enabled = []
1617

1718
[dependencies]
1819
lightning = { version = "0.0.123", path = "../lightning", default-features = false }

lightning-rapid-gossip-sync/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ impl<NG: Deref<Target=NetworkGraph<L>>, L: Deref> RapidGossipSync<NG, L> where L
186186
}
187187

188188
#[cfg(feature = "std")]
189-
#[cfg(test)]
189+
#[cfg(test_force_enabled)]
190190
mod tests {
191191
use std::fs;
192192

lightning-rapid-gossip-sync/src/processing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ impl<NG: Deref<Target=NetworkGraph<L>>, L: Deref> RapidGossipSync<NG, L> where L
259259
}
260260
}
261261

262-
#[cfg(test)]
262+
#[cfg(test_force_enabled)]
263263
mod tests {
264264
use bitcoin::Network;
265265

lightning-transaction-sync/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ esplora-async-https = ["esplora-async", "esplora-client/async-https-rustls"]
2121
esplora-blocking = ["esplora-client/blocking"]
2222
electrum = ["electrum-client"]
2323
async-interface = []
24+
test_force_enabled = []
2425

2526
[dependencies]
2627
lightning = { version = "0.0.123", path = "../lightning", default-features = false, features = ["std"] }

lightning/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ features = ["std"]
1616
rustdoc-args = ["--cfg", "docsrs"]
1717

1818
[features]
19+
test_force_enabled = []
20+
1921
# Internal test utilities exposed to other repo crates
2022
_test_utils = ["regex", "bitcoin/bitcoinconsensus"]
2123
# Unlog messages superior at targeted level.

lightning/src/blinded_path/payment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ impl_writeable_tlv_based!(Bolt12OfferContext, {
421421

422422
impl_writeable_tlv_based!(Bolt12RefundContext, {});
423423

424-
#[cfg(test)]
424+
#[cfg(test_force_enabled)]
425425
mod tests {
426426
use bitcoin::secp256k1::PublicKey;
427427
use crate::blinded_path::payment::{ForwardNode, ForwardTlvs, ReceiveTlvs, PaymentConstraints, PaymentContext, PaymentRelay};

lightning/src/chain/chaininterface.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl<F: Deref> LowerBoundedFeeEstimator<F> where F::Target: FeeEstimator {
191191
}
192192
}
193193

194-
#[cfg(test)]
194+
#[cfg(test_force_enabled)]
195195
mod tests {
196196
use super::{FEERATE_FLOOR_SATS_PER_KW, LowerBoundedFeeEstimator, ConfirmationTarget, FeeEstimator};
197197

lightning/src/chain/chainmonitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner, C: Deref, T: Deref, F: Deref, L
980980
}
981981
}
982982

983-
#[cfg(test)]
983+
#[cfg(test_force_enabled)]
984984
mod tests {
985985
use crate::check_added_monitors;
986986
use crate::{expect_payment_claimed, expect_payment_path_successful, get_event_msg};

0 commit comments

Comments
 (0)