[PATCH V2] test-largefiles: partially adapt for Windows

Adrian Buehlmann adrian at cadifra.com
Sat Jun 30 12:40:52 CDT 2012


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1341077463 -7200
# Node ID 327cc87b6f59c133172b36f3aa07bf9262c3070d
# Parent  e1f2f7134ceda91ff08a203cad48f288c04238b3
test-largefiles: partially adapt for Windows

The adaption is partial, because "serve" is not yet officially supported in
in tests on Windows.

The test passes on Windows with an experimental testbed that supports
hg serve in tests on Windows.

The added (glob)'s are needed because of backslash <-> shlash issues in paths.

diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -1,5 +1,5 @@
   $ "$TESTDIR/hghave" serve || exit 80
-  $ USERCACHE=`pwd`/cache; export USERCACHE
+  $ USERCACHE="$TESTTMP/cache"; export USERCACHE
   $ mkdir -p ${USERCACHE}
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
@@ -14,9 +14,17 @@
   > patterns=glob:**.dat
   > usercache=${USERCACHE}
   > [hooks]
-  > precommit=echo "Invoking status precommit hook"; hg status
+  > precommit=sh -c "echo \"Invoking status precommit hook\"; hg status"
   > EOF
 
+MSYS on Windows doesn't support "rm -Rf ${USERCACHE}/*", so we define a
+portable function instead
+
+  $ wipecache()
+  > {
+  >   find "${USERCACHE}" -mindepth 1 -print0 | xargs -0 rm -Rf
+  > }
+
 Create the repo with a couple of revisions of both large and normal
 files, testing that status correctly shows largefiles and that summary output
 is correct.
@@ -436,7 +444,7 @@
 
 Test cloning with --all-largefiles flag
 
-  $ rm -Rf ${USERCACHE}/*
+  $ wipecache
   $ hg clone --all-largefiles a a-backup
   updating to branch default
   5 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -460,10 +468,10 @@
   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
   getting changed largefiles
   2 largefiles updated, 0 removed
-  $ rm -Rf ${USERCACHE}/*
+  $ wipecache
   $ cd a-backup
   $ hg pull --all-largefiles
-  pulling from $TESTTMP/a
+  pulling from $TESTTMP/a (glob)
   searching for changes
   adding changesets
   adding manifests
@@ -727,7 +735,7 @@
   3 largefiles updated, 0 removed
 # Delete the largefiles in the largefiles system cache so that we have an
 # opportunity to test that caching after a pull works.
-  $ rm ${USERCACHE}/*
+  $ wipecache
   $ cd f
   $ echo "large4-merge-test" > sub/large4
   $ hg commit -m "Modify large4 to test merge"
@@ -845,7 +853,7 @@
   normal3-modified
   $ hg cat sub/large4
   large4-modified
-  $ rm ${USERCACHE}/*
+  $ wipecache
   $ hg cat -r a381d2c8c80e -o cat.out sub/large4
   $ cat cat.out
   large4-modified
@@ -989,7 +997,7 @@
   pushing to http://localhost:$HGPORT1/
   searching for changes
   remote: largefiles: failed to put 4cdac4d8b084d0b599525cf732437fb337d422a8 into store: largefile contents do not match hash
-  abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/
+  abort: remotestore: could not put $TESTTMP/r7/.hg/largefiles/4cdac4d8b084d0b599525cf732437fb337d422a8 to remote store http://localhost:$HGPORT1/ (glob)
   [255]
   $ rm -rf empty
 
@@ -1004,7 +1012,7 @@
   $ hg serve -R empty -d -p $HGPORT2 --pid-file hg.pid \
   >   --config 'web.allow_push=*' --config web.push_ssl=False
   $ cat hg.pid >> $DAEMON_PIDS
-  $ rm ${USERCACHE}/*
+  $ wipecache
   $ hg push -R r8 http://localhost:$HGPORT2
   pushing to http://localhost:$HGPORT2/
   searching for changes


More information about the Mercurial-devel mailing list