Fix tests when the sqlite3 command line utility isn't installed.

We know the user already has to have python, so use its bindings.
This commit is contained in:
Joseph Garvin 2011-02-22 22:47:00 -06:00 committed by Avery Pennarun
commit d039aad57b
12 changed files with 50 additions and 41 deletions

21
t/flush-cache.py Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env python
import os, os.path, sqlite3, sys
if "DO_BUILT" in os.environ:
sys.exit(0)
print >>sys.stderr, "Flushing redo cache..."
db_file = os.path.join(os.environ["REDO_BASE"], ".redo", "db.sqlite3")
db_con = sqlite3.connect(db_file, timeout=5000)
db_con.executescript("pragma synchronous = off;"
"update Files set checked_runid=checked_runid-1, "
" changed_runid=changed_runid-1, "
" failed_runid=failed_runid-1;")
db_con.commit()
db_con.close()