]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Add autotests for Erlang macros.
authorRomain Lenglet <romain.lenglet@laposte.net>
Thu, 23 Jul 2009 12:47:52 +0000 (06:47 -0600)
committerEric Blake <ebb9@byu.net>
Thu, 23 Jul 2009 12:47:52 +0000 (06:47 -0600)
* 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.
* NEWS: Mention this.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
NEWS
tests/Makefile.am
tests/compile.at
tests/erlang.at [new file with mode: 0644]
tests/suite.at

index 4b9fb5c97c9126423fb0a2c6e064682e7da5ff15..dac5b0c019b33c1eff4fd20d18b2985d67cf9828 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-07-23  Romain Lenglet  <romain.lenglet@laposte.net>
+
+       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.
+       * NEWS: Mention this.
+
 2009-07-22  Eric Blake  <ebb9@byu.net>
 
        Fix test of autom4te from stdin.
diff --git a/NEWS b/NEWS
index ef67c77cb15631aa0604a9a404a77c8b7bf24ebd..ec638342305279e512f5440e9319b9949c2412df 100644 (file)
--- 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.*.
 
index f07c553f4136f37c87da6c66496fcd18836aa48e..085c9d191cde28811b71e3f1d62a136893415bff 100644 (file)
@@ -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 \
index 20398fb8390267493051a9270712029741f31f4c..9675539721504b416d617c1a9ae78c6dd347fd88 100644 (file)
@@ -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 (file)
index 0000000..f3ced24
--- /dev/null
@@ -0,0 +1,214 @@
+#                                                      -*- 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.
+
+
+# AT_SETUP_ERLANG(title)
+# ----------------------
+# Setup a test group for Erlang, named TITLE.
+m4_define([AT_SETUP_ERLANG],
+[AT_SETUP([$1])
+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"])])
+
+
+## ----------------- ##
+## Erlang Compiler.  ##
+## ----------------- ##
+
+AT_SETUP_ERLANG([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_ERLANG([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
+
+
+## --------------------------- ##
+## Erlang root dir detection.  ##
+## --------------------------- ##
+
+AT_SETUP_ERLANG([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
+
+
+## -------------------------- ##
+## Erlang lib dir detection.  ##
+## -------------------------- ##
+
+AT_SETUP_ERLANG([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
+
+
+## ------------------------------- ##
+## Erlang installation detection.  ##
+## ------------------------------- ##
+
+AT_CHECK_MACRO([AC_ERLANG_SUBST_INSTALL_LIB_DIR], [],
+[AT_KEYWORDS([Erlang])])
+
+
+## ------------------------------- ##
+## Erlang installation detection.  ##
+## ------------------------------- ##
+
+AT_SETUP([AC_ERLANG_SUBST_INSTALL_LIB_SUBDIR])
+AT_KEYWORDS([Erlang])
+
+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],
+[[@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
+
+
+## -------------------------- ##
+## Erlang version detection.  ##
+## -------------------------- ##
+
+AT_SETUP_ERLANG([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
index ff0347e3a3788f5a225574b8683d4045d78689d0..7302b609c5b6735e4c6ee2bee7e4c68607a106cd 100644 (file)
@@ -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])