From: Bogdan Date: Wed, 1 Nov 2023 16:22:46 +0000 (-0700) Subject: tests: add new test for AM_PROG_LEX arguments. X-Git-Tag: v1.16i~27 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=c889fedb8b28748b5fcf435c20484542a1b77324;p=thirdparty%2Fautomake.git tests: add new test for AM_PROG_LEX arguments. See https://bugs.gnu.org/65600 and https://bugs.gnu.org/65730 and https://lists.gnu.org/archive/html/automake/2023-07/msg00007.html. * t/lex-args.sh: New test. * t/list-of-tests.mk (handwritten_tests): Add it. --- diff --git a/t/lex-args.sh b/t/lex-args.sh new file mode 100644 index 000000000..669c0e559 --- /dev/null +++ b/t/lex-args.sh @@ -0,0 +1,90 @@ +#! /bin/sh +# Copyright (C) 2023 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 . + +# Autoconf 2.70 requires AC_PROG_LEX to be called with either 'yywrap' +# or 'noyywrap' as the parameter (previously, the macro had no parameters). +# After updating AM_PROG_LEX, check that either the required parameter values +# are passed down to AC_PROG_LEX, the defaults are used, or a warning is +# issued (and the default is used). +# (parts copied from t/lex-clean.sh) + +required='cc lex' +. test-init.sh + +expected_errmsg='AC_PROG_LEX without either yywrap or noyywrap' + +cp configure.ac configure.bak + +cat > Makefile.am << 'END' +bin_PROGRAMS = foo +foo_SOURCES = main.c lexer.l +LDADD = $(LEXLIB) +END + +cat > lexer.l << 'END' +%{ +#define YY_NO_UNISTD_H 1 +%} +%% +"GOOD" return EOF; +. +END + +cat > main.c << 'END' +int main (void) { return yylex (); } +int yywrap (void) { return 1; } +END + +for failing in '' '([])' '()'; +do + echo "============== Testing AM_PROG_LEX with >$failing<" + + cat configure.bak - > configure.ac <&1 | grep "$expected_errmsg") \ + || (cat configure.ac && exit 1) + rm -rf autom4te*.cache +done; + +for working in '([noyywrap])' '([yywrap])'; +do + echo "============== Testing AM_PROG_LEX with >$working<" + + cat configure.bak - > configure.ac <&1 | grep "$expected_errmsg") \ + && cat configure.ac && exit 2 + rm -rf autom4te*.cache +done; + +: diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index 5c118b52d..4e063342f 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -592,6 +592,7 @@ t/lex3.sh \ t/lex5.sh \ t/lexcpp.sh \ t/lexvpath.sh \ +t/lex-args.sh \ t/lex-subobj-nodep.sh \ t/lex-header.sh \ t/lex-lib.sh \