# perl t9700 failures?

9 messages from 2008-06-29 to 2008-06-30. Participants: Linus Torvalds, Junio C Hamano, Jakub Narebski, Johannes Schindelin, Lea Wiemann, Johannes Sixt.
Thread: https://gitlist.dev/t/14210

## Linus Torvalds, 2008-06-29 19:52

Subject: perl t9700 failures?
Message-ID: <alpine.LFD.1.10.0806291241210.27776@hp.linux-foundation.org>
URL: https://gitlist.dev/e/alpine.LFD.1.10.0806291241210.27776%40hp.linux-foundation.org

```

Am I the only one who gets this error:

	*** t9700-perl-git.sh ***
	*   ok 1: set up test repository
	*  run 2: Perl API (perl ../t9700/test.pl)
	* FAIL 2: Perl API
	        perl ../t9700/test.pl
	* FAIL 3: no stderr: Perl API
	        perl ../t9700/test.pl
	* failed 2 among 3 test(s)

which I have no idea about, since to me perl is a black box, and doing  
run of the tests with '-i -v' doesn't actually tell any more about which 
part of the perl script is failing, or why.. Trying to run the perl thing 
by hand, though, gives me this:

	Can't locate Test/More.pm in @INC (@INC contains: ...)

which is presumably the problem. It looks like it is assuming I have the 
Test::More perl libs, which I presumably don't have, don't have any clue 
where they are, nor really any interest in installing.

Wouldn't it be a lot more polite to just not run the test when the 
Test::More stuff doesn't exist? Rather than failing the testsuite? From a 
quick "git grep", this test is the only one that uses Test::More..

		Linus

```

## Junio C Hamano, 2008-06-29 20:18

Subject: Re: perl t9700 failures?
Message-ID: <7v4p7c9erj.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v4p7c9erj.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <alpine.LFD.1.10.0806291241210.27776@hp.linux-foundation.org>

```
Linus Torvalds <torvalds@linux-foundation.org> writes:

> Am I the only one who gets this error:
>
> 	*** t9700-perl-git.sh ***
> 	*   ok 1: set up test repository
> 	*  run 2: Perl API (perl ../t9700/test.pl)
> 	* FAIL 2: Perl API
> 	        perl ../t9700/test.pl
> 	* FAIL 3: no stderr: Perl API
> 	        perl ../t9700/test.pl
> 	* failed 2 among 3 test(s)
>
> which I have no idea about, since to me perl is a black box, and doing  
> run of the tests with '-i -v' doesn't actually tell any more about which 
> part of the perl script is failing, or why.. Trying to run the perl thing 
> by hand, though, gives me this:
>
> 	Can't locate Test/More.pm in @INC (@INC contains: ...)
>
> which is presumably the problem. It looks like it is assuming I have the 
> Test::More perl libs, which I presumably don't have, don't have any clue 
> where they are, nor really any interest in installing.
>
> Wouldn't it be a lot more polite to just not run the test when the 
> Test::More stuff doesn't exist? Rather than failing the testsuite? From a 
> quick "git grep", this test is the only one that uses Test::More..

Hmm.  I was told that Test::More was part of the std Perl distribution
(and my quick check showed I happened to have that installed on my boxes
even though I do not use it myself and assumed it was there because the
claim is true).  Another test that does rely on more obscure Perl library
does refrain from running when it is not available, though...

Perlhaps something liek this should be sufficient.

diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh
index b2fb9ec..9b57ad1 100755
--- a/t/t9700-perl-git.sh
+++ b/t/t9700-perl-git.sh
@@ -6,6 +6,11 @@
 test_description='perl interface (Git.pm)'
 . ./test-lib.sh
 
+perl -MTest::More -e 0 2>/dev/null || {
+	say_color skip >&3 "Perl Test::More not available, skipping test"
+	test_done
+}
+
 # set up test repository
 
 test_expect_success \

```

## Junio C Hamano, 2008-06-29 20:23

Subject: Re: perl t9700 failures?
Message-ID: <7vzlp47zy8.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vzlp47zy8.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <alpine.LFD.1.10.0806291241210.27776@hp.linux-foundation.org>

```
I'll commit this (which is simpler than "Perlhaps this would suffice"
patch I sent earlier).  Thanks for noticing.

-- >8 --
[PATCH] t9700: skip when Test::More is not available

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t9700-perl-git.sh |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh
index b2fb9ec..5dd32f4 100755
--- a/t/t9700-perl-git.sh
+++ b/t/t9700-perl-git.sh
@@ -6,6 +6,11 @@
 test_description='perl interface (Git.pm)'
 . ./test-lib.sh
 
+perl -MTest::More -e 0 2>/dev/null || {
+	say skip "Perl Test::More unavailable, skipping test"
+	test_done
+}
+
 # set up test repository
 
 test_expect_success \
-- 
1.5.6.1.102.g8e69d

```

## Jakub Narebski, 2008-06-29 20:32

Subject: [PATCH] Skip Perl interface (Git.pm) tests if requirements not fullfilled
Message-ID: <1214771560-14005-1-git-send-email-jnareb@gmail.com>
URL: https://gitlist.dev/e/1214771560-14005-1-git-send-email-jnareb%40gmail.com
In-Reply-To: <alpine.LFD.1.10.0806291241210.27776@hp.linux-foundation.org>

