From cdd03ea3e90b9e6782252fd823f57aae758ae26d Mon Sep 17 00:00:00 2001 From: Jaremy Creechley Date: Tue, 18 Jul 2023 15:46:33 -0700 Subject: [PATCH] setup to use env variable for parallel tests --- build.nims | 2 ++ tests/testAllParallel.nim | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/build.nims b/build.nims index 9761a1f..155eddc 100644 --- a/build.nims +++ b/build.nims @@ -4,6 +4,7 @@ when declared(getPathsClause): proc nimc(): string = "nim c " & getPathsClause() else: proc nimc(): string = "nim c" + proc getPathsClause(): string = "" switch("define", "libp2p_pki_schemes=secp256k1") @@ -11,6 +12,7 @@ task testAll, "Run DHT tests": exec nimc() & " -r tests/testAll.nim" task test, "Run DHT tests": + putEnv("NIMBLE_PATHS", getPathsClause().split(" ").join($PathSep & $PathSep)) exec nimc() & " -r -d:testsAll --verbosity:0 tests/testAllParallel.nim" task testPart1, "Run DHT tests A": diff --git a/tests/testAllParallel.nim b/tests/testAllParallel.nim index d81235a..fcb53de 100644 --- a/tests/testAllParallel.nim +++ b/tests/testAllParallel.nim @@ -4,22 +4,23 @@ import std/[os, osproc, strutils] -when declared(getPathsClause): - ## note this doesn't appear to work, what to do? - proc nimc(): string = "nim c -r " & getPathsClause() -else: - proc nimc(): string = "nim c -r " +## we wanna get nimble paths if set +let nimblePaths = getEnv("NIMBLE_PATHS", "").split($PathSep & $PathSep).join(" ") var cmds: seq[string] for d in walkDirRec("tests", {pcDir}): for (kind, file) in walkDir(d): if kind == pcFile and file.endswith(".nim") and file.startsWith("t"): - cmds.add nimc() & file.absolutePath.quoteShell() + cmds.add "nim c " & nimblePaths & " " & file.absolutePath.quoteShell() when defined(testsPart1): cmds = cmds[0..cmds.len div 2 - 1] when defined(testsPart2): cmds = cmds[cmds.len div 2 - 1..