mirror of
https://github.com/glebarez/go-sqlite.git
synced 2025-10-05 07:46:50 +08:00
enable memory auditing in most tests/benchmarks using -tags=libc.memgrind
This commit is contained in:
@@ -39,6 +39,7 @@ func makename(inMemory bool, driver string, e int) string {
|
||||
}
|
||||
|
||||
func benchmarkRead(b *testing.B, drivername, file string, n int) {
|
||||
libc.MemAuditStart()
|
||||
os.Remove(file)
|
||||
db, err := sql.Open(drivername, file)
|
||||
if err != nil {
|
||||
@@ -47,6 +48,9 @@ func benchmarkRead(b *testing.B, drivername, file string, n int) {
|
||||
|
||||
defer func() {
|
||||
db.Close()
|
||||
if err := libc.MemAuditReport(); err != nil {
|
||||
b.Error(err)
|
||||
}
|
||||
}()
|
||||
|
||||
if _, err := db.Exec(`
|
||||
@@ -126,6 +130,7 @@ func BenchmarkReading1(b *testing.B) {
|
||||
}
|
||||
|
||||
func benchmarkInsertComparative(b *testing.B, drivername, file string, n int) {
|
||||
libc.MemAuditStart()
|
||||
os.Remove(file)
|
||||
db, err := sql.Open(drivername, file)
|
||||
if err != nil {
|
||||
@@ -134,6 +139,9 @@ func benchmarkInsertComparative(b *testing.B, drivername, file string, n int) {
|
||||
|
||||
defer func() {
|
||||
db.Close()
|
||||
if err := libc.MemAuditReport(); err != nil {
|
||||
b.Error(err)
|
||||
}
|
||||
}()
|
||||
|
||||
if _, err := db.Exec(`
|
||||
|
Reference in New Issue
Block a user