Rename flush-cache.py to flush-cache, and rearrange the code a bit.

It was working fine, but the style wasn't exactly the way I like it, because
I'm unnecessarily picky. :)

Also, removed the file extension since we should probably learn from the
fact that it's already been rewritten once from one language to another.
Who knows, maybe it will be again someday.
This commit is contained in:
Avery Pennarun 2011-02-23 01:24:48 -08:00
commit 94c254de77
12 changed files with 47 additions and 51 deletions

View file

@ -1,32 +1,32 @@
rm -f stampy usestamp usestamp2 stampy.log usestamp.log usestamp2.log
echo one >inp
../flush-cache.py
../flush-cache
redo stampy
[ "$(wc -l <stampy.log)" -eq 1 ] || exit 11
# stampy already exists, so we won't generate it a second time, even though
# usestamp depends on it.
../flush-cache.py
../flush-cache
redo-ifchange usestamp
[ "$(wc -l <stampy.log)" -eq 1 ] || exit 21
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 12
../flush-cache.py
../flush-cache
redo stampy
. ../skip-if-minimal-do.sh
[ "$(wc -l <stampy.log)" -eq 2 ] || exit 31
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 32
# same as above: stampy is already up-to-date, so it won't be redone.
../flush-cache.py
../flush-cache
redo-ifchange usestamp
[ "$(wc -l <stampy.log)" -eq 2 ] || exit 41
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 42
# stampy depends on bob, so we'll have to rebuild stampy automatically. But
# stampy's checksum will still be identical.
../flush-cache.py
../flush-cache
redo bob
redo-ifchange usestamp
[ "$(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
# even though *neither* of them is newer than bob.
../flush-cache.py
../flush-cache
redo-ifchange usestamp
[ "$(wc -l <stampy.log)" -eq 3 ] || exit 45
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 46
# now we're changing the contents of stampy.
../flush-cache.py
../flush-cache
echo two >inp
redo stampy
[ "$(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
# never having been deleted. So usestamp won't need to change.
../flush-cache.py
../flush-cache
rm -f stampy
redo-ifchange usestamp usestamp2
[ "$(wc -l <stampy.log)" -eq 5 ] || exit 71
@ -61,7 +61,7 @@ redo-ifchange usestamp usestamp2
[ "$(wc -l <usestamp2.log)" -eq 1 ] || exit 73
# this simple test used to cause a deadlock.
../flush-cache.py
../flush-cache
rm -f stampy
redo-ifchange stampy
[ "$(wc -l <stampy.log)" -eq 6 ] || exit 74