@@ -3,7 +3,9 @@ fn main() {
33}
44
55#[ cfg( test) ]
6+ #[ allow( unused) ]
67mod tests {
8+ use lightning:: ln:: functional_tests:: * ;
79 use lightning:: util:: dyn_signer:: { DynKeysInterfaceTrait , DynSigner } ;
810 use lightning:: util:: test_utils:: { TestSignerFactory , SIGNER_FACTORY } ;
911 use std:: panic:: catch_unwind;
@@ -20,12 +22,40 @@ mod tests {
2022 }
2123 }
2224
25+ #[ cfg( feature = "test-broken" ) ]
2326 #[ test]
24- fn test_functional ( ) {
25- lightning:: ln:: functional_tests:: test_insane_channel_opens ( ) ;
26- lightning:: ln:: functional_tests:: fake_network_test ( ) ;
27-
27+ fn test_broken ( ) {
2828 SIGNER_FACTORY . set ( Arc :: new ( BrokenSignerFactory ( ) ) ) ;
29- catch_unwind ( || lightning:: ln:: functional_tests:: fake_network_test ( ) ) . unwrap_err ( ) ;
29+ catch_unwind ( || fake_network_test ( ) ) . unwrap_err ( ) ;
30+ }
31+
32+ #[ cfg( not( feature = "test-broken" ) ) ]
33+ #[ test]
34+ fn test_default_one ( ) {
35+ test_htlc_on_chain_success ( ) ;
36+ }
37+
38+ #[ cfg( not( feature = "test-broken" ) ) ]
39+ #[ test]
40+ fn test_default_all ( ) {
41+ let mut failed_tests = Vec :: new ( ) ;
42+ for test in lightning:: get_xtests ( ) {
43+ print ! ( "Running test: {}" , test. test_name) ;
44+ let mut pass = catch_unwind ( || ( test. test_fn ) ( ) ) . is_ok ( ) ;
45+ if test. should_panic {
46+ pass = !pass;
47+ }
48+ if !pass {
49+ failed_tests. push ( test. test_name ) ;
50+ }
51+ }
52+ if !failed_tests. is_empty ( ) {
53+ println ! ( "Failed tests:" ) ;
54+ for test in failed_tests. iter ( ) {
55+ println ! ( "- {}" , test) ;
56+ }
57+ }
58+ println ! ( "Done with {} failures" , failed_tests. len( ) ) ;
59+ assert ! ( failed_tests. is_empty( ) ) ;
3060 }
3161}
0 commit comments