made 'testament all' run in parallel

This commit is contained in:
Araq
2017-10-25 17:36:50 +02:00
parent a5f1abc5ca
commit fa02ffaeba
3 changed files with 15 additions and 13 deletions

View File

@@ -70,5 +70,6 @@ proc open*() =
thisCommit = getCommit()
proc close*() =
results.writeLine("]")
close(results)
if currentCategory.len > 0:
results.writeLine("]")
close(results)

View File

@@ -99,7 +99,7 @@ proc allTestResults(): AllTests =
else:
for elem in data:
result.data.add elem
let state = elem["result"]
let state = elem["result"].str
if state.contains("reSuccess"): inc result.successCount
elif state.contains("reIgnored"): inc result.ignoredCount
@@ -120,7 +120,7 @@ proc generateTestRunTabContentPartial(outfile: File, allResults: AllTests, testR
firstTabActiveClass = if firstRow: " in active"
else: ""
commitId = htmlQuote testRunRow["commit"].str
hash = htmlQuote(testRunRow["hash"].str)
hash = htmlQuote(testRunRow["commit"].str)
branch = htmlQuote(testRunRow["branch"].str)
machineId = htmlQuote testRunRow["machine"].str
machineName = htmlQuote(testRunRow["machine"].str)
@@ -141,15 +141,12 @@ proc generateTestRunTabContentPartial(outfile: File, allResults: AllTests, testR
proc generateTestRunsHtmlPartial(outfile: File, allResults: AllTests, onlyFailing = false) =
# Iterating the results twice, get entire result set in one go
outfile.generateHtmlTabListBegin()
var firstRow = true
for testRunRow in allResults.data:
generateTestRunTabListItemPartial(outfile, testRunRow, firstRow)
if firstRow:
firstRow = false
if allResults.data.len > 0:
generateTestRunTabListItemPartial(outfile, allResults.data[0], true)
outfile.generateHtmlTabListEnd()
outfile.generateHtmlTabContentsBegin()
firstRow = true
var firstRow = true
for testRunRow in allResults.data:
generateTestRunTabContentPartial(outfile, allResults, testRunRow, onlyFailing, firstRow)
if firstRow:

View File

@@ -459,13 +459,17 @@ proc main() =
case action
of "all":
let testsDir = "tests" & DirSep
let myself = quoteShell(findExe("tests" / "testament" / "tester"))
var cmds: seq[string] = @[]
let rest = if p.cmdLineRest.string.len > 0: " " & p.cmdLineRest.string else: ""
for kind, dir in walkDir(testsDir):
assert testsDir.startsWith(testsDir)
let cat = dir[testsDir.len .. ^1]
if kind == pcDir and cat notin ["testament", "testdata", "nimcache"]:
processCategory(r, Category(cat), p.cmdLineRest.string)
for a in AdditionalCategories:
processCategory(r, Category(a), p.cmdLineRest.string)
cmds.add(myself & " cat " & cat & rest)
for cat in AdditionalCategories:
cmds.add(myself & " cat " & cat & rest)
quit osproc.execProcesses(cmds, {poEchoCmd, poStdErrToStdOut, poUsePath, poParentStreams})
of "c", "cat", "category":
var cat = Category(p.key)
p.next