Hi, The attached patch adds tests for the macros in erlang.m4.
I haven't been able to use AT_CHECK_MACRO for testing most of the macros, because most macros fail in AT_CHECK_ENV, for reasons I don't yet understand. It seems that every time a test that runs Erlang code is peformed, AT_CHECK_ENV fails, so it may be a bug in the Erlang language support. How can I get more information about what is going on with AT_CHECK_ENV? Also, those tests will fail if Erlang is not installed. I could use AT_SKIP_IF for each test group to don't perform a test group, but it's tedious. Is there an equivalent to AT_SKIP_IF that works for a whole test group category (the whole erlang.at file)? Best regards, -- Romain Lenglet
diff --git a/ChangeLog b/ChangeLog index e1a6494..9334e21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-07-20 Romain Lenglet <[email protected]> + + 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 <[email protected]> Don't hide leading space in autom4te --trace output. diff --git a/NEWS b/NEWS index ef67c77..43f02ad 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,11 @@ 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 following macros are now covered by autotests: + AC_ERLANG_CHECK_LIB, AC_ERLANG_SUBST_ROOT_DIR, + AC_ERLANG_SUBST_LIB_DIR, AC_ERLANG_SUBST_INSTALL_LIB_DIR, + AC_ERLANG_SUBST_ERTS_VER, and the macros for tests in Erlang + * 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..ba248a0 100644 --- a/tests/compile.at +++ b/tests/compile.at @@ -43,9 +43,13 @@ AC_LANG_PUSH(C++) # C++ C C AC_LANG(C++) # C++ C C +AC_LANG_PUSH(Erlang) +# Erlang C++ C C AC_LANG_PUSH(Fortran 77) -# F77 C++ C C +# F77 Erlang C++ C C AC_LANG_POP(Fortran 77) +# Erlang C++ C C +AC_LANG_POP(Erlang) # C++ C C AC_LANG(C++) # C++ C C @@ -62,7 +66,9 @@ c c cpp cpp +erl f +erl cpp cpp c diff --git a/tests/erlang.at b/tests/erlang.at new file mode 100644 index 0000000..6c056e5 --- /dev/null +++ b/tests/erlang.at @@ -0,0 +1,178 @@ +# -*- Autotest -*- + +AT_BANNER([Erlang low level compiling and utility macros.]) + +# Copyright (C) 2000, 2001, 2003, 2008 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. + + +## ----------------- ## +## Erlang Compiler. ## +## ----------------- ## + +AT_SETUP([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_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], +...@erlang_lib_dir_stdlib@ +]]) + +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_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], +...@erlang_root_dir@ +]]) + +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_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], +...@erlang_lib_dir@ +]]) + +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_NEED_ERL +AC_ERLANG_NEED_ERLC +AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR([test_blah], [1.24-b]) +AC_CONFIG_FILES([dir]) +AC_OUTPUT +]]) + +AT_DATA([dir.in], +...@erlang_install_lib_dir_test_blah@ +]]) + +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_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])
