t/*: update some tests from my rewrite branch.

Just some minor test fixes so that tests pass on both current redo and the
upcoming rewritten one.
This commit is contained in:
Avery Pennarun 2012-02-07 23:52:54 -05:00
commit 116c279e96
4 changed files with 11 additions and 18 deletions

View file

@ -1,3 +0,0 @@
exec >&2
[ -n "$DO_BUILT" ] && exit 0 # not relevant in minimal/do
python tstate.py

View file

@ -25,27 +25,32 @@ redo-ifchange usestamp
[ "$(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, so usestamp shouldn't rebuild.
../flush-cache ../flush-cache
redo bob redo bob
../flush-cache
redo-ifchange usestamp redo-ifchange usestamp
[ "$(wc -l <stampy.log)" -eq 3 ] || exit 43 [ "$(wc -l <stampy.log)" -eq 3 ] || exit 43
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 44 [ "$(wc -l <usestamp.log)" -eq 1 ] || exit 44
# 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
# even though *neither* of them is newer than bob. # up-to-date even though *neither* of them is newer than bob.
../flush-cache ../flush-cache
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. Thus usestamp will need to
../flush-cache # be rebuilt, but not yet...
echo two >inp echo two >inp
../flush-cache
redo stampy redo stampy
[ "$(wc -l <stampy.log)" -eq 4 ] || exit 51 [ "$(wc -l <stampy.log)" -eq 4 ] || exit 51
[ "$(wc -l <usestamp.log)" -eq 1 ] || exit 52 [ "$(wc -l <usestamp.log)" -eq 1 ] || exit 52
# let's see about usestamp. It needs to be rebuilt because stampy has changed,
# but since stampy is *already* changed, stampy itself shouldn't be re-rebuilt.
../flush-cache
redo-ifchange usestamp usestamp2 redo-ifchange usestamp usestamp2
[ "$(wc -l <stampy.log)" -eq 4 ] || exit 61 [ "$(wc -l <stampy.log)" -eq 4 ] || exit 61
[ "$(wc -l <usestamp.log)" -eq 2 ] || exit 62 [ "$(wc -l <usestamp.log)" -eq 2 ] || exit 62

View file

@ -4,6 +4,6 @@ redo nonshelltest shelltest \
deltest deltest2 test.args test2.args passfailtest chdirtest \ deltest deltest2 test.args test2.args passfailtest chdirtest \
curse/test deps/test "space dir/test" modetest makedir2 \ curse/test deps/test "space dir/test" modetest makedir2 \
silencetest touchtest stamp/test alwaystest ifcreate-test \ silencetest touchtest stamp/test alwaystest ifcreate-test \
unicode blank/blank vartest atime autosubdir/test pytest \ unicode blank/blank vartest atime autosubdir/test \
fail/test fail/test

View file

@ -1,9 +0,0 @@
import sys
sys.path.insert(0, '..')
import state
assert(state.relpath('/a/b/c', '/a/b') == 'c')
assert(state.relpath('/a/b/c/', '/a/b') == 'c')
assert(state.relpath('/a/b/c', '/a/b/') == 'c')
assert(state.relpath('/a/b/c//', '/a/b/') == 'c')
assert(state.relpath('/a/b/c/../d', '/a/b/') == 'd')