threads / discuss / 14210

perl t9700 failures?

Subject: perl t9700 failures?

## tl;dr

9 messages between Jun 29, 2008 and Jun 30, 2008.

replies: 8people: 6as markdown or json

Linus Torvalds· Jun 29, 2008, 19:52 UTC · lore
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· Jun 29, 2008, 20:18 UTC · re: Linus Torvalds · lore

Re: perl t9700 failures?

Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 25 quoted lines
> 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· Jun 29, 2008, 20:23 UTC · re: Linus Torvalds · lore

Re: perl t9700 failures?

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· Jun 29, 2008, 22:53 UTC · re: Junio C Hamano · lore

Re: perl t9700 failures?

Junio C Hamano <gitster@pobox.com> writes:
Show 5 quoted lines
> +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· Jun 29, 2008, 22:56 UTC · re: Junio C Hamano · lore

Re: perl t9700 failures?

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.
Johannes Sixt· Jun 30, 2008, 06:11 UTC · re: Junio C Hamano · lore

Re: perl t9700 failures?

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
Jakub Narebski· Jun 29, 2008, 20:32 UTC · re: Linus Torvalds · lore

[PATCH] Skip Perl interface (Git.pm) tests if requirements not fullfilled

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· Jun 29, 2008, 21:55 UTC · re: Linus Torvalds · lore

Re: perl t9700 failures?

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

← back to recent threads