threads / discuss / 27626

Test 9500 - unhelpful without Perl::CGI

Subject: Test 9500 - unhelpful without Perl::CGI

## tl;dr

6 messages between Jun 15, 2011 and Jun 15, 2011.

replies: 5people: 3as markdown or json

Linus Torvalds· Jun 15, 2011, 02:37 UTC · lore

This has probably been going on forever, and the only reason I noticed is that I had a machine that doesn't have perl-CGI installed.

I'm talking about t9500-gitweb-standalone-no-errors.

Anyway, if you don't have that, the test fails at everything, and it does so without any clues about _why_ it fails. I ended up figuring it out by doing a "strace -f" to see what seems to be wrong.

Maybe that test could have some additional check for "is perl::CGI installed at all" and at least give a useful error message rather than just saying it failed?

                    Linus
Junio C Hamano· Jun 15, 2011, 05:59 UTC · re: Linus Torvalds · lore

Re: Test 9500 - unhelpful without Perl::CGI

Linus Torvalds <torvalds@linux-foundation.org> writes:
Show 7 quoted lines
> This has probably been going on forever, and the only reason I noticed
> is that I had a machine that doesn't have perl-CGI installed.
>
> I'm talking about t9500-gitweb-standalone-no-errors.
>
> Anyway, if you don't have that, the test fails at everything, and it
> does so without any clues about _why_ it fails.
Something like this would hopefully suffice.

It seems that we do test for the version of Encode, but we do not specifically test CGI or other modules that people do not have to slurp from CPAN?

 t/gitweb-lib.sh |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh
index 143eb1f..292753f 100644
--- a/t/gitweb-lib.sh
+++ b/t/gitweb-lib.sh
@@ -107,4 +107,9 @@ perl -MEncode -e '$e="";decode_utf8($e, Encode::FB_CROAK)' >/dev/null 2>&1 || {
 	test_done
 }
 
+perl -MCGI -MCGI::Util -MCGI::Carp -e 0 >/dev/null 2>&1 || {
+	skip_all='skipping gitweb tests, CGI module unusable'
+	test_done
+}
+
 gitweb_init
Sverre Rabbelier· Jun 15, 2011, 07:26 UTC · re: Junio C Hamano · lore

Re: Test 9500 - unhelpful without Perl::CGI

Heya,
On Wed, Jun 15, 2011 at 07:59, Junio C Hamano <gitster@pobox.com> wrote:
Show 5 quoted lines
> +perl -MCGI -MCGI::Util -MCGI::Carp -e 0 >/dev/null 2>&1 || {
> +       skip_all='skipping gitweb tests, CGI module unusable'
> +       test_done
> +}
> +

Isn't the new style to use test_must_succeed CGI_AVAILABLE '...' '...' rather than skip_all+test_done?

-- 
Cheers,

Sverre Rabbelier
Junio C Hamano· Jun 15, 2011, 16:51 UTC · re: Sverre Rabbelier · lore

Re: Test 9500 - unhelpful without Perl::CGI

Sverre Rabbelier <srabbelier@gmail.com> writes:
Show 9 quoted lines
> On Wed, Jun 15, 2011 at 07:59, Junio C Hamano <gitster@pobox.com> wrote:
>> +perl -MCGI -MCGI::Util -MCGI::Carp -e 0 >/dev/null 2>&1 || {
>> +       skip_all='skipping gitweb tests, CGI module unusable'
>> +       test_done
>> +}
>> +
>
> Isn't the new style to use test_must_succeed CGI_AVAILABLE '...' '...'
> rather than skip_all+test_done?

I do not think that adds any value, at least in this case. Besides, look at the context line above what you quoted ;-)

Junio C Hamano· Jun 15, 2011, 17:05 UTC · re: Junio C Hamano · lore

Re: Test 9500 - unhelpful without Perl::CGI

Junio C Hamano <gitster@pobox.com> writes:
Show 7 quoted lines
> Sverre Rabbelier <srabbelier@gmail.com> writes:
>
>> Isn't the new style to use test_must_succeed CGI_AVAILABLE '...' '...'
>> rather than skip_all+test_done?
>
> I do not think that adds any value, at least in this case.  Besides, look
> at the context line above what you quoted ;-)
In any case, I'd justify it like this and queue.  Thanks for noticing.
-- >8 --
Subject: [PATCH] t/gitweb-lib.sh: skip gitweb tests when perl dependencies are not met

Linus noticed that we go ahead testing gitweb and fail miserably on a box with Perl but not perl-CGI library. We already have a code to detect lack of Perl and refrain from testing gitweb in t/gitweb-lib.sh (by the way, shouldn't it be called t/lib-gitweb.sh?), so let's extend it to cover this case as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/gitweb-lib.sh |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh
index 143eb1f..292753f 100644
--- a/t/gitweb-lib.sh
+++ b/t/gitweb-lib.sh
@@ -107,4 +107,9 @@ perl -MEncode -e '$e="";decode_utf8($e, Encode::FB_CROAK)' >/dev/null 2>&1 || {
 	test_done
 }
 
+perl -MCGI -MCGI::Util -MCGI::Carp -e 0 >/dev/null 2>&1 || {
+	skip_all='skipping gitweb tests, CGI module unusable'
+	test_done
+}
+
 gitweb_init
-- 
1.7.6.rc1.119.g85fc2
Linus Torvalds· Jun 15, 2011, 18:36 UTC · re: Junio C Hamano · lore

Re: Test 9500 - unhelpful without Perl::CGI

On Wed, Jun 15, 2011 at 10:05 AM, Junio C Hamano <gitster@pobox.com> wrote:
>
> Subject: [PATCH] t/gitweb-lib.sh: skip gitweb tests when perl dependencies are not met
Looks good. This makes t9500 go from
   not ok - 1 no commits: projects_list (implicit)
   #	gitweb_run
   not ok - 2 no commits: projects_index
   #	gitweb_run "a=project_index"
   not ok - 3 no commits: .git summary (implicit)
   #	gitweb_run "p=.git"
   not ok - 4 no commits: .git commit (implicit HEAD)
   ...
   not ok - 98 categories: projects list, only default category
   #	echo "\$projects_list_group_categories = 1;" >>gitweb_config.perl &&
   #		 gitweb_run
   # failed 91 among 98 test(s)
   1..98
to
  # passed all 0 test(s)
  1..0 # SKIP skipping gitweb tests, CGI module unusable
without perl-CGI installed. And with perl-CGI installed I obviously get
   ...
   ok 97 - ctags: malformed tag weights
   ok 98 - categories: projects list, only default category
   # passed all 98 test(s)
   1..98
So Ack on that patch.
   Thanks,
                           Linus

← back to recent threads