git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 2/3] t5601: add more test cases for IPV6
@ 2015-02-21 15:53 Torsten Bögershausen
  2015-02-23  2:50 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Torsten Bögershausen @ 2015-02-21 15:53 UTC (permalink / raw)
  To: git; +Cc: tboegi, lists

Test the parsing of literall IPV6 addresses more systematically:
- with and without brackets (e.g. ::1 [::1])
- with brackets and port number: (e.g. [::1]:22)
- with username (e.g. user@::1)
- with username and brackets:
  Because user@[::1] was not supported on older Git version,
  [user@::1] had to be used as a workaround.
  Test that user@::1 user@[::1] and [user@::1] all do the same.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
---
 t/t5601-clone.sh | 57 +++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 40 insertions(+), 17 deletions(-)

diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index f901b8a..02b40b1 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -301,11 +301,17 @@ expect_ssh () {
 		(cd "$TRASH_DIRECTORY" && rm -f ssh-expect && >ssh-output)
 	' &&
 	{
-		case "$1" in
-		none)
+		case "$#" in
+		1)
 			;;
-		*)
+		2)
 			echo "ssh: $1 git-upload-pack '$2'"
+			;;
+		3)
+			echo "ssh: $1 $2 git-upload-pack '$3'"
+			;;
+		*)
+			echo "ssh: $1 $2 git-upload-pack '$3' $4"
 		esac
 	} >"$TRASH_DIRECTORY/ssh-expect" &&
 	(cd "$TRASH_DIRECTORY" && test_cmp ssh-expect ssh-output)
@@ -336,7 +342,8 @@ counter=0
 test_clone_url () {
 	counter=$(($counter + 1))
 	test_might_fail git clone "$1" tmp$counter &&
-	expect_ssh "$2" "$3"
+	shift &&
+	expect_ssh "$@"
 }
 
 test_expect_success !MINGW 'clone c:temp is ssl' '
@@ -359,7 +366,7 @@ done
 for repo in rep rep/home/project 123
 do
 	test_expect_success "clone [::1]:$repo" '
-		test_clone_url [::1]:$repo ::1 $repo
+		test_clone_url [::1]:$repo ::1 "$repo"
 	'
 done
 #home directory
@@ -400,24 +407,40 @@ test_expect_success 'clone ssh://host.xz:22/~repo' '
 '
 
 #IPv6
-test_expect_success 'clone ssh://[::1]/home/user/repo' '
-	test_clone_url "ssh://[::1]/home/user/repo" "::1" "/home/user/repo"
-'
+for tuah in ::1 [::1] user@::1 user@[::1] [user@::1]
+do
+	ehost=$(echo $tuah | tr -d "[]")
+	test_expect_success "clone ssh://$tuah/home/user/repo" "
+	  test_clone_url ssh://$tuah/home/user/repo $ehost /home/user/repo
+	"
+done
 
 #IPv6 from home directory
-test_expect_success 'clone ssh://[::1]/~repo' '
-	test_clone_url "ssh://[::1]/~repo" "::1" "~repo"
-'
+for tuah in ::1 [::1] user@::1 user@[::1] [user@::1]
+do
+	euah=$(echo $tuah | tr -d "[]")
+	test_expect_success "clone ssh://$tuah/~repo" "
+	  test_clone_url ssh://$tuah/~repo $euah '~repo'
+	"
+done
 
 #IPv6 with port number
-test_expect_success 'clone ssh://[::1]:22/home/user/repo' '
-	test_clone_url "ssh://[::1]:22/home/user/repo" "-p 22 ::1" "/home/user/repo"
-'
+for tuah in [::1] user@[::1] [user@::1]
+do
+	euah=$(echo $tuah | tr -d "[]")
+	test_expect_success "clone ssh://$tuah:22/home/user/repo" "
+	  test_clone_url ssh://$tuah:22/home/user/repo '-p 22' $euah /home/user/repo
+	"
+done
 
 #IPv6 from home directory with port number
-test_expect_success 'clone ssh://[::1]:22/~repo' '
-	test_clone_url "ssh://[::1]:22/~repo" "-p 22 ::1" "~repo"
-'
+for tuah in [::1] user@[::1] [user@::1]
+do
+	euah=$(echo $tuah | tr -d "[]")
+	test_expect_success "clone ssh://$tuah:22/~repo" "
+	  test_clone_url ssh://$tuah:22/~repo '-p 22' $euah '~repo'
+	"
+done
 
 test_expect_success 'clone from a repository with two identical branches' '
 
-- 
2.2.0.rc1.790.ge19fcd2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 2/3] t5601: add more test cases for IPV6
  2015-02-21 15:53 [PATCH v2 2/3] t5601: add more test cases for IPV6 Torsten Bögershausen
@ 2015-02-23  2:50 ` Junio C Hamano
  2015-02-23  5:36   ` Torsten Bögershausen
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2015-02-23  2:50 UTC (permalink / raw)
  To: Torsten Bögershausen; +Cc: git, lists

Torsten Bögershausen <tboegi@web.de> writes:

> @@ -359,7 +366,7 @@ done
>  for repo in rep rep/home/project 123
>  do
>  	test_expect_success "clone [::1]:$repo" '
> -		test_clone_url [::1]:$repo ::1 $repo
> +		test_clone_url [::1]:$repo ::1 "$repo"
>  	'
>  done

This change is somewhat a curious one.  Why quote the last
occurrence of $repo but not the previous one?

> +for tuah in ::1 [::1] user@::1 user@[::1] [user@::1]
> +do
> +	euah=$(echo $tuah | tr -d "[]")

What are tuah and euah, by the way?  Are they FLA for some phrases?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 2/3] t5601: add more test cases for IPV6
  2015-02-23  2:50 ` Junio C Hamano
@ 2015-02-23  5:36   ` Torsten Bögershausen
  0 siblings, 0 replies; 3+ messages in thread
From: Torsten Bögershausen @ 2015-02-23  5:36 UTC (permalink / raw)
  To: Junio C Hamano, Torsten Bögershausen; +Cc: git, lists

On 02/23/2015 03:50 AM, Junio C Hamano wrote:
> Torsten Bögershausen <tboegi@web.de> writes:
>
>> @@ -359,7 +366,7 @@ done
>>   for repo in rep rep/home/project 123
>>   do
>>   	test_expect_success "clone [::1]:$repo" '
>> -		test_clone_url [::1]:$repo ::1 $repo
>> +		test_clone_url [::1]:$repo ::1 "$repo"
>>   	'
>>   done
> This change is somewhat a curious one.  Why quote the last
> occurrence of $repo but not the previous one?
The reason to quote is that
some shells replace ~ with $HOME, but not "~"
exactly here it seems not to be needed.
>
>> +for tuah in ::1 [::1] user@::1 user@[::1] [user@::1]
>> +do
>> +	euah=$(echo $tuah | tr -d "[]")
> What are tuah and euah, by the way?  Are they FLA for some phrases?
tuah = tested username and host
euah = expected username and host

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-23  5:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-21 15:53 [PATCH v2 2/3] t5601: add more test cases for IPV6 Torsten Bögershausen
2015-02-23  2:50 ` Junio C Hamano
2015-02-23  5:36   ` Torsten Bögershausen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).