diff --git a/ChangeLog b/ChangeLog index e1a6494..9334e21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-07-20 Romain Lenglet + + Add autotests for Erlang macros. + * tests/erlang.at: Added tests for all macros in erlang.m4. + * tests/Makefile.am: Added erlang.at. + * tests/suite.at: Likewise. + * tests/compile.at: Added test for extension of Erlang files. + 2009-07-16 Eric Blake Don't hide leading space in autom4te --trace output. diff --git a/NEWS b/NEWS index ef67c77..ec63834 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,8 @@ GNU Autoconf NEWS - User visible changes. m4_argn m4_copy_force m4_default_nblank m4_default_nblank_quoted m4_ifblank m4_ifnblank m4_rename_force +** The autoconf testsuite now validates all Erlang macros. + * Major changes in Autoconf 2.63b (2009-03-31) [beta] Released by Eric Blake, based on git versions 2.63.*. diff --git a/tests/Makefile.am b/tests/Makefile.am index f07c553..085c9d1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -100,7 +100,7 @@ TESTSUITE_HAND_AT = \ suite.at \ m4sugar.at m4sh.at autotest.at \ base.at tools.at torture.at \ - compile.at c.at fortran.at \ + compile.at c.at erlang.at fortran.at \ semantics.at \ autoscan.at \ foreign.at @@ -168,6 +168,7 @@ AUTOCONF_FILES = $(autoconfdir)/general.m4 \ $(autoconfdir)/functions.m4 \ $(autoconfdir)/lang.m4 \ $(autoconfdir)/c.m4 \ + $(autoconfdir)/erlang.m4 \ $(autoconfdir)/fortran.m4 \ $(autoconfdir)/headers.m4 \ $(autoconfdir)/libs.m4 \ diff --git a/tests/compile.at b/tests/compile.at index 20398fb..9675539 100644 --- a/tests/compile.at +++ b/tests/compile.at @@ -35,23 +35,27 @@ AT_SETUP([[AC_LANG, AC_LANG_PUSH & AC_LANG_POP]]) AT_DATA([configure.ac], [[AC_INIT # C -AC_LANG(C) +AC_LANG([C]) # C -AC_LANG_PUSH(C) +AC_LANG_PUSH([C]) # C C -AC_LANG_PUSH(C++) +AC_LANG_PUSH([C++]) # C++ C C -AC_LANG(C++) +AC_LANG([C++]) # C++ C C -AC_LANG_PUSH(Fortran 77) -# F77 C++ C C -AC_LANG_POP(Fortran 77) +AC_LANG_PUSH([Erlang]) +# Erlang C++ C C +AC_LANG_PUSH([Fortran 77]) +# F77 Erlang C++ C C +AC_LANG_POP([Fortran 77]) +# Erlang C++ C C +AC_LANG_POP([Erlang]) # C++ C C -AC_LANG(C++) +AC_LANG([C++]) # C++ C C -AC_LANG_POP(C++) +AC_LANG_POP([C++]) # C C -AC_LANG_POP(C) +AC_LANG_POP([C]) # C ]]) @@ -62,7 +66,9 @@ c c cpp cpp +erl f +erl cpp cpp c @@ -243,16 +249,16 @@ AT_DATA([configure.ac], AC_PROG_CC AC_PROG_CXX -AC_LANG_PUSH(C) +AC_LANG_PUSH([C]) AC_MSG_CHECKING([a simple C program that is not valid C++]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([enum a { A, B, C }; enum a f(enum a in) { return in++; }], [])], [AC_MSG_RESULT([ok])], [AC_MSG_RESULT([failed]) AC_MSG_ERROR([could not compile test program])]) -AC_LANG_POP(C) +AC_LANG_POP([C]) -AC_LANG_PUSH(C++) +AC_LANG_PUSH([C++]) AC_MSG_CHECKING([a simple C++ program that is not valid C]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([class A {};], [])], [AC_MSG_RESULT([ok])], @@ -260,7 +266,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([class A {};], [])], AC_MSG_ERROR([could not compile test program])]) AC_CHECK_HEADER([cstring]) -AC_LANG_POP(C++) +AC_LANG_POP([C++]) ]]) AT_CHECK_AUTOCONF diff --git a/tests/erlang.at b/tests/erlang.at new file mode 100644 index 0000000..5dbdc19 --- /dev/null +++ b/tests/erlang.at @@ -0,0 +1,194 @@ +# -*- Autotest -*- + +AT_BANNER([Erlang low level compiling and utility macros.]) + +# Copyright (C) 2009 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + + +# Since the macros which compile are required by most tests, check +# them first. But remember that looking for a compiler is even more +# primitive, so check those first. + + +m4_define([AT_CHECK_ERLANG], +[AT_KEYWORDS([Erlang]) +found_erl=no +found_erlc=no +_AS_PATH_WALK([], [ +if AS_EXECUTABLE_P(["$as_dir/erl"]); then found_erl=yes; fi +if AS_EXECUTABLE_P(["$as_dir/erlc"]); then found_erlc=yes; fi +if test "${found_erl}${found_erlc}" = "yesyes"; then break; fi +]) +AT_SKIP_IF([test "$found_erl$found_erlc" != "yesyes"]) +AT_CHECK($@)]) + + +## ----------------- ## +## Erlang Compiler. ## +## ----------------- ## + +AT_SETUP([Erlang]) +AT_CHECK_ERLANG + +AT_DATA([configure.ac], +[[AC_INIT +AC_ERLANG_NEED_ERL +AC_ERLANG_NEED_ERLC +AC_LANG([Erlang]) +## Can't compile, but can run an Erlang module: +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [halt(0)])], + [AC_MSG_RESULT([ok]) + AC_MSG_ERROR([compiling Erlang program should fail])], + [AC_MSG_RESULT([failed])]) +AC_RUN_IFELSE([AC_LANG_PROGRAM([], [halt(0)])], + [AC_MSG_RESULT([ok])], + [AC_MSG_RESULT([failed]) + AC_MSG_ERROR([could not run test program])]) +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([-q]) + +AT_CLEANUP + + +## ----------------------- ## +## Erlang path detection. ## +## ----------------------- ## + +AT_SETUP([AC_ERLANG_CHECK_LIB]) +AT_CHECK_ERLANG + +AT_DATA([configure.ac], +[[AC_INIT +AC_ERLANG_NEED_ERL +AC_ERLANG_NEED_ERLC +AC_ERLANG_CHECK_LIB([stdlib], + [AC_MSG_RESULT([ok])], + [AC_MSG_RESULT([failed])]) +AC_CONFIG_FILES([dir]) +AC_OUTPUT +]]) + +AT_DATA([dir.in], address@hidden@ +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([-q]) + +dir=`cat dir` +rm -f dir +AT_CHECK([test "$dir" = "not found" || test -d "$dir"]) + +AT_CLEANUP + + +AT_SETUP([AC_ERLANG_SUBST_ROOT_DIR]) +AT_CHECK_ERLANG + +AT_DATA([configure.ac], +[[AC_INIT +AC_ERLANG_NEED_ERL +AC_ERLANG_NEED_ERLC +AC_ERLANG_SUBST_ROOT_DIR +AC_CONFIG_FILES([dir]) +AC_OUTPUT +]]) + +AT_DATA([dir.in], address@hidden@ +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([-q]) + +dir=`cat dir` +rm -f dir +AT_CHECK([test -d "$dir"]) + +AT_CLEANUP + + +AT_SETUP([AC_ERLANG_SUBST_LIB_DIR]) +AT_CHECK_ERLANG + +AT_DATA([configure.ac], +[[AC_INIT +AC_ERLANG_NEED_ERL +AC_ERLANG_NEED_ERLC +AC_ERLANG_SUBST_LIB_DIR +AC_CONFIG_FILES([dir]) +AC_OUTPUT +]]) + +AT_DATA([dir.in], address@hidden@ +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([-q]) + +dir=`cat dir` +rm -f dir +AT_CHECK([test -d "$dir"]) + +AT_CLEANUP + + +AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_DIR]) + + +AT_SETUP([AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR]) + +AT_DATA([configure.ac], +[[AC_INIT +AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR([test_blah], [1.24-b]) +AC_CONFIG_FILES([dir]) +AC_OUTPUT +]]) + +AT_DATA([dir.in], address@hidden@ +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([-q]) + +dir=`cat dir` +subdir=`AS_BASENAME([$dir])` +rm -f dir +AT_CHECK([test "$subdir" = "test_blah-1.24-b"]) + +AT_CLEANUP + + +AT_SETUP([AC_ERLANG_SUBST_ERTS_VER]) +AT_CHECK_ERLANG + +AT_DATA([configure.ac], +[[AC_INIT +AC_ERLANG_NEED_ERL +AC_ERLANG_NEED_ERLC +AC_ERLANG_SUBST_ERTS_VER +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([-q]) + +AT_CLEANUP diff --git a/tests/suite.at b/tests/suite.at index ff0347e..7302b60 100644 --- a/tests/suite.at +++ b/tests/suite.at @@ -52,6 +52,7 @@ m4_include([c.at]) m4_include([acc.at]) m4_include([fortran.at]) m4_include([acfortran.at]) +m4_include([erlang.at]) # Checking that AC_CHECK_FOO macros work properly. m4_include([semantics.at])