Subject: Document how to set up TAP tests for Perl 5.8.8

From: Craig Ringer <[email-masked]>
Date: Wed, 16 Nov 2016 12:48:03 +0800

I found it a real pain to set up Perl 5.8.8 to re-check recent TAP
changes against it. It turns out there's a much easier way than
messing with VMs or manually doing a source install, so I documented
it to save others the future pain.

It'd be nice to commit this at least to 9.6 and v10. Trivial one-file
docs patch. There's no README to patch in 9.4 or 9.5.

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
From 4ea6e7bff66ac2026bbca130bd036618b4012c35 Mon Sep 17 00:00:00 2001
From: Craig Ringer <[email-masked]>
Date: Tue, 15 Nov 2016 15:45:41 +0800
Subject: [PATCH] Document that perl 5.8.8 is required

---
 src/test/perl/README | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/test/perl/README b/src/test/perl/README
index cfb45a1..f15e4f0 100644
--- a/src/test/perl/README
+++ b/src/test/perl/README
@@ -64,3 +64,20 @@ For available PostgreSQL-specific test methods and some example tests read the
 perldoc for the test modules, e.g.:
 
     perldoc src/test/perl/PostgresNode.pm
+
+Required Perl
+-------------
+
+Tests must run on perl 5.8.8 and newer. perlbrew is a good way to obtain
+such a Perl; see https://metacpan.org/pod/distribution/App-perlbrew/bin/perlbrew .
+Just install and
+
+    perlbrew --force install 5.8.8
+    perlbrew use 5.8.8
+    perlbrew install-cpanm
+    cpanm install IPC::Run
+
+then re-run configure to ensure the correct Perl is used when running tests. To verify
+that the right Perl was found:
+
+    grep ^PERL= config.log
-- 
2.5.5

-- 
Sent via pgsql-hackers mailing list ([email-masked])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

---

From: Noah Misch <[email-masked]>
Date: Wed, 16 Nov 2016 02:32:43 -0500

>      perldoc src/test/perl/PostgresNode.pm

Tests must run on Perl 5.8.0 and newer.

---

From: Michael Paquier <[email-masked]>
Date: Wed, 16 Nov 2016 08:01:25 -0800

> Tests must run on Perl 5.8.0 and newer.

Hm? I thought that 5.8.8 was the minimum supported by recalling the
precious discussions. That's as well the oldest version of perldoc,
which is kind of useful. Anyway it would be nice to mention the
minimum requirements directly in src/test/perl/README?
-- 
Michael

---

From: Craig Ringer <[email-masked]>
Date: Thu, 17 Nov 2016 10:00:53 +0800

>> Tests must run on Perl 5.8.0 and newer.

Why? We've always discussed 5.8.8 before. That's already a full 10 years old.

5.8.0 is from *2002*. Are you running any 15-year-old systems you
can't update to a *patch release* of the same perl major?

gendef.pl says it needs 5.8.0 or newer with "use 5.8.0" but that's the
only relevant thing I can find, and it's not relevant to the TAP tests
anyway.

BTW, here's my older approach, with a dockerfile, before I became
aware of perlbrew:

https://www.postgresql.org/message-id/[email-masked]

5.8.8 is in CentOS 5.

Debian Lenny (6) has 5.14.2 Wheezy (5) has 5.10. Etch (4) has 5.8.8.
Etch came out in early 2007. Even Sarge had 5.8.4.

Ubuntu 10.04 Lucid (old-lts) had 5.10.1-8ubuntu2 .

So unless we care about Debian 3 Sarge or source builds done more than
10 years ago, 5.8.8 is more than good enough.

---

From: Kyotaro HORIGUCHI <[email-masked]>
Date: Thu, 17 Nov 2016 11:31:09 +0900 (Tokyo Standard Time)

Hello,

At Thu, 17 Nov 2016 10:00:53 +0800, Craig Ringer <[email-masked]> wrote in <[email-masked]>
> 10 years ago, 5.8.8 is more than good enough.

I vote +1 to upgrading perl, but I'm not sure if all supporting
platforms other than linux support the version of perl.

Anyway ./configure is saying as the following.