```
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Linus Torvalds wrote:

> Wouldn't it be a lot more polite to just not run the test when the 
> Test::More stuff doesn't exist? Rather than failing the testsuite? From a 
> quick "git grep", this test is the only one that uses Test::More...

Would this be enough?

 t/t9700-perl-git.sh |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/t/t9700-perl-git.sh b/t/t9700-perl-git.sh
index b2fb9ec..81ff84d 100755
--- a/t/t9700-perl-git.sh
+++ b/t/t9700-perl-git.sh
@@ -6,6 +6,18 @@
 test_description='perl interface (Git.pm)'
 . ./test-lib.sh
 
+perl -MTest::More -e '' >/dev/null 2>&1 || {
+	test_expect_success 'skipping Git.pm tests, Test::More module not found' :
+	test_done
+	exit
+}
+
+perl -e 'use 5.006002;' >/dev/null 2>&1 || {
+	test_expect_success 'skipping Git.pm tests, Perl version too old' :
+	test_done
+	exit
+}
+
 # set up test repository
 
 test_expect_success \
-- 
1.5.6

```

## Johannes Schindelin, 2008-06-29 21:55

Subject: Re: perl t9700 failures?
Message-ID: <alpine.DEB.1.00.0806292253050.9925@racer>
URL: https://gitlist.dev/e/alpine.DEB.1.00.0806292253050.9925%40racer
In-Reply-To: <alpine.LFD.1.10.0806291241210.27776@hp.linux-foundation.org>

```
Hi,

On Sun, 29 Jun 2008, Linus Torvalds wrote:

> 	Can't locate Test/More.pm in @INC (@INC contains: ...)

I cannot say that I am really surprised.  And given that I _actively_ 
warned that something like this is prone to happen, I have to say that I 
am actually a little pleased, too, since it shows I am not actually a 
complete moron having warned, even if people laughed in my face because of 
my concerns.

Ciao,
Dscho

```

## Jakub Narebski, 2008-06-29 22:53

Subject: Re: perl t9700 failures?
Message-ID: <m3zlp3hn19.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3zlp3hn19.fsf%40localhost.localdomain
In-Reply-To: <7vzlp47zy8.fsf@gitster.siamese.dyndns.org>

```
Junio C Hamano <gitster@pobox.com> writes:

> +perl -MTest::More -e 0 2>/dev/null || {
> +	say skip "Perl Test::More unavailable, skipping test"
> +	test_done
> +}
> +

I think it would be nice to have "test_skip" function in test-lib.sh;
a few tests beside this one (t9500 gitweb test, git-svn tests) have
not always filled requirements.

-- 
Jakub Narebski
Poland
ShadeHawk on #git

```

## Lea Wiemann, 2008-06-29 22:56

Subject: Re: perl t9700 failures?
Message-ID: <4868130F.2080600@gmail.com>
URL: https://gitlist.dev/e/4868130F.2080600%40gmail.com
In-Reply-To: <7vzlp47zy8.fsf@gitster.siamese.dyndns.org>

```
Junio C Hamano wrote:
> +perl -MTest::More -e 0 2>/dev/null || {
> +	say skip "Perl Test::More unavailable, skipping test"

That looks fine -- the git scripts that use Git.pm are still tested
separately, so even if this test is skipped, Git.pm can be assumed to
not be broken.

Jakub Narebski wrote:
> +perl -MTest::More -e '' >/dev/null 2>&1 || {
> [...]
> +perl -e 'use 5.006002;' >/dev/null 2>&1 || {

I don't think checking for 5.6.2 (which is the version in which
Test::More was added) is actually necessary.  If someone installs
Test::More on an older Perl version, we might as well run the tests --
apparently Git.pm works even with older versions, since
t3701-add-interactive.sh seems to work fine for Linus.

Johannes Schindelin wrote:
> And given that I _actively_  warned [...] I
> am actually a little pleased

Johannes, I'd actually be a little pleased if you either

- stop "actively warning" and start actively sending patches, or
- spare the list (and in particular, my mailbox) your whining.

TIA.

```

## Linus Torvalds, 2008-06-30 01:17

Subject: Re: perl t9700 failures?
Message-ID: <alpine.LFD.1.10.0806291806120.17544@hp.linux-foundation.org>
URL: https://gitlist.dev/e/alpine.LFD.1.10.0806291806120.17544%40hp.linux-foundation.org
In-Reply-To: <7v4p7c9erj.fsf@gitster.siamese.dyndns.org>

```


On Sun, 29 Jun 2008, Junio C Hamano wrote:
> 
> Perlhaps something liek this should be sufficient.

Works-for-me(tm)

		Linus

```

## Johannes Sixt, 2008-06-30 06:11

Subject: Re: perl t9700 failures?
Message-ID: <48687924.7020309@viscovery.net>
URL: https://gitlist.dev/e/48687924.7020309%40viscovery.net
In-Reply-To: <7vzlp47zy8.fsf@gitster.siamese.dyndns.org>

```
Junio C Hamano schrieb:
> I'll commit this

> +perl -MTest::More -e 0 2>/dev/null || {
> +	say skip "Perl Test::More unavailable, skipping test"

But without the "skip", right? ;)

-- Hannes

```
