summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2017-10-25 17:36:50 +0200
committerAraq <rumpf_a@web.de>2017-10-25 17:37:03 +0200
commitfa02ffaeba219ca3f259667d5161d30e47bb13e0 (patch)
treef2fba64a63046efff43ef11be6e8e3788cb42439
parenta5f1abc5ca52f5842a7583036d28cc8b251b63ad (diff)
downloadNim-fa02ffaeba219ca3f259667d5161d30e47bb13e0.tar.gz
made 'testament all' run in parallel
-rw-r--r--tests/testament/backend.nim5
-rw-r--r--tests/testament/htmlgen.nim13
-rw-r--r--tests/testament/tester.nim10
3 files changed, 15 insertions, 13 deletions
diff --git a/tests/testament/backend.nim b/tests/testament/backend.nim
index b1bc2df60..4acef9ca4 100644
--- a/tests/testament/backend.nim
+++ b/tests/testament/backend.nim
@@ -70,5 +70,6 @@ proc open*() =
   thisCommit = getCommit()
 
 proc close*() =
-  results.writeLine("]")
-  close(results)
+  if currentCategory.len > 0:
+    results.writeLine("]")
+    close(results)
diff --git a/tests/testament/htmlgen.nim b/tests/testament/htmlgen.nim
index d82664dc0..05c24b2b5 100644
--- a/tests/testament/htmlgen.nim
+++ b/tests/testament/htmlgen.nim
@@ -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:
diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim
index a8719c1b2..dd5e70d50 100644
--- a/tests/testament/tester.nim
+++ b/tests/testament/tester.nim
@@ -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