>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..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 . - -# 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 . - -# 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 . - -# 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 . - -# 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 . - -# 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 . - -# prog_error due to invalid $REQUIRED. - -use Automake::Version; - -Automake::Version::check ('1.2.3', ''); -- 2.18.0