automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[automake-commit] 02/02: tests: add new test for AM_PROG_LEX arguments.


From: Karl Berry
Subject: [automake-commit] 02/02: tests: add new test for AM_PROG_LEX arguments.
Date: Wed, 01 Nov 2023 12:22:59 -0400

karl pushed a commit to branch master
in repository automake.

View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=c889fedb8b28748b5fcf435c20484542a1b77324

commit c889fedb8b28748b5fcf435c20484542a1b77324
Author: Bogdan <bogdro_rep@gmx.us>
AuthorDate: Wed Nov 1 09:22:46 2023 -0700

    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.
---
 t/lex-args.sh      | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 t/list-of-tests.mk |  1 +
 2 files changed, 91 insertions(+)

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 <https://www.gnu.org/licenses/>.
+
+# 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 <<END
+AC_PROG_CC
+AM_PROG_LEX$failing
+AC_OUTPUT
+END
+       # debug:
+       #cat configure.ac
+
+       # aclocal seems required every time (at least, if 'make' would be run)
+       $ACLOCAL
+       # we expect the message, so missing is an error:
+       ($AUTOCONF 2>&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 <<END
+AC_PROG_CC
+AM_PROG_LEX$working
+AC_OUTPUT
+END
+       # debug:
+       #cat configure.ac
+
+       $ACLOCAL
+       # we don't expect the message, so it is an error if found:
+       ($AUTOCONF 2>&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 \



reply via email to

[Prev in Thread] Current Thread [Next in Thread]