From 6bbf0fb64d4037b1ae7f00af0c153b1064e05355 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Mon, 15 May 2017 22:34:30 +0800 Subject: compiler option for testament (#5713) * compiler option for testament * different spacing --- tests/testament/specs.nim | 11 +++++++---- tests/testament/tester.nim | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'tests/testament') 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 -- cgit 1.4.1-2-gfad0