Tester now appreciates the test target. Modified 'cmd' in specs.
This commit is contained in:
parent
6692d95ee2
commit
2fb5d62927
24 changed files with 31 additions and 31 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tasyncawait.nim"
|
file: "tasyncawait.nim"
|
||||||
cmd: "nimrod cc --hints:on $# $#"
|
|
||||||
output: "5000"
|
output: "5000"
|
||||||
"""
|
"""
|
||||||
import asyncdispatch, rawsockets, net, strutils, os
|
import asyncdispatch, rawsockets, net, strutils, os
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tasynciossl.nim"
|
file: "tasynciossl.nim"
|
||||||
cmd: "nimrod cc --hints:on --define:ssl $# $#"
|
cmd: "nimrod $target --hints:on --define:ssl $options $file"
|
||||||
output: "20000"
|
output: "20000"
|
||||||
"""
|
"""
|
||||||
import sockets, asyncio, strutils, times
|
import sockets, asyncio, strutils, times
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
outputsub: "101"
|
outputsub: "101"
|
||||||
cmd: "nimrod cc --hints:on --threads:on $# $#"
|
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os, locks
|
import os, locks
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
output: "Done"
|
output: "Done"
|
||||||
cmd: "nimrod cc --debuginfo --hints:on --define:useNimRtl $# $#"
|
cmd: "nimrod $target --debuginfo --hints:on --define:useNimRtl $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod cc --debuginfo --hints:on --define:useNimRtl --app:lib $# $#"
|
cmd: "nimrod $target --debuginfo --hints:on --define:useNimRtl --app:lib $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod check $# $#"
|
cmd: "nimrod check $options $file"
|
||||||
errormsg: "'proc' is not a concrete type"
|
errormsg: "'proc' is not a concrete type"
|
||||||
errormsg: "'Foo' is not a concrete type."
|
errormsg: "'Foo' is not a concrete type."
|
||||||
errormsg: "invalid type: 'TBaseMed'"
|
errormsg: "invalid type: 'TBaseMed'"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod cc --hints:on --threads:on $# $#"
|
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''true'''
|
output: '''true'''
|
||||||
cmd: "nimrod cc --gc:none --hints:on --warnings:off $# $#"
|
cmd: "nimrod $target --gc:none --hints:on --warnings:off $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import hashes
|
import hashes
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod js --hints:on $# $#"
|
cmd: "nimrod js --hints:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# This file tests the JavaScript generator
|
# This file tests the JavaScript generator
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod js --hints:on $# $#"
|
|
||||||
output: "1261129"
|
output: "1261129"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod js --hints:on -r $# $#"
|
|
||||||
output: '''foo
|
output: '''foo
|
||||||
js 3.14'''
|
js 3.14'''
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod js --hints:on -r $# $#"
|
|
||||||
output: '''true'''
|
output: '''true'''
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod cc --hints:on -d:release $# $#"
|
cmd: "nimrod $target --hints:on -d:release $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# -*- nimrod -*-
|
# -*- nimrod -*-
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''true'''
|
output: '''true'''
|
||||||
cmd: "nimrod cc --hints:on $# $#"
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import hashes, sets
|
import hashes, sets
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod cc --hints:on -d:embedUnidecodeTable $# $#"
|
cmd: "nimrod $target --hints:on -d:embedUnidecodeTable $options $file"
|
||||||
output: "Ausserst"
|
output: "Ausserst"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''true'''
|
output: '''true'''
|
||||||
cmd: "nimrod cc --hints:on $# $#"
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import hashes, tables
|
import hashes, tables
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''true'''
|
output: '''true'''
|
||||||
cmd: "nimrod cc --hints:on $# $#"
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import tables
|
import tables
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
import parseutils, strutils, os, osproc, streams, parsecfg
|
import parseutils, strutils, os, osproc, streams, parsecfg
|
||||||
|
|
||||||
const
|
const
|
||||||
cmdTemplate* = r"nimrod cc --hints:on $# $#"
|
cmdTemplate* = r"nimrod $target --hints:on $options $file"
|
||||||
|
|
||||||
type
|
type
|
||||||
TTestAction* = enum
|
TTestAction* = enum
|
||||||
|
|
@ -51,6 +51,7 @@ type
|
||||||
|
|
||||||
const
|
const
|
||||||
targetToExt*: array[TTarget, string] = ["c", "cpp", "m", "js"]
|
targetToExt*: array[TTarget, string] = ["c", "cpp", "m", "js"]
|
||||||
|
targetToCmd*: array[TTarget, string] = ["c", "cpp", "objc", "js"]
|
||||||
|
|
||||||
when not defined(parseCfgBool):
|
when not defined(parseCfgBool):
|
||||||
# candidate for the stdlib:
|
# candidate for the stdlib:
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,10 @@ let
|
||||||
pegSuccess = peg"'Hint: operation successful'.*"
|
pegSuccess = peg"'Hint: operation successful'.*"
|
||||||
pegOfInterest = pegLineError / pegOtherError
|
pegOfInterest = pegLineError / pegOtherError
|
||||||
|
|
||||||
proc callCompiler(cmdTemplate, filename, options: string): TSpec =
|
proc callCompiler(cmdTemplate, filename, options: string,
|
||||||
let c = parseCmdLine(cmdTemplate % [options, filename])
|
target: TTarget): TSpec =
|
||||||
|
let c = parseCmdLine(cmdTemplate % ["target", targetToCmd[target],
|
||||||
|
"options", options, "file", filename])
|
||||||
var p = startProcess(command=c[0], args=c[1.. -1],
|
var p = startProcess(command=c[0], args=c[1.. -1],
|
||||||
options={poStdErrToStdOut, poUseShell})
|
options={poStdErrToStdOut, poUseShell})
|
||||||
let outp = p.outputStream
|
let outp = p.outputStream
|
||||||
|
|
@ -160,13 +162,15 @@ proc testSpec(r: var TResults, test: TTest) =
|
||||||
else:
|
else:
|
||||||
case expected.action
|
case expected.action
|
||||||
of actionCompile:
|
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:
|
if given.err == reSuccess:
|
||||||
codegenCheck(test, expected.ccodeCheck, given)
|
codegenCheck(test, expected.ccodeCheck, given)
|
||||||
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)
|
||||||
of actionRun:
|
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:
|
if given.err != reSuccess:
|
||||||
r.addResult(test, "", given.msg, given.err)
|
r.addResult(test, "", given.msg, given.err)
|
||||||
else:
|
else:
|
||||||
|
|
@ -178,7 +182,8 @@ proc testSpec(r: var TResults, test: TTest) =
|
||||||
exeFile = changeFileExt(tname, ExeExt)
|
exeFile = changeFileExt(tname, ExeExt)
|
||||||
if existsFile(exeFile):
|
if existsFile(exeFile):
|
||||||
if test.target == targetJS and findExe("nodejs") == "":
|
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
|
return
|
||||||
var (buf, exitCode) = execCmdEx(
|
var (buf, exitCode) = execCmdEx(
|
||||||
(if test.target == targetJS: "nodejs " else: "") & exeFile)
|
(if test.target == targetJS: "nodejs " else: "") & exeFile)
|
||||||
|
|
@ -196,7 +201,8 @@ proc testSpec(r: var TResults, test: TTest) =
|
||||||
else:
|
else:
|
||||||
r.addResult(test, expected.outp, "executable not found", reExeNotFound)
|
r.addResult(test, expected.outp, "executable not found", reExeNotFound)
|
||||||
of actionReject:
|
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)
|
cmpMsgs(r, expected, given, test)
|
||||||
|
|
||||||
proc testNoSpec(r: var TResults, test: TTest) =
|
proc testNoSpec(r: var TResults, test: TTest) =
|
||||||
|
|
@ -204,7 +210,7 @@ proc testNoSpec(r: var TResults, test: TTest) =
|
||||||
let tname = test.name.addFileExt(".nim")
|
let tname = test.name.addFileExt(".nim")
|
||||||
inc(r.total)
|
inc(r.total)
|
||||||
echo extractFilename(tname)
|
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)
|
r.addResult(test, "", given.msg, given.err)
|
||||||
if given.err == reSuccess: inc(r.passed)
|
if given.err == reSuccess: inc(r.passed)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ discard """
|
||||||
outputsub: "101"
|
outputsub: "101"
|
||||||
msg: "Warning: write to foreign heap"
|
msg: "Warning: write to foreign heap"
|
||||||
line: 37
|
line: 37
|
||||||
cmd: "nimrod cc --hints:on --threads:on $# $#"
|
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ discard """
|
||||||
file: "tthreadanalysis2.nim"
|
file: "tthreadanalysis2.nim"
|
||||||
line: 42
|
line: 42
|
||||||
errormsg: "write to foreign heap"
|
errormsg: "write to foreign heap"
|
||||||
cmd: "nimrod cc --hints:on --threads:on $# $#"
|
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ discard """
|
||||||
file: "tthreadanalysis3.nim"
|
file: "tthreadanalysis3.nim"
|
||||||
line: 35
|
line: 35
|
||||||
errormsg: "write to foreign heap"
|
errormsg: "write to foreign heap"
|
||||||
cmd: "nimrod cc --hints:on --threads:on $# $#"
|
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
discard """
|
discard """
|
||||||
line: 12
|
line: 12
|
||||||
errormsg: "write to foreign heap"
|
errormsg: "write to foreign heap"
|
||||||
cmd: "nimrod cc --hints:on --threads:on $# $#"
|
cmd: "nimrod $target --hints:on --threads:on $options $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
var
|
var
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
cmd: "nimrod c --threads:on $# $#"
|
cmd: "nimrod $target --threads:on $options $file"
|
||||||
errormsg: "illegal recursion in type 'TIRC'"
|
errormsg: "illegal recursion in type 'TIRC'"
|
||||||
line: 16
|
line: 16
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue