[PATCH] tests: replace `cd ..` with an absolute path in a couple ssh tests

Matt Harbison mharbison72 at gmail.com
Sun Oct 14 02:40:36 UTC 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1539474573 14400
#      Sat Oct 13 19:49:33 2018 -0400
# Node ID fb97b23d9256601538396ea49c8284219992fe99
# Parent  83dab13d625cd3fa2ce24801c9ee962d695045b8
tests: replace `cd ..` with an absolute path in a couple ssh tests

These tests are broken under py3 on Windows to the point where the `cd ..` was
actually escaping into the system wide $TEMP.  The subsequent `hg init` created
a repo there, and then added a local extension to the hgrc.  This breaks every
single subsequent test when it tries to `hg init` in its $TESTTMP, and can't
load the localwrite.py extension.  And since I botched this the first time and
replaced the wrong `cd ..`, this just replaces all of them.  I've noticed test
garbage in $TEMP recently, and maybe this will help.

Perhaps `hg init` shouldn't load the config for the local repo, but this is an
easy enough workaround for now.

diff --git a/tests/test-ssh-bundle1.t b/tests/test-ssh-bundle1.t
--- a/tests/test-ssh-bundle1.t
+++ b/tests/test-ssh-bundle1.t
@@ -48,7 +48,7 @@ configure for serving
   > [hooks]
   > changegroup = sh -c "printenv.py changegroup-in-remote 0 ../dummylog"
   > EOF
-  $ cd ..
+  $ cd $TESTTMP
 
 repo not found error
 
@@ -87,7 +87,7 @@ clone remote via stream
   checked 3 changesets with 2 changes to 2 files
   $ hg branches
   default                        0:1160648e36ce
-  $ cd ..
+  $ cd $TESTTMP
 
 clone bookmarks via stream
 
@@ -103,7 +103,7 @@ clone bookmarks via stream
   $ cd stream2
   $ hg book
      mybook                    0:1160648e36ce
-  $ cd ..
+  $ cd $TESTTMP
   $ rm -rf local-stream stream2
 
 #endif
@@ -210,7 +210,7 @@ push
   remote: adding manifests
   remote: adding file changes
   remote: added 1 changesets with 1 changes to 1 files
-  $ cd ../remote
+  $ cd $TESTTMP/remote
 
 check remote tip
 
@@ -236,7 +236,7 @@ check remote tip
 
 test pushkeys and bookmarks
 
-  $ cd ../local
+  $ cd $TESTTMP/local
   $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
   bookmarks	
   namespaces	
@@ -343,7 +343,7 @@ results here)
   abort: password in URL not supported!
   [255]
 
-  $ cd ..
+  $ cd $TESTTMP
 
 hide outer repo
   $ hg init
@@ -433,7 +433,7 @@ Test hg-ssh in read-only mode:
   updating 6c0482d977a3 to public failed!
   [1]
 
-  $ cd ..
+  $ cd $TESTTMP
 
 stderr from remote commands should be printed before stdout from local code (issue4336)
 
@@ -500,7 +500,7 @@ debug output
   received listkey for "phases": 15 bytes
   checking for updated bookmarks
 
-  $ cd ..
+  $ cd $TESTTMP
 
   $ cat dummylog
   Got arguments 1:user at dummy 2:hg -R nonexistent serve --stdio
diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -38,7 +38,7 @@ configure for serving
   > [hooks]
   > changegroup = sh -c "printenv.py changegroup-in-remote 0 ../dummylog"
   > EOF
-  $ cd ..
+  $ cd $TESTTMP
 
 repo not found error
 
@@ -73,7 +73,7 @@ clone remote via stream
   checked 3 changesets with 2 changes to 2 files
   $ hg branches
   default                        0:1160648e36ce
-  $ cd ..
+  $ cd $TESTTMP
 
 clone bookmarks via stream
 
@@ -87,7 +87,7 @@ clone bookmarks via stream
   $ cd stream2
   $ hg book
      mybook                    0:1160648e36ce
-  $ cd ..
+  $ cd $TESTTMP
   $ rm -rf local-stream stream2
 
 #endif
@@ -194,7 +194,7 @@ push
   remote: adding manifests
   remote: adding file changes
   remote: added 1 changesets with 1 changes to 1 files
-  $ cd ../remote
+  $ cd $TESTTMP/remote
 
 check remote tip
 
@@ -220,7 +220,7 @@ check remote tip
 
 test pushkeys and bookmarks
 
-  $ cd ../local
+  $ cd $TESTTMP/local
   $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
   bookmarks	
   namespaces	
@@ -359,7 +359,7 @@ results here)
   abort: password in URL not supported!
   [255]
 
-  $ cd ..
+  $ cd $TESTTMP
 
 hide outer repo
   $ hg init
@@ -460,7 +460,7 @@ Test hg-ssh in read-only mode:
   abort: push failed on remote
   [255]
 
-  $ cd ..
+  $ cd $TESTTMP
 
 stderr from remote commands should be printed before stdout from local code (issue4336)
 
@@ -549,7 +549,7 @@ debug output
   bundle2-input-bundle: 2 parts total
   checking for updated bookmarks
 
-  $ cd ..
+  $ cd $TESTTMP
 
   $ cat dummylog
   Got arguments 1:user at dummy 2:hg -R nonexistent serve --stdio


More information about the Mercurial-devel mailing list