Hello,

Here are the reworked patches for enabling the Test::Simple tests in
Automake's test suite.  I split the original patch into 4 smaller/easier
to review ones.  I hope this is better this way.

--
Matthias Paulmier

>From c39c9e0d749a8f977bfea30a10e8cb60aafe90e2 Mon Sep 17 00:00:00 2001
From: Matthias Paulmier <matthias.paulm...@etu.u-bordeaux.fr>
Date: Thu, 30 Aug 2018 16:30:19 +0200
Subject: [PATCH 1/4] t/pm: Fix fake XFAIL perl tests

Use eval to fix fail XFAIL perl test and catch fatal errors.  This allows to
group tests by module since we don't need to worry anymore about tests
"fataling out" of the file.

* t/pm: No more XFAIL perl tests
---
 t/list-of-tests.mk     | 19 +------------------
 t/pm/Cond2.pl          | 22 ----------------------
 t/pm/Cond3.pl          | 22 ----------------------
 t/pm/Condition.pl      | 26 +++++++++++++++++++++++++-
 t/pm/DisjCon2.pl       | 24 ------------------------
 t/pm/DisjCon3.pl       | 23 -----------------------
 t/pm/DisjConditions.pl | 26 +++++++++++++++++++++++++-
 t/pm/Version.pl        | 15 +++++++++++++++
 t/pm/Version2.pl       | 20 --------------------
 t/pm/Version3.pl       | 20 --------------------
 10 files changed, 66 insertions(+), 151 deletions(-)
 delete mode 100644 t/pm/Cond2.pl
 delete mode 100644 t/pm/Cond3.pl
 delete mode 100644 t/pm/DisjCon2.pl
 delete mode 100644 t/pm/DisjCon3.pl
 delete mode 100644 t/pm/Version2.pl
 delete mode 100644 t/pm/Version3.pl

diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 84dd29af0..ec2d106a2 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -17,16 +17,6 @@
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
-# FIXME: this "expected failures" are in truth an hack used to
-# FIXME: to verify that some incorrect usages of our perl libraries
-# FIXME: raise an error.  We should find a cleaner way to check that.
-perl_fake_XFAIL_TESTS = \
-t/pm/Cond2.pl \
-t/pm/Cond3.pl \
-t/pm/DisjCon2.pl \
-t/pm/DisjCon3.pl \
-t/pm/Version2.pl \
-t/pm/Version3.pl
 
 XFAIL_TESTS = \
 t/all.sh \
@@ -42,22 +32,15 @@ t/objext-pr10128.sh \
 t/remake-timing-bug-pr8365.sh \
 t/lex-subobj-nodep.sh \
 t/remake-am-pr10111.sh \
-t/remake-m4-pr10111.sh \
-$(perl_fake_XFAIL_TESTS)
+t/remake-m4-pr10111.sh
 
 perl_TESTS = \
-t/pm/Cond2.pl \
-t/pm/Cond3.pl \
 t/pm/Condition.pl \
 t/pm/Condition-t.pl \
-t/pm/DisjCon2.pl \
-t/pm/DisjCon3.pl \
 t/pm/DisjConditions.pl \
 t/pm/DisjConditions-t.pl \
 t/pm/General.pl \
 t/pm/Version.pl \
-t/pm/Version2.pl \
-t/pm/Version3.pl \
 t/pm/Wrap.pl
 
 perf_TESTS = \
diff --git a/t/pm/Cond2.pl b/t/pm/Cond2.pl
deleted file mode 100644
index f586a67b9..000000000
--- a/t/pm/Cond2.pl
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (C) 2011-2018 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-# Catch common programming error:
-# A Condition passed as a string to 'new'.
-
-use Automake::Condition;
-
-my $cond = new Automake::Condition ('TRUE');
-new Automake::Condition ($cond);
diff --git a/t/pm/Cond3.pl b/t/pm/Cond3.pl
deleted file mode 100644
index 769d01b9a..000000000
--- a/t/pm/Cond3.pl
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (C) 2011-2018 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-# Catch common programming error:
-# A Condition passed as a string to 'new'.
-
-use Automake::Condition;
-
-my $cond = new Automake::Condition ("COND1_TRUE");
-new Automake::Condition ("$cond");
diff --git a/t/pm/Condition.pl b/t/pm/Condition.pl
index 21021b555..58f89b3ae 100644
--- a/t/pm/Condition.pl
+++ b/t/pm/Condition.pl
@@ -253,8 +253,32 @@ sub test_merge ()
   return 0;
 }
 
