X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Ftest%2Ftests.mts;h=b72703e7bc5727bc59b714a5f5941300d0ffb7f9;hb=cf5dbd06f37b9e98d391a93e9b9299aed0c95995;hp=bbf2c8d111bf4ec197d18d23bcd804a54096ede1;hpb=6ec1feeafbf54048d547268cd93c23f7db6dd67e;p=ldk-java diff --git a/ts/test/tests.mts b/ts/test/tests.mts index bbf2c8d1..b72703e7 100644 --- a/ts/test/tests.mts +++ b/ts/test/tests.mts @@ -162,5 +162,19 @@ export async function run_tests(wasm_path: string) { console.log("test results: " + results); const result = results.every((v) => { return v === true }); console.log("all tests passed: " + result); - return result; + if (result !== true) { return result; } + + const allocs_finished = new Promise((resolve, reject) => { + var loop_count = 0; + const interval_id = setInterval(() => { + const alloc_count = rawldk.getRemainingAllocationCount(); + if (loop_count % 20 == 0) + console.log("Remaining LDK allocation count: " + alloc_count); + // Note that there are currently 9 leaks in the above tests. At least some are known - look for XXX in bindings.c + if (alloc_count <= 10) { resolve(true); clearInterval(interval_id); } + loop_count += 1; + if (loop_count > 30*2) { resolve(false); clearInterval(interval_id); rawldk.debugPrintRemainingAllocs(); } + }, 500); + }); + return allocs_finished; }