compiler option for testament (#5713)
* compiler option for testament * different spacing
This commit is contained in:
parent
3afd852f54
commit
6bbf0fb64d
2 changed files with 11 additions and 6 deletions
|
|
@ -9,8 +9,11 @@
|
||||||
|
|
||||||
import parseutils, strutils, os, osproc, streams, parsecfg
|
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
|
type
|
||||||
TTestAction* = enum
|
TTestAction* = enum
|
||||||
|
|
@ -100,7 +103,7 @@ proc specDefaults*(result: var TSpec) =
|
||||||
result.outp = ""
|
result.outp = ""
|
||||||
result.nimout = ""
|
result.nimout = ""
|
||||||
result.ccodeCheck = ""
|
result.ccodeCheck = ""
|
||||||
result.cmd = cmdTemplate
|
result.cmd = cmdTemplate()
|
||||||
result.line = 0
|
result.line = 0
|
||||||
result.column = 0
|
result.column = 0
|
||||||
result.tfile = ""
|
result.tfile = ""
|
||||||
|
|
@ -173,7 +176,7 @@ proc parseSpec*(filename: string): TSpec =
|
||||||
raise newException(ValueError, "cannot interpret as a bool: " & e.value)
|
raise newException(ValueError, "cannot interpret as a bool: " & e.value)
|
||||||
of "cmd":
|
of "cmd":
|
||||||
if e.value.startsWith("nim "):
|
if e.value.startsWith("nim "):
|
||||||
result.cmd = "compiler" / e.value
|
result.cmd = compilerPrefix & e.value[4..^1]
|
||||||
else:
|
else:
|
||||||
result.cmd = e.value
|
result.cmd = e.value
|
||||||
of "ccodecheck": result.ccodeCheck = e.value
|
of "ccodecheck": result.ccodeCheck = e.value
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ Options:
|
||||||
--failing only show failing/ignored tests
|
--failing only show failing/ignored tests
|
||||||
--pedantic return non-zero status code if there are failures
|
--pedantic return non-zero status code if there are failures
|
||||||
--targets:"c c++ js objc" run tests for specified targets (default: all)
|
--targets:"c c++ js objc" run tests for specified targets (default: all)
|
||||||
|
--nim:path use a particular nim executable (default: compiler/nim)
|
||||||
""" % resultsFile
|
""" % resultsFile
|
||||||
|
|
||||||
type
|
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
|
# does not extract the spec because the file is not supposed to have any
|
||||||
#let tname = test.name.addFileExt(".nim")
|
#let tname = test.name.addFileExt(".nim")
|
||||||
inc(r.total)
|
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)
|
r.addResult(test, "", given.msg, given.err)
|
||||||
if given.err == reSuccess: inc(r.passed)
|
if given.err == reSuccess: inc(r.passed)
|
||||||
|
|
||||||
|
|
@ -376,7 +377,7 @@ proc testC(r: var TResults, test: TTest) =
|
||||||
let tname = test.name.addFileExt(".c")
|
let tname = test.name.addFileExt(".c")
|
||||||
inc(r.total)
|
inc(r.total)
|
||||||
styledEcho "Processing ", fgCyan, extractFilename(tname)
|
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:
|
if given.err != reSuccess:
|
||||||
r.addResult(test, "", given.msg, given.err)
|
r.addResult(test, "", given.msg, given.err)
|
||||||
elif test.action == actionRun:
|
elif test.action == actionRun:
|
||||||
|
|
@ -424,6 +425,7 @@ proc main() =
|
||||||
of "failing": optFailing = true
|
of "failing": optFailing = true
|
||||||
of "pedantic": optPedantic = true
|
of "pedantic": optPedantic = true
|
||||||
of "targets": targets = parseTargets(p.val.string)
|
of "targets": targets = parseTargets(p.val.string)
|
||||||
|
of "nim": compilerPrefix = p.val.string
|
||||||
else: quit Usage
|
else: quit Usage
|
||||||
p.next()
|
p.next()
|
||||||
if p.kind != cmdArgument: quit Usage
|
if p.kind != cmdArgument: quit Usage
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue