setup to use env variable for parallel tests

This commit is contained in:
Jaremy Creechley 2023-07-18 15:46:33 -07:00
parent 387db1e1e5
commit cdd03ea3e9
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
2 changed files with 11 additions and 8 deletions

View File

@ -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":

View File

@ -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..<cmds.len]
echo "Running Test Commands: ", cmds
# quit execProcesses(cmds)
echo "Running Test Commands: "
for cmd in cmds:
echo "\t", cmd
echo ""
quit execProcesses(cmds)