Skip to contentSkip to conversation

gitweb tests: Skip tests when we don't have Time::HiRes

PATCH In review Ævar Arnfjörð Bjarmason 3 participants 7 messages Feb 27, 2017 – Mar 1, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitweb tests: Skip tests when we don't have Time::HiRes

Change the gitweb tests to skip when we can't load the Time::HiRes module.

This module has bee in perl core since v5.8, which is the oldest version we support, however CentOS (and perhaps some other distributions) carve it into its own non-core-perl package that's not installed along with /usr/bin/perl by default. Without this we'll hard fail the gitweb tests when trying to load the module.

---
 t/gitweb-lib.sh | 5 +++++
 1 file changed, 5 insertions(+)
t/gitweb-lib.sh +5 -0
index d5dab5a94f..116c3890e6 100644
@@ -114,4 +114,9 @@ perl -MCGI -MCGI::Util -MCGI::Carp -e 0 >/dev/null 2>&1 || {
 	test_done
 }
 
+perl -mTime::HiRes -e 0  >/dev/null 2>&1 || {
+	skip_all='skipping gitweb tests, Time::HiRes module unusable'
+	test_done
+}
+
 gitweb_init
Signature · 1 line
2.11.0
#1 lore raw

W dniu 27.02.2017 o 13:37, Ævar Arnfjörð Bjarmason pisze:

Quoted 2 lines

Change the gitweb tests to skip when we can't load the Time::HiRes module.

Could you tell us in the commit message why this module is needed? Is it because gitweb loads it unconditionally, or does that at least in the default configuration, or is it used in tests, or...?

[I see it is somewhat addressed below]

Quoted 2 lines

This module has bee in perl core since v5.8, which is the oldest

s/bee/been/

Quoted 4 lines

version we support, however CentOS (and perhaps some other distributions) carve it into its own non-core-perl package that's not installed along with /usr/bin/perl by default. Without this we'll hard fail the gitweb tests when trying to load the module.

I see that it because gitweb.perl as the following at line 20:

	use Time::HiRes qw(gettimeofday tv_interval);
Quoted 2 lines

Good catch (if a strange one...).

Quoted 9 lines
---
 t/gitweb-lib.sh | 5 +++++
 1 file changed, 5 insertions(+)
t/gitweb-lib.sh +0 -0
index d5dab5a94f..116c3890e6 100644

