make tests green again

This commit is contained in:
Andreas Rumpf 2016-11-22 10:01:51 +01:00
commit 204838b358

View file

@ -9,7 +9,7 @@
## Memory tracking support for Nim. ## Memory tracking support for Nim.
when not defined(memTracker): when not defined(memTracker) and not isMainModule:
{.error: "Memory tracking support is turned off!".} {.error: "Memory tracking support is turned off!".}
{.push memtracker: off.} {.push memtracker: off.}
@ -31,7 +31,8 @@ template sbind(x: int; value) =
if ret != SQLITE_OK: if ret != SQLITE_OK:
quit "could not bind value" quit "could not bind value"
proc logEntries(log: TrackLog) {.nimcall.} = when defined(memTracker):
proc logEntries(log: TrackLog) {.nimcall.} =
for i in 0..log.count-1: for i in 0..log.count-1:
var success = false var success = false
let e = log.data[i] let e = log.data[i]
@ -72,6 +73,7 @@ if sqlite3.open("memtrack.db", dbHandle) == SQLITE_OK:
const query = "INSERT INTO tracking(op, address, size, file, line) values (?, ?, ?, ?, ?)" const query = "INSERT INTO tracking(op, address, size, file, line) values (?, ?, ?, ?, ?)"
if prepare_v2(dbHandle, query, if prepare_v2(dbHandle, query,
query.len, insertStmt, nil) == SQLITE_OK: query.len, insertStmt, nil) == SQLITE_OK:
when defined(memTracker):
setTrackLogger logEntries setTrackLogger logEntries
else: else:
quit "could not prepare statement B " & $sqlite3.errmsg(dbHandle) quit "could not prepare statement B " & $sqlite3.errmsg(dbHandle)