From: Stefano Lattarini <stefano.lattar...@gmail.com> * tests/strictness-overriding.test: New test. * tests/strictness-precedence.test: New test. * tests/warnings-overriding.test: New test. * tests/warnings-precedence.test: New test. * tests/Makefile.am (TESTS): Update. --- ChangeLog | 9 +++ tests/Makefile.am | 4 + tests/Makefile.in | 4 + tests/strictness-overriding.test | 116 ++++++++++++++++++++++++++++++++++++++ tests/strictness-precedence.test | 76 +++++++++++++++++++++++++ tests/warnings-overriding.test | 105 ++++++++++++++++++++++++++++++++++ tests/warnings-precedence.test | 76 +++++++++++++++++++++++++ 7 files changed, 390 insertions(+), 0 deletions(-) create mode 100755 tests/strictness-overriding.test create mode 100755 tests/strictness-precedence.test create mode 100755 tests/warnings-overriding.test create mode 100755 tests/warnings-precedence.test
diff --git a/ChangeLog b/ChangeLog index 0540fc8..b6c0b56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-12-20 Stefano Lattarini <stefano.lattar...@gmail.com> + + Add new tests on strictness and warnings precedence and overriding. + * tests/strictness-overriding.test: New test. + * tests/strictness-precedence.test: New test. + * tests/warnings-overriding.test: New test. + * tests/warnings-precedence.test: New test. + * tests/Makefile.am (TESTS): Update. + 2010-12-22 Stefano Lattarini <stefano.lattar...@gmail.com> Add some tests on 'cygnus' mode. diff --git a/tests/Makefile.am b/tests/Makefile.am index 05e15bc..d70cdcb 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -802,6 +802,8 @@ stdinc.test \ stamph2.test \ stdlib.test \ stdlib2.test \ +strictness-overriding.test \ +strictness-precedence.test \ strip.test \ strip2.test \ strip3.test \ @@ -922,6 +924,8 @@ version8.test \ vpath.test \ vtexi.test \ vtexi2.test \ +warnings-overriding.test \ +warnings-precedence.test \ warnopts.test \ werror.test \ werror2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index d0e08a6..4013e8d 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1065,6 +1065,8 @@ stdinc.test \ stamph2.test \ stdlib.test \ stdlib2.test \ +strictness-overriding.test \ +strictness-precedence.test \ strip.test \ strip2.test \ strip3.test \ @@ -1185,6 +1187,8 @@ version8.test \ vpath.test \ vtexi.test \ vtexi2.test \ +warnings-overriding.test \ +warnings-precedence.test \ warnopts.test \ werror.test \ werror2.test \ diff --git a/tests/strictness-overriding.test b/tests/strictness-overriding.test new file mode 100755 index 0000000..4c24ede --- /dev/null +++ b/tests/strictness-overriding.test @@ -0,0 +1,116 @@ +#! /bin/sh +# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. + +# The strictness specified in Makefile.am:AUTOMAKE_OPTIONS should +# override that specified in configure.in:AM_INIT_AUTOMAKE, and both +# should override the strictness specified on the command line. +# NOTE: this current semantic might not be the best one (even if it has +# been in place for quite a long time); see also Automake bug #7673. +# Update this test if the semantic is changed. + +. ./defs || Exit 1 + +set -e + +# We want complete control over automake options. +AUTOMAKE=$original_AUTOMAKE + +cat > Makefile.am <<'END' +AUTOMAKE_OPTIONS = +END + +set_strictness() +{ + set +x + sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \ + -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|" + mv -f $2-t $2 + set -x + cat $2 +} + +ok() +{ + $AUTOMAKE -Werror $* +} + +ko() +{ + AUTOMAKE_fails $* + grep 'required file.*README' stderr +} + +$ACLOCAL + +# Leave out only one of the required files, to avoid too much +# repetitions in the error messages. +touch INSTALL NEWS AUTHORS ChangeLog COPYING + +set_strictness '' Makefile.am +set_strictness '' configure.in +ko --gnu +ko +ok --foreign + +set_strictness 'gnu' Makefile.am +set_strictness '' configure.in +ko --gnu +ko +ko --foreign + +set_strictness '' Makefile.am +set_strictness 'gnu' configure.in +ko --gnu +ko +ko --foreign + +set_strictness 'foreign' Makefile.am +set_strictness '' configure.in +ok --gnu +ok +ok --foreign + +set_strictness '' Makefile.am +set_strictness 'foreign' configure.in +ok --gnu +ok +ok --foreign + +set_strictness 'gnu' Makefile.am +set_strictness 'gnu' configure.in +ko --gnu +ko +ko --foreign + +set_strictness 'foreign' Makefile.am +set_strictness 'foreign' configure.in +ok --gnu +ok +ok --foreign + +set_strictness 'foreign' Makefile.am +set_strictness 'gnu' configure.in +ok --gnu +ok +ok --foreign + +set_strictness 'gnu' Makefile.am +set_strictness 'foreign' configure.in +ko --gnu +ko +ko --foreign + +: diff --git a/tests/strictness-precedence.test b/tests/strictness-precedence.test new file mode 100755 index 0000000..237b068 --- /dev/null +++ b/tests/strictness-precedence.test @@ -0,0 +1,76 @@ +#! /bin/sh +# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. + +# On the command line, in AM_INIT_AUTOMAKE, and in AUTOMAKE_OPTIONS, +# strictness specified later should take precedence over strictness +# specified earlier. + +. ./defs || Exit 1 + +set -e + +# We want complete control over automake options. +AUTOMAKE=$original_AUTOMAKE + +cat > Makefile.am <<'END' +AUTOMAKE_OPTIONS = +END + +set_strictness() +{ + set +x + sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \ + -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|" + mv -f $2-t $2 + set -x + cat $2 +} + +ok() +{ + $AUTOMAKE -Werror $* +} + +ko() +{ + AUTOMAKE_fails $* + grep 'required file.*README' stderr +} + +# Leave out only one of the required files, to avoid too much +# repetitions in the error messages. +touch INSTALL NEWS AUTHORS ChangeLog COPYING + +$ACLOCAL --force +ko --foreign --gnu +ok --gnu --foreign + +set_strictness '' Makefile.am +set_strictness 'gnu foreign' configure.in +$ACLOCAL --force +ok +set_strictness 'foreign gnu' configure.in +$ACLOCAL --force +ko + +set_strictness '' configure.in +$ACLOCAL --force +set_strictness 'gnu foreign' Makefile.am +ok +set_strictness 'foreign gnu' Makefile.am +ko + +: diff --git a/tests/warnings-overriding.test b/tests/warnings-overriding.test new file mode 100755 index 0000000..e1b8d20 --- /dev/null +++ b/tests/warnings-overriding.test @@ -0,0 +1,105 @@ +#! /bin/sh +# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. + +# The warnings specified in Makefile.am:AUTOMAKE_OPTIONS should override +# those specified in configure.in:AM_INIT_AUTOMAKE, and both should +# override the warnings specified on the command line. +# NOTE: this current semantic might not be the best one (even if it has +# been in place for quite a long time); see also Automake bug #7673. +# Update this test if the semantic is changed. + +. ./defs || Exit 1 + +set -e + +# We want (almost) complete control over automake options. +AUTOMAKE="$original_AUTOMAKE -Werror" + +cat > Makefile.am <<'END' +FOO := bar +AUTOMAKE_OPTIONS = +END + +set_warnings() +{ + set +x + sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \ + -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|" + mv -f $2-t $2 + set -x + cat $2 +} + +ok() +{ + $AUTOMAKE $* +} + +ko() +{ + AUTOMAKE_fails $* + grep '^Makefile\.am:1:.*:=.*not portable' stderr +} + +$ACLOCAL + +# Files required in gnu strictness. +touch README INSTALL NEWS AUTHORS ChangeLog COPYING + +set_warnings '-Wno-portability' Makefile.am +set_warnings '' configure.in + +ok -Wportability +ok + +set_warnings '' Makefile.am +set_warnings '-Wno-portability' configure.in + +ok -Wportability +ok + +set_warnings '-Wno-portability' Makefile.am +set_warnings '-Wno-portability' configure.in + +ok -Wportability + +set_warnings '-Wportability' Makefile.am +set_warnings '' configure.in + +ko +ko -Wno-portability + +set_warnings '' Makefile.am +set_warnings '-Wportability' configure.in + +ko +ko -Wno-portability + +set_warnings '-Wportability' Makefile.am +set_warnings '-Wportability' configure.in +ko -Wno-portability + +set_warnings '-Wno-portability' Makefile.am +set_warnings '-Wportability' configure.in +ok +ok -Wportability + +set_warnings '-Wportability' Makefile.am +set_warnings '-Wno-portability' configure.in +ko +ko -Wno-portability + +: diff --git a/tests/warnings-precedence.test b/tests/warnings-precedence.test new file mode 100755 index 0000000..de60a8c --- /dev/null +++ b/tests/warnings-precedence.test @@ -0,0 +1,76 @@ +#! /bin/sh +# Copyright (C) 2010 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 <http://www.gnu.org/licenses/>. + +# On the command line, in AM_INIT_AUTOMAKE, and in AUTOMAKE_OPTIONS, +# warnings specified later should take precedence over those specified +# earlier. + +. ./defs || Exit 1 + +set -e + +# We want (almost) complete control over automake options. +AUTOMAKE="$original_AUTOMAKE -Werror" + +cat > Makefile.am <<'END' +FOO := bar +AUTOMAKE_OPTIONS = +END + +set_warnings() +{ + set +x + sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \ + -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|" + mv -f $2-t $2 + set -x + cat $2 +} + +ok() +{ + $AUTOMAKE $* +} + +ko() +{ + AUTOMAKE_fails $* + grep '^Makefile\.am:1:.*:=.*not portable' stderr +} + +# Files required in gnu strictness. +touch README INSTALL NEWS AUTHORS ChangeLog COPYING + +$ACLOCAL --force +ok -Wportability -Wno-portability +ko -Wno-portability -Wportability + +set_warnings '' Makefile.am +set_warnings '-Wportability -Wno-portability' configure.in +$ACLOCAL --force +ok +set_warnings '-Wno-portability -Wportability' configure.in +$ACLOCAL --force +ko + +set_warnings '' configure.in +$ACLOCAL --force +set_warnings '-Wportability -Wno-portability' Makefile.am +ok +set_warnings '-Wno-portability -Wportability' Makefile.am +ko + +: -- 1.7.2.3