Skip to content

Commit 374801c

Browse files
committed
Reënable debug-level print statements for unit tests.
1 parent 4c67aa9 commit 374801c

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

ci/LDKSwift/Tests/LDKSwiftTests/LDKSwiftTest.swift

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class LDKSwiftTest: XCTestCase {
1313

1414
override func setUpWithError() throws {
1515
// Put setup code here. This method is called before the invocation of each test method in the class.
16+
Bindings.setLogThreshold(severity: .DEBUG)
1617
}
1718

1819
override func tearDownWithError() throws {
@@ -30,7 +31,7 @@ class LDKSwiftTest: XCTestCase {
3031
check_platform()
3132
}
3233

33-
func testIncrementalMemoryLeaks() throws {
34+
private func incrementalMemoryLeakTest() throws {
3435
let filter = TestFilter()
3536
let broadcaster = TestBroadcasterInterface()
3637
let logger = TestLogger()
@@ -53,10 +54,6 @@ class LDKSwiftTest: XCTestCase {
5354
let serializedChannelMonitors: [[UInt8]] = LDKTestFixtures.serializedChannelMonitors
5455

5556
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")
6057

6158
let channel_manager_constructor = try ChannelManagerConstructor(
6259
channel_manager_serialized: serialized_channel_manager,
@@ -77,9 +74,11 @@ class LDKSwiftTest: XCTestCase {
7774
channel_manager_constructor.interrupt()
7875
}
7976

77+
func testMemoryLeaksIncrementally() throws {
78+
try incrementalMemoryLeakTest()
79+
}
8080

81-
82-
func testExtendedActivity() {
81+
func testExtendedActivity() throws {
8382
// for i in 0...(1 << 7) {
8483
for i in 0..<1 { // only do one test run initially
8584
let nice_close = (i & (1 << 0)) != 0;
@@ -101,17 +100,9 @@ class LDKSwiftTest: XCTestCase {
101100
}
102101

103102
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)
105104
}
106105

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-
115106
}
116107

117108
fileprivate class SimulationRunner {
@@ -132,13 +123,14 @@ class LDKSwiftTest: XCTestCase {
132123

133124
}
134125

135-
136126
func testPerformanceExample() throws {
137127
// This is an example of a performance test case.
128+
Bindings.setLogThreshold(severity: .WARNING)
138129
measure {
139130
// Put the code you want to measure the time of here.
131+
// try! incrementalMemoryLeakTest()
140132
}
133+
Bindings.setLogThreshold(severity: .DEBUG)
141134
}
142135

143-
144136
}

0 commit comments

Comments
 (0)