Re: [PATCH] t/pm: Use Test::Simple for Perl tests

2018-09-07 Thread Matthias Paulmier

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 
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 .
 
-# 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..0
--- 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 .
-
-# 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..0
--- 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 .
-
-# 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 

Re: [PATCH] t/pm: Use Test::Simple for Perl tests

2018-09-06 Thread Mathieu Lirzin
Matthias Paulmier  writes:

> I sure can, I was feeling like it was a bit long but for some reason
> thought it was better that way.

No problem, the appropriate granularity for patches is a subjective
matter.  However in practice software projects tend to agree that new
features, bug fixes, and file renaming/moving should be done in
separated commit/patches.

> Can I send multiple patches at once (in one email as attachements), or
> should I send them each on their own?

Both are possible, and convenient for me.

To be more precise, if you do it by hand with attachments, it will be
simpler to include all those attachments in one email.

Alternatively If you use ‘git send-email’, by default it sends the
patches in response to the first patch or the “cover letter” if you made
one.  In your case you it is important to add the
‘--in-reply-to="<878t4fhddt@mpaulmier.home>"’ option to ensure that
your first patch is sent in response to the current thread.

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37



Re: [PATCH] t/pm: Use Test::Simple for Perl tests

2018-09-06 Thread Matthias Paulmier
Mathieu Lirzin  writes:

> Hello Matthias,
>
> Matthias Paulmier  writes:
>
>>  [...]
>
> This patch is too fat for me to properly review it.  The changelog
> description makes me think it could easily be separated in smaller
> chunks.  For example you could make one patch adding support for
> ‘Test::Simple’ and a basic test file with a ‘.plt’ extension, one patch
> for each test file migrated to Test::Simple, one for fixing the XFAIL
> hack...
>
> Feel free to adapt to your particular case, since you understand the
> dependencies between the change you made better than I do.
>
> Can you send the updated patches?

I sure can, I was feeling like it was a bit long but for some reason
thought it was better that way.

Can I send multiple patches at once (in one email as attachements), or
should I send them each on their own?

--
Matthias Paulmier



Re: [PATCH] t/pm: Use Test::Simple for Perl tests

2018-09-05 Thread Mathieu Lirzin
Hello Matthias,

Matthias Paulmier  writes:

> This patch enables the use of the Test::Simple (and Test::More) library
> for the Perl lib tests.  One point that may need reflexion is wether or
> not to keep the "old" way of testing Perl libraries into Automake (that
> is without using Test::Simple/More).
>
> This patch is part of my GSoC project.  I am sorry it took so long and
> will make sure to submit the rest of my modifications in the comming days.

This is already a big chunk to review so please wait for this patch to
be reviewed and applied before sending the other ones.  ;-)

> From b0a682a918242b3a74147cd60aadf4e543eb5ce0 Mon Sep 17 00:00:00 2001
> From: Matthias Paulmier 
> Date: Thu, 30 Aug 2018 16:30:19 +0200
> Subject: [PATCH] t/pm: Use Test::Simple for the tests of the Perl libraries
>
> This allows to have more tests using the TAP protocol for tests.  We can also
> use other libraries such as Test::More.  For these tests, we use a new
> extension (.plt) for those tests.  This change does not exclude the "old" way
> of doing things as the .pl extension still exists in t/local.mk in case
> someone wants to test the old way.
>
> * t/pm: Use eval to fix fail XFAIL perl test and catch fatal errors.
> * t/pm: Regroup tests by module (consequence of the above).
> * t/pm: Add a new extension for Perl tests using Test::Simple (.plt).
> * t/pm: Move all current tests to the .plt extension.
> * lib/Automake: Move END to its own submodule to fix a termination bug with
>   Test::Simple where STDOUT was closed and then reopened.
> ---
>  bin/aclocal.in|   1 +
>  bin/automake.in   |   1 +
>  lib/Automake/End.pm   |  47 +++
>  lib/Automake/General.pm   |  24 +---
>  lib/Automake/local.mk |   1 +
>  t/list-of-tests.mk|  33 ++---
>  t/local.mk|   4 +-
>  t/pm/Cond2.pl |  22 
>  t/pm/Cond3.pl |  22 
>  t/pm/{Condition-t.pl => Condition-t.plt}  |  12 +-
>  t/pm/{Condition.pl => Condition.plt}  |  34 -
>  t/pm/DisjCon2.pl  |  24 
>  t/pm/DisjCon3.pl  |  23 
>  ...sjConditions-t.pl => DisjConditions-t.plt} |  12 +-
>  .../{DisjConditions.pl => DisjConditions.plt} |  36 +-
>  t/pm/{General.pl => General.plt}  |  10 +-
>  t/pm/Version.pl   | 112 
>  t/pm/Version.plt  | 122 ++
>  t/pm/Version2.pl  |  20 ---
>  t/pm/Version3.pl  |  20 ---
>  t/pm/{Wrap.pl => Wrap.plt}|  23 ++--
>  21 files changed, 277 insertions(+), 326 deletions(-)

This patch is too fat for me to properly review it.  The changelog
description makes me think it could easily be separated in smaller
chunks.  For example you could make one patch adding support for
‘Test::Simple’ and a basic test file with a ‘.plt’ extension, one patch
for each test file migrated to Test::Simple, one for fixing the XFAIL
hack...

Feel free to adapt to your particular case, since you understand the
dependencies between the change you made better than I do.

Can you send the updated patches?

Thanks.

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37



[PATCH] t/pm: Use Test::Simple for Perl tests

2018-09-05 Thread Matthias Paulmier


This patch enables the use of the Test::Simple (and Test::More) library
for the Perl lib tests.  One point that may need reflexion is wether or
not to keep the "old" way of testing Perl libraries into Automake (that
is without using Test::Simple/More).

This patch is part of my GSoC project.  I am sorry it took so long and
will make sure to submit the rest of my modifications in the comming days.

--
Matthias Paulmier
>From b0a682a918242b3a74147cd60aadf4e543eb5ce0 Mon Sep 17 00:00:00 2001
From: Matthias Paulmier 
Date: Thu, 30 Aug 2018 16:30:19 +0200
Subject: [PATCH] t/pm: Use Test::Simple for the tests of the Perl libraries

This allows to have more tests using the TAP protocol for tests.  We can also
use other libraries such as Test::More.  For these tests, we use a new
extension (.plt) for those tests.  This change does not exclude the "old" way
of doing things as the .pl extension still exists in t/local.mk in case
someone wants to test the old way.

* t/pm: Use eval to fix fail XFAIL perl test and catch fatal errors.
* t/pm: Regroup tests by module (consequence of the above).
* t/pm: Add a new extension for Perl tests using Test::Simple (.plt).
* t/pm: Move all current tests to the .plt extension.
* lib/Automake: Move END to its own submodule to fix a termination bug with
  Test::Simple where STDOUT was closed and then reopened.
---
 bin/aclocal.in|   1 +
 bin/automake.in   |   1 +
 lib/Automake/End.pm   |  47 +++
 lib/Automake/General.pm   |  24 +---
 lib/Automake/local.mk |   1 +
 t/list-of-tests.mk|  33 ++---
 t/local.mk|   4 +-
 t/pm/Cond2.pl |  22 
 t/pm/Cond3.pl |  22 
 t/pm/{Condition-t.pl => Condition-t.plt}  |  12 +-
 t/pm/{Condition.pl => Condition.plt}  |  34 -
 t/pm/DisjCon2.pl  |  24 
 t/pm/DisjCon3.pl  |  23 
 ...sjConditions-t.pl => DisjConditions-t.plt} |  12 +-
 .../{DisjConditions.pl => DisjConditions.plt} |  36 +-
 t/pm/{General.pl => General.plt}  |  10 +-
 t/pm/Version.pl   | 112 
 t/pm/Version.plt  | 122 ++
 t/pm/Version2.pl  |  20 ---
 t/pm/Version3.pl  |  20 ---
 t/pm/{Wrap.pl => Wrap.plt}|  23 ++--
 21 files changed, 277 insertions(+), 326 deletions(-)
 mode change 100644 => 100755 bin/aclocal.in
 create mode 100644 lib/Automake/End.pm
 delete mode 100644 t/pm/Cond2.pl
 delete mode 100644 t/pm/Cond3.pl
 rename t/pm/{Condition-t.pl => Condition-t.plt} (96%)
 rename t/pm/{Condition.pl => Condition.plt} (90%)
 delete mode 100644 t/pm/DisjCon2.pl
 delete mode 100644 t/pm/DisjCon3.pl
 rename t/pm/{DisjConditions-t.pl => DisjConditions-t.plt} (97%)
 rename t/pm/{DisjConditions.pl => DisjConditions.plt} (93%)
 rename t/pm/{General.pl => General.plt} (84%)
 delete mode 100644 t/pm/Version.pl
 create mode 100644 t/pm/Version.plt
 delete mode 100644 t/pm/Version2.pl
 delete mode 100644 t/pm/Version3.pl
 rename t/pm/{Wrap.pl => Wrap.plt} (77%)

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 0..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 .
+
+package Automake::End;
+
+use Exporter;
+use File::Basename;
+
+use vars (@ISA, @EXPORT);
+
+@ISA = qw (Exporter);