| *** The installed version of Perl, $PERL, is too old to use with PostgreSQL.
| *** Perl version 5.8 or later is required, but this is $pgac_perl_version." >&5

If TAP test requires 5.8.8, the whole build sequence should
follow that. Or at least ./configure --enable-tap-tests should
check that.

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

---

From: Craig Ringer <[email-masked]>
Date: Thu, 17 Nov 2016 10:42:54 +0800

> follow that. Or at least ./configure --enable-tap-tests should

I wrote 5.8.8 because that's what we've always discussed before and I
could honestly not imagine it mattering whether we require 10-year or
15-year old Perl. Especially for the TAP tests, which are new, and
optional.

I really don't think it matters if the TAP tests use a slightly newer
Perl. They're optional and not enabled by default. Can we just
document this please? I didn't think a four-line docs patch to an
optional, non-default, new test suite would require this kind of
discussion.

But sure, if it's easier, we can have 5.8.0 in the README. What's five
extra years matter anyway? Hey, while we're at it, lets change Pg to
build on Borland C and require K&R style!

---

From: Craig Ringer <[email-masked]>
Date: Thu, 17 Nov 2016 10:54:09 +0800

> build on Borland C and require K&R style!

Sorry. That was unnecessary. I should've had the sense to save that as
a draft and come back later.

In all seriousness, though, lets query the buildfarm database for Perl
versions. Let it answer.

---

From: Kyotaro HORIGUCHI <[email-masked]>
Date: Thu, 17 Nov 2016 11:59:02 +0900 (Tokyo Standard Time)

At Thu, 17 Nov 2016 10:42:54 +0800, Craig Ringer <[email-masked]> wrote in <[email-masked]>
> Perl. They're optional and not enabled by default. Can we just

If so, why explicitly require 5.8.8? I think it is because the
'slight' difference actually prevent the test from running.

> optional, non-default, new test suite would require this kind of

My only concern is the fact that 'make check-world' runs the TAP
tests as a part if --enable-tap-tests (according to
release-9.4.sgml, but I haven't done by myself.). I completely
agree to you if it didn't run as a part of top-level 'make <some
kind of check>'.
 
> build on Borland C and require K&R style!

It's seems an extreme story. And I *believe* anywhere written
that Pg requires some version of C standard.

regards,

---

From: Kyotaro HORIGUCHI <[email-masked]>
Date: Thu, 17 Nov 2016 12:16:01 +0900 (Tokyo Standard Time)

Hello,

At Thu, 17 Nov 2016 11:59:02 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <[email-masked]> wrote in <[email-masked]>
> agree to you if it didn't run as a part of top-level 'make <some

Hmm. I notice that older perls may reject installation of TAP. If
that's true, no check needed but a description also might be
needed to --enable-tap-tests. Or, might not be needed since
anyway it fails for the older versions.

diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 296611d..58459e5 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -1285,9 +1285,11 @@ su - postgres
        <term><option>--enable-tap-tests</option></term>
        <listitem>
         <para>
-         Enable tests using the Perl TAP tools.  This requires a Perl
-         installation and the Perl module <literal>IPC::Run</literal>.
-         <![%standalone-ignore;[See <xref linkend="regress-tap"> for more information.]]>
+         Enable tests using the Perl TAP tools.  This requires a Perl (5.8.8
+         or later) installation and the Perl
+         module <literal>IPC::Run</literal>.
+         <![%standalone-ignore;[See <xref linkend="regress-tap"> for more
+         information.]]>
         </para>
        </listitem>
       </varlistentry>

regards,

---

From: Michael Paquier <[email-masked]>
Date: Wed, 16 Nov 2016 20:23:28 -0800

> In all seriousness, though, lets query the buildfarm database for Perl

castoroides, Solaris 10 and perl 5.8.4, no?
https://www.postgresql.org/message-id/[email-masked]
-- 
Michael

---

From: Craig Ringer <[email-masked]>
Date: Thu, 17 Nov 2016 14:47:49 +0800

> https://www.postgresql.org/message-id/[email-masked]

Thanks for checking.

Can we just add the README text with Perl 5.8.4 then? Or 5.8.0 or
3.005 or whatever version is determined to be the oldest needed?

---

From: Robert Haas <[email-masked]>
Date: Thu, 17 Nov 2016 16:41:42 -0500

> a draft and come back later.

Well, *I* thought it was pretty funny...

I remember K&R style rather fondly.  Of course it was inferior
technically, but if you could get things to compile that way you could
feel like a wizard for being able to make the old compiler work.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

---

From: Craig Ringer <[email-masked]>
Date: Fri, 18 Nov 2016 06:39:33 +0800

> feel like a wizard for being able to make the old compiler work.

Rather. I remember getting modern software to compile on SCO
OpenServer 5.0.5 that way. *Twich* *twitch*.

Anyway, here's an updated patch with version changed to 5.8.4 since
that's the newest we test on the buildfarm (and it's from 2004).

