tests/test-verify
author Will Maier <willmaier@ml1.net>
Thu, 04 Jun 2009 17:33:30 -0600
changeset 8720 da1b93583855
parent 8167 6c82beaaa11a
child 9690 b33d70849a20
permissions -rwxr-xr-x
Make test-verify SUSv3 compatible. 'head -c' isn't supported on (at least) OpenBSD and is not part of SUSv3. Instead, use dd. See also: http://www.opengroup.org/onlinepubs/009695399/utilities/head.html

#!/bin/sh

echo % prepare repo
hg init a
cd a
echo "some text" > FOO.txt
echo "another text" > bar.txt
echo "more text" > QUICK.txt
hg add
hg ci -mtest1

echo
echo % verify
hg verify

echo
echo % introduce some bugs in repo
cd .hg/store/data
mv _f_o_o.txt.i X_f_o_o.txt.i
mv bar.txt.i xbar.txt.i
rm _q_u_i_c_k.txt.i

echo
echo % verify
hg verify

cd ..

echo % test revlog corruption
hg init b
cd b

touch a
hg add a
hg ci -m a

echo 'corrupted' > b
dd if=.hg/store/data/a.i of=start bs=1 count=20 2>/dev/null
cat start b > .hg/store/data/a.i

echo
echo % verify
hg verify

exit 0