Skip to contentSkip to conversation

perl t9700 failures?

PATCH New Linus Torvalds 6 participants 9 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

PATCH 1/1 Skip Perl interface (Git.pm) tests if requirements not fullfilled

---

Quoted 3 lines · Linus Torvalds

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(-)
t/t9700-perl-git.sh +12 -0
index b2fb9ec..81ff84d 100755
@@ -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 \
Signature · 1 line
1.5.6
#2 lore raw
In reply to Linus Torvalds
Quoted 18 lines · Linus Torvalds

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: ...)

Quoted 7 lines

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.

t/t9700-perl-git.sh +5 -0
index b2fb9ec..9b57ad1 100755
@@ -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 \
#3 lore raw
Quoted 2 lines · Junio C Hamano

Perlhaps something liek this should be sufficient.

Works-for-me(tm)

Linus

#4 lore raw
In reply to Linus Torvalds

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

---
 t/t9700-perl-git.sh |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
t/t9700-perl-git.sh +5 -0
index b2fb9ec..5dd32f4 100755
@@ -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 \
Signature · 1 line
1.5.6.1.102.g8e69d
#5 lore raw

t/t9700-perl-git.sh line 10

Quoted 2 lines · Junio C Hamano
t/t9700-perl-git.sh +2 -0
+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.

Review

Quoted 3 lines · Jakub Narebski
(quoted diff) +2 -0
+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.

Quoted 2 lines · Johannes Schindelin

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.

#6 lore raw
In reply to Junio C Hamano

t/t9700-perl-git.sh line 10

Quoted 4 lines · Junio C Hamano

I'll commit this

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

But without the "skip", right? ;)

-- Hannes

#7 lore raw
In reply to Junio C Hamano

t/t9700-perl-git.sh line 13

Quoted 5 lines · Junio C Hamano
t/t9700-perl-git.sh +5 -0
+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.

Signature · 3 lines
Jakub Narebski
Poland
ShadeHawk on #git
#8 lore raw
In reply to Linus Torvalds

Hi,

Quoted 1 line · Linus Torvalds

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