changeset 550:96ff7dae94f7

[PATCH] Tests for clone command -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] Tests for clone command From: Bryan O'Sullivan <bos@serpentine.com> This patch adds two new tests. One tests clone's correct operation, the other that clone fails when it should. This patch depends on oserror.patch. manifest hash: a0c9c4932baf29e7b33b2bd2003ddd2254ce65d3 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCxPX9ywK+sNU5EO8RAmSNAJ9esixtATdkszwLltu65dzpKf6P4gCcCqGT +Z7CTbXRTFcJvmXFlvEo0xE= =6fqz -----END PGP SIGNATURE-----
author mpm@selenic.com
date Thu, 30 Jun 2005 23:51:25 -0800
parents 92b60cabf808
children b460a2fd8bb7
files tests/test-clone tests/test-clone-failure tests/test-clone-failure.out tests/test-clone.out
diffstat 4 files changed, 147 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-clone	Thu Jun 30 23:51:25 2005 -0800
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+set -x
+mkdir a
+cd a
+hg init
+echo a > a
+hg add a
+hg commit -t test -u test -d '0 0'
+
+# Default operation
+hg clone . ../b
+cd ../b
+cat a
+hg verify
+
+# No update
+hg clone -U . ../c
+cd ../c
+cat a
+hg verify
+
+# Default destination
+mkdir ../d
+cd ../d
+hg clone ../a
+cd a
+hg cat a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-clone-failure	Thu Jun 30 23:51:25 2005 -0800
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+set -x
+
+# No local source
+hg clone a b
+echo $?
+
+# No remote source
+hg clone http://127.0.0.1:3121/a b
+echo $?
+rm -rf b # work around bug with http clone
+
+# Inaccessible source
+mkdir a
+chmod 000 a
+hg clone a b
+echo $?
+
+# Inaccessible destination
+mkdir b
+cd b
+hg init
+hg clone . ../a
+echo $?
+cd ..
+chmod 700 a
+rm -rf a b
+
+# Source of wrong type
+mkfifo a
+hg clone a b
+echo $?
+rm a
+
+# Default destination, same directory
+mkdir q
+cd q
+hg init
+cd ..
+hg clone q
+
+true
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-clone-failure.out	Thu Jun 30 23:51:25 2005 -0800
@@ -0,0 +1,44 @@
++ hg clone a b
+abort: No such file or directory: a
++ echo 255
+255
++ hg clone http://127.0.0.1:3121/a b
+requesting all changes
+adding changesets
+abort: error 111: Connection refused
+transaction abort!
+rollback completed
++ echo 255
+255
++ rm -rf b
++ mkdir a
++ chmod 000 a
++ hg clone a b
+cp: cannot stat `a/.hg': Permission denied
+abort: cp exited with status 1
++ echo 255
+255
++ mkdir b
++ cd b
++ hg init
++ hg clone . ../a
+abort: destination '../a' already exists
++ echo 1
+1
++ cd ..
++ chmod 700 a
++ rm -rf a b
++ mkfifo a
++ hg clone a b
+cp: cannot stat `a/.hg': Not a directory
+abort: cp exited with status 1
++ echo 255
+255
++ rm a
++ mkdir q
++ cd q
++ hg init
++ cd ..
++ hg clone q
+abort: destination 'q' already exists
++ true
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-clone.out	Thu Jun 30 23:51:25 2005 -0800
@@ -0,0 +1,32 @@
++ mkdir a
++ cd a
++ hg init
++ echo a
++ hg add a
++ hg commit -t test -u test -d '0 0'
++ hg clone . ../b
++ cd ../b
++ cat a
+a
++ hg verify
+checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+1 files, 1 changesets, 1 total revisions
++ hg clone -U . ../c
++ cd ../c
++ cat a
+cat: a: No such file or directory
++ hg verify
+checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+1 files, 1 changesets, 1 total revisions
++ mkdir ../d
++ cd ../d
++ hg clone ../a
++ cd a
++ hg cat a
+a