# HG changeset patch # User Thomas Arendsen Hein # Date 2007-12-21 09:24:03 # Node ID 396c7010b0cdd1dd8c3d3578dd2d1a1cf5af42fe # Parent 048889f8c7d14779b45d00da4657ef213be7c375 Use common readlink.py instead of own implementations per test script. diff --git a/tests/readlink.py b/tests/readlink.py new file mode 100755 --- /dev/null +++ b/tests/readlink.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python + +import errno, os, sys + +for f in sys.argv[1:]: + try: + print f, '->', os.readlink(f) + except OSError, err: + if err.errno != errno.EINVAL: raise + print f, 'not a symlink' + +sys.exit(0) diff --git a/tests/test-archive-symlinks b/tests/test-archive-symlinks --- a/tests/test-archive-symlinks +++ b/tests/test-archive-symlinks @@ -4,14 +4,6 @@ origdir=`pwd` -cat >> readlink.py <', os.readlink(f) -EOF - hg init repo cd repo ln -s nothing dangling @@ -25,16 +17,16 @@ hg archive -t zip -p zip ../archive.zip echo '% files' cd "$origdir" cd archive -python ../readlink.py dangling +$TESTDIR/readlink.py dangling echo '% tar' cd "$origdir" tar xf archive.tar cd tar -python ../readlink.py dangling +$TESTDIR/readlink.py dangling echo '% zip' cd "$origdir" unzip archive.zip > /dev/null cd zip -python ../readlink.py dangling +$TESTDIR/readlink.py dangling diff --git a/tests/test-merge-types b/tests/test-merge-types --- a/tests/test-merge-types +++ b/tests/test-merge-types @@ -18,7 +18,7 @@ echo % symlink is left parent, executabl if [ -h a ]; then echo a is a symlink - readlink a + $TESTDIR/readlink.py a elif [ -x a ]; then echo a is executable fi @@ -30,7 +30,7 @@ echo % symlink is right parent, executab if [ -h a ]; then echo a is a symlink - readlink a + $TESTDIR/readlink.py a elif [ -x a ]; then echo a is executable fi diff --git a/tests/test-mq-symlinks b/tests/test-mq-symlinks --- a/tests/test-mq-symlinks +++ b/tests/test-mq-symlinks @@ -3,17 +3,6 @@ echo "[extensions]" >> $HGRCPATH echo "mq=" >> $HGRCPATH -cat >> readlink.py <', os.readlink(f) - except OSError, err: - if err.errno != errno.EINVAL: raise - print f, 'not a symlink' -EOF - hg init hg qinit hg qnew base.patch @@ -21,14 +10,14 @@ echo a > a echo b > b hg add a b hg qrefresh -python readlink.py a +$TESTDIR/readlink.py a hg qnew symlink.patch rm a ln -s b a hg qrefresh --git -python readlink.py a +$TESTDIR/readlink.py a hg qpop hg qpush -python readlink.py a +$TESTDIR/readlink.py a diff --git a/tests/test-symlink-basic b/tests/test-symlink-basic --- a/tests/test-symlink-basic +++ b/tests/test-symlink-basic @@ -7,14 +7,6 @@ cleanpath() sed -e "s:/.*\(/test-symlink-basic/.*\):...\1:" } -cat >> readlink.py <', os.readlink(f) -EOF - hg init a cd a ln -s nothing dangling @@ -25,29 +17,29 @@ hg commit -m 'add symlink' -d '0 0' hg tip -v hg manifest --debug echo '% rev 0:' -python ../readlink.py dangling +$TESTDIR/readlink.py dangling rm dangling ln -s void dangling hg commit -m 'change symlink' echo '% rev 1:' -python ../readlink.py dangling +$TESTDIR/readlink.py dangling echo '% modifying link' rm dangling ln -s empty dangling -python ../readlink.py dangling +$TESTDIR/readlink.py dangling echo '% reverting to rev 0:' hg revert -r 0 -a -python ../readlink.py dangling +$TESTDIR/readlink.py dangling echo '% backups:' -python ../readlink.py *.orig +$TESTDIR/readlink.py *.orig rm *.orig hg up -C echo '% copies' hg cp -v dangling dangling2 hg st -Cmard -python ../readlink.py dangling dangling2 +$TESTDIR/readlink.py dangling dangling2