mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
tester cleanup; enable some rod tests
This commit is contained in:
@@ -145,15 +145,16 @@ proc fixupDispatcher(meth, disp: PSym) =
|
||||
disp.typ.lockLevel = meth.typ.lockLevel
|
||||
|
||||
proc methodDef*(s: PSym, fromCache: bool) =
|
||||
var L = len(gMethods)
|
||||
let L = len(gMethods)
|
||||
var witness: PSym
|
||||
for i in countup(0, L - 1):
|
||||
var disp = gMethods[i].dispatcher
|
||||
let disp = gMethods[i].dispatcher
|
||||
case sameMethodBucket(disp, s)
|
||||
of Yes:
|
||||
add(gMethods[i].methods, s)
|
||||
attachDispatcher(s, lastSon(disp.ast))
|
||||
fixupDispatcher(s, disp)
|
||||
#echo "fixup ", disp.name.s, " ", disp.id
|
||||
when useEffectSystem: checkMethodEffects(disp, s)
|
||||
if sfBase in s.flags and gMethods[i].methods[0] != s:
|
||||
# already exists due to forwarding definition?
|
||||
|
||||
@@ -163,7 +163,7 @@ proc myImportModule(c: PContext, n: PNode): PSym =
|
||||
var f = checkModuleName(n)
|
||||
if f != InvalidFileIDX:
|
||||
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")
|
||||
if sfDeprecated in result.flags:
|
||||
message(n.info, warnDeprecated, result.name.s)
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
const
|
||||
MaxSetElements* = 1 shl 16 # (2^16) to support unicode character sets?
|
||||
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.methods = ""
|
||||
result.init = ""
|
||||
result.origFile = module.info.toFilename
|
||||
result.origFile = module.info.toFullPath
|
||||
result.data = newStringOfCap(12_000)
|
||||
|
||||
proc addModDep(w: PRodWriter, dep: string; info: TLineInfo) =
|
||||
@@ -100,6 +100,10 @@ proc pushType(w: PRodWriter, t: PType) =
|
||||
proc pushSym(w: PRodWriter, s: PSym) =
|
||||
# check so that the stack does not grow too large:
|
||||
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)
|
||||
|
||||
proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode,
|
||||
@@ -119,7 +123,7 @@ proc encodeNode(w: PRodWriter, fInfo: TLineInfo, n: PNode,
|
||||
result.add(',')
|
||||
encodeVInt(n.info.line, result)
|
||||
result.add(',')
|
||||
encodeVInt(fileIdx(w, toFilename(n.info)), result)
|
||||
encodeVInt(fileIdx(w, toFullPath(n.info)), result)
|
||||
elif fInfo.line != n.info.line:
|
||||
result.add('?')
|
||||
encodeVInt(n.info.col, result)
|
||||
@@ -224,8 +228,7 @@ proc encodeType(w: PRodWriter, t: PType, result: var string) =
|
||||
if t.lockLevel.ord != UnspecifiedLockLevel.ord:
|
||||
add(result, '\14')
|
||||
encodeVInt(t.lockLevel.int16, result)
|
||||
|
||||
if t.destructor != nil:
|
||||
if t.destructor != nil and t.destructor.id != 0:
|
||||
add(result, '\15')
|
||||
encodeVInt(t.destructor.id, result)
|
||||
pushSym(w, t.destructor)
|
||||
@@ -293,7 +296,7 @@ proc encodeSym(w: PRodWriter, s: PSym, result: var string) =
|
||||
result.add(',')
|
||||
if s.info.line != -1'i16: encodeVInt(s.info.line, result)
|
||||
result.add(',')
|
||||
encodeVInt(fileIdx(w, toFilename(s.info)), result)
|
||||
encodeVInt(fileIdx(w, toFullPath(s.info)), result)
|
||||
if s.owner != nil:
|
||||
result.add('*')
|
||||
encodeVInt(s.owner.id, result)
|
||||
@@ -607,7 +610,7 @@ proc process(c: PPassContext, n: PNode): PNode =
|
||||
for i in countup(0, sonsLen(n) - 1):
|
||||
addModDep(w, getModuleName(n.sons[i]), n.info)
|
||||
addStmt(w, n)
|
||||
of nkFromStmt:
|
||||
of nkFromStmt, nkImportExceptStmt:
|
||||
addModDep(w, getModuleName(n.sons[0]), n.info)
|
||||
addStmt(w, n)
|
||||
of nkIncludeStmt:
|
||||
|
||||
@@ -59,6 +59,7 @@ var
|
||||
thisMachine: MachineId
|
||||
thisCommit: CommitId
|
||||
|
||||
{.experimental.}
|
||||
proc `()`(cmd: string{lit}): string = cmd.execProcess.string.strip
|
||||
|
||||
proc getMachine*(db: DbConn): MachineId =
|
||||
|
||||
@@ -24,7 +24,7 @@ proc delNimCache() =
|
||||
echo "[Warning] could not delete: ", nimcacheDir
|
||||
|
||||
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)
|
||||
|
||||
delNimCache()
|
||||
@@ -46,18 +46,19 @@ proc runRodFiles(r: var TResults, cat: Category, options: string) =
|
||||
test "deada2"
|
||||
delNimCache()
|
||||
|
||||
# test method generation:
|
||||
test "bmethods"
|
||||
test "bmethods2"
|
||||
delNimCache()
|
||||
when false:
|
||||
# test method generation:
|
||||
test "bmethods"
|
||||
test "bmethods2"
|
||||
delNimCache()
|
||||
|
||||
# test generics:
|
||||
test "tgeneric1"
|
||||
test "tgeneric2"
|
||||
delNimCache()
|
||||
# test generics:
|
||||
test "tgeneric1"
|
||||
test "tgeneric2"
|
||||
delNimCache()
|
||||
|
||||
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)
|
||||
|
||||
delNimCache()
|
||||
@@ -114,20 +115,20 @@ proc dllTests(r: var TResults, cat: Category, options: string) =
|
||||
# ------------------------------ GC tests -------------------------------------
|
||||
|
||||
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 &
|
||||
" -d:release", cat, actionRun)
|
||||
testSpec r, makeTest("tests/gc" / filename, options &
|
||||
" -d:release -d:useRealtimeGC", cat, actionRun)
|
||||
|
||||
template testWithoutBoehm(filename: expr): stmt =
|
||||
template testWithoutBoehm(filename: untyped) =
|
||||
testWithoutMs filename
|
||||
testSpec r, makeTest("tests/gc" / filename, options &
|
||||
" --gc:markAndSweep", cat, actionRun)
|
||||
testSpec r, makeTest("tests/gc" / filename, options &
|
||||
" -d:release --gc:markAndSweep", cat, actionRun)
|
||||
template test(filename: expr): stmt =
|
||||
template test(filename: untyped) =
|
||||
testWithoutBoehm filename
|
||||
when not defined(windows):
|
||||
# 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 -----------------------------------
|
||||
|
||||
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 &
|
||||
" -d:release", cat, actionRun)
|
||||
@@ -209,7 +210,7 @@ proc debuggerTests(r: var TResults, cat: Category, options: string) =
|
||||
# ------------------------- JS tests ------------------------------------------
|
||||
|
||||
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,
|
||||
actionRun, targetJS)
|
||||
testSpec r, makeTest(filename, options & " -d:nodejs -d:release", cat,
|
||||
|
||||
Reference in New Issue
Block a user