changeset 1929:85daa4e03b4c

Merging with crew.
author Eric Hopper <hopper@omnifarious.org>
date Mon, 06 Mar 2006 08:47:16 -0800
parents 397b62d5dd13 (diff) cd5c1db2132a (current diff)
children 70be74899338
files tests/test-archive tests/test-pull tests/test-static-http.out
diffstat 14 files changed, 51 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/md5sum.py	Mon Mar 06 08:47:16 2006 -0800
@@ -0,0 +1,25 @@
+#! /usr/bin/env python
+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	Sun Mar 05 01:37:28 2006 -0800
+++ b/tests/run-tests	Mon Mar 06 08:47:16 2006 -0800
@@ -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 ..
@@ -100,7 +104,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
@@ -125,7 +129,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	Sun Mar 05 01:37:28 2006 -0800
+++ b/tests/test-archive	Mon Mar 06 08:47:16 2006 -0800
@@ -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	Sun Mar 05 01:37:28 2006 -0800
+++ b/tests/test-bad-pull	Mon Mar 06 08:47:16 2006 -0800
@@ -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	Sun Mar 05 01:37:28 2006 -0800
+++ b/tests/test-clone	Mon Mar 06 08:47:16 2006 -0800
@@ -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	Sun Mar 05 01:37:28 2006 -0800
+++ b/tests/test-clone.out	Mon Mar 06 08:47:16 2006 -0800
@@ -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	Sun Mar 05 01:37:28 2006 -0800
+++ b/tests/test-conflict	Mon Mar 06 08:47:16 2006 -0800
@@ -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	Sun Mar 05 01:37:28 2006 -0800
+++ b/tests/test-copy	Mon Mar 06 08:47:16 2006 -0800
@@ -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	Sun Mar 05 01:37:28 2006 -0800
+++ b/tests/test-empty-dir	Mon Mar 06 08:47:16 2006 -0800
@@ -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	Sun Mar 05 01:37:28 2006 -0800
+++ b/tests/test-empty-dir.out	Mon Mar 06 08:47:16 2006 -0800
@@ -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	Sun Mar 05 01:37:28 2006 -0800
+++ b/tests/test-flags	Mon Mar 06 08:47:16 2006 -0800
@@ -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	Sun Mar 05 01:37:28 2006 -0800
+++ b/tests/test-pull	Mon Mar 06 08:47:16 2006 -0800
@@ -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	Sun Mar 05 01:37:28 2006 -0800
+++ b/tests/test-static-http	Mon Mar 06 08:47:16 2006 -0800
@@ -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	Sun Mar 05 01:37:28 2006 -0800
+++ b/tests/test-static-http.out	Mon Mar 06 08:47:16 2006 -0800
@@ -1,5 +1,5 @@
+255
 abort: Connection refused
-255
 ls: copy: No such file or directory
 changeset:   0:61c9426e69fe
 tag:         tip