summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJacek Sieka <arnetheduck@gmail.com>2017-05-15 22:34:30 +0800
committerAndreas Rumpf <rumpf_a@web.de>2017-05-15 16:34:30 +0200
commit6bbf0fb64d4037b1ae7f00af0c153b1064e05355 (patch)
treede46505af6380071de3e8f2a601372d471adc4d3 /tests
parent3afd852f54df2a0bc06be34d06509dfb2b9c80c5 (diff)
downloadNim-6bbf0fb64d4037b1ae7f00af0c153b1064e05355.tar.gz
compiler option for testament (#5713)
* compiler option for testament

* different spacing
Diffstat (limited to 'tests')
-rw-r--r--tests/testament/specs.nim11
-rw-r--r--tests/testament/tester.nim6
2 files changed, 11 insertions, 6 deletions
diff --git a/tests/testament/specs.nim b/tests/testament/specs.nim
index 91e8b2ec7..ab24acc70 100644
--- a/tests/testament/specs.nim
+++ b/tests/testament/specs.nim
@@ -9,8 +9,11 @@
 
 import parseutils, strutils, os, osproc, streams, parsecfg
 
-const
-  cmdTemplate* = r"compiler" / "nim $target --lib:lib --hints:on -d:testing $options $file"
+
+var compilerPrefix* = "compiler" / "nim "
+
+proc cmdTemplate*(): string =
+  compilerPrefix & "$target --lib:lib --hints:on -d:testing $options $file"
 
 type
   TTestAction* = enum
@@ -100,7 +103,7 @@ proc specDefaults*(result: var TSpec) =
   result.outp = ""
   result.nimout = ""
   result.ccodeCheck = ""
-  result.cmd = cmdTemplate
+  result.cmd = cmdTemplate()
   result.line = 0
   result.column = 0
   result.tfile = ""
@@ -173,7 +176,7 @@ proc parseSpec*(filename: string): TSpec =
         raise newException(ValueError, "cannot interpret as a bool: " & e.value)
     of "cmd":
       if e.value.startsWith("nim "):
-        result.cmd = "compiler" / e.value
+        result.cmd = compilerPrefix & e.value[4..^1]
       else:
         result.cmd = e.value
     of "ccodecheck": result.ccodeCheck = e.value
diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim
index 2d758ef0d..0f74de013 100644
--- a/tests/testament/tester.nim
+++ b/tests/testament/tester.nim
@@ -34,6 +34,7 @@ Options:
   --failing                 only show failing/ignored tests
   --pedantic                return non-zero status code if there are failures
   --targets:"c c++ js objc" run tests for specified targets (default: all)
+  --nim:path                use a particular nim executable (default: compiler/nim)
 """ % resultsFile
 
 type
@@ -367,7 +368,7 @@ proc testNoSpec(r: var TResults, test: TTest) =
   # does not extract the spec because the file is not supposed to have any
   #let tname = test.name.addFileExt(".nim")
   inc(r.total)
-  let given = callCompiler(cmdTemplate, test.name, test.options, test.target)
+  let given = callCompiler(cmdTemplate(), test.name, test.options, test.target)
   r.addResult(test, "", given.msg, given.err)
   if given.err == reSuccess: inc(r.passed)
 
@@ -376,7 +377,7 @@ proc testC(r: var TResults, test: TTest) =
   let tname = test.name.addFileExt(".c")
   inc(r.total)
   styledEcho "Processing ", fgCyan, extractFilename(tname)
-  var given = callCCompiler(cmdTemplate, test.name & ".c", test.options, test.target)
+  var given = callCCompiler(cmdTemplate(), test.name & ".c", test.options, test.target)
   if given.err != reSuccess:
     r.addResult(test, "", given.msg, given.err)
   elif test.action == actionRun:
@@ -424,6 +425,7 @@ proc main() =
     of "failing": optFailing = true
     of "pedantic": optPedantic = true
     of "targets": targets = parseTargets(p.val.string)
+    of "nim": compilerPrefix = p.val.string
     else: quit Usage
     p.next()
   if p.kind != cmdArgument: quit Usage