setup getPathsClause and parallels

This commit is contained in:
Jaremy Creechley 2023-07-17 16:22:21 -07:00
parent fc7d7ef80c
commit 62005c1a3c
No known key found for this signature in database
GPG Key ID: 4E66FB67B21D3300
2 changed files with 23 additions and 15 deletions

View File

@ -1,18 +1,23 @@
import std / [os, strutils, sequtils]
import std / [os, strutils, sequtils, osproc]
when declared(getPathsClause):
proc nimc(): string = "nim c " & getPathsClause()
else:
proc nimc(): string = "nim c"
switch("define", "libp2p_pki_schemes=secp256k1")
task testAll, "Run DHT tests":
exec "nim c -r tests/testAll.nim"
exec nimc() & " -r tests/testAll.nim"
task test, "Run DHT tests":
exec "nim c -r -d:testsAll --verbosity:0 tests/testAllParallel.nim"
exec nimc() & " -r -d:testsAll --verbosity:0 tests/testAllParallel.nim"
task testPart1, "Run DHT tests A":
exec "nim c -r -d:testsPart1 tests/testAllParallel.nim"
exec nimc() & " -r -d:testsPart1 tests/testAllParallel.nim"
task testPart2, "Run DHT tests B":
exec "nim c -r -d:testsPart2 tests/testAllParallel.nim"
exec nimc() & " -r -d:testsPart2 tests/testAllParallel.nim"
task coverage, "generates code coverage report":
var (output, exitCode) = gorgeEx("which lcov")

View File

@ -2,21 +2,24 @@
# ./dht/[test_providers, test_providermngr],
# ./discv5/[test_discoveryv5, test_discoveryv5_encoding]
import osproc
import std/[os, osproc, strutils]
when declared(getPathsClause):
proc nimc(): string = "nim c -r " & getPathsClause()
else:
proc nimc(): string = "nim c -r "
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()
when defined(testsPart1) or defined(testsAll):
cmds.add [
"nim c -r tests/dht/test_providers.nim",
"nim c -r tests/dht/test_providermngr.nim",
]
cmds = cmds[0..cmds.len div 2]
when defined(testsPart2) or defined(testsAll):
cmds.add [
"nim c -r tests/discv5/test_discoveryv5.nim",
"nim c -r tests/discv5/test_discoveryv5_encoding.nim",
]
cmds = cmds[cmds.len div 2..<cmds.len]
echo "Running Test Commands: ", cmds
quit execProcesses(cmds)
# quit execProcesses(cmds)