summary refs log tree commit diff stats
diff options
context:
space:
mode:
authoralaviss <alaviss@users.noreply.github.com>2018-12-19 01:49:43 +0700
committerAndreas Rumpf <rumpf_a@web.de>2018-12-18 19:49:43 +0100
commit8f4befe3680b1d2ce38d9b5e482a5436b49f122f (patch)
treef907d0502fa5b42da0ff717e64f2843f87dc7437
parent25d3539da7b1e6fd4560efcee6037df34a9c549a (diff)
downloadNim-8f4befe3680b1d2ce38d9b5e482a5436b49f122f.tar.gz
Testament fixes (#10034)
* testament/htmlgen: add support for disabled and joined tests

* testament/tester: respect --targets
-rw-r--r--testament/htmlgen.nim7
-rw-r--r--testament/tester.nim8
2 files changed, 10 insertions, 5 deletions
diff --git a/testament/htmlgen.nim b/testament/htmlgen.nim
index 4a10fe00c..34902f71e 100644
--- a/testament/htmlgen.nim
+++ b/testament/htmlgen.nim
@@ -35,12 +35,12 @@ proc generateTestResultPanelPartial(outfile: File, testResultRow: JsonNode) =
     bgCtxClass = "success"
     resultSign = "ok"
     resultDescription = "PASS"
-  of "reIgnored":
+  of "reDisabled", "reJoined":
     panelCtxClass = "info"
     textCtxClass = "info"
     bgCtxClass = "info"
     resultSign = "question"
-    resultDescription = "SKIP"
+    resultDescription = if result != "reJoined": "SKIP" else: "JOINED"
   else:
     panelCtxClass = "danger"
     textCtxClass = "danger"
@@ -78,7 +78,8 @@ proc allTestResults(onlyFailing = false): AllTests =
         let state = elem["result"].str
         inc result.totalCount
         if state.contains("reSuccess"): inc result.successCount
-        elif state.contains("reIgnored"): inc result.ignoredCount
+        elif state.contains("reDisabled") or state.contains("reJoined"):
+          inc result.ignoredCount
         if not onlyFailing or not(state.contains("reSuccess")):
           result.data.add elem
   result.successPercentage = 100 *
diff --git a/testament/tester.nim b/testament/tester.nim
index a056f36d2..1f3b96059 100644
--- a/testament/tester.nim
+++ b/testament/tester.nim
@@ -68,7 +68,7 @@ let
   pegSuccess = peg"'Hint: operation successful'.*"
   pegOfInterest = pegLineError / pegOtherError
 
-var targets = {low(TTarget)..high(TTarget)}
+var gTargets = {low(TTarget)..high(TTarget)}
 
 proc normalizeMsg(s: string): string =
   result = newStringOfCap(s.len+1)
@@ -372,6 +372,10 @@ proc testSpec(r: var TResults, test: TTest, targets: set[TTarget] = {}) =
       expected.targets = {targetC}
   for target in expected.targets:
     inc(r.total)
+    if target notin gTargets:
+      r.addResult(test, target, "", "", reDisabled)
+      inc(r.skipped)
+      continue
     case expected.action
     of actionCompile:
       var given = callCompiler(expected.getCmd, test.name, test.options, target,
@@ -504,7 +508,7 @@ proc main() =
     of "pedantic": discard "now always enabled"
     of "targets":
       targetsStr = p.val.string
-      targets = parseTargets(targetsStr)
+      gTargets = parseTargets(targetsStr)
     of "nim":
       compilerPrefix = addFileExt(p.val.string, ExeExt)
     of "directory":