From 08db79fe6354cc3e381daaf81e769b07334ecfc9 Mon Sep 17 00:00:00 2001 From: Eugene Kabanov Date: Wed, 14 Feb 2024 00:03:12 +0200 Subject: [PATCH] Disable memory hungry tests in 32bit tests. (#503) * Disable memory hungry tests in 32bit tests. * Limit threadsync tests for 32bit. --- tests/testproc.nim | 53 +++++++++++++++++++++------------------- tests/teststream.nim | 4 +-- tests/testthreadsync.nim | 5 +++- 3 files changed, 34 insertions(+), 28 deletions(-) diff --git a/tests/testproc.nim b/tests/testproc.nim index 4d8accf..57ef5a6 100644 --- a/tests/testproc.nim +++ b/tests/testproc.nim @@ -209,31 +209,34 @@ suite "Asynchronous process management test suite": await process.closeWait() asyncTest "Capture big amount of bytes from STDOUT stream test": - let options = {AsyncProcessOption.EvalCommand} - let command = - when defined(windows): - "tests\\testproc.bat bigdata" - else: - "tests/testproc.sh bigdata" - let expect = - when defined(windows): - 100_000 * (64 + 2) - else: - 100_000 * (64 + 1) - let process = await startProcess(command, options = options, - stdoutHandle = AsyncProcess.Pipe, - stderrHandle = AsyncProcess.Pipe) - try: - let outBytesFut = process.stdoutStream.read() - let errBytesFut = process.stderrStream.read() - let res = await process.waitForExit(InfiniteDuration) - await allFutures(outBytesFut, errBytesFut) - check: - res == 0 - len(outBytesFut.read()) == expect - len(errBytesFut.read()) == 0 - finally: - await process.closeWait() + when sizeof(int) == 4: + skip() + else: + let options = {AsyncProcessOption.EvalCommand} + let command = + when defined(windows): + "tests\\testproc.bat bigdata" + else: + "tests/testproc.sh bigdata" + let expect = + when defined(windows): + 100_000 * (64 + 2) + else: + 100_000 * (64 + 1) + let process = await startProcess(command, options = options, + stdoutHandle = AsyncProcess.Pipe, + stderrHandle = AsyncProcess.Pipe) + try: + let outBytesFut = process.stdoutStream.read() + let errBytesFut = process.stderrStream.read() + let res = await process.waitForExit(InfiniteDuration) + await allFutures(outBytesFut, errBytesFut) + check: + res == 0 + len(outBytesFut.read()) == expect + len(errBytesFut.read()) == 0 + finally: + await process.closeWait() asyncTest "Long-waiting waitForExit() test": let command = diff --git a/tests/teststream.nim b/tests/teststream.nim index bf4c455..340575c 100644 --- a/tests/teststream.nim +++ b/tests/teststream.nim @@ -1520,12 +1520,12 @@ suite "Stream Transport test suite": check waitFor(testWCR(addresses[i])) == ClientsCount * MessagesCount test prefixes[i] & "writeFile() multiple clients (" & $FilesCount & " files)": when defined(windows): - if addresses[i].family == AddressFamily.IPv4: + if addresses[i].family == AddressFamily.IPv4 and (sizeof(int) == 8): check waitFor(testSendFile(addresses[i])) == FilesCount else: skip() else: - if defined(emscripten): + if defined(emscripten) or (sizeof(int) == 4): skip() else: check waitFor(testSendFile(addresses[i])) == FilesCount diff --git a/tests/testthreadsync.nim b/tests/testthreadsync.nim index fc85dc8..b527397 100644 --- a/tests/testthreadsync.nim +++ b/tests/testthreadsync.nim @@ -39,9 +39,12 @@ type Sync, Async const - TestsCount = 1000 + TestsCount = when sizeof(int) == 8: 1000 else: 100 suite "Asynchronous multi-threading sync primitives test suite": + teardown: + checkLeaks() + proc setResult(thr: ThreadResultPtr, value: int) = thr[].value = value