Use common readlink.py instead of own implementations per test script.
authorThomas Arendsen Hein <thomas@intevation.de>
Fri, 21 Dec 2007 10:24:03 +0100
changeset 5683 396c7010b0cd
parent 5682 048889f8c7d1
child 5684 c08cda4e4ddd
Use common readlink.py instead of own implementations per test script.
tests/readlink.py
tests/test-archive-symlinks
tests/test-merge-types
tests/test-mq-symlinks
tests/test-symlink-basic
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/readlink.py	Fri Dec 21 10:24:03 2007 +0100
@@ -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)
--- a/tests/test-archive-symlinks	Fri Dec 21 09:51:19 2007 +0100
+++ b/tests/test-archive-symlinks	Fri Dec 21 10:24:03 2007 +0100
@@ -4,14 +4,6 @@
 
 origdir=`pwd`
 
-cat >> readlink.py <<EOF
-import os
-import sys
-
-for f in sys.argv[1:]:
-    print f, '->', os.readlink(f)
-EOF
-
 hg init repo
 cd repo
 ln -s nothing dangling
@@ -25,16 +17,16 @@
 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
--- a/tests/test-merge-types	Fri Dec 21 09:51:19 2007 +0100
+++ b/tests/test-merge-types	Fri Dec 21 10:24:03 2007 +0100
@@ -18,7 +18,7 @@
 
 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 @@
 
 if [ -h a ]; then
     echo a is a symlink
-    readlink a
+    $TESTDIR/readlink.py a
 elif [ -x a ]; then
     echo a is executable
 fi
--- a/tests/test-mq-symlinks	Fri Dec 21 09:51:19 2007 +0100
+++ b/tests/test-mq-symlinks	Fri Dec 21 10:24:03 2007 +0100
@@ -3,17 +3,6 @@
 echo "[extensions]" >> $HGRCPATH
 echo "mq=" >> $HGRCPATH
 
-cat >> readlink.py <<EOF
-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'
-EOF
-
 hg init
 hg qinit
 hg qnew base.patch
@@ -21,14 +10,14 @@
 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
--- a/tests/test-symlink-basic	Fri Dec 21 09:51:19 2007 +0100
+++ b/tests/test-symlink-basic	Fri Dec 21 10:24:03 2007 +0100
@@ -7,14 +7,6 @@
     sed -e "s:/.*\(/test-symlink-basic/.*\):...\1:"
 }
 
-cat >> readlink.py <<EOF
-import os
-import sys
-
-for f in sys.argv[1:]:
-    print f, '->', os.readlink(f)
-EOF
-
 hg init a
 cd a
 ln -s nothing dangling
@@ -25,29 +17,29 @@
 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