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:
parent
e8790145be
commit
d039aad57b
12 changed files with 50 additions and 41 deletions
|
|
@ -5,21 +5,21 @@ redo t/always1
|
||||||
cd t
|
cd t
|
||||||
[ "$(wc -l <always1.log)" -eq 1 ] || exit 11
|
[ "$(wc -l <always1.log)" -eq 1 ] || exit 11
|
||||||
|
|
||||||
# This shouldn't rebuild, but because other people might be running flush-cache.sh
|
# This shouldn't rebuild, but because other people might be running flush-cache.py
|
||||||
# in parallel with us, we can't be 100% sure it won't. So don't test it.
|
# in parallel with us, we can't be 100% sure it won't. So don't test it.
|
||||||
#redo-ifchange always1
|
#redo-ifchange always1
|
||||||
#[ "$(wc -l <always1.log)" -eq 1 ] || exit 21
|
#[ "$(wc -l <always1.log)" -eq 1 ] || exit 21
|
||||||
|
|
||||||
./flush-cache.sh
|
./flush-cache.py
|
||||||
redo-ifchange always1
|
redo-ifchange always1
|
||||||
. ./skip-if-minimal-do.sh
|
. ./skip-if-minimal-do.sh
|
||||||
[ "$(wc -l <always1.log)" -eq 2 ] || exit 31
|
[ "$(wc -l <always1.log)" -eq 2 ] || exit 31
|
||||||
|
|
||||||
./flush-cache.sh
|
./flush-cache.py
|
||||||
redo-ifchange always1
|
redo-ifchange always1
|
||||||
[ "$(wc -l <always1.log)" -eq 3 ] || exit 41
|
[ "$(wc -l <always1.log)" -eq 3 ] || exit 41
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
./t/flush-cache.sh
|
./t/flush-cache.py
|
||||||
redo-ifchange t/always1
|
redo-ifchange t/always1
|
||||||
[ "$(wc -l <t/always1.log)" -eq 4 ] || exit 51
|
[ "$(wc -l <t/always1.log)" -eq 4 ] || exit 51
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,15 @@ rm -f chdir1
|
||||||
redo chdir2
|
redo chdir2
|
||||||
redo chdir3
|
redo chdir3
|
||||||
|
|
||||||
./flush-cache.sh
|
./flush-cache.py
|
||||||
redo-ifchange chdir3
|
redo-ifchange chdir3
|
||||||
|
|
||||||
rm -f chdir1
|
rm -f chdir1
|
||||||
./flush-cache.sh
|
./flush-cache.py
|
||||||
redo-ifchange chdir3
|
redo-ifchange chdir3
|
||||||
[ -e chdir1 ] || exit 77
|
[ -e chdir1 ] || exit 77
|
||||||
|
|
||||||
rm -f chdir1
|
rm -f chdir1
|
||||||
./flush-cache.sh
|
./flush-cache.py
|
||||||
redo-ifchange chdir3
|
redo-ifchange chdir3
|
||||||
[ -e chdir1 ] || exit 78
|
[ -e chdir1 ] || exit 78
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
rm -f *.out *.log
|
rm -f *.out *.log
|
||||||
|
|
||||||
../../flush-cache.sh
|
../../flush-cache.py
|
||||||
redo-ifchange 1.out 2.out
|
redo-ifchange 1.out 2.out
|
||||||
[ "$(cat 1.log | wc -l)" -eq 1 ] || exit 55
|
[ "$(cat 1.log | wc -l)" -eq 1 ] || exit 55
|
||||||
[ "$(cat 2.log | wc -l)" -eq 1 ] || exit 56
|
[ "$(cat 2.log | wc -l)" -eq 1 ] || exit 56
|
||||||
../../flush-cache.sh
|
../../flush-cache.py
|
||||||
touch 1.in
|
touch 1.in
|
||||||
redo-ifchange 1.out 2.out
|
redo-ifchange 1.out 2.out
|
||||||
[ "$(cat 2.log | wc -l)" -eq 1 ] || exit 58
|
[ "$(cat 2.log | wc -l)" -eq 1 ] || exit 58
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
rm -f log dir1/log dir1/stinky
|
rm -f log dir1/log dir1/stinky
|
||||||
touch t1.do
|
touch t1.do
|
||||||
../../flush-cache.sh
|
../../flush-cache.py
|
||||||
redo t1
|
redo t1
|
||||||
touch t1.do
|
touch t1.do
|
||||||
../../flush-cache.sh
|
../../flush-cache.py
|
||||||
redo t1
|
redo t1
|
||||||
../../flush-cache.sh
|
../../flush-cache.py
|
||||||
redo-ifchange t1
|
redo-ifchange t1
|
||||||
C1="$(wc -l <dir1/log)"
|
C1="$(wc -l <dir1/log)"
|
||||||
C2="$(wc -l <log)"
|
C2="$(wc -l <log)"
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ rm -f static.log
|
||||||
redo static1 static2
|
redo static1 static2
|
||||||
|
|
||||||
touch static.in
|
touch static.in
|
||||||
../flush-cache.sh
|
../flush-cache.py
|
||||||
redo-ifchange static1 static2
|
redo-ifchange static1 static2
|
||||||
|
|
||||||
COUNT=$(wc -l <static.log)
|
COUNT=$(wc -l <static.log)
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
rm -f genfile2 genfile2.do genfile.log
|
rm -f genfile2 genfile2.do genfile.log
|
||||||
|
|
||||||
echo echo hello >genfile2.do
|
echo echo hello >genfile2.do
|
||||||
../flush-cache.sh
|
../flush-cache.py
|
||||||
redo genfile1
|
redo genfile1
|
||||||
|
|
||||||
# this will cause a rebuild:
|
# this will cause a rebuild:
|
||||||
# genfile1 depends on genfile2 depends on genfile2.do
|
# genfile1 depends on genfile2 depends on genfile2.do
|
||||||
rm -f genfile2.do
|
rm -f genfile2.do
|
||||||
../flush-cache.sh
|
../flush-cache.py
|
||||||
redo-ifchange genfile1
|
redo-ifchange genfile1
|
||||||
|
|
||||||
# but genfile2.do was gone last time, so genfile2 no longer depends on it.
|
# but genfile2.do was gone last time, so genfile2 no longer depends on it.
|
||||||
# thus, it can be considered up-to-date. Prior versions of redo had a bug
|
# thus, it can be considered up-to-date. Prior versions of redo had a bug
|
||||||
# where the dependency on genfile2.do was never dropped.
|
# where the dependency on genfile2.do was never dropped.
|
||||||
../flush-cache.sh
|
../flush-cache.py
|
||||||
redo-ifchange genfile1
|
redo-ifchange genfile1
|
||||||
|
|
||||||
COUNT=$(wc -l <genfile.log)
|
COUNT=$(wc -l <genfile.log)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ if [ -e t1a ]; then
|
||||||
else
|
else
|
||||||
BEFORE=
|
BEFORE=
|
||||||
fi
|
fi
|
||||||
../flush-cache.sh
|
../flush-cache.py
|
||||||
redo-ifchange t1a # it definitely had to rebuild because t1dep changed
|
redo-ifchange t1a # it definitely had to rebuild because t1dep changed
|
||||||
AFTER="$(cat t1a)"
|
AFTER="$(cat t1a)"
|
||||||
if [ "$BEFORE" = "$AFTER" ]; then
|
if [ "$BEFORE" = "$AFTER" ]; then
|
||||||
|
|
|
||||||
21
t/flush-cache.py
Executable file
21
t/flush-cache.py
Executable 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()
|
||||||
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#echo "Flushing redo cache..." >&2
|
|
||||||
if [ -z "$DO_BUILT" ]; then
|
|
||||||
(
|
|
||||||
echo ".timeout 5000"
|
|
||||||
echo "pragma synchronous = off;"
|
|
||||||
echo "update Files set checked_runid=checked_runid-1, " \
|
|
||||||
" changed_runid=changed_runid-1, " \
|
|
||||||
" failed_runid=failed_runid-1;"
|
|
||||||
) | sqlite3 "$REDO_BASE/.redo/db.sqlite3"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
@ -10,11 +10,11 @@ for d in 1 2; do
|
||||||
[ "$(wc -l <ifcreate$d.log)" -eq 1 ] || exit ${d}1
|
[ "$(wc -l <ifcreate$d.log)" -eq 1 ] || exit ${d}1
|
||||||
redo-ifchange ifcreate$d
|
redo-ifchange ifcreate$d
|
||||||
[ "$(wc -l <ifcreate$d.log)" -eq 1 ] || exit ${d}2
|
[ "$(wc -l <ifcreate$d.log)" -eq 1 ] || exit ${d}2
|
||||||
./flush-cache.sh
|
./flush-cache.py
|
||||||
touch ifcreate$d.dep
|
touch ifcreate$d.dep
|
||||||
redo-ifchange ifcreate$d
|
redo-ifchange ifcreate$d
|
||||||
[ "$(wc -l <ifcreate$d.log)" -eq 2 ] || exit ${d}3
|
[ "$(wc -l <ifcreate$d.log)" -eq 2 ] || exit ${d}3
|
||||||
./flush-cache.sh
|
./flush-cache.py
|
||||||
rm ifcreate$d.dep
|
rm ifcreate$d.dep
|
||||||
redo-ifchange ifcreate$d
|
redo-ifchange ifcreate$d
|
||||||
[ "$(wc -l <ifcreate$d.log)" -eq 3 ] || exit ${d}4
|
[ "$(wc -l <ifcreate$d.log)" -eq 3 ] || exit ${d}4
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
rm -f makedir.log
|
rm -f makedir.log
|
||||||
redo makedir
|
redo makedir
|
||||||
touch makedir/outfile
|
touch makedir/outfile
|
||||||
./flush-cache.sh
|
./flush-cache.py
|
||||||
redo-ifchange makedir
|
redo-ifchange makedir
|
||||||
COUNT=$(wc -l <makedir.log)
|
COUNT=$(wc -l <makedir.log)
|
||||||
[ "$COUNT" -eq 1 ] || exit 99
|
[ "$COUNT" -eq 1 ] || exit 99
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,32 @@
|
||||||
rm -f stampy usestamp usestamp2 stampy.log usestamp.log usestamp2.log
|
rm -f stampy usestamp usestamp2 stampy.log usestamp.log usestamp2.log
|
||||||
echo one >inp
|
echo one >inp
|
||||||
|
|
||||||
../flush-cache.sh
|
../flush-cache.py
|
||||||
redo stampy
|
redo stampy
|
||||||
[ "$(wc -l <stampy.log)" -eq 1 ] || exit 11
|
[ "$(wc -l <stampy.log)" -eq 1 ] || exit 11
|
||||||
|
|
||||||
# stampy already exists, so we won't generate it a second time, even though
|
# stampy already exists, so we won't generate it a second time, even though
|
||||||
# usestamp depends on it.
|
# usestamp depends on it.
|
||||||
../flush-cache.sh
|
../flush-cache.py
|
||||||
redo-ifchange usestamp
|
redo-ifchange usestamp
|
||||||
[ "$(wc -l <stampy.log)" -eq 1 ] || exit 21
|
[ "$(wc -l <stampy.log)" -eq 1 ] || exit 21
|
||||||
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 12
|
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 12
|
||||||
|
|
||||||
../flush-cache.sh
|
../flush-cache.py
|
||||||
redo stampy
|
redo stampy
|
||||||
. ../skip-if-minimal-do.sh
|
. ../skip-if-minimal-do.sh
|
||||||
[ "$(wc -l <stampy.log)" -eq 2 ] || exit 31
|
[ "$(wc -l <stampy.log)" -eq 2 ] || exit 31
|
||||||
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 32
|
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 32
|
||||||
|
|
||||||
# same as above: stampy is already up-to-date, so it won't be redone.
|
# same as above: stampy is already up-to-date, so it won't be redone.
|
||||||
../flush-cache.sh
|
../flush-cache.py
|
||||||
redo-ifchange usestamp
|
redo-ifchange usestamp
|
||||||
[ "$(wc -l <stampy.log)" -eq 2 ] || exit 41
|
[ "$(wc -l <stampy.log)" -eq 2 ] || exit 41
|
||||||
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 42
|
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 42
|
||||||
|
|
||||||
# stampy depends on bob, so we'll have to rebuild stampy automatically. But
|
# stampy depends on bob, so we'll have to rebuild stampy automatically. But
|
||||||
# stampy's checksum will still be identical.
|
# stampy's checksum will still be identical.
|
||||||
../flush-cache.sh
|
../flush-cache.py
|
||||||
redo bob
|
redo bob
|
||||||
redo-ifchange usestamp
|
redo-ifchange usestamp
|
||||||
[ "$(wc -l <stampy.log)" -eq 3 ] || exit 43
|
[ "$(wc -l <stampy.log)" -eq 3 ] || exit 43
|
||||||
|
|
@ -34,13 +34,13 @@ redo-ifchange usestamp
|
||||||
|
|
||||||
# Make sure the previous step correctly marked stampy and usestamp as up-to-date
|
# Make sure the previous step correctly marked stampy and usestamp as up-to-date
|
||||||
# even though *neither* of them is newer than bob.
|
# even though *neither* of them is newer than bob.
|
||||||
../flush-cache.sh
|
../flush-cache.py
|
||||||
redo-ifchange usestamp
|
redo-ifchange usestamp
|
||||||
[ "$(wc -l <stampy.log)" -eq 3 ] || exit 45
|
[ "$(wc -l <stampy.log)" -eq 3 ] || exit 45
|
||||||
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 46
|
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 46
|
||||||
|
|
||||||
# now we're changing the contents of stampy.
|
# now we're changing the contents of stampy.
|
||||||
../flush-cache.sh
|
../flush-cache.py
|
||||||
echo two >inp
|
echo two >inp
|
||||||
redo stampy
|
redo stampy
|
||||||
[ "$(wc -l <stampy.log)" -eq 4 ] || exit 51
|
[ "$(wc -l <stampy.log)" -eq 4 ] || exit 51
|
||||||
|
|
@ -53,7 +53,7 @@ redo-ifchange usestamp usestamp2
|
||||||
|
|
||||||
# when we delete the file and it gets regenerated identically, it's as good as
|
# when we delete the file and it gets regenerated identically, it's as good as
|
||||||
# never having been deleted. So usestamp won't need to change.
|
# never having been deleted. So usestamp won't need to change.
|
||||||
../flush-cache.sh
|
../flush-cache.py
|
||||||
rm -f stampy
|
rm -f stampy
|
||||||
redo-ifchange usestamp usestamp2
|
redo-ifchange usestamp usestamp2
|
||||||
[ "$(wc -l <stampy.log)" -eq 5 ] || exit 71
|
[ "$(wc -l <stampy.log)" -eq 5 ] || exit 71
|
||||||
|
|
@ -61,7 +61,7 @@ redo-ifchange usestamp usestamp2
|
||||||
[ "$(wc -l <usestamp2.log)" -eq 1 ] || exit 73
|
[ "$(wc -l <usestamp2.log)" -eq 1 ] || exit 73
|
||||||
|
|
||||||
# this simple test used to cause a deadlock.
|
# this simple test used to cause a deadlock.
|
||||||
../flush-cache.sh
|
../flush-cache.py
|
||||||
rm -f stampy
|
rm -f stampy
|
||||||
redo-ifchange stampy
|
redo-ifchange stampy
|
||||||
[ "$(wc -l <stampy.log)" -eq 6 ] || exit 74
|
[ "$(wc -l <stampy.log)" -eq 6 ] || exit 74
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue