tester cleanup; enable some rod tests
This commit is contained in:
parent
7630cd076b
commit
68e30d7d52
6 changed files with 31 additions and 25 deletions
|
|
@ -145,15 +145,16 @@ proc fixupDispatcher(meth, disp: PSym) =
|
||||||
disp.typ.lockLevel = meth.typ.lockLevel
|
disp.typ.lockLevel = meth.typ.lockLevel
|
||||||
|
|
||||||
proc methodDef*(s: PSym, fromCache: bool) =
|
proc methodDef*(s: PSym, fromCache: bool) =
|
||||||
var L = len(gMethods)
|
let L = len(gMethods)
|
||||||
var witness: PSym
|
var witness: PSym
|
||||||
for i in countup(0, L - 1):
|
for i in countup(0, L - 1):
|
||||||
var disp = gMethods[i].dispatcher
|
let disp = gMethods[i].dispatcher
|
||||||
case sameMethodBucket(disp, s)
|
case sameMethodBucket(disp, s)
|
||||||
of Yes:
|
of Yes:
|
||||||
add(gMethods[i].methods, s)
|
add(gMethods[i].methods, s)
|
||||||
attachDispatcher(s, lastSon(disp.ast))
|
attachDispatcher(s, lastSon(disp.ast))
|
||||||
fixupDispatcher(s, disp)
|
fixupDispatcher(s, disp)
|
||||||
|
#echo "fixup ", disp.name.s, " ", disp.id
|
||||||
when useEffectSystem: checkMethodEffects(disp, s)
|
when useEffectSystem: checkMethodEffects(disp, s)
|
||||||
if sfBase in s.flags and gMethods[i].methods[0] != s:
|
if sfBase in s.flags and gMethods[i].methods[0] != s:
|
||||||
# already exists due to forwarding definition?
|
# already exists due to forwarding definition?
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ proc myImportModule(c: PContext, n: PNode): PSym =
|
||||||
var f = checkModuleName(n)
|
var f = checkModuleName(n)
|
||||||
if f != InvalidFileIDX:
|
if f != InvalidFileIDX:
|
||||||
result = importModuleAs(n, gImportModule(c.module, f))
|
result = importModuleAs(n, gImportModule(c.module, f))
|
||||||
if result.info.fileIndex == n.info.fileIndex:
|
if result.info.fileIndex == c.module.info.fileIndex:
|
||||||
localError(n.info, errGenerated, "A module cannot import itself")
|
localError(n.info, errGenerated, "A module cannot import itself")
|
||||||
if sfDeprecated in result.flags:
|
if sfDeprecated in result.flags:
|
||||||
message(n.info, warnDeprecated, result.name.s)
|
message(n.info, warnDeprecated, result.name.s)
|
||||||
|
|
|
||||||
|
|
@ -13,5 +13,5 @@
|
||||||
const
|
const
|
||||||
MaxSetElements* = 1 shl 16 # (2^16) to support unicode character sets?
|
MaxSetElements* = 1 shl 16 # (2^16) to support unicode character sets?
|
||||||
VersionAsString* = system.NimVersion
|
VersionAsString* = system.NimVersion
|
||||||
RodFileVersion* = "1218" # modify this if the rod-format changes!
|
RodFileVersion* = "1221" # modify this if the rod-format changes!
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ proc newRodWriter(hash: SecureHash, module: PSym): PRodWriter =
|
||||||
result.converters = ""
|
result.converters = ""
|
||||||
result.methods = ""
|
result.methods = ""
|
||||||
result.init = ""
|
result.init = ""
|
||||||
result.origFile = module.info.toFilename
|
result.origFile = module.info.toFullPath
|
||||||
result.data = newStringOfCap(12_000)
|
result.data = newStringOfCap(12_000)
|
||||||
|
|
||||||
proc addModDep(w: PRodWriter, dep: string; info: TLineInfo) =
|
proc addModDep(w: PRodWriter, dep: string; info: TLineInfo) =
|
||||||
|
|
@ -100,6 +100,10 @@ proc pushType(w: PRodWriter, t: PType) =
|
||||||
proc pushSym(w: PRodWriter, s: PSym) =
|
proc pushSym(w: PRodWriter, s: PSym) =
|
||||||
# check so that the stack does not grow too large:
|
# check so that the stack does not grow too large:
|
||||||
if iiTableGet(w.index.tab, s.id) == InvalidKey:
|
if iiTableGet(w.index.tab, s.id) == InvalidKey:
|
||||||
|
when false:
|
||||||
|
if s.kind == skMethod:
|
||||||
|
echo "encoding ", s.id, " ", s.name.s
|
||||||
|
writeStackTrace()
|
||||||
w.sstack.add(s)
|
w.sstack.add(s)
|
||||||
|
|
||||||
proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode,
|
proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode,
|
||||||
|
|
@ -119,7 +123,7 @@ proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode,
|
||||||
result.add(',')
|
result.add(',')
|
||||||
encodeVInt(n.info.line, result)
|
encodeVInt(n.info.line, result)
|
||||||
result.add(',')
|
result.add(',')
|
||||||
encodeVInt(fileIdx(w, toFilename(n.info)), result)
|
encodeVInt(fileIdx(w, toFullPath(n.info)), result)
|
||||||
elif fInfo.line != n.info.line:
|
elif fInfo.line != n.info.line:
|
||||||
result.add('?')
|
result.add('?')
|
||||||
encodeVInt(n.info.col, result)
|
encodeVInt(n.info.col, result)
|
||||||
|
|
@ -224,8 +228,7 @@ proc encodeType(w: PRodWriter, t: PType, result: var string) =
|
||||||
if t.lockLevel.ord != UnspecifiedLockLevel.ord:
|
if t.lockLevel.ord != UnspecifiedLockLevel.ord:
|
||||||
add(result, '\14')
|
add(result, '\14')
|
||||||
encodeVInt(t.lockLevel.int16, result)
|
encodeVInt(t.lockLevel.int16, result)
|
||||||
|
if t.destructor != nil and t.destructor.id != 0:
|
||||||
if t.destructor != nil:
|
|
||||||
add(result, '\15')
|
add(result, '\15')
|
||||||
encodeVInt(t.destructor.id, result)
|
encodeVInt(t.destructor.id, result)
|
||||||
pushSym(w, t.destructor)
|
pushSym(w, t.destructor)
|
||||||
|
|
@ -293,7 +296,7 @@ proc encodeSym(w: PRodWriter, s: PSym, result: var string) =
|
||||||
result.add(',')
|
result.add(',')
|
||||||
if s.info.line != -1'i16: encodeVInt(s.info.line, result)
|
if s.info.line != -1'i16: encodeVInt(s.info.line, result)
|
||||||
result.add(',')
|
result.add(',')
|
||||||
encodeVInt(fileIdx(w, toFilename(s.info)), result)
|
encodeVInt(fileIdx(w, toFullPath(s.info)), result)
|
||||||
if s.owner != nil:
|
if s.owner != nil:
|
||||||
result.add('*')
|
result.add('*')
|
||||||
encodeVInt(s.owner.id, result)
|
encodeVInt(s.owner.id, result)
|
||||||
|
|
@ -607,7 +610,7 @@ proc process(c: PPassContext, n: PNode): PNode =
|
||||||
for i in countup(0, sonsLen(n) - 1):
|
for i in countup(0, sonsLen(n) - 1):
|
||||||
addModDep(w, getModuleName(n.sons[i]), n.info)
|
addModDep(w, getModuleName(n.sons[i]), n.info)
|
||||||
addStmt(w, n)
|
addStmt(w, n)
|
||||||
of nkFromStmt:
|
of nkFromStmt, nkImportExceptStmt:
|
||||||
addModDep(w, getModuleName(n.sons[0]), n.info)
|
addModDep(w, getModuleName(n.sons[0]), n.info)
|
||||||
addStmt(w, n)
|
addStmt(w, n)
|
||||||
of nkIncludeStmt:
|
of nkIncludeStmt:
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ var
|
||||||
thisMachine: MachineId
|
thisMachine: MachineId
|
||||||
thisCommit: CommitId
|
thisCommit: CommitId
|
||||||
|
|
||||||
|
{.experimental.}
|
||||||
proc `()`(cmd: string{lit}): string = cmd.execProcess.string.strip
|
proc `()`(cmd: string{lit}): string = cmd.execProcess.string.strip
|
||||||
|
|
||||||
proc getMachine*(db: DbConn): MachineId =
|
proc getMachine*(db: DbConn): MachineId =
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ proc delNimCache() =
|
||||||
echo "[Warning] could not delete: ", nimcacheDir
|
echo "[Warning] could not delete: ", nimcacheDir
|
||||||
|
|
||||||
proc runRodFiles(r: var TResults, cat: Category, options: string) =
|
proc runRodFiles(r: var TResults, cat: Category, options: string) =
|
||||||
template test(filename: expr): stmt =
|
template test(filename: untyped) =
|
||||||
testSpec r, makeTest(rodfilesDir / filename, options, cat, actionRun)
|
testSpec r, makeTest(rodfilesDir / filename, options, cat, actionRun)
|
||||||
|
|
||||||
delNimCache()
|
delNimCache()
|
||||||
|
|
@ -46,18 +46,19 @@ proc runRodFiles(r: var TResults, cat: Category, options: string) =
|
||||||
test "deada2"
|
test "deada2"
|
||||||
delNimCache()
|
delNimCache()
|
||||||
|
|
||||||
# test method generation:
|
when false:
|
||||||
test "bmethods"
|
# test method generation:
|
||||||
test "bmethods2"
|
test "bmethods"
|
||||||
delNimCache()
|
test "bmethods2"
|
||||||
|
delNimCache()
|
||||||
|
|
||||||
# test generics:
|
# test generics:
|
||||||
test "tgeneric1"
|
test "tgeneric1"
|
||||||
test "tgeneric2"
|
test "tgeneric2"
|
||||||
delNimCache()
|
delNimCache()
|
||||||
|
|
||||||
proc compileRodFiles(r: var TResults, cat: Category, options: string) =
|
proc compileRodFiles(r: var TResults, cat: Category, options: string) =
|
||||||
template test(filename: expr): stmt =
|
template test(filename: untyped) =
|
||||||
testSpec r, makeTest(rodfilesDir / filename, options, cat)
|
testSpec r, makeTest(rodfilesDir / filename, options, cat)
|
||||||
|
|
||||||
delNimCache()
|
delNimCache()
|
||||||
|
|
@ -114,20 +115,20 @@ proc dllTests(r: var TResults, cat: Category, options: string) =
|
||||||
# ------------------------------ GC tests -------------------------------------
|
# ------------------------------ GC tests -------------------------------------
|
||||||
|
|
||||||
proc gcTests(r: var TResults, cat: Category, options: string) =
|
proc gcTests(r: var TResults, cat: Category, options: string) =
|
||||||
template testWithoutMs(filename: expr): stmt =
|
template testWithoutMs(filename: untyped) =
|
||||||
testSpec r, makeTest("tests/gc" / filename, options, cat, actionRun)
|
testSpec r, makeTest("tests/gc" / filename, options, cat, actionRun)
|
||||||
testSpec r, makeTest("tests/gc" / filename, options &
|
testSpec r, makeTest("tests/gc" / filename, options &
|
||||||
" -d:release", cat, actionRun)
|
" -d:release", cat, actionRun)
|
||||||
testSpec r, makeTest("tests/gc" / filename, options &
|
testSpec r, makeTest("tests/gc" / filename, options &
|
||||||
" -d:release -d:useRealtimeGC", cat, actionRun)
|
" -d:release -d:useRealtimeGC", cat, actionRun)
|
||||||
|
|
||||||
template testWithoutBoehm(filename: expr): stmt =
|
template testWithoutBoehm(filename: untyped) =
|
||||||
testWithoutMs filename
|
testWithoutMs filename
|
||||||
testSpec r, makeTest("tests/gc" / filename, options &
|
testSpec r, makeTest("tests/gc" / filename, options &
|
||||||
" --gc:markAndSweep", cat, actionRun)
|
" --gc:markAndSweep", cat, actionRun)
|
||||||
testSpec r, makeTest("tests/gc" / filename, options &
|
testSpec r, makeTest("tests/gc" / filename, options &
|
||||||
" -d:release --gc:markAndSweep", cat, actionRun)
|
" -d:release --gc:markAndSweep", cat, actionRun)
|
||||||
template test(filename: expr): stmt =
|
template test(filename: untyped) =
|
||||||
testWithoutBoehm filename
|
testWithoutBoehm filename
|
||||||
when not defined(windows):
|
when not defined(windows):
|
||||||
# AR: cannot find any boehm.dll on the net, right now, so disabled
|
# AR: cannot find any boehm.dll on the net, right now, so disabled
|
||||||
|
|
@ -173,7 +174,7 @@ proc longGCTests(r: var TResults, cat: Category, options: string) =
|
||||||
# ------------------------- threading tests -----------------------------------
|
# ------------------------- threading tests -----------------------------------
|
||||||
|
|
||||||
proc threadTests(r: var TResults, cat: Category, options: string) =
|
proc threadTests(r: var TResults, cat: Category, options: string) =
|
||||||
template test(filename: expr): stmt =
|
template test(filename: untyped) =
|
||||||
testSpec r, makeTest("tests/threads" / filename, options, cat, actionRun)
|
testSpec r, makeTest("tests/threads" / filename, options, cat, actionRun)
|
||||||
testSpec r, makeTest("tests/threads" / filename, options &
|
testSpec r, makeTest("tests/threads" / filename, options &
|
||||||
" -d:release", cat, actionRun)
|
" -d:release", cat, actionRun)
|
||||||
|
|
@ -209,7 +210,7 @@ proc debuggerTests(r: var TResults, cat: Category, options: string) =
|
||||||
# ------------------------- JS tests ------------------------------------------
|
# ------------------------- JS tests ------------------------------------------
|
||||||
|
|
||||||
proc jsTests(r: var TResults, cat: Category, options: string) =
|
proc jsTests(r: var TResults, cat: Category, options: string) =
|
||||||
template test(filename: expr): stmt =
|
template test(filename: untyped) =
|
||||||
testSpec r, makeTest(filename, options & " -d:nodejs", cat,
|
testSpec r, makeTest(filename, options & " -d:nodejs", cat,
|
||||||
actionRun, targetJS)
|
actionRun, targetJS)
|
||||||
testSpec r, makeTest(filename, options & " -d:nodejs -d:release", cat,
|
testSpec r, makeTest(filename, options & " -d:nodejs -d:release", cat,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue