changeset 1932:82995896d5af

Merge with http://hg.home.dataloss.nl/hg-portabletests
author Thomas Arendsen Hein <thomas@intevation.de>
date Mon, 13 Mar 2006 12:22:55 +0100
parents 6d50d6189269 (current diff) 819a2508f2c6 (diff)
children 7544700fd931
files tests/run-tests
diffstat 14 files changed, 58 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/md5sum.py	Mon Mar 13 12:22:55 2006 +0100
@@ -0,0 +1,32 @@
+#! /usr/bin/env python
+#
+# Based on python's Tools/scripts/md5sum.py
+#
+# This software may be used and distributed according to the terms
+# of the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2, which is
+# GPL-compatible.
+
+import sys
+import os
+import md5
+
+for filename in sys.argv[1:]:
+    try:
+        fp = open(filename, 'rb')
+    except IOError, msg:
+        sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg))
+        sys.exit(1)
+    
+    m = md5.new()
+    try:
+        while 1:
+            data = fp.read(8192)
+            if not data:
+                break
+            m.update(data)
+    except IOError, msg:
+        sys.stderr.write('%s: I/O error: %s\n' % (filename, msg))
+        sys.exit(1)
+    sys.stdout.write('%s  %s\n' % (m.hexdigest(), filename))
+
+sys.exit(0)
--- a/tests/run-tests	Mon Mar 13 08:56:59 2006 +0100
+++ b/tests/run-tests	Mon Mar 13 12:22:55 2006 +0100
@@ -19,6 +19,9 @@
 HGMERGE=true; export HGMERGE
 HGUSER="test"; export HGUSER
 
+ECHO_N="echo -n"
+[ -x /usr/ucb/echo ] && ECHO_N="/usr/ucb/echo -n"
+
 umask 022
 
 tests=0
@@ -40,6 +43,7 @@
 }
 
 TESTDIR="$PWD"
+export TESTDIR
 INST="$HGTMP/install"
 PYTHONDIR="$INST/lib/python"
 cd ..
@@ -109,7 +113,7 @@
 
 # list of prerequisite programs
 # stuff from coreutils (cat, rm, etc) are not tested
-prereqs="python merge diff grep unzip md5sum gunzip sed"
+prereqs="python merge diff grep unzip gunzip sed"
 missing=''
 for pre in $prereqs ; do
     if type $pre > /dev/null 2>&1 ; then
@@ -134,7 +138,7 @@
 fi
 
 for f in $TESTS ; do
-    echo -n "."
+    $ECHO_N "."
     run_one $f || failed=`expr $failed + 1`
     tests=`expr $tests + 1`
 done
--- a/tests/test-archive	Mon Mar 13 08:56:59 2006 +0100
+++ b/tests/test-archive	Mon Mar 13 12:22:55 2006 +0100
@@ -29,9 +29,10 @@
                     % (node, archive))
 sys.stdout.write(f.read())
 EOF
-http_proxy= python getarchive.py "$TIP" gz | tar tzf - | sed "s/$QTIP/TIP/"
-http_proxy= python getarchive.py "$TIP" bz2 | tar tjf - | sed "s/$QTIP/TIP/"
+http_proxy= python getarchive.py "$TIP" gz | gunzip -dc - | tar tf - | sed "s/$QTIP/TIP/"
+http_proxy= python getarchive.py "$TIP" bz2 | bunzip2 -dc - | tar tf - | sed "s/$QTIP/TIP/"
 http_proxy= python getarchive.py "$TIP" zip > archive.zip
 unzip -t archive.zip | sed "s/$QTIP/TIP/"
 
 kill `cat hg.pid`
+sleep 1 # wait for server to scream and die
--- a/tests/test-bad-pull	Mon Mar 13 08:56:59 2006 +0100
+++ b/tests/test-bad-pull	Mon Mar 13 12:22:55 2006 +0100
@@ -19,7 +19,7 @@
 
 python dumb.py 2>/dev/null &
 
-hg clone http://localhost:20059/foo copy2
+http_proxy= hg clone http://localhost:20059/foo copy2
 echo $?
 
 kill $!
--- a/tests/test-clone	Mon Mar 13 08:56:59 2006 +0100
+++ b/tests/test-clone	Mon Mar 13 12:22:55 2006 +0100
@@ -16,7 +16,7 @@
 # No update
 hg clone -U . ../c
 cd ../c
-cat a
+cat a 2>/dev/null || echo "a not present"
 hg verify
 
 # Default destination
--- a/tests/test-clone.out	Mon Mar 13 08:56:59 2006 +0100
+++ b/tests/test-clone.out	Mon Mar 13 12:22:55 2006 +0100
@@ -4,7 +4,7 @@
 crosschecking files in changesets and manifests
 checking files
 1 files, 1 changesets, 1 total revisions
-cat: a: No such file or directory
+a not present
 checking changesets
 checking manifests
 crosschecking files in changesets and manifests
--- a/tests/test-conflict	Mon Mar 13 08:56:59 2006 +0100
+++ b/tests/test-conflict	Mon Mar 13 12:22:55 2006 +0100
@@ -12,5 +12,5 @@
 HGMERGE=merge; export HGMERGE
 hg up -m 1
 hg id
-grep -Ev ">>>|<<<" a
+egrep -v ">>>|<<<" a
 hg status
--- a/tests/test-copy	Mon Mar 13 08:56:59 2006 +0100
+++ b/tests/test-copy	Mon Mar 13 12:22:55 2006 +0100
@@ -20,11 +20,11 @@
 hg debugindex .hg/data/b.i
 
 echo "this should show the rename information in the metadata"
-hg debugdata .hg/data/b.d 0 | head -n 3 | tail -n 2
+hg debugdata .hg/data/b.d 0 | head -3 | tail -2
 
-md5sum .hg/data/b.d
+$TESTDIR/md5sum.py .hg/data/b.d
 hg cat b > bsum
-md5sum bsum
+$TESTDIR/md5sum.py bsum
 hg cat a > asum
-md5sum asum
+$TESTDIR/md5sum.py asum
 hg verify
--- a/tests/test-empty-dir	Mon Mar 13 08:56:59 2006 +0100
+++ b/tests/test-empty-dir	Mon Mar 13 12:22:55 2006 +0100
@@ -10,7 +10,7 @@
 hg commit -m "second" -d "0 0" sub/b
 cat sub/b
 hg co 0
-cat sub/b
-ls sub
+cat sub/b 2>/dev/null || echo "sub/b not present"
+ls sub 2>/dev/null || echo "sub not present"
 
 true
--- a/tests/test-empty-dir.out	Mon Mar 13 08:56:59 2006 +0100
+++ b/tests/test-empty-dir.out	Mon Mar 13 12:22:55 2006 +0100
@@ -1,3 +1,3 @@
 321
-cat: sub/b: No such file or directory
-ls: sub: No such file or directory
+sub/b not present
+sub not present
--- a/tests/test-flags	Mon Mar 13 08:56:59 2006 +0100
+++ b/tests/test-flags	Mon Mar 13 12:22:55 2006 +0100
@@ -30,5 +30,5 @@
 hg -v co -m
 
 ls -l ../test[12]/a > foo
-cut -b 0-10 < foo
+cut -b 1-10 < foo
 
--- a/tests/test-pull	Mon Mar 13 08:56:59 2006 +0100
+++ b/tests/test-pull	Mon Mar 13 12:22:55 2006 +0100
@@ -10,7 +10,7 @@
 hg serve -p 20059 -d --pid-file=hg.pid
 cd ..
 
-hg clone http://localhost:20059/ copy
+http_proxy= hg clone http://localhost:20059/ copy
 cd copy
 hg verify
 hg co
--- a/tests/test-static-http	Mon Mar 13 08:56:59 2006 +0100
+++ b/tests/test-static-http	Mon Mar 13 12:22:55 2006 +0100
@@ -1,7 +1,8 @@
 #!/bin/sh
 
-http_proxy= hg clone old-http://localhost:20059/ copy
+http_proxy= hg clone old-http://localhost:20059/ copy > clonefail.out 2>&1
 echo $?
+sed 's/[0-9]//g' < clonefail.out
 ls copy
 
 # This server doesn't do range requests so it's basically only good for
--- a/tests/test-static-http.out	Mon Mar 13 08:56:59 2006 +0100
+++ b/tests/test-static-http.out	Mon Mar 13 12:22:55 2006 +0100
@@ -1,5 +1,5 @@
+255
 abort: Connection refused
-255
 ls: copy: No such file or directory
 changeset:   0:61c9426e69fe
 tag:         tip