fixed the rodfiles tests
This commit is contained in:
parent
4841b6390c
commit
371619c43a
5 changed files with 39 additions and 36 deletions
|
|
@ -942,9 +942,9 @@ proc genInitCode(m: BModule) =
|
||||||
app(prc, genSectionStart(cpsStmts))
|
app(prc, genSectionStart(cpsStmts))
|
||||||
app(prc, m.preInitProc.s(cpsStmts))
|
app(prc, m.preInitProc.s(cpsStmts))
|
||||||
app(prc, m.initProc.s(cpsStmts))
|
app(prc, m.initProc.s(cpsStmts))
|
||||||
|
app(prc, genSectionEnd(cpsStmts))
|
||||||
if optStackTrace in m.initProc.options and not m.PreventStackTrace:
|
if optStackTrace in m.initProc.options and not m.PreventStackTrace:
|
||||||
app(prc, deinitFrame(m.initProc))
|
app(prc, deinitFrame(m.initProc))
|
||||||
app(prc, genSectionEnd(cpsStmts))
|
|
||||||
app(prc, deinitGCFrame(m.initProc))
|
app(prc, deinitGCFrame(m.initProc))
|
||||||
appf(prc, "}$N$N")
|
appf(prc, "}$N$N")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -407,7 +407,7 @@ proc decodeSym(r: PRodReader, info: TLineInfo): PSym =
|
||||||
if r.s[r.pos] == '%':
|
if r.s[r.pos] == '%':
|
||||||
inc(r.pos)
|
inc(r.pos)
|
||||||
result.position = decodeVInt(r.s, r.pos)
|
result.position = decodeVInt(r.s, r.pos)
|
||||||
elif result.kind notin routineKinds:
|
elif result.kind notin routineKinds + {skModule}:
|
||||||
result.position = 0
|
result.position = 0
|
||||||
# this may have been misused as reader index! But we still
|
# this may have been misused as reader index! But we still
|
||||||
# need it for routines as the body is loaded lazily.
|
# need it for routines as the body is loaded lazily.
|
||||||
|
|
|
||||||
2
tests/rodfiles/nimrod.cfg
Normal file
2
tests/rodfiles/nimrod.cfg
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
--nimcache:"$projectPath/nimcache"
|
||||||
|
--symbolFiles:on
|
||||||
|
|
@ -23,14 +23,10 @@ proc delNimCache() =
|
||||||
except EOS:
|
except EOS:
|
||||||
echo "[Warning] could not delete: ", nimcacheDir
|
echo "[Warning] could not delete: ", nimcacheDir
|
||||||
|
|
||||||
proc plusCache(options: string): string = return options &
|
|
||||||
" --symbolFiles:on --nimcache:" & nimcacheDir
|
|
||||||
|
|
||||||
proc runRodFiles(r: var TResults, options: string) =
|
proc runRodFiles(r: var TResults, options: string) =
|
||||||
template test(filename: expr): stmt =
|
template test(filename: expr): stmt =
|
||||||
runSingleTest(r, rodfilesDir / filename, options)
|
runSingleTest(r, rodfilesDir / filename, options)
|
||||||
|
|
||||||
var options = options.plusCache
|
|
||||||
delNimCache()
|
delNimCache()
|
||||||
|
|
||||||
# test basic recompilation scheme:
|
# test basic recompilation scheme:
|
||||||
|
|
@ -64,7 +60,6 @@ proc compileRodFiles(r: var TResults, options: string) =
|
||||||
template test(filename: expr): stmt =
|
template test(filename: expr): stmt =
|
||||||
compileSingleTest(r, rodfilesDir / filename, options)
|
compileSingleTest(r, rodfilesDir / filename, options)
|
||||||
|
|
||||||
var options = options.plusCache
|
|
||||||
delNimCache()
|
delNimCache()
|
||||||
# test DLL interfacing:
|
# test DLL interfacing:
|
||||||
test "gtkex1"
|
test "gtkex1"
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,9 @@ const
|
||||||
cmdTemplate = r"nimrod cc --hints:on $# $#"
|
cmdTemplate = r"nimrod cc --hints:on $# $#"
|
||||||
resultsFile = "testresults.html"
|
resultsFile = "testresults.html"
|
||||||
jsonFile = "testresults.json"
|
jsonFile = "testresults.json"
|
||||||
Usage = "usage: tester reject|compile|examples|run|merge [nimrod options]\n" &
|
Usage = "usage: tester [--print] " &
|
||||||
|
"reject|compile|examples|run|" &
|
||||||
|
"merge|special|rodfiles| [nimrod options]\n" &
|
||||||
" or: tester test|comp|rej singleTest"
|
" or: tester test|comp|rej singleTest"
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
@ -335,40 +337,48 @@ proc main() =
|
||||||
runJson = "run.json"
|
runJson = "run.json"
|
||||||
rejectJson = "reject.json"
|
rejectJson = "reject.json"
|
||||||
|
|
||||||
|
var optPrintResults = false
|
||||||
var p = initOptParser()
|
var p = initOptParser()
|
||||||
p.next()
|
p.next()
|
||||||
|
if p.kind == cmdLongoption:
|
||||||
|
case p.key
|
||||||
|
of "print": optPrintResults = true
|
||||||
|
else: quit usage
|
||||||
|
p.next()
|
||||||
if p.kind != cmdArgument: quit usage
|
if p.kind != cmdArgument: quit usage
|
||||||
var action = p.key.string.normalize
|
var action = p.key.string.normalize
|
||||||
p.next()
|
p.next()
|
||||||
|
var r = initResults()
|
||||||
case action
|
case action
|
||||||
of "reject":
|
of "reject":
|
||||||
var rejectRes = initResults()
|
reject(r, "tests/reject", p.cmdLineRest.string)
|
||||||
reject(rejectRes, "tests/reject", p.cmdLineRest.string)
|
rejectSpecialTests(r, p.cmdLineRest.string)
|
||||||
rejectSpecialTests(rejectRes, p.cmdLineRest.string)
|
writeResults(rejectJson, r)
|
||||||
writeResults(rejectJson, rejectRes)
|
|
||||||
of "compile":
|
of "compile":
|
||||||
var compileRes = initResults()
|
compile(r, "tests/compile/t*.nim", p.cmdLineRest.string)
|
||||||
compile(compileRes, "tests/compile/t*.nim", p.cmdLineRest.string)
|
compile(r, "tests/ecmas.nim", p.cmdLineRest.string)
|
||||||
compile(compileRes, "tests/ecmas.nim", p.cmdLineRest.string)
|
compileSpecialTests(r, p.cmdLineRest.string)
|
||||||
compileSpecialTests(compileRes, p.cmdLineRest.string)
|
writeResults(compileJson, r)
|
||||||
writeResults(compileJson, compileRes)
|
|
||||||
of "examples":
|
of "examples":
|
||||||
var compileRes = readResults(compileJson)
|
compileExample(r, "lib/pure/*.nim", p.cmdLineRest.string)
|
||||||
compileExample(compileRes, "lib/pure/*.nim", p.cmdLineRest.string)
|
compileExample(r, "examples/*.nim", p.cmdLineRest.string)
|
||||||
compileExample(compileRes, "examples/*.nim", p.cmdLineRest.string)
|
compileExample(r, "examples/gtk/*.nim", p.cmdLineRest.string)
|
||||||
compileExample(compileRes, "examples/gtk/*.nim", p.cmdLineRest.string)
|
writeResults(compileJson, r)
|
||||||
writeResults(compileJson, compileRes)
|
|
||||||
of "run":
|
of "run":
|
||||||
var runRes = initResults()
|
run(r, "tests/run", p.cmdLineRest.string)
|
||||||
run(runRes, "tests/run", p.cmdLineRest.string)
|
runSpecialTests(r, p.cmdLineRest.string)
|
||||||
runSpecialTests(runRes, p.cmdLineRest.string)
|
writeResults(runJson, r)
|
||||||
writeResults(runJson, runRes)
|
of "special":
|
||||||
|
runSpecialTests(r, p.cmdLineRest.string)
|
||||||
|
writeResults(runJson, r)
|
||||||
|
of "rodfiles":
|
||||||
|
runRodFiles(r, p.cmdLineRest.string)
|
||||||
|
writeResults(runJson, r)
|
||||||
of "js":
|
of "js":
|
||||||
var runRes = initResults()
|
|
||||||
if existsFile(runJSon):
|
if existsFile(runJSon):
|
||||||
runRes = readResults(runJson)
|
r = readResults(runJson)
|
||||||
runJsTests(runRes, p.cmdLineRest.string)
|
runJsTests(r, p.cmdLineRest.string)
|
||||||
writeResults(runJson, runRes)
|
writeResults(runJson, r)
|
||||||
of "merge":
|
of "merge":
|
||||||
var rejectRes = readResults(rejectJson)
|
var rejectRes = readResults(rejectJson)
|
||||||
var compileRes = readResults(compileJson)
|
var compileRes = readResults(compileJson)
|
||||||
|
|
@ -376,15 +386,10 @@ proc main() =
|
||||||
listResults(rejectRes, compileRes, runRes)
|
listResults(rejectRes, compileRes, runRes)
|
||||||
outputJSON(rejectRes, compileRes, runRes)
|
outputJSON(rejectRes, compileRes, runRes)
|
||||||
of "dll":
|
of "dll":
|
||||||
var r = initResults()
|
|
||||||
runDLLTests r, p.cmdLineRest.string
|
runDLLTests r, p.cmdLineRest.string
|
||||||
echo r.data, r
|
|
||||||
of "gc":
|
of "gc":
|
||||||
var r = initResults()
|
|
||||||
runGCTests(r, p.cmdLineRest.string)
|
runGCTests(r, p.cmdLineRest.string)
|
||||||
echo r.data, r
|
|
||||||
of "test", "comp", "rej":
|
of "test", "comp", "rej":
|
||||||
var r = initResults()
|
|
||||||
if p.kind != cmdArgument: quit usage
|
if p.kind != cmdArgument: quit usage
|
||||||
var testFile = p.key.string
|
var testFile = p.key.string
|
||||||
p.next()
|
p.next()
|
||||||
|
|
@ -394,10 +399,11 @@ proc main() =
|
||||||
compileSingleTest(r, testFile, p.cmdLineRest.string)
|
compileSingleTest(r, testFile, p.cmdLineRest.string)
|
||||||
else:
|
else:
|
||||||
runSingleTest(r, testFile, p.cmdLineRest.string)
|
runSingleTest(r, testFile, p.cmdLineRest.string)
|
||||||
echo r.data, r
|
|
||||||
else:
|
else:
|
||||||
quit usage
|
quit usage
|
||||||
|
|
||||||
|
if optPrintResults: echo r, r.data
|
||||||
|
|
||||||
if paramCount() == 0:
|
if paramCount() == 0:
|
||||||
quit usage
|
quit usage
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue