tests: replace `cd ..` with an absolute path in a couple ssh tests
authorMatt Harbison <matt_harbison@yahoo.com>
Sat, 13 Oct 2018 19:49:33 -0400
changeset 52910 52b773f5e9a4fdde221f1466c352c37776c2a240
parent 52909 9c4cbbb0fc5156cfb42e0f57935c68f51a8cdd42
child 52911 8783710b1d58d2ccc0f611904af244a1dde214d4
push id1054
push usergszorc@mozilla.com
push dateSun, 14 Oct 2018 07:52:12 +0000
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.
tests/test-ssh-bundle1.t
tests/test-ssh.t
--- a/tests/test-ssh-bundle1.t
+++ b/tests/test-ssh-bundle1.t
@@ -43,17 +43,17 @@ configure for serving
 
   $ cat <<EOF > .hg/hgrc
   > [server]
   > uncompressed = True
   > 
   > [hooks]
   > changegroup = sh -c "printenv.py changegroup-in-remote 0 ../dummylog"
   > EOF
-  $ cd ..
+  $ cd $TESTTMP
 
 repo not found error
 
   $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
   remote: abort: repository nonexistent not found!
   abort: no suitable response from remote hg!
   [255]
 
@@ -82,33 +82,33 @@ clone remote via stream
   $ hg verify
   checking changesets
   checking manifests
   crosschecking files in changesets and manifests
   checking files
   checked 3 changesets with 2 changes to 2 files
   $ hg branches
   default                        0:1160648e36ce
-  $ cd ..
+  $ cd $TESTTMP
 
 clone bookmarks via stream
 
   $ hg -R local-stream book mybook
   $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/local-stream stream2
   streaming all changes
   4 files to transfer, 602 bytes of data
   transferred 602 bytes in * seconds (*) (glob)
   searching for changes
   no changes found
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd stream2
   $ hg book
      mybook                    0:1160648e36ce
-  $ cd ..
+  $ cd $TESTTMP
   $ rm -rf local-stream stream2
 
 #endif
 
 clone remote via pull
 
   $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
   requesting all changes
@@ -205,17 +205,17 @@ push
 
   $ hg push
   pushing to ssh://user@dummy/remote
   searching for changes
   remote: adding changesets
   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
 
   $ hg tip
   changeset:   3:a28a9d1a809c
   tag:         tip
   parent:      0:1160648e36ce
   user:        test
@@ -231,17 +231,17 @@ check remote tip
   $ hg cat -r tip foo
   bleah
   $ echo z > z
   $ hg ci -A -m z z
   created new head
 
 test pushkeys and bookmarks
 
-  $ cd ../local
+  $ cd $TESTTMP/local
   $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
   bookmarks	
   namespaces	
   phases	
   $ hg book foo -r 0
   $ hg out -B
   comparing with ssh://user@dummy/remote
   searching for changed bookmarks
@@ -338,17 +338,17 @@ passwords in ssh urls are not supported
 (we use a glob here because different Python versions give different
 results here)
 
   $ hg push ssh://user:erroneouspwd@dummy/remote
   pushing to ssh://user:*@dummy/remote (glob)
   abort: password in URL not supported!
   [255]
 
-  $ cd ..
+  $ cd $TESTTMP
 
 hide outer repo
   $ hg init
 
 Test remote paths with spaces (issue2983):
 
   $ hg init --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
   $ touch "$TESTTMP/a repo/test"
@@ -428,17 +428,17 @@ Test hg-ssh in read-only mode:
   searching for changes
   remote: Permission denied
   remote: abort: pretxnopen.hg-ssh hook failed
   remote: Permission denied
   remote: pushkey-abort: prepushkey.hg-ssh hook failed
   updating 6c0482d977a3 to public failed!
   [1]
 
-  $ cd ..
+  $ cd $TESTTMP
 
 stderr from remote commands should be printed before stdout from local code (issue4336)
 
   $ hg clone remote stderr-ordering
   updating to branch default
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd stderr-ordering
   $ cat >> localwrite.py << EOF
@@ -495,17 +495,17 @@ debug output
   searching for changes
   all remote heads known locally
   no changes found
   preparing listkeys for "phases"
   sending listkeys command
   received listkey for "phases": 15 bytes
   checking for updated bookmarks
 
-  $ cd ..
+  $ cd $TESTTMP
 
   $ cat dummylog
   Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
   Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio (no-msys !)
   Got arguments 1:user@dummy 2:hg -R remote serve --stdio
   Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio (no-reposimplestore !)
   Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !)
   Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !)
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -33,17 +33,17 @@ configure for serving
 
   $ cat <<EOF > .hg/hgrc
   > [server]
   > uncompressed = True
   > 
   > [hooks]
   > changegroup = sh -c "printenv.py changegroup-in-remote 0 ../dummylog"
   > EOF
-  $ cd ..
+  $ cd $TESTTMP
 
 repo not found error
 
   $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
   remote: abort: repository nonexistent not found!
   abort: no suitable response from remote hg!
   [255]
 
@@ -68,31 +68,31 @@ clone remote via stream
   $ hg verify
   checking changesets
   checking manifests
   crosschecking files in changesets and manifests
   checking files
   checked 3 changesets with 2 changes to 2 files
   $ hg branches
   default                        0:1160648e36ce
-  $ cd ..
+  $ cd $TESTTMP
 
 clone bookmarks via stream
 
   $ hg -R local-stream book mybook
   $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/local-stream stream2
   streaming all changes
   9 files to transfer, 870 bytes of data
   transferred 870 bytes in * seconds (*) (glob)
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd stream2
   $ hg book
      mybook                    0:1160648e36ce
-  $ cd ..
+  $ cd $TESTTMP
   $ rm -rf local-stream stream2
 
 #endif
 
 clone remote via pull
 
   $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
   requesting all changes
@@ -189,17 +189,17 @@ push
 
   $ hg push
   pushing to ssh://user@dummy/remote
   searching for changes
   remote: adding changesets
   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
 
   $ hg tip
   changeset:   3:a28a9d1a809c
   tag:         tip
   parent:      0:1160648e36ce
   user:        test
@@ -215,17 +215,17 @@ check remote tip
   $ hg cat -r tip foo
   bleah
   $ echo z > z
   $ hg ci -A -m z z
   created new head
 
 test pushkeys and bookmarks
 
-  $ cd ../local
+  $ cd $TESTTMP/local
   $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
   bookmarks	
   namespaces	
   phases	
   $ hg book foo -r 0
   $ hg out -B --config paths.default=bogus://invalid --config paths.default:pushurl=`hg paths default`
   comparing with ssh://user@dummy/remote
   searching for changed bookmarks
@@ -354,17 +354,17 @@ passwords in ssh urls are not supported
 (we use a glob here because different Python versions give different
 results here)
 
   $ hg push ssh://user:erroneouspwd@dummy/remote
   pushing to ssh://user:*@dummy/remote (glob)
   abort: password in URL not supported!
   [255]
 
-  $ cd ..
+  $ cd $TESTTMP
 
 hide outer repo
   $ hg init
 
 Test remote paths with spaces (issue2983):
 
   $ hg init --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
   $ touch "$TESTTMP/a repo/test"
@@ -455,17 +455,17 @@ Test hg-ssh in read-only mode:
   $ hg push --ssh "sh ../ssh.sh"
   pushing to ssh://user@dummy/*/remote (glob)
   searching for changes
   remote: Permission denied
   remote: pretxnopen.hg-ssh hook failed
   abort: push failed on remote
   [255]
 
-  $ cd ..
+  $ cd $TESTTMP
 
 stderr from remote commands should be printed before stdout from local code (issue4336)
 
   $ hg clone remote stderr-ordering
   updating to branch default
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd stderr-ordering
   $ cat >> localwrite.py << EOF
@@ -544,17 +544,17 @@ debug output
   bundle2-input-part: total payload size 26
   bundle2-input-part: "listkeys" (params: 1 mandatory) supported
   bundle2-input-part: total payload size 45
   bundle2-input-part: "phase-heads" supported
   bundle2-input-part: total payload size 72
   bundle2-input-bundle: 2 parts total
   checking for updated bookmarks
 
-  $ cd ..
+  $ cd $TESTTMP
 
   $ cat dummylog
   Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
   Got arguments 1:user@dummy 2:hg -R $TESTTMP/nonexistent serve --stdio
   Got arguments 1:user@dummy 2:hg -R remote serve --stdio
   Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio (no-reposimplestore !)
   Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !)
   Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !)