diff options
author | Zahary Karadjov <zahary@gmail.com> | 2012-07-20 00:35:05 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2012-07-20 00:35:05 +0300 |
commit | 371619c43a721af3f8f24cc3b349aa9b177e18dd (patch) | |
tree | bf0640fa56ac4d3d105e86f017f3bdc9c71b870c | |
parent | 4841b6390c136a0e6a4f641d0d45f65a422809f6 (diff) | |
download | Nim-371619c43a721af3f8f24cc3b349aa9b177e18dd.tar.gz |
fixed the rodfiles tests
-rwxr-xr-x | compiler/cgen.nim | 2 | ||||
-rwxr-xr-x | compiler/rodread.nim | 2 | ||||
-rw-r--r-- | tests/rodfiles/nimrod.cfg | 2 | ||||
-rw-r--r-- | tests/specials.nim | 5 | ||||
-rwxr-xr-x | tests/tester.nim | 64 |
5 files changed, 39 insertions, 36 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index c23084f5c..bcc7615ce 100755 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -942,9 +942,9 @@ proc genInitCode(m: BModule) = app(prc, genSectionStart(cpsStmts)) app(prc, m.preInitProc.s(cpsStmts)) app(prc, m.initProc.s(cpsStmts)) + app(prc, genSectionEnd(cpsStmts)) if optStackTrace in m.initProc.options and not m.PreventStackTrace: app(prc, deinitFrame(m.initProc)) - app(prc, genSectionEnd(cpsStmts)) app(prc, deinitGCFrame(m.initProc)) appf(prc, "}$N$N") diff --git a/compiler/rodread.nim b/compiler/rodread.nim index a600d14c1..7e8584955 100755 --- a/compiler/rodread.nim +++ b/compiler/rodread.nim @@ -407,7 +407,7 @@ proc decodeSym(r: PRodReader, info: TLineInfo): PSym = if r.s[r.pos] == '%': inc(r.pos) result.position = decodeVInt(r.s, r.pos) - elif result.kind notin routineKinds: + elif result.kind notin routineKinds + {skModule}: result.position = 0 # this may have been misused as reader index! But we still # need it for routines as the body is loaded lazily. diff --git a/tests/rodfiles/nimrod.cfg b/tests/rodfiles/nimrod.cfg new file mode 100644 index 000000000..78fc8db64 --- /dev/null +++ b/tests/rodfiles/nimrod.cfg @@ -0,0 +1,2 @@ +--nimcache:"$projectPath/nimcache" +--symbolFiles:on diff --git a/tests/specials.nim b/tests/specials.nim index f0f471c02..bc5b801eb 100644 --- a/tests/specials.nim +++ b/tests/specials.nim @@ -23,14 +23,10 @@ proc delNimCache() = except EOS: echo "[Warning] could not delete: ", nimcacheDir -proc plusCache(options: string): string = return options & - " --symbolFiles:on --nimcache:" & nimcacheDir - proc runRodFiles(r: var TResults, options: string) = template test(filename: expr): stmt = runSingleTest(r, rodfilesDir / filename, options) - var options = options.plusCache delNimCache() # test basic recompilation scheme: @@ -64,7 +60,6 @@ proc compileRodFiles(r: var TResults, options: string) = template test(filename: expr): stmt = compileSingleTest(r, rodfilesDir / filename, options) - var options = options.plusCache delNimCache() # test DLL interfacing: test "gtkex1" diff --git a/tests/tester.nim b/tests/tester.nim index be0765874..420233c18 100755 --- a/tests/tester.nim +++ b/tests/tester.nim @@ -17,7 +17,9 @@ const cmdTemplate = r"nimrod cc --hints:on $# $#" resultsFile = "testresults.html" 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" type @@ -335,40 +337,48 @@ proc main() = runJson = "run.json" rejectJson = "reject.json" + var optPrintResults = false var p = initOptParser() p.next() + if p.kind == cmdLongoption: + case p.key + of "print": optPrintResults = true + else: quit usage + p.next() if p.kind != cmdArgument: quit usage var action = p.key.string.normalize p.next() + var r = initResults() case action of "reject": - var rejectRes = initResults() - reject(rejectRes, "tests/reject", p.cmdLineRest.string) - rejectSpecialTests(rejectRes, p.cmdLineRest.string) - writeResults(rejectJson, rejectRes) + reject(r, "tests/reject", p.cmdLineRest.string) + rejectSpecialTests(r, p.cmdLineRest.string) + writeResults(rejectJson, r) of "compile": - var compileRes = initResults() - compile(compileRes, "tests/compile/t*.nim", p.cmdLineRest.string) - compile(compileRes, "tests/ecmas.nim", p.cmdLineRest.string) - compileSpecialTests(compileRes, p.cmdLineRest.string) - writeResults(compileJson, compileRes) + compile(r, "tests/compile/t*.nim", p.cmdLineRest.string) + compile(r, "tests/ecmas.nim", p.cmdLineRest.string) + compileSpecialTests(r, p.cmdLineRest.string) + writeResults(compileJson, r) of "examples": - var compileRes = readResults(compileJson) - compileExample(compileRes, "lib/pure/*.nim", p.cmdLineRest.string) - compileExample(compileRes, "examples/*.nim", p.cmdLineRest.string) - compileExample(compileRes, "examples/gtk/*.nim", p.cmdLineRest.string) - writeResults(compileJson, compileRes) + compileExample(r, "lib/pure/*.nim", p.cmdLineRest.string) + compileExample(r, "examples/*.nim", p.cmdLineRest.string) + compileExample(r, "examples/gtk/*.nim", p.cmdLineRest.string) + writeResults(compileJson, r) of "run": - var runRes = initResults() - run(runRes, "tests/run", p.cmdLineRest.string) - runSpecialTests(runRes, p.cmdLineRest.string) - writeResults(runJson, runRes) + run(r, "tests/run", p.cmdLineRest.string) + runSpecialTests(r, p.cmdLineRest.string) + writeResults(runJson, r) + of "special": + runSpecialTests(r, p.cmdLineRest.string) + writeResults(runJson, r) + of "rodfiles": + runRodFiles(r, p.cmdLineRest.string) + writeResults(runJson, r) of "js": - var runRes = initResults() if existsFile(runJSon): - runRes = readResults(runJson) - runJsTests(runRes, p.cmdLineRest.string) - writeResults(runJson, runRes) + r = readResults(runJson) + runJsTests(r, p.cmdLineRest.string) + writeResults(runJson, r) of "merge": var rejectRes = readResults(rejectJson) var compileRes = readResults(compileJson) @@ -376,15 +386,10 @@ proc main() = listResults(rejectRes, compileRes, runRes) outputJSON(rejectRes, compileRes, runRes) of "dll": - var r = initResults() runDLLTests r, p.cmdLineRest.string - echo r.data, r of "gc": - var r = initResults() runGCTests(r, p.cmdLineRest.string) - echo r.data, r of "test", "comp", "rej": - var r = initResults() if p.kind != cmdArgument: quit usage var testFile = p.key.string p.next() @@ -394,10 +399,11 @@ proc main() = compileSingleTest(r, testFile, p.cmdLineRest.string) else: runSingleTest(r, testFile, p.cmdLineRest.string) - echo r.data, r else: quit usage + if optPrintResults: echo r, r.data + if paramCount() == 0: quit usage main() |