Fixes #802, #803 and #3775 - genscript issues (#7677)

* Fixes #802, #803 and #3775 - genscript issues

* Test case for genscript

* Test script

* Verify on Linux

* Update categories.nim

* Fix merge

* Improve test framework

* Windows fixes
This commit is contained in:
genotrance 2018-04-25 03:52:32 -05:00 • committed by Andreas Rumpf
commit e931f3b5a9
8 changed files with 57 additions and 12 deletions

View file

@ -16,7 +16,7 @@ import
const
resultsFile = "testresults.html"
jsonFile = "testresults.json"
#jsonFile = "testresults.json" # not used
Usage = """Usage:
tester [options] command [arguments]
@ -150,11 +150,11 @@ proc initResults: TResults =
result.skipped = 0
result.data = ""
proc readResults(filename: string): TResults =
result = marshal.to[TResults](readFile(filename).string)
#proc readResults(filename: string): TResults = # not used
# result = marshal.to[TResults](readFile(filename).string)
proc writeResults(filename: string, r: TResults) =
writeFile(filename, $$r)
#proc writeResults(filename: string, r: TResults) = # not used
# writeFile(filename, $$r)
proc `$`(x: TResults): string =
result = ("Tests passed: $1 / $3 <br />\n" &
@ -404,6 +404,21 @@ proc testC(r: var TResults, test: TTest) =
if exitCode != 0: given.err = reExitCodesDiffer
if given.err == reSuccess: inc(r.passed)
proc testExec(r: var TResults, test: TTest) =
# runs executable or script, just goes by exit code
inc(r.total)
let (outp, errC) = execCmdEx(test.options.strip())
var given: TSpec
specDefaults(given)
if errC == 0:
given.err = reSuccess
else:
given.err = reExitCodesDiffer
given.msg = outp.string
if given.err == reSuccess: inc(r.passed)
r.addResult(test, targetC, "", given.msg, given.err)
proc makeTest(test, options: string, cat: Category, action = actionCompile,
env: string = ""): TTest =
# start with 'actionCompile', will be overwritten in the spec: