unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH 0/2] test fixes for older systems
@ 2020-06-20  0:13 Eric Wong
  2020-06-20  0:13 ` [PATCH 1/2] testcommon: require IO::Socket::SSL >= 2.007 Eric Wong
  2020-06-20  0:13 ` [PATCH 2/2] tests: require git 2.6+ in more places Eric Wong
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Wong @ 2020-06-20  0:13 UTC (permalink / raw)
  To: meta

I've been relying git2u (IUS, git 2.16) package for CentOS 7.x,
so I failed to notice the git 1.8.3 package was not skipping
several v2-only tests.  So properly account for older versions
of git and skip those tests.

We'll also match IO::Socket::SSL support to what libnet
(Net::NNTP) supports, since it doesn't seem worth the
effort to support < 2.007 and skip tests if IO::Socket::SSL
is too old

Eric Wong (2):
  testcommon: require IO::Socket::SSL >= 2.007
  tests: require git 2.6+ in more places

 lib/PublicInbox/TestCommon.pm | 10 +++++++++-
 t/git.t                       |  3 ++-
 t/imap.t                      |  2 +-
 t/imapd.t                     |  2 +-
 t/inbox_idle.t                |  2 +-
 t/nntpd-tls.t                 |  2 --
 t/nntpd.t                     |  5 -----
 t/psgi_bad_mids.t             |  1 +
 t/psgi_multipart_not.t        |  1 +
 t/psgi_scan_all.t             |  1 +
 10 files changed, 17 insertions(+), 12 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] testcommon: require IO::Socket::SSL >= 2.007
  2020-06-20  0:13 [PATCH 0/2] test fixes for older systems Eric Wong
@ 2020-06-20  0:13 ` Eric Wong
  2020-06-20  0:13 ` [PATCH 2/2] tests: require git 2.6+ in more places Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2020-06-20  0:13 UTC (permalink / raw)
  To: meta

Net::NNTP does not support older IO::Socket::SSL.  1.94 on
CentOS 7.x fails HTTPS and IMAPS tests, too.

cf. https://rt.cpan.org/Ticket/Display.html?id=100529
---
 lib/PublicInbox/TestCommon.pm | 10 +++++++++-
 t/nntpd-tls.t                 |  2 --
 t/nntpd.t                     |  5 -----
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index a97125e5..6bf4526a 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -95,7 +95,15 @@ sub require_mods {
 		} else {
 			eval "require $mod";
 		}
-		push @need, $mod if $@;
+		if ($@) {
+			push @need, $mod;
+		} elsif ($mod eq 'IO::Socket::SSL' &&
+			# old versions of IO::Socket::SSL aren't supported
+			# by libnet, at least:
+			# https://rt.cpan.org/Ticket/Display.html?id=100529
+				!eval{ IO::Socket::SSL->VERSION(2.007); 1 }) {
+			push @need, $@;
+		}
 	}
 	return unless @need;
 	my $m = join(', ', @need)." missing for $0";
diff --git a/t/nntpd-tls.t b/t/nntpd-tls.t
index 3de219f1..23baf4e4 100644
--- a/t/nntpd-tls.t
+++ b/t/nntpd-tls.t
@@ -10,8 +10,6 @@ use PublicInbox::TestCommon;
 require_mods(qw(DBD::SQLite IO::Socket::SSL Net::NNTP IO::Poll));
 Net::NNTP->can('starttls') or
 	plan skip_all => 'Net::NNTP does not support TLS';
-IO::Socket::SSL->VERSION(2.007) or
-	plan skip_all => 'IO::Socket::SSL <2.007 not supported by Net::NNTP';
 
 my $cert = 'certs/server-cert.pem';
 my $key = 'certs/server-key.pem';
diff --git a/t/nntpd.t b/t/nntpd.t
index b24720eb..575b66fa 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -109,11 +109,6 @@ EOF
 		$n->can('starttls') or
 			skip('Net::NNTP too old to support STARTTLS', 2);
 		require_mods('IO::Socket::SSL', 2);
-		eval {
-			IO::Socket::SSL->VERSION(2.007);
-		} or skip(<<EOF, 2);
-IO::Socket::SSL <2.007 not supported by Net::NNTP
-EOF
 		ok(!$n->starttls, 'STARTTLS fails when unconfigured');
 		is($n->code, 580, 'got 580 code on server w/o TLS');
 	};

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] tests: require git 2.6+ in more places
  2020-06-20  0:13 [PATCH 0/2] test fixes for older systems Eric Wong
  2020-06-20  0:13 ` [PATCH 1/2] testcommon: require IO::Socket::SSL >= 2.007 Eric Wong
@ 2020-06-20  0:13 ` Eric Wong
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Wong @ 2020-06-20  0:13 UTC (permalink / raw)
  To: meta

We also need to check for git 2.6 earlier in each test case,
before any other TAP output is emitted to avoid confusing the
TAP consumers.
---
 t/git.t                | 3 ++-
 t/imap.t               | 2 +-
 t/imapd.t              | 2 +-
 t/inbox_idle.t         | 2 +-
 t/psgi_bad_mids.t      | 1 +
 t/psgi_multipart_not.t | 1 +
 t/psgi_scan_all.t      | 1 +
 7 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/t/git.t b/t/git.t
index 228df90f..dfd7173a 100644
--- a/t/git.t
+++ b/t/git.t
@@ -84,7 +84,8 @@ if (1) {
 	ok($gcf->packed_bytes > 0, 'packed size is positive');
 }
 
-if ('alternates reloaded') {
+SKIP: {
+	require_git(2.6, 7) or skip('need git 2.6+ for --batch-all-objects', 7);
 	my ($alt, $alt_obj) = tmpdir();
 	my $hash_obj = [ 'git', "--git-dir=$alt", qw(hash-object -w --stdin) ];
 	PublicInbox::Import::init_bare($alt);
diff --git a/t/imap.t b/t/imap.t
index 95bda4fa..5a251c6b 100644
--- a/t/imap.t
+++ b/t/imap.t
@@ -5,11 +5,11 @@
 use strict;
 use Test::More;
 use PublicInbox::TestCommon;
+require_git 2.6;
 require_mods(qw(DBD::SQLite Email::Address::XS||Mail::Address
 	Parse::RecDescent));
 require_ok 'PublicInbox::IMAP';
 require_ok 'PublicInbox::IMAPD';
-require_git 2.6;
 
 my ($tmpdir, $for_destroy) = tmpdir();
 my $cfgfile = "$tmpdir/config";
diff --git a/t/imapd.t b/t/imapd.t
index f9d93448..ffa195d5 100644
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -105,7 +105,7 @@ my @orig_list = @raw = $mic->list;
 like($raw[0], qr/^\* LIST \(.*?\) "\." INBOX/,
 	'got an inbox');
 like($raw[-1], qr/^\S+ OK /, 'response ended with OK');
-is(scalar(@raw), scalar(@V) + 4, 'default LIST response');
+is(scalar(@raw), scalar(@V) * 2 + 2, 'default LIST response');
 @raw = $mic->list('', 'inbox.i1');
 is(scalar(@raw), 2, 'limited LIST response');
 like($raw[0], qr/^\* LIST \(.*?\) "\." INBOX/,
diff --git a/t/inbox_idle.t b/t/inbox_idle.t
index 6bd56113..f754e0fc 100644
--- a/t/inbox_idle.t
+++ b/t/inbox_idle.t
@@ -4,10 +4,10 @@
 use Test::More;
 use PublicInbox::TestCommon;
 use PublicInbox::Config;
+require_git 2.6;
 require_mods(qw(DBD::SQLite));
 require PublicInbox::SearchIdx;
 use_ok 'PublicInbox::InboxIdle';
-require_git('2.6');
 use PublicInbox::InboxWritable;
 my ($tmpdir, $for_destroy) = tmpdir();
 
diff --git a/t/psgi_bad_mids.t b/t/psgi_bad_mids.t
index 81bd9356..70393573 100644
--- a/t/psgi_bad_mids.t
+++ b/t/psgi_bad_mids.t
@@ -8,6 +8,7 @@ use PublicInbox::Config;
 use PublicInbox::TestCommon;
 my @mods = qw(DBD::SQLite HTTP::Request::Common Plack::Test
 		URI::Escape Plack::Builder PublicInbox::WWW);
+require_git 2.6;
 require_mods(@mods);
 use_ok($_) for @mods;
 use_ok 'PublicInbox::WWW';
diff --git a/t/psgi_multipart_not.t b/t/psgi_multipart_not.t
index e36820f4..9b7fb4d0 100644
--- a/t/psgi_multipart_not.t
+++ b/t/psgi_multipart_not.t
@@ -6,6 +6,7 @@ use Test::More;
 use PublicInbox::Eml;
 use PublicInbox::Config;
 use PublicInbox::TestCommon;
+require_git 2.6;
 my @mods = qw(DBD::SQLite Search::Xapian HTTP::Request::Common
               Plack::Test URI::Escape Plack::Builder Plack::Test);
 require_mods(@mods);
diff --git a/t/psgi_scan_all.t b/t/psgi_scan_all.t
index 46eb489f..c8cb2409 100644
--- a/t/psgi_scan_all.t
+++ b/t/psgi_scan_all.t
@@ -7,6 +7,7 @@ use PublicInbox::Eml;
 use PublicInbox::Config;
 use PublicInbox::TestCommon;
 my @mods = qw(HTTP::Request::Common Plack::Test URI::Escape DBD::SQLite);
+require_git 2.6;
 require_mods(@mods);
 use_ok 'PublicInbox::V2Writable';
 foreach my $mod (@mods) { use_ok $mod; }

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-20  0:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-20  0:13 [PATCH 0/2] test fixes for older systems Eric Wong
2020-06-20  0:13 ` [PATCH 1/2] testcommon: require IO::Socket::SSL >= 2.007 Eric Wong
2020-06-20  0:13 ` [PATCH 2/2] tests: require git 2.6+ in more places Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).