+sub test_bad_declarations ()
+{
+  my $failed = 0;
+
+  # Catch error:
+  # A condition object passed to 'new'
+  my $cond1 = new Automake::Condition ('TRUE');
+  eval { new Automake::Condition ($cond1) };
+
+  warn $@ if $@;
+  $failed = 1 unless $@;
+  $@ = '';
+
+  # Catch common programming error:
+  # A Condition passed as a string to 'new'.
+  my $cond2 = new Automake::Condition ("COND1_TRUE");
+  eval { new Automake::Condition ("$cond2") };
+
+  warn $@ if $@;
+  $failed = 1 unless $@;
+  return $failed;
+}
+
 exit (test_basics
       || test_true_when
       || test_reduce_and
       || test_reduce_or
-      || test_merge);
+      || test_merge
+      || test_bad_declarations);
diff --git a/t/pm/DisjCon2.pl b/t/pm/DisjCon2.pl
deleted file mode 100644
index e5f204db6..000000000
--- a/t/pm/DisjCon2.pl
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (C) 2011-2018 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-# Catch common programming error:
-# A non-Condition reference passed to new.
-
-use Automake::Condition;
-use Automake::DisjConditions;
-
-my $cond = new Automake::Condition ('TRUE');
-my $cond2 = new Automake::DisjConditions ($cond);
-new Automake::DisjConditions ($cond2);
diff --git a/t/pm/DisjCon3.pl b/t/pm/DisjCon3.pl
deleted file mode 100644
index cc1f467fd..000000000
--- a/t/pm/DisjCon3.pl
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (C) 2011-2018 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-# Catch common programming error:
-# A non-reference passed to new.
-
-use Automake::Condition qw/TRUE FALSE/;
-use Automake::DisjConditions;
-
-my $cond = new Automake::Condition ("COND1_TRUE");
-new Automake::DisjConditions ("$cond");
diff --git a/t/pm/DisjConditions.pl b/t/pm/DisjConditions.pl
index f4075b0be..bdcafd2bb 100644
--- a/t/pm/DisjConditions.pl
+++ b/t/pm/DisjConditions.pl
@@ -380,8 +380,32 @@ sub test_ambig ()
   return 0;
 }
 
+sub test_bad_declarations
+{
+  my $failed;
+  my $cond = new Automake::Condition ('TRUE');
+  my $cond2 = new Automake::DisjConditions ($cond);
+
+  eval { new Automake::DisjConditions ($cond2) };
+
+  warn $@ if $@;
+  $failed = 1 unless $@;
+
+  $@ = '';
+
+  my $cond3 = new Automake::Condition ("COND1_TRUE");
+
+  eval { new Automake::DisjConditions ("$cond3") };
+
+  warn $@ if $@;
+  $failed = 1 unless $@;
+
+  return $failed;
+}
+
 exit (test_basics
       || test_invert
       || test_simplify
       || test_sub_conditions
-      || test_ambig);
+      || test_ambig
+      || test_bad_declarations);
diff --git a/t/pm/Version.pl b/t/pm/Version.pl
index 3177c0361..e4372fffb 100644
--- a/t/pm/Version.pl
+++ b/t/pm/Version.pl
@@ -65,6 +65,21 @@ sub test_bad_versions
   }
 }
 