I wasted a bunch of time getting set up to test for such an ancient
Perl and would love to save the next person along the hassle by
documenting the easy way.

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
From 2a911dda796e88c88703095ad2f34cb73ccf919b Mon Sep 17 00:00:00 2001
From: Craig Ringer <[email-masked]>
Date: Tue, 15 Nov 2016 15:45:41 +0800
Subject: [PATCH] Document that perl 5.8.4 is required for TAP tests

We don't test with anything older than Perl 5.8.4 in the buildfarm
and it's from 2004, so document that the TAP tests are expected to
work with Perl 5.8.4 and explain how to get it easily.

This does not affect configure tests; we'll still compile against
an older Perl 5.8.x if there's one in the wild.
---
 src/test/perl/README | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

index cfb45a1..9c8bd05 100644
 
     perldoc src/test/perl/PostgresNode.pm
+
+Required Perl
+-------------
+
+Tests must run on perl 5.8.4 and newer. perlbrew is a good way to obtain
+such a Perl; see https://metacpan.org/pod/distribution/App-perlbrew/bin/perlbrew .
+Just install and
+
+    perlbrew --force install 5.8.4
+    perlbrew use 5.8.4
+    perlbrew install-cpanm
+    cpanm install IPC::Run
+
+then re-run configure to ensure the correct Perl is used when running tests. To verify
+that the right Perl was found:
+
+    grep ^PERL= config.log
-- 
2.5.5

---

From: Michael Paquier <[email-masked]>
Date: Thu, 17 Nov 2016 15:10:18 -0800

> documenting the easy way.

It looks sensible to mention that in the README, so +1.

By the way, would it matter to mention ways to install perlbrew? For
example, I just bumped into http://install.perlbrew.pl by looking
around, though I don't doubt that most people would just use cpan with
"install App::perlbrew" for example. For OSX users with brew and
without macports that would matter.
-- 
Michael

---

From: Craig Ringer <[email-masked]>
Date: Fri, 18 Nov 2016 08:15:36 +0800

> without macports that would matter.

The docs linked mention it, so I figured that'd probably do. Though I
notice it's only mentioned in the "configuration" section not under
"installation", so maybe it's worth adding yeah.

---

From: Craig Ringer <[email-masked]>
Date: Mon, 21 Nov 2016 11:58:34 +0800

> "installation", so maybe it's worth adding yeah.

Updated docs patch. Since configure checks for 5.8.0 that's what's
specified. Anyone who wants to argue about the actual version we
_should_ target can do so elsewhere, all I'm interested in is what we
_do_ officially target so I can document this.

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
From e659e76ed2a1049ce5f7428fb6a8ef9deaef3ca6 Mon Sep 17 00:00:00 2001
From: Craig Ringer <[email-masked]>
Date: Tue, 15 Nov 2016 15:45:41 +0800
Subject: [PATCH] Document that perl 5.8.0 is required

---
 src/test/perl/README | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/test/perl/README b/src/test/perl/README
index cfb45a1..d2550a9 100644
--- a/src/test/perl/README
+++ b/src/test/perl/README
@@ -64,3 +64,21 @@ For available PostgreSQL-specific test methods and some example tests read the
 perldoc for the test modules, e.g.:
 
     perldoc src/test/perl/PostgresNode.pm
+
+Required Perl
+-------------
+
+Tests must run on perl 5.8.0 and newer. perlbrew is a good way to obtain
+such a Perl; see http://install.perlbrew.pl .
+
+Just install and
+
+    perlbrew --force install 5.8.0
+    perlbrew use 5.8.0
+    perlbrew install-cpanm
+    cpanm install IPC::Run
+
+then re-run configure to ensure the correct Perl is used when running tests. To verify
+that the right Perl was found:
+
+    grep ^PERL= config.log
-- 
2.5.5

---

From: Kyotaro HORIGUCHI <[email-masked]>
Date: Mon, 21 Nov 2016 13:23:49 +0900 (Tokyo Standard Time)

Hello,

At Mon, 21 Nov 2016 11:58:34 +0800, Craig Ringer <[email-masked]> wrote in <CAMsr+YHdiEMRB+2yBz=[email-masked]>
> >> It looks sensible to mention that in the README, so +1.

I appreciate the labor. Anyway I don't object for adding that to
the README. +1.

> _do_ officially target so I can document this.

I understand you :p By the way, the new doc points to
http://install.perlbrew.pl and it just shows the install
script. It seems more puzzling..

I suppose https://perlbrew.pl/ seems to me the primary site for
perbrew.

| Perlbrew
| 
| perlbrew is an admin-free perl installation management tool. The latest version is 0.78, read the release note: Release 0.78.
| 
| Install, quickly
| 
| Copy & Paste this line into your terminal:
| 
| \curl -L https://install.perlbrew.pl | bash

regards,

---

From: Craig Ringer <[email-masked]>
Date: Mon, 21 Nov 2016 14:38:24 +0800

> I appreciate the labor. Anyway I don't object for adding that to

Thanks.

> I suppose https://perlbrew.pl/ seems to me the primary site for

Oops!

Fixed in attached.

From e9a654aebd76abeadd5bc592191f8b01bce3716e Mon Sep 17 00:00:00 2001

---

index cfb45a1..0732cac 100644
 
+such a Perl; see http://perlbrew.pl .

---

From: Michael Paquier <[email-masked]>
Date: Mon, 21 Nov 2016 16:45:10 +0900

>> I suppose https://perlbrew.pl/ seems to me the primary site for

No objections to this version. It's a good idea to document that.
-- 
Michael

---

From: Kyotaro HORIGUCHI <[email-masked]>
Date: Mon, 21 Nov 2016 17:37:50 +0900 (Tokyo Standard Time)

At Mon, 21 Nov 2016 16:45:10 +0900, Michael Paquier <[email-masked]> wrote in <[email-masked]>
> No objections to this version. It's a good idea to document that.

+1

regards,

---

From: Noah Misch <[email-masked]>
Date: Sun, 4 Dec 2016 00:28:39 -0500

> _do_ officially target so I can document this.

That's a proper separation of efforts; thanks.

> > No objections to this version. It's a good idea to document that.

Committed after re-filling paragraphs.

---

From: Michael Paquier <[email-masked]>
Date: Mon, 5 Dec 2016 14:19:19 +0900

> Committed after re-filling paragraphs.

Thanks, I have updated the CF entry as well.
-- 
Michael

---

From: [email-masked] (Dagfinn Ilmari Mannsåker)
Date: Mon, 05 Dec 2016 11:17:08 +0000

> Committed after re-filling paragraphs.

I just noticed this bit in the committed patch:

+    cpanm install IPC::Run

This is not the correct invocation of cpanm: it just takes a list of
module names.  This will pull in the 'install' module, which is
harmless, but unnecessary: https://metacpan.org/pod/install.

-- 
"I use RMS as a guide in the same way that a boat captain would use
 a lighthouse.  It's good to know where it is, but you generally
 don't want to find yourself in the same spot." - Tollef Fog Heen

---

From: Craig Ringer <[email-masked]>
Date: Mon, 5 Dec 2016 21:15:15 +0800

> harmless, but unnecessary: https://metacpan.org/pod/install.

Ha. Good catch. Since, as you noted, it's harmless I didn't realise
it'd happened.