@@ -13,6 +13,7 @@ class LDKSwiftTest: XCTestCase {
13
13
14
14
override func setUpWithError( ) throws {
15
15
// Put setup code here. This method is called before the invocation of each test method in the class.
16
+ Bindings . setLogThreshold ( severity: . DEBUG)
16
17
}
17
18
18
19
override func tearDownWithError( ) throws {
@@ -30,7 +31,7 @@ class LDKSwiftTest: XCTestCase {
30
31
check_platform ( )
31
32
}
32
33
33
- func testIncrementalMemoryLeaks ( ) throws {
34
+ private func incrementalMemoryLeakTest ( ) throws {
34
35
let filter = TestFilter ( )
35
36
let broadcaster = TestBroadcasterInterface ( )
36
37
let logger = TestLogger ( )
@@ -53,10 +54,6 @@ class LDKSwiftTest: XCTestCase {
53
54
let serializedChannelMonitors : [ [ UInt8 ] ] = LDKTestFixtures . serializedChannelMonitors
54
55
55
56
var monitors : [ LDKChannelMonitor ] = [ ]
56
- // let secondConfig = config.clone()
57
- // let res = UtilMethods.constructor_BlockHashChannelManagerZ_read(ser: serialized_channel_manager, arg_keys_manager: keysInterface, arg_fee_estimator: feeEstimator, arg_chain_monitor: chainMonitor.as_Watch(), arg_tx_broadcaster: broadcaster, arg_logger: logger, arg_default_config: config, arg_channel_monitors: monitors)
58
-
59
- print ( " last statement in memory leak test " )
60
57
61
58
let channel_manager_constructor = try ChannelManagerConstructor (
62
59
channel_manager_serialized: serialized_channel_manager,
@@ -77,9 +74,11 @@ class LDKSwiftTest: XCTestCase {
77
74
channel_manager_constructor. interrupt ( )
78
75
}
79
76
77
+ func testMemoryLeaksIncrementally( ) throws {
78
+ try incrementalMemoryLeakTest ( )
79
+ }
80
80
81
-
82
- func testExtendedActivity( ) {
81
+ func testExtendedActivity( ) throws {
83
82
// for i in 0...(1 << 7) {
84
83
for i in 0 ..< 1 { // only do one test run initially
85
84
let nice_close = ( i & ( 1 << 0 ) ) != 0 ;
@@ -101,17 +100,9 @@ class LDKSwiftTest: XCTestCase {
101
100
}
102
101
103
102
print ( " Running test with flags \( i) " ) ;
104
- try ? SimulationRunner . do_test ( nice_close: nice_close, use_km_wrapper: use_km_wrapper, use_manual_watch: use_manual_watch, reload_peers: reload_peers, break_cross_peer_refs: break_cross_refs, nio_peer_handler: nio_peer_handler, use_chan_manager_constructor: use_chan_manager_constructor)
103
+ try SimulationRunner . do_test ( nice_close: nice_close, use_km_wrapper: use_km_wrapper, use_manual_watch: use_manual_watch, reload_peers: reload_peers, break_cross_peer_refs: break_cross_refs, nio_peer_handler: nio_peer_handler, use_chan_manager_constructor: use_chan_manager_constructor)
105
104
}
106
105
107
- // avoid early termination
108
- /*
109
- print("Press enter to stop running test.")
110
- let keyboard = FileHandle.standardInput
111
- let inputData = keyboard.availableData
112
- let strData = String(data: inputData, encoding: String.Encoding.utf8)!
113
- */
114
-
115
106
}
116
107
117
108
fileprivate class SimulationRunner {
@@ -132,13 +123,14 @@ class LDKSwiftTest: XCTestCase {
132
123
133
124
}
134
125
135
-
136
126
func testPerformanceExample( ) throws {
137
127
// This is an example of a performance test case.
128
+ Bindings . setLogThreshold ( severity: . WARNING)
138
129
measure {
139
130
// Put the code you want to measure the time of here.
131
+ // try! incrementalMemoryLeakTest()
140
132
}
133
+ Bindings . setLogThreshold ( severity: . DEBUG)
141
134
}
142
135
143
-
144
136
}
0 commit comments