diff --git a/tests/async/tasyncawait.nim b/tests/async/tasyncawait.nim index bd722842f2..ffceeaee68 100644 --- a/tests/async/tasyncawait.nim +++ b/tests/async/tasyncawait.nim @@ -1,6 +1,5 @@ discard """ file: "tasyncawait.nim" - cmd: "nimrod cc --hints:on $# $#" output: "5000" """ import asyncdispatch, rawsockets, net, strutils, os diff --git a/tests/async/tasynciossl.nim b/tests/async/tasynciossl.nim index fbed46efb0..26c4c587c8 100644 --- a/tests/async/tasynciossl.nim +++ b/tests/async/tasynciossl.nim @@ -1,6 +1,6 @@ discard """ file: "tasynciossl.nim" - cmd: "nimrod cc --hints:on --define:ssl $# $#" + cmd: "nimrod $target --hints:on --define:ssl $options $file" output: "20000" """ import sockets, asyncio, strutils, times @@ -88,4 +88,4 @@ while true: break assert msgCount == (swarmSize * messagesToSend) * serverCount -echo(msgCount) \ No newline at end of file +echo(msgCount) diff --git a/tests/concurrency/tnodeadlocks.nim b/tests/concurrency/tnodeadlocks.nim index 3f27e24f68..d44196039f 100644 --- a/tests/concurrency/tnodeadlocks.nim +++ b/tests/concurrency/tnodeadlocks.nim @@ -1,6 +1,6 @@ discard """ outputsub: "101" - cmd: "nimrod cc --hints:on --threads:on $# $#" + cmd: "nimrod $target --hints:on --threads:on $options $file" """ import os, locks diff --git a/tests/dll/client.nim b/tests/dll/client.nim index a78cef1d4d..45fa8f6393 100644 --- a/tests/dll/client.nim +++ b/tests/dll/client.nim @@ -1,6 +1,6 @@ discard """ output: "Done" - cmd: "nimrod cc --debuginfo --hints:on --define:useNimRtl $# $#" + cmd: "nimrod $target --debuginfo --hints:on --define:useNimRtl $options $file" """ type diff --git a/tests/dll/server.nim b/tests/dll/server.nim index ae2acc893b..b2fac9ecc0 100644 --- a/tests/dll/server.nim +++ b/tests/dll/server.nim @@ -1,5 +1,5 @@ discard """ - cmd: "nimrod cc --debuginfo --hints:on --define:useNimRtl --app:lib $# $#" + cmd: "nimrod $target --debuginfo --hints:on --define:useNimRtl --app:lib $options $file" """ type diff --git a/tests/generics/tmetafield.nim b/tests/generics/tmetafield.nim index f2fac8fdd6..e1bc43ce31 100644 --- a/tests/generics/tmetafield.nim +++ b/tests/generics/tmetafield.nim @@ -1,5 +1,5 @@ discard """ - cmd: "nimrod check $# $#" + cmd: "nimrod check $options $file" errormsg: "'proc' is not a concrete type" errormsg: "'Foo' is not a concrete type." errormsg: "invalid type: 'TBaseMed'" diff --git a/tests/generics/tthread_generic.nim b/tests/generics/tthread_generic.nim index beae4b6527..7109bba18c 100644 --- a/tests/generics/tthread_generic.nim +++ b/tests/generics/tthread_generic.nim @@ -1,5 +1,5 @@ discard """ - cmd: "nimrod cc --hints:on --threads:on $# $#" + cmd: "nimrod $target --hints:on --threads:on $options $file" """ type diff --git a/tests/iter/titer2.nim b/tests/iter/titer2.nim index f8967109e2..71c7327a7f 100644 --- a/tests/iter/titer2.nim +++ b/tests/iter/titer2.nim @@ -1,6 +1,6 @@ discard """ output: '''true''' - cmd: "nimrod cc --gc:none --hints:on --warnings:off $# $#" + cmd: "nimrod $target --gc:none --hints:on --warnings:off $options $file" """ import hashes diff --git a/tests/js.nim b/tests/js.nim index f31bb10d91..becc178341 100644 --- a/tests/js.nim +++ b/tests/js.nim @@ -1,5 +1,5 @@ discard """ - cmd: "nimrod js --hints:on $# $#" + cmd: "nimrod js --hints:on $options $file" """ # This file tests the JavaScript generator diff --git a/tests/js/test1.nim b/tests/js/test1.nim index 3f3d5f02c4..09ba306760 100644 --- a/tests/js/test1.nim +++ b/tests/js/test1.nim @@ -1,5 +1,4 @@ discard """ - cmd: "nimrod js --hints:on $# $#" output: "1261129" """ diff --git a/tests/js/test2.nim b/tests/js/test2.nim index 1342ed15d9..5a734358cb 100644 --- a/tests/js/test2.nim +++ b/tests/js/test2.nim @@ -1,5 +1,4 @@ discard """ - cmd: "nimrod js --hints:on -r $# $#" output: '''foo js 3.14''' """ diff --git a/tests/js/testmagic.nim b/tests/js/testmagic.nim index 2c02d24be0..5f793ae052 100644 --- a/tests/js/testmagic.nim +++ b/tests/js/testmagic.nim @@ -1,5 +1,4 @@ discard """ - cmd: "nimrod js --hints:on -r $# $#" output: '''true''' """ diff --git a/tests/misc/tmandelbrot.nim b/tests/misc/tmandelbrot.nim index 1e39c8756d..bb1b46d898 100644 --- a/tests/misc/tmandelbrot.nim +++ b/tests/misc/tmandelbrot.nim @@ -1,5 +1,5 @@ discard """ - cmd: "nimrod cc --hints:on -d:release $# $#" + cmd: "nimrod $target --hints:on -d:release $options $file" """ # -*- nimrod -*- diff --git a/tests/sets/tsets2.nim b/tests/sets/tsets2.nim index ac977096ba..7f313e14f7 100644 --- a/tests/sets/tsets2.nim +++ b/tests/sets/tsets2.nim @@ -1,6 +1,5 @@ discard """ output: '''true''' - cmd: "nimrod cc --hints:on $# $#" """ import hashes, sets diff --git a/tests/stdlib/tunidecode.nim b/tests/stdlib/tunidecode.nim index cb6589d600..6478588258 100644 --- a/tests/stdlib/tunidecode.nim +++ b/tests/stdlib/tunidecode.nim @@ -1,5 +1,5 @@ discard """ - cmd: "nimrod cc --hints:on -d:embedUnidecodeTable $# $#" + cmd: "nimrod $target --hints:on -d:embedUnidecodeTable $options $file" output: "Ausserst" """ diff --git a/tests/table/ttables.nim b/tests/table/ttables.nim index 681ff54241..60446b5a37 100644 --- a/tests/table/ttables.nim +++ b/tests/table/ttables.nim @@ -1,6 +1,5 @@ discard """ output: '''true''' - cmd: "nimrod cc --hints:on $# $#" """ import hashes, tables diff --git a/tests/table/ttables2.nim b/tests/table/ttables2.nim index b88c8dfbf8..611f3f8ecb 100644 --- a/tests/table/ttables2.nim +++ b/tests/table/ttables2.nim @@ -1,6 +1,5 @@ discard """ output: '''true''' - cmd: "nimrod cc --hints:on $# $#" """ import tables diff --git a/tests/testament/specs.nim b/tests/testament/specs.nim index 65e17a4533..225ea18910 100644 --- a/tests/testament/specs.nim +++ b/tests/testament/specs.nim @@ -10,7 +10,7 @@ import parseutils, strutils, os, osproc, streams, parsecfg const - cmdTemplate* = r"nimrod cc --hints:on $# $#" + cmdTemplate* = r"nimrod $target --hints:on $options $file" type TTestAction* = enum @@ -51,6 +51,7 @@ type const targetToExt*: array[TTarget, string] = ["c", "cpp", "m", "js"] + targetToCmd*: array[TTarget, string] = ["c", "cpp", "objc", "js"] when not defined(parseCfgBool): # candidate for the stdlib: diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim index 361a5a26f1..757e548898 100644 --- a/tests/testament/tester.nim +++ b/tests/testament/tester.nim @@ -53,8 +53,10 @@ let pegSuccess = peg"'Hint: operation successful'.*" pegOfInterest = pegLineError / pegOtherError -proc callCompiler(cmdTemplate, filename, options: string): TSpec = - let c = parseCmdLine(cmdTemplate % [options, filename]) +proc callCompiler(cmdTemplate, filename, options: string, + target: TTarget): TSpec = + let c = parseCmdLine(cmdTemplate % ["target", targetToCmd[target], + "options", options, "file", filename]) var p = startProcess(command=c[0], args=c[1.. -1], options={poStdErrToStdOut, poUseShell}) let outp = p.outputStream @@ -160,13 +162,15 @@ proc testSpec(r: var TResults, test: TTest) = else: case expected.action of actionCompile: - var given = callCompiler(expected.cmd, test.name, test.options) + var given = callCompiler(expected.cmd, test.name, test.options, + test.target) if given.err == reSuccess: codegenCheck(test, expected.ccodeCheck, given) r.addResult(test, "", given.msg, given.err) if given.err == reSuccess: inc(r.passed) of actionRun: - var given = callCompiler(expected.cmd, test.name, test.options) + var given = callCompiler(expected.cmd, test.name, test.options, + test.target) if given.err != reSuccess: r.addResult(test, "", given.msg, given.err) else: @@ -178,7 +182,8 @@ proc testSpec(r: var TResults, test: TTest) = exeFile = changeFileExt(tname, ExeExt) if existsFile(exeFile): if test.target == targetJS and findExe("nodejs") == "": - r.addResult(test, expected.outp, "nodejs binary not in PATH", reExeNotFound) + r.addResult(test, expected.outp, "nodejs binary not in PATH", + reExeNotFound) return var (buf, exitCode) = execCmdEx( (if test.target == targetJS: "nodejs " else: "") & exeFile) @@ -196,7 +201,8 @@ proc testSpec(r: var TResults, test: TTest) = else: r.addResult(test, expected.outp, "executable not found", reExeNotFound) of actionReject: - var given = callCompiler(expected.cmd, test.name, test.options) + var given = callCompiler(expected.cmd, test.name, test.options, + test.target) cmpMsgs(r, expected, given, test) proc testNoSpec(r: var TResults, test: TTest) = @@ -204,7 +210,7 @@ proc testNoSpec(r: var TResults, test: TTest) = let tname = test.name.addFileExt(".nim") inc(r.total) echo extractFilename(tname) - let given = callCompiler(cmdTemplate, test.name, test.options) + let given = callCompiler(cmdTemplate, test.name, test.options, test.target) r.addResult(test, "", given.msg, given.err) if given.err == reSuccess: inc(r.passed) diff --git a/tests/threads/tthreadanalysis.nim b/tests/threads/tthreadanalysis.nim index 3a46cd1851..383680d816 100644 --- a/tests/threads/tthreadanalysis.nim +++ b/tests/threads/tthreadanalysis.nim @@ -2,7 +2,7 @@ discard """ outputsub: "101" msg: "Warning: write to foreign heap" line: 37 - cmd: "nimrod cc --hints:on --threads:on $# $#" + cmd: "nimrod $target --hints:on --threads:on $options $file" """ import os diff --git a/tests/threads/tthreadanalysis2.nim b/tests/threads/tthreadanalysis2.nim index 07f0e61fde..697e2cb228 100644 --- a/tests/threads/tthreadanalysis2.nim +++ b/tests/threads/tthreadanalysis2.nim @@ -2,7 +2,7 @@ discard """ file: "tthreadanalysis2.nim" line: 42 errormsg: "write to foreign heap" - cmd: "nimrod cc --hints:on --threads:on $# $#" + cmd: "nimrod $target --hints:on --threads:on $options $file" """ import os diff --git a/tests/threads/tthreadanalysis3.nim b/tests/threads/tthreadanalysis3.nim index d7a838fec0..3c17fe7e29 100644 --- a/tests/threads/tthreadanalysis3.nim +++ b/tests/threads/tthreadanalysis3.nim @@ -2,7 +2,7 @@ discard """ file: "tthreadanalysis3.nim" line: 35 errormsg: "write to foreign heap" - cmd: "nimrod cc --hints:on --threads:on $# $#" + cmd: "nimrod $target --hints:on --threads:on $options $file" """ import os diff --git a/tests/threads/tthreadheapviolation1.nim b/tests/threads/tthreadheapviolation1.nim index 7ca6f7928e..f3a36e036d 100644 --- a/tests/threads/tthreadheapviolation1.nim +++ b/tests/threads/tthreadheapviolation1.nim @@ -1,7 +1,7 @@ discard """ line: 12 errormsg: "write to foreign heap" - cmd: "nimrod cc --hints:on --threads:on $# $#" + cmd: "nimrod $target --hints:on --threads:on $options $file" """ var diff --git a/tests/types/tillegaltyperecursion.nim b/tests/types/tillegaltyperecursion.nim index 711f458bfa..114e4d08e6 100644 --- a/tests/types/tillegaltyperecursion.nim +++ b/tests/types/tillegaltyperecursion.nim @@ -1,5 +1,5 @@ discard """ - cmd: "nimrod c --threads:on $# $#" + cmd: "nimrod $target --threads:on $options $file" errormsg: "illegal recursion in type 'TIRC'" line: 16 """