t/gitweb-lib.sh perl -MCGI -MCGI::Util -MCGI::Carp -e 0 >/dev/null 2>&1 || { · line 118

Quoted 5 lines
t/gitweb-lib.sh +2 -0
@@ -114,4 +114,9 @@ perl -MCGI -MCGI::Util -MCGI::Carp -e 0 >/dev/null 2>&1 || {
 	test_done
 }
 
+perl -mTime::HiRes -e 0  >/dev/null 2>&1 || {
+	skip_all='skipping gitweb tests, Time::HiRes module unusable'

Is "unusable" a good description, instead of "not found"?

Quoted 5 lines
t/gitweb-lib.sh +3 -0
+	test_done
+}
+
 gitweb_init
#2 lore raw
Quoted 8 lines · Jakub Narębski

W dniu 27.02.2017 o 13:37, Ævar Arnfjörð Bjarmason pisze:

Quoted 2 lines

Change the gitweb tests to skip when we can't load the Time::HiRes module.

Could you tell us in the commit message why this module is needed? Is it because gitweb loads it unconditionally, or does that at least in the default configuration, or is it used in tests, or...?

Quoted 6 lines

[I see it is somewhat addressed below]

Quoted 2 lines

This module has bee in perl core since v5.8, which is the oldest

s/bee/been/

I'll clarify that in a re-roll & fix the typo, pending any other comments. Thanks!

Quoted 5 lines
Quoted 4 lines

version we support, however CentOS (and perhaps some other distributions) carve it into its own non-core-perl package that's not installed along with /usr/bin/perl by default. Without this we'll hard fail the gitweb tests when trying to load the module.

Quoted 8 lines

I see that it because gitweb.perl as the following at line 20:

        use Time::HiRes qw(gettimeofday tv_interval);
Quoted 2 lines

Good catch (if a strange one...).

This and the associated cvs tests failing as root patch I submitted were discovered when trying to build git in the standard mock build environment on CentOS. It creates a chroot and rpm installs just the packages you declare, so issues like these crop up.

Quoted 12 lines
Quoted 12 lines
---
 t/gitweb-lib.sh | 5 +++++
 1 file changed, 5 insertions(+)
t/gitweb-lib.sh +0 -0
index d5dab5a94f..116c3890e6 100644
@@ -114,4 +114,9 @@ perl -MCGI -MCGI::Util -MCGI::Carp -e 0 >/dev/null 2>&1 || {
      test_done
 }
 
Quoted 4 lines

t/gitweb-lib.sh perl -MCGI -MCGI::Util -MCGI::Carp -e 0 >/dev/null 2>&1 || { · line 118

Quoted 2 lines
t/gitweb-lib.sh +2 -0
+perl -mTime::HiRes -e 0  >/dev/null 2>&1 || {
+     skip_all='skipping gitweb tests, Time::HiRes module unusable'

Is "unusable" a good description, instead of "not found"?

Yeah it's odd, but I just copied the several lines above that use that phrasing.

Quoted 6 lines
Quoted 5 lines
t/gitweb-lib.sh +3 -0
+     test_done
+}
+
 gitweb_init
#3 lore raw

v2 cover Minor changes to skip gitweb tests without Time::HiRes

In reply to Jakub Narębski

This was originally just one small patch, but Jakub Narębski pointed out that calling the module "unusable" when we failed to load it was confusing, so now the start of this series is just a rephrasing of an existing error message I copied.

Ævar Arnfjörð Bjarmason (2):
gitweb tests: Change confusing "skip_all" phrasing gitweb tests: Skip tests when we don't have Time::HiRes

 t/gitweb-lib.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Signature · 1 line
2.11.0
#4 lore raw

PATCH v2 1/2 gitweb tests: Change confusing "skip_all" phrasing

Change the phrasing so that instead of saying that the CGI module is unusable, we say that it's not available.

This came up on the git mailing list in <[email protected]> from Jakub Narębski.

---
 t/gitweb-lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
t/gitweb-lib.sh +1 -1
index d5dab5a94f..59ef15efbd 100644
@@ -110,7 +110,7 @@ perl -MEncode -e '$e="";decode_utf8($e, Encode::FB_CROAK)' >/dev/null 2>&1 || {
 }
 
 perl -MCGI -MCGI::Util -MCGI::Carp -e 0 >/dev/null 2>&1 || {
-	skip_all='skipping gitweb tests, CGI module unusable'
+	skip_all='skipping gitweb tests, CGI & CGI::Util & CGI::Carp modules not available'
 	test_done
 }
 
Signature · 1 line
2.11.0
#5 lore raw

PATCH v2 2/2 gitweb tests: Skip tests when we don't have Time::HiRes

In reply to Ævar Arnfjörð Bjarmason

Change the gitweb tests to skip when we can't load the Time::HiRes module.

Gitweb needs this module to work. It has been in perl core since v5.8, which is the oldest version we support. However CentOS (and perhaps some other distributions) carve it into its own non-core-perl package that's not installed along with /usr/bin/perl by default. Without this we'll hard fail the gitweb tests when trying to load the module.

---
 t/gitweb-lib.sh | 5 +++++
 1 file changed, 5 insertions(+)
t/gitweb-lib.sh +5 -0
index 59ef15efbd..b7a73874e7 100644
@@ -114,4 +114,9 @@ perl -MCGI -MCGI::Util -MCGI::Carp -e 0 >/dev/null 2>&1 || {
 	test_done
 }
 
+perl -mTime::HiRes -e 0  >/dev/null 2>&1 || {
+	skip_all='skipping gitweb tests, Time::HiRes module not available'
+	test_done
+}
+
 gitweb_init
Signature · 1 line
2.11.0