+sub test_bad_declarations
+{
+  eval { Automake::Version::check ('', '1.2.3') };
+
+  warn $@ if $@;
+  $failed = 1 unless $@;
+
+  $@ = '';
+
+  eval { Automake::Version::check ('1.2.3', '') };
+
+  warn $@ if $@;
+  $failed = 1 unless $@;
+}
+
 my @tests = (
 # basics
   ['1.0', '2.0', -1],
diff --git a/t/pm/Version2.pl b/t/pm/Version2.pl
deleted file mode 100644
index d6d0111dd..000000000
--- a/t/pm/Version2.pl
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2011-2018 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-# prog_error due to invalid $VERSION.
-
-use Automake::Version;
-
-Automake::Version::check ('', '1.2.3');
diff --git a/t/pm/Version3.pl b/t/pm/Version3.pl
deleted file mode 100644
index f1583c081..000000000
--- a/t/pm/Version3.pl
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2011-2018 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-# prog_error due to invalid $REQUIRED.
-
-use Automake::Version;
-
-Automake::Version::check ('1.2.3', '');
-- 
2.18.0

>From d3a3e33471ce0342652ca51760e3a3267e53c3c6 Mon Sep 17 00:00:00 2001
From: Matthias Paulmier <matthias.paulm...@etu.u-bordeaux.fr>
Date: Thu, 30 Aug 2018 16:33:16 +0200
Subject: [PATCH 2/4] Add extension for perl tests using Test::Simple

This extension is for Perl tests written with the help of the Test::Simple.

* t/pm/Version.pl: Replace it with Version.plt as an example.
---
 t/list-of-tests.mk |   2 +-
 t/local.mk         |   4 +-
 t/pm/Version.pl    | 127 ---------------------------------------------
 t/pm/Version.plt   | 122 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 126 insertions(+), 129 deletions(-)
 delete mode 100644 t/pm/Version.pl
 create mode 100644 t/pm/Version.plt

diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index ec2d106a2..7cc0e6585 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -40,7 +40,7 @@ t/pm/Condition-t.pl \
 t/pm/DisjConditions.pl \
 t/pm/DisjConditions-t.pl \
 t/pm/General.pl \
-t/pm/Version.pl \
+t/pm/Version.plt \
 t/pm/Wrap.pl
 
 perf_TESTS = \
diff --git a/t/local.mk b/t/local.mk
index 0d0aee6ad..14b3e61b3 100644
--- a/t/local.mk
+++ b/t/local.mk
@@ -21,13 +21,15 @@
 # Run the tests with a proper shell detected at configure time.
 LOG_COMPILER = ./pre-inst-env $(AM_TEST_RUNNER_SHELL)
 
-TEST_EXTENSIONS = .pl .sh .tap
+TEST_EXTENSIONS = .pl .plt .sh .tap
 SH_LOG_COMPILER = $(LOG_COMPILER)
 TAP_LOG_COMPILER = $(LOG_COMPILER)
 PL_LOG_COMPILER = ./pre-inst-env $(PERL)
+PLT_LOG_COMPILER = $(PL_LOG_COMPILER)
 AM_PL_LOG_FLAGS = -Mstrict -w
 
 TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) $(srcdir)/lib/tap-driver.sh
+PLT_LOG_DRIVER = $(TAP_LOG_DRIVER)
 
 AM_TAP_LOG_DRIVER_FLAGS = --merge
 
diff --git a/t/pm/Version.pl b/t/pm/Version.pl
deleted file mode 100644
index e4372fffb..000000000
--- a/t/pm/Version.pl
+++ /dev/null
@@ -1,127 +0,0 @@
-# Copyright (C) 2002-2018 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-use Automake::Version;
-
-my $failed = 0;
-
-sub test_version_compare
-{
-  my ($left, $right, $result) = @_;
-  my @leftver = Automake::Version::split ($left);
-  my @rightver = Automake::Version::split ($right);
-  if ($#leftver == -1)
-  {
-    print "can't grok \"$left\"\n";
-    $failed = 1;
-    return;
-  }
-  if ($#rightver == -1)
-  {
-    print "can't grok \"$right\"\n";
-    $failed = 1;
-    return;
-  }
-  my $res = Automake::Version::compare (@leftver, @rightver);
-  if ($res != $result)
-  {
-    print "compare (\"$left\", \"$right\") = $res! (not $result?)\n";
-    $failed = 1;
-  }
-
-  my $check_expected = ($result == 0 || $result == 1) ? 0 : 1;
-  # Exception for 'foo' fork.
-  $check_expected = 1
-    if ($right =~ /foo/ && !($left =~ /foo/));
-
-  my $check = Automake::Version::check ($left, $right);
-  if ($check != $check_expected)
-  {
-    print "check (\"$left\", \"$right\") = $check! (not $check_expected?)\n";
-    $failed = 1;
-  }
-}
-
-sub test_bad_versions
-{
-  my ($ver) = @_;
-  my @version = Automake::Version::split ($ver);
-  if ($#version != -1)
-  {
-    print "shouldn't grok \"$ver\"\n";
-    $failed = 1;
-  }
-}
-
-sub test_bad_declarations
-{
-  eval { Automake::Version::check ('', '1.2.3') };
-
-  warn $@ if $@;
-  $failed = 1 unless $@;
-
-  $@ = '';
-
-  eval { Automake::Version::check ('1.2.3', '') };
-
-  warn $@ if $@;
-  $failed = 1 unless $@;
-}
-
-my @tests = (
-# basics
-  ['1.0', '2.0', -1],
-  ['2.0', '1.0', 1],
-  ['1.2', '1.2', 0],
-  ['1.1', '1.2', -1],
-  ['1.2', '1.1', 1],
-# alphas
-  ['1.4', '1.4g', -1],
-  ['1.4g', '1.5', -1],
-  ['1.4g', '1.4', 1],
-  ['1.5', '1.4g', 1],
-  ['1.4a', '1.4g', -1],
-  ['1.5a', '1.3g', 1],
-  ['1.6a', '1.6a', 0],
-# micros
-  ['1.5.1', '1.5', 1],
-  ['1.5.0', '1.5', 0],
-  ['1.5.4', '1.6.1', -1],
-# micros and alphas
-  ['1.5a', '1.5.1', 1],
-  ['1.5a', '1.5.1a', 1],
-  ['1.5a', '1.5.1f', 1],
-  ['1.5', '1.5.1a', -1],
-  ['1.5.1a', '1.5.1f', -1],
-  ['1.5.1f', '1.5.1a', 1],
-  ['1.5.1f', '1.5.1f', 0],
-# special exceptions
-  ['1.6-p5a', '1.6.5a', 0],
-  ['1.6', '1.6-p5a', -1],
-  ['1.6-p4b', '1.6-p5a', -1],
-  ['1.6-p4b', '1.6-foo', 1],
-  ['1.6-p4b', '1.6a-foo', -1],
-  ['1.6-p5', '1.6.5', 0],
-  ['1.6a-foo', '1.6a-foo', 0],
-);
-
-my @bad_versions = (
-  '', 'a', '1', '1a', '1.2.3.4', '-1.2'
-);
-
-test_version_compare (@{$_}) foreach @tests;
-test_bad_versions ($_) foreach @bad_versions;
-
-exit $failed;
diff --git a/t/pm/Version.plt b/t/pm/Version.plt
new file mode 100644
index 000000000..4684453af
--- /dev/null
+++ b/t/pm/Version.plt
@@ -0,0 +1,122 @@
+# -*- mode:perl -*-
+# Copyright (C) 2002-2018 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+use Automake::Version;
+use Test::Simple tests => 34;
+
+sub test_version_compare
+{
+  my ($left, $right, $result) = @_;
+  my @leftver = Automake::Version::split ($left);
+  my @rightver = Automake::Version::split ($right);
+  if ($#leftver == -1)
+  {
+    print "can't grok \"$left\"\n";
+    return 1;
+  }
+  if ($#rightver == -1)
+  {
+    print "can't grok \"$right\"\n";
+    return 1;
+  }
+  my $res = Automake::Version::compare (@leftver, @rightver);
+  if ($res != $result)
+  {
+    print "compare (\"$left\", \"$right\") = $res! (not $result?)\n";
+    return 1;
+  }
+
+  my $check_expected = ($result == 0 || $result == 1) ? 0 : 1;
+  # Exception for 'foo' fork.
+  $check_expected = 1
+    if ($right =~ /foo/ && !($left =~ /foo/));
+
+  my $check = Automake::Version::check ($left, $right);
+  if ($check != $check_expected)
+    {
+      print "check (\"$left\", \"$right\") = $check! (not $check_expected?)\n";
+      return 1;
+    }
+  return 0;
+}
+
+sub test_bad_versions
+{
+  my ($ver) = @_;
+  my @version = Automake::Version::split ($ver);
+  if ($#version != -1)
+    {
+      print "shouldn't grok \"$ver\"\n";
+      return 1;
+    }
+  return 0;
+}
+
+sub test_bad_declarations
+{
+  eval { Automake::Version::check ('', '1.2.3') };
+
+  warn $@ if $@;
+  $failed = 1 unless $@;
+
+  $@ = '';
+
+  eval { Automake::Version::check ('1.2.3', '') };
+
+  warn $@ if $@;
+  return 1 unless $@;
+  return 0;
+}
+
+ok (test_version_compare ('2.0', '1.0', 1) == 0, 'Test comparing versions basics 2');
+ok (test_version_compare ('1.2', '1.2', 0) == 0, 'Test comparing versions basics 3');
+ok (test_version_compare ('1.1', '1.2', -1) == 0, 'Test comparing versions basics 4');
+ok (test_version_compare ('1.2', '1.1', 1) == 0, 'Test comparing versions basics 5');
+
+ok (test_version_compare ('1.4', '1.4g', -1) == 0, 'Test comparing versions with alphas 1');
+ok (test_version_compare ('1.4g', '1.5', -1) == 0, 'Test comparing versions with alphas 2');
+ok (test_version_compare ('1.4g', '1.4', 1) == 0, 'Test comparing versions with alphas 3');
+ok (test_version_compare ('1.5', '1.4g', 1) == 0, 'Test comparing versions with alphas 4');
+ok (test_version_compare ('1.4a', '1.4g', -1) == 0, 'Test comparing versions with alphas 5');
+ok (test_version_compare ('1.5a', '1.3g', 1) == 0, 'Test comparing versions with alphas 6');
+ok (test_version_compare ('1.6a', '1.6a', 0) == 0, 'Test comparing versions with alphas 7');
+
+ok (test_version_compare ('1.5.1', '1.5', 1) == 0, 'Test comparing versions micros 1');
+ok (test_version_compare ('1.5.0', '1.5', 0) == 0, 'Test comparing versions micros 2');
+ok (test_version_compare ('1.5.4', '1.6.1', -1) == 0, 'Test comparing versions micros 3');
+
+ok (test_version_compare ('1.5a', '1.5.1', 1) == 0, 'Test comparing versions micros and alphas 1');
+ok (test_version_compare ('1.5a', '1.5.1a', 1) == 0, 'Test comparing versions micros and alphas 2');
+ok (test_version_compare ('1.5a', '1.5.1f', 1) == 0, 'Test comparing versions micros and alphas 3');
+ok (test_version_compare ('1.5', '1.5.1a', -1) == 0, 'Test comparing versions micros and alphas 4');
+ok (test_version_compare ('1.5.1a', '1.5.1f', -1) == 0, 'Test comparing versions micros and alphas 5');
+ok (test_version_compare ('1.5.1f', '1.5.1a', 1) == 0, 'Test comparing versions micros and alphas 6');
+ok (test_version_compare ('1.5.1f', '1.5.1f', 0) == 0, 'Test comparing versions micros and alphas 7');
+
+ok (test_version_compare ('1.6-p5a', '1.6.5a', 0) == 0, 'Test comparing versions special exceptions 1');
+ok (test_version_compare ('1.6', '1.6-p5a', -1) == 0, 'Test comparing versions special exceptions 1');
+ok (test_version_compare ('1.6-p4b', '1.6-p5a', -1) == 0, 'Test comparing versions special exceptions 1');
+ok (test_version_compare ('1.6-p4b', '1.6-foo', 1) == 0, 'Test comparing versions special exceptions 1');
+ok (test_version_compare ('1.6-p4b', '1.6a-foo', -1) == 0, 'Test comparing versions special exceptions 1');
+ok (test_version_compare ('1.6-p5', '1.6.5', 0) == 0, 'Test comparing versions special exceptions 1');
+ok (test_version_compare ('1.6a-foo', '1.6a-foo', 0) == 0, 'Test comparing versions special exceptions 1');
+
+ok (test_bad_versions ('') == 0, 'Test bad version numbers empty str');
+ok (test_bad_versions ('a') == 0, 'Test bad version numbers only alpha');
+ok (test_bad_versions ('1') == 0, 'Test bad version numbers only major');
+ok (test_bad_versions ('1a') == 0, 'Test bad version numbers only major with alpha');
+ok (test_bad_versions ('1.2.3.4') == 0, 'Test bad version numbers to many minor versions');
+ok (test_bad_versions ('-1.2') == 0, 'Test bad version numbers negative');
-- 
2.18.0

>From 5b397a953f5ed897bc5f6861b05599063ac80b37 Mon Sep 17 00:00:00 2001
From: Matthias Paulmier <matthias.paulm...@etu.u-bordeaux.fr>
Date: Fri, 7 Sep 2018 18:17:40 +0200
Subject: [PATCH 3/4] Fix termination error for .plt test files

We had an error where the STDOUT handler would be closed and then reopened
because of the redefinition of END in the Automake::General library.
Isolating this redefinition in its own file and including it only where it is
needed (in bin/* scripts) fixes this error.

- lib/Automake/End.pm: Add it and move END from General.pm to here.  Fixes a
  termination bug where the STDOUT handler was closed and reopened
---
 bin/aclocal.in          |  1 +
 bin/automake.in         |  1 +
 lib/Automake/End.pm     | 47 +++++++++++++++++++++++++++++++++++++++++
 lib/Automake/General.pm | 24 +--------------------
 lib/Automake/local.mk   |  1 +
 5 files changed, 51 insertions(+), 23 deletions(-)
 mode change 100644 => 100755 bin/aclocal.in
 create mode 100644 lib/Automake/End.pm

diff --git a/bin/aclocal.in b/bin/aclocal.in
old mode 100644
new mode 100755
index 722affa55..09d8b89de
--- a/bin/aclocal.in
+++ b/bin/aclocal.in
@@ -34,6 +34,7 @@ use Automake::Channels;
 use Automake::ChannelDefs;
 use Automake::XFile;
 use Automake::FileUtils;
+use Automake::End;
 use File::Basename;
 use File::Path ();
 
diff --git a/bin/automake.in b/bin/automake.in
index b4ae8f43f..8c783074b 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -55,6 +55,7 @@ use Automake::XFile;
 use Automake::Channels;
 use Automake::ChannelDefs;
 use Automake::Configure_ac;
+use Automake::End;
 use Automake::FileUtils;
 use Automake::Location;
 use Automake::Condition qw/TRUE FALSE/;
diff --git a/lib/Automake/End.pm b/lib/Automake/End.pm
new file mode 100644
index 000000000..7946d814b
--- /dev/null
+++ b/lib/Automake/End.pm
@@ -0,0 +1,47 @@
+# Copyright (C) 2018 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+package Automake::End;
+
+use Exporter;
+use File::Basename;
+
+use vars (@ISA, @EXPORT);
+
+@ISA = qw (Exporter);
+@EXPORT = qw ($me);
+
+# Variable we share with the main package.  Be sure to have a single
+# copy of them: using 'my' together with multiple inclusion of this
+# package would introduce several copies.
+use vars qw ($me);
+$me = basename ($0);
+
+# END
+# ---
+# Exit nonzero whenever closing STDOUT fails.
+sub END
+{
+  # This is required if the code might send any output to stdout
+  # E.g., even --version or --help.  So it's best to do it unconditionally.
+  if (! close STDOUT)
+    {
+      print STDERR "$me: closing standard output: $!\n";
+      $? = 74; # EX_IOERR
+      return;
+    }
+}
+
+1;
diff --git a/lib/Automake/General.pm b/lib/Automake/General.pm
index aa2de38b8..646608552 100644
--- a/lib/Automake/General.pm
+++ b/lib/Automake/General.pm
@@ -23,29 +23,7 @@ use File::Basename;
 use vars qw (@ISA @EXPORT);
 
 @ISA = qw (Exporter);
-@EXPORT = qw (&uniq &none $me);
-
-# Variable we share with the main package.  Be sure to have a single
-# copy of them: using 'my' together with multiple inclusion of this
-# package would introduce several copies.
-use vars qw ($me);
-$me = basename ($0);
-
-# END
-# ---
-# Exit nonzero whenever closing STDOUT fails.
-sub END
-{
-  # This is required if the code might send any output to stdout
-  # E.g., even --version or --help.  So it's best to do it unconditionally.
-  if (! close STDOUT)
-    {
-      print STDERR "$me: closing standard output: $!\n";
-      $? = 74; # EX_IOERR
-      return;
-    }
-}
-
+@EXPORT = qw (uniq none);
 
 # @RES
 # uniq (@LIST)
diff --git a/lib/Automake/local.mk b/lib/Automake/local.mk
index fbb21f3f1..75cfda75c 100644
--- a/lib/Automake/local.mk
+++ b/lib/Automake/local.mk
@@ -26,6 +26,7 @@ dist_perllib_DATA = \
   %D%/Condition.pm \
   %D%/Configure_ac.pm \
   %D%/DisjConditions.pm \
+  %D%/End.pm \
   %D%/FileUtils.pm \
   %D%/General.pm \
   %D%/Getopt.pm \
-- 
2.18.0

>From 99ae26b451f055969be8873aa2cff72f422eeb61 Mon Sep 17 00:00:00 2001
From: Matthias Paulmier <matthias.paulm...@etu.u-bordeaux.fr>
Date: Fri, 7 Sep 2018 18:24:21 +0200
Subject: [PATCH 4/4] Modify all tests to use the Test::Simple lib

All tests now use the Test::Simple library.  We keep the distinction between
pl (pure perl) and plt (perl + Test::Simple) in case someone wants to write a
perl tests without this lib.

- t/pm/*: All tests now use the plt extension and the Test::Simple library.
---
 t/list-of-tests.mk                            | 12 +++++-----
 t/pm/{Condition-t.pl => Condition-t.plt}      | 12 ++++++----
 t/pm/{Condition.pl => Condition.plt}          | 16 ++++++-------
 ...sjConditions-t.pl => DisjConditions-t.plt} | 12 ++++++----
 .../{DisjConditions.pl => DisjConditions.plt} | 14 ++++++-----
 t/pm/{General.pl => General.plt}              | 10 ++++----
 t/pm/{Wrap.pl => Wrap.plt}                    | 23 ++++++++++++-------
 7 files changed, 55 insertions(+), 44 deletions(-)
 rename t/pm/{Condition-t.pl => Condition-t.plt} (96%)
 rename t/pm/{Condition.pl => Condition.plt} (95%)
 rename t/pm/{DisjConditions-t.pl => DisjConditions-t.plt} (97%)
 rename t/pm/{DisjConditions.pl => DisjConditions.plt} (97%)
 rename t/pm/{General.pl => General.plt} (84%)
 rename t/pm/{Wrap.pl => Wrap.plt} (77%)

diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 7cc0e6585..c1ad773a9 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -35,13 +35,13 @@ t/remake-am-pr10111.sh \
 t/remake-m4-pr10111.sh
 
 perl_TESTS = \
-t/pm/Condition.pl \
-t/pm/Condition-t.pl \
-t/pm/DisjConditions.pl \
-t/pm/DisjConditions-t.pl \
-t/pm/General.pl \
+t/pm/Condition.plt \
+t/pm/Condition-t.plt \
+t/pm/DisjConditions.plt \
+t/pm/DisjConditions-t.plt \
+t/pm/General.plt \
 t/pm/Version.plt \
-t/pm/Wrap.pl
+t/pm/Wrap.plt
 
 perf_TESTS = \
 t/perf/cond.sh \
diff --git a/t/pm/Condition-t.pl b/t/pm/Condition-t.plt
similarity index 96%
rename from t/pm/Condition-t.pl
rename to t/pm/Condition-t.plt
index 18d30eaf0..364230d82 100644
--- a/t/pm/Condition-t.pl
+++ b/t/pm/Condition-t.plt
@@ -1,3 +1,4 @@
+# -*- mode:perl -*-
 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -28,6 +29,7 @@ BEGIN {
     }
 }
 use Automake::Condition qw/TRUE FALSE/;
+use Test::Simple tests => 5;
 
 sub test_basics ()
 {
@@ -303,8 +305,8 @@ sub test_merge ()
   return 0;
 }
 
-exit (test_basics
-      || test_true_when
-      || test_reduce_and
-      || test_reduce_or
-      || test_merge);
+ok (test_basics == 0, 'Test basic conditions');
+ok (test_true_when == 0, 'Test implied conditions when declaring a new one');
+ok (test_reduce_and == 0, 'Test "and" reduction');
+ok (test_reduce_or == 0, 'Test "or" reduction');
+ok (test_merge == 0, 'Test the merge method');
diff --git a/t/pm/Condition.pl b/t/pm/Condition.plt
similarity index 95%
rename from t/pm/Condition.pl
rename to t/pm/Condition.plt
index 58f89b3ae..c019b5fdc 100644
--- a/t/pm/Condition.pl
+++ b/t/pm/Condition.plt
@@ -1,3 +1,4 @@
+# -*- mode:perl -*-
 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -14,6 +15,7 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 use Automake::Condition qw/TRUE FALSE/;
+use Test::Simple tests => 6;
 
 sub test_basics ()
 {
@@ -262,7 +264,6 @@ sub test_bad_declarations ()
   my $cond1 = new Automake::Condition ('TRUE');
   eval { new Automake::Condition ($cond1) };
 
-  warn $@ if $@;
   $failed = 1 unless $@;
   $@ = '';
 
@@ -271,14 +272,13 @@ sub test_bad_declarations ()
   my $cond2 = new Automake::Condition ("COND1_TRUE");
   eval { new Automake::Condition ("$cond2") };
 
-  warn $@ if $@;
   $failed = 1 unless $@;
   return $failed;
 }
 
-exit (test_basics
-      || test_true_when
-      || test_reduce_and
-      || test_reduce_or
-      || test_merge
-      || test_bad_declarations);
+ok (test_basics == 0, 'Test basic conditions');
+ok (test_true_when == 0, 'Test implied conditions when declaring a new one');
+ok (test_reduce_and == 0, 'Test "and" reduction');
+ok (test_reduce_or == 0, 'Test "or" reduction');
+ok (test_merge == 0, 'Test the merge method');
+ok (test_bad_declarations == 0, 'Test bad condition declarations');
diff --git a/t/pm/DisjConditions-t.pl b/t/pm/DisjConditions-t.plt
similarity index 97%
rename from t/pm/DisjConditions-t.pl
rename to t/pm/DisjConditions-t.plt
index 33c6c2d75..976d7a82e 100644
--- a/t/pm/DisjConditions-t.pl
+++ b/t/pm/DisjConditions-t.plt
@@ -1,3 +1,4 @@
+# -*- mode:perl -*-
 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -29,6 +30,7 @@ BEGIN {
 }
 use Automake::Condition qw/TRUE FALSE/;
 use Automake::DisjConditions;
+use Test::Simple tests => 5;
 
 sub test_basics ()
 {
@@ -437,8 +439,8 @@ sub test_ambig ()
   return $failed;
 }
 
-exit (test_basics
-      || test_invert
-      || test_simplify
-      || test_sub_conditions
-      || test_ambig);
+ok (test_basics == 0, 'Basic tests');
+ok (test_invert == 0, 'Test inverts');
+ok (test_simplify == 0, 'Test condition simplifications');
+ok (test_sub_conditions == 0, 'Test sub conditions');
+ok (test_ambig == 0, 'Test ambiguous conditions');
diff --git a/t/pm/DisjConditions.pl b/t/pm/DisjConditions.plt
similarity index 97%
rename from t/pm/DisjConditions.pl
rename to t/pm/DisjConditions.plt
index bdcafd2bb..c5ec25be0 100644
--- a/t/pm/DisjConditions.pl
+++ b/t/pm/DisjConditions.plt
@@ -1,3 +1,4 @@
+# -*- mode:perl -*-
 # Copyright (C) 2001-2018 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -15,6 +16,7 @@
 
 use Automake::Condition qw/TRUE FALSE/;
 use Automake::DisjConditions;
+use Test::Simple tests => 6;
 
 sub test_basics ()
 {
@@ -403,9 +405,9 @@ sub test_bad_declarations
   return $failed;
 }
 
-exit (test_basics
-      || test_invert
-      || test_simplify
-      || test_sub_conditions
-      || test_ambig
-      || test_bad_declarations);
+ok (test_basics == 0, 'Basic tests');
+ok (test_invert == 0, 'Test inverts');
+ok (test_simplify == 0, 'Test condition simplifications');
+ok (test_sub_conditions == 0, 'Test sub conditions');
+ok (test_ambig == 0, 'Test ambiguous conditions');
+ok (test_bad_declarations == 0, 'Test wrong condition declarations');
diff --git a/t/pm/General.pl b/t/pm/General.plt
similarity index 84%
rename from t/pm/General.pl
rename to t/pm/General.plt
index 0caefe7cf..645886d9c 100644
--- a/t/pm/General.pl
+++ b/t/pm/General.plt
@@ -1,3 +1,4 @@
+# -*- mode:perl -*-
 # Copyright (C) 2018 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -14,14 +15,11 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 use Automake::General;
-
-my $failed = 0;
+use Test::Simple tests => 2;
 
 # Check 'none'.
 my $none_positive = none { $_[0] < 0 } (1, 7, 3, 8, 9);
-$failed = 1 if ($none_positive == 0);
+ok ($none_positive != 0, 'Test none on positive values');
 
 my $none_gt_8 = none { $_[0] >= 8 } (1, 7, 3, 8, 9);
-$failed = 1 if ($none_gt_8 == 1);
-
-exit $failed;
+ok ($none_gt_8 == 0, 'Test none on values > 8');
diff --git a/t/pm/Wrap.pl b/t/pm/Wrap.plt
similarity index 77%
rename from t/pm/Wrap.pl
rename to t/pm/Wrap.plt
index 995569a4f..fdfdab3bf 100644
--- a/t/pm/Wrap.pl
+++ b/t/pm/Wrap.plt
@@ -1,3 +1,4 @@
+# -*- mode:perl -*-
 # Copyright (C) 2003-2018 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -14,8 +15,7 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 use Automake::Wrap qw/wrap makefile_wrap/;
-
-my $failed = 0;
+use Test::Simple tests => 9;
 
 sub test_wrap
 {
@@ -25,20 +25,21 @@ sub test_wrap
   if ($out ne $exp_out)
     {
       print STDERR "For: @$in\nGot:\n$out\nInstead of:\n$exp_out\n---\n";
-      ++$failed;
+      return 1;
     }
+  return 0;
 }
 
 sub test_makefile_wrap
 {
   my ($in, $exp_out) = @_;
-
   my $out = &makefile_wrap (@$in);
   if ($out ne $exp_out)
     {
       print STDERR "For: @$in\nGot:\n$out\nInstead of:\n$exp_out\n---\n";
-      ++$failed;
+      return 1;
     }
+  return 0;
 }
 
 my @tests = (
@@ -89,7 +90,13 @@ my @makefile_tests = (
 \tunlike in the second line
 "]);
 
-test_wrap (@{$_}) foreach @tests;
-test_makefile_wrap (@{$_}) foreach @makefile_tests;
+ok (test_wrap (@{$tests[0]}) == 0, 'test_wrap 0');
+ok (test_wrap (@{$tests[1]}) == 0, 'test_wrap 1');
+ok (test_wrap (@{$tests[2]}) == 0, 'test_wrap 2');
+ok (test_wrap (@{$tests[3]}) == 0, 'test_wrap 3');
+ok (test_wrap (@{$tests[4]}) == 0, 'test_wrap 4');
 
-exit $failed;
+ok (test_makefile_wrap (@{$makefile_tests[0]}) == 0, 'test_makefile_wrap 0');
+ok (test_makefile_wrap (@{$makefile_tests[1]}) == 0, 'test_makefile_wrap 1');
+ok (test_makefile_wrap (@{$makefile_tests[2]}) == 0, 'test_makefile_wrap 2');
+ok (test_makefile_wrap (@{$makefile_tests[3]}) == 0, 'test_makefile_wrap 3');
-- 
2.18.0

Reply via email to