make tests green again
This commit is contained in:
parent
83ffc6bf54
commit
204838b358
1 changed files with 19 additions and 17 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue