autoconf-commit
[Top][All Lists]
Advanced

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

[SCM] GNU Autoconf source repository branch, master, updated. v2.64-5-gd


From: Paolo Bonzini
Subject: [SCM] GNU Autoconf source repository branch, master, updated. v2.64-5-gdab22fb
Date: Sun, 02 Aug 2009 06:21:32 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Autoconf source repository".

http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=dab22fbfe1ec3c836d09f32aca0d5c3eb2a32fdf

The branch, master has been updated
       via  dab22fbfe1ec3c836d09f32aca0d5c3eb2a32fdf (commit)
      from  9b849a97c69a4ab6063a8a3c794f4d5076a23c4c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dab22fbfe1ec3c836d09f32aca0d5c3eb2a32fdf
Author: Romain Lenglet <address@hidden>
Date:   Sat Aug 1 22:28:56 2009 +0900

    add AT_CHECK_EUNIT autotest macro
    
    * lib/autotest/specific.m4: New file.
    * lib/autotest/Makefile.am (dist_autotestlib_DATA): Add specific.m4.
    * lib/autoconf/autotest.m4 (AC_CONFIG_TESTDIR): Add definitions of
    variables used by AT_CHECK_EUNIT macro: ERL, ERLC, ERLCFLAGS.
    * tests/autotest.at (Erlang Eunit unit tests): Add test for macro
    AT_CHECK_EUNIT.
    * doc/autoconf.texi (Writing Testsuites): Document macro AT_CHECK_EUNIT.
    * NEWS: Mention macro AT_CHECK_EUNIT.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   13 +++
 NEWS                                               |    3 +
 doc/autoconf.texi                                  |   52 +++++++++++
 lib/autoconf/autotest.m4                           |   14 +++-
 lib/autotest/Makefile.am                           |    2 +-
 lib/autotest/autotest.m4                           |    1 +
 lib/{autoconf/autotest.m4 => autotest/specific.m4} |   90 ++++++++++---------
 tests/autotest.at                                  |   90 ++++++++++++++++++++
 8 files changed, 219 insertions(+), 46 deletions(-)
 copy lib/{autoconf/autotest.m4 => autotest/specific.m4} (56%)

diff --git a/ChangeLog b/ChangeLog
index c307701..bd77e86 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-08-01  Romain Lenglet  <address@hidden>
+           Paolo Bonzini  <address@hidden>
+
+       * lib/autotest/specific.m4 (AT_CHECK_EUNIT): New file.
+       * lib/autotest/Makefile.am (dist_autotestlib_DATA): Add specific.m4.
+       * lib/autoconf/autotest.m4 (AC_CONFIG_TESTDIR): Add definitions of
+       variables used by AT_CHECK_EUNIT macro: ERL, ERLC, ERLCFLAGS.
+       * tests/autotest.at (Erlang Eunit unit tests): Add test for macro
+       AT_CHECK_EUNIT.
+       * doc/autoconf.texi (Writing Testsuites): Document macro
+       AT_CHECK_EUNIT.
+       * NEWS: Mention macro AT_CHECK_EUNIT.
+
 2009-07-30  Paolo Bonzini  <address@hidden>
            Joel E. Denny  <address@hidden>
 
diff --git a/NEWS b/NEWS
index 7e8a522..50f4e0e 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ GNU Autoconf NEWS - User visible changes.
 
    These macros are present only for backwards compatibility purposes.
 
+** The following documented autotest macros are new:
+   AT_CHECK_EUNIT
+
 * Major changes in Autoconf 2.64 (2009-07-26) [stable]
   Released by Eric Blake, based on git versions 2.63b.*.
 
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index c920d73..b1b38da 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -22527,6 +22527,8 @@ of debugging scripts has the purpose of easing the 
chase for bugs.
 
 @item all the files created with @code{AT_DATA}
 
address@hidden all the Erlang source code files created with 
@code{AT_CHECK_EUNIT}
+
 @item a log of the run, named @file{testsuite.log}
 @end itemize
 
@@ -22901,6 +22903,56 @@ parameter, and the standard error contents are 
compared with
 @end table
 @end defmac
 
address@hidden AT_CHECK_EUNIT (@var{module}, @var{test-spec}, @ovar{erlflags}, @
+  @ovar{run-if-fail}, @ovar{run-if-pass})
address@hidden
+Initialize and execute an Erlang module named @var{module} that performs
+tests following the @var{test-spec} EUnit test specification.
address@hidden must be a valid EUnit test specification, as defined in
+the @uref{http://@/erlang.org/@/doc/@/apps/@/eunit/@/index.html, EUnit
+Reference Manual}.  @var{erlflags} are optional command-line options
+passed to the Erlang interpreter to execute the test Erlang module.
+Typically, @var{erlflags} defines at least the paths to directories
+containing the compiled Erlang modules under test, as @samp{-pa path1
+path2 ...}.
+
+For example, the unit tests associated with Erlang module @samp{testme},
+which compiled code is in subdirectory @file{src}, can be performed
+with:
+
address@hidden
+AT_CHECK_EUNIT([testme_testsuite], address@hidden, address@hidden,
+               [-pa "address@hidden@}/src"])
address@hidden example
+
+This macro must be invoked in between @code{AT_SETUP} and @code{AT_CLEANUP}.
+
+Variables @code{ERL}, @code{ERLC}, and (optionally) @code{ERLCFLAGS}
+must be defined as the path of the Erlang interpreter, the path of the
+Erlang compiler, and the command-line flags to pass to the compiler,
+respectively.  Those variables should be configured in
address@hidden using the @command{AC_ERLANG_PATH_ERL} and
address@hidden macros, and the configured values of those
+variables are automatically defined in the testsuite.  If @code{ERL} or
address@hidden is not defined, the test group is skipped.
+
+If the EUnit library cannot be found, i.e. if module @code{eunit} cannot
+be loaded, the test group is skipped.  Otherwise, if @var{test-spec} is
+an invalid EUnit test specification, the test group fails.  Otherwise,
+if the EUnit test passes, shell commands @var{run-if-pass} are executed
+or, if the EUnit test fails, shell commands @var{run-if-fail} are
+executed and the test group fails.
+
+Only the generated test Erlang module is automatically compiled and
+executed.  If @var{test-spec} involves testing other Erlang modules,
+e.g. module @samp{testme} in the example above, those modules must be
+already compiled.
+
+If the testsuite is run in verbose mode, with option @option{--verbose},
+EUnit is also run in verbose mode to output more details about
+individual unit tests.
address@hidden defmac
+
 
 @node testsuite Invocation
 @section Running @command{testsuite} Scripts
diff --git a/lib/autoconf/autotest.m4 b/lib/autoconf/autotest.m4
index 72b4b7f..aec589b 100644
--- a/lib/autoconf/autotest.m4
+++ b/lib/autoconf/autotest.m4
@@ -84,6 +84,16 @@ at_top_builddir=\$at_top_build_prefix
 AUTOTEST_PATH='m4_default([$2], [$1])'
 
 SHELL=\${CONFIG_SHELL-'$SHELL'}
+m4_provide_if([AC_ERLANG_PATH_ERL], [
+ERL='$ERL'
+])dnl
+m4_provide_if([AC_ERLANG_PATH_ERLC], [
+ERLC='$ERLC'
+ERLCFLAGS='$ERLCFLAGS'
+])dnl
 ATEOF
-])
-])# AC_CONFIG_TESTDIR
+],
+[m4_provide_if([AC_ERLANG_PATH_ERL], [ERL="$ERL"
+])m4_provide_if([AC_ERLANG_PATH_ERLC], [ERLC="$ERLC"
+ERLCFLAGS="$ERLCFLAGS"
+])])])# AC_CONFIG_TESTDIR
diff --git a/lib/autotest/Makefile.am b/lib/autotest/Makefile.am
index d310e46..006b7ef 100644
--- a/lib/autotest/Makefile.am
+++ b/lib/autotest/Makefile.am
@@ -16,7 +16,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 autotestlibdir = $(pkgdatadir)/autotest
-dist_autotestlib_DATA = autotest.m4 general.m4
+dist_autotestlib_DATA = autotest.m4 general.m4 specific.m4
 nodist_autotestlib_DATA = autotest.m4f
 CLEANFILES = $(nodist_autotestlib_DATA)
 
diff --git a/lib/autotest/autotest.m4 b/lib/autotest/autotest.m4
index dead4c0..8e2002d 100644
--- a/lib/autotest/autotest.m4
+++ b/lib/autotest/autotest.m4
@@ -45,3 +45,4 @@
 # to the GPL from your modified version.
 
 m4_include([autotest/general.m4])
+m4_include([autotest/specific.m4])
diff --git a/lib/autoconf/autotest.m4 b/lib/autotest/specific.m4
similarity index 56%
copy from lib/autoconf/autotest.m4
copy to lib/autotest/specific.m4
index 72b4b7f..df32cfe 100644
--- a/lib/autoconf/autotest.m4
+++ b/lib/autotest/specific.m4
@@ -1,7 +1,7 @@
-# This file is part of Autoconf.                       -*- Autoconf -*-
-# Interface with Autotest.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
+# This file is part of Autoconf.                          -*- Autoconf -*-
+# M4 macros used in running tests using third-party testing tools.
+m4_define([_AT_COPYRIGHT_YEARS],
+[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
@@ -44,46 +44,50 @@
 # the non-data portions to the data portions.)  If your modification has
 # such potential, you must delete any notice of this special exception
 # to the GPL from your modified version.
-#
-# Written by David MacKenzie, with help from
-# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
-# Roland McGrath, Noah Friedman, david d zuhn, and many others.
-
-
-# AC_CONFIG_TESTDIR(TEST-DIRECTORY, [AUTOTEST-PATH = TEST-DIRECTORY])
-# -------------------------------------------------------------------
-# Configure an Autotest test suite directory.  Invoke it once per dir,
-# even if there are several test suites in there.
-#
-# AUTOTEST-PATH must help the test suite to find the executables.
-# It is relative to the top level of the package, and is expanded
-# into all the build dirs of AUTOTEST-PATH, then all the src dirs.
-#
-# Do not use _ACEOF as we are being dumped into config.status via
-# an _ACEOF-heredoc.
-AC_DEFUN([AC_CONFIG_TESTDIR],
-[AC_CONFIG_COMMANDS([$1/atconfig],
-[cat >$1/atconfig <<ATEOF
address@hidden:@ Configurable variable values for building test suites.
address@hidden:@ Generated by $[0].
address@hidden:@ Copyright (C) m4_PACKAGE_YEAR Free Software Foundation, Inc.
-
-# The test suite will define top_srcdir=$at_top_srcdir/../.. etc.
-at_testdir='$1'
-abs_builddir='$ac_abs_builddir'
-at_srcdir='$ac_srcdir'
-abs_srcdir='$ac_abs_srcdir'
-at_top_srcdir='$ac_top_srcdir'
-abs_top_srcdir='$ac_abs_top_srcdir'
-at_top_build_prefix='$ac_top_build_prefix'
-abs_top_builddir='$ac_abs_top_builddir'
 
-# Backward compatibility with Autotest <= 2.59b:
-at_top_builddir=\$at_top_build_prefix
 
-AUTOTEST_PATH='m4_default([$2], [$1])'
+## ------------------------ ##
+## Erlang EUnit unit tests.  ##
+## ------------------------ ##
 
-SHELL=\${CONFIG_SHELL-'$SHELL'}
-ATEOF
+# AT_CHECK_EUNIT(MODULE, SPEC, [ERLFLAGS], [RUN-IF-FAIL], [RUN-IF-PASS])
+# ----------------------------------------------------------------------
+# Check that the EUnit test specification SPEC passes. The ERLFLAGS
+# optional flags are passed to the Erlang interpreter command line to
+# execute the test. The test is executed from an automatically
+# generated Erlang module named MODULE. Each call to this macro should
+# have a distinct MODULE name within each test group, to ease
+# debugging.
+# An Erlang/OTP version which contains the eunit library must be
+# installed, in order to execute this macro in a test suite.  The ERL,
+# ERLC, and ERLCFLAGS variables must be defined in atconfig,
+# typically by using the AC_ERLANG_PATH_ERL and AC_ERLANG_PATH_ERLC
+# Autoconf macros.
+_AT_DEFINE_SETUP([AT_CHECK_EUNIT],
+[AT_SKIP_IF([test ! -f "$ERL" || test ! -f "$ERLC"])
+## A wrapper to EUnit, to exit the Erlang VM with the right exit code:
+AT_DATA([$1.erl],
+[[-module($1).
+-export([test/0, test/1]).
+test() -> test([]).
+test(Options) ->
+  TestSpec = $2,
+  ReturnValue = case code:load_file(eunit) of
+    {module, _} -> case eunit:test(TestSpec, Options) of
+        ok -> 0; %% test passes
+        _  -> 1  %% test fails
+      end;
+    _ -> 77 %% EUnit not found, test skipped
+  end,
+  init:stop(ReturnValue).
+]])
+AT_CHECK(["$ERLC" $ERLCFLAGS -b beam $1.erl])
+## Make EUnit verbose when testsuite is verbose:
+if test -z "$at_verbose"; then
+  at_eunit_options="verbose"
+else
+  at_eunit_options=""
+fi
+AT_CHECK(["$ERL" $3 -s $1 test $at_eunit_options -noshell], [0], [ignore], [],
+         [$4], [$5])
 ])
-])# AC_CONFIG_TESTDIR
diff --git a/tests/autotest.at b/tests/autotest.at
index 7836439..162bbb7 100644
--- a/tests/autotest.at
+++ b/tests/autotest.at
@@ -1429,3 +1429,93 @@ m4_include([sub/two  spaces.at])
 AT_CHECK([$CONFIG_SHELL ./suite], [0], [stdout])
 AT_CHECK([grep 'two spaces' suite.log], [1])
 AT_CLEANUP
+
+
+## ------------------------- ##
+## Erlang EUnit unit tests.  ##
+## ------------------------- ##
+
+AT_SETUP([Erlang Eunit unit tests])
+AT_KEYWORDS([Erlang])
+
+mkdir s t
+AT_DATA([configure.ac], [[AC_INIT
+AC_ERLANG_PATH_ERL([not found])
+AC_ERLANG_PATH_ERLC([not found])
+if test "$ERL" = "not found" || test "$ERLC" = "not found"; then
+  HAVE_ERLANG=no
+  HAVE_EUNIT=no
+else
+  HAVE_ERLANG=yes
+  AC_ERLANG_CHECK_LIB([eunit], [HAVE_EUNIT=yes], [HAVE_EUNIT=no])
+fi
+AC_SUBST([HAVE_ERLANG])
+AC_SUBST([HAVE_EUNIT])
+
+AC_CONFIG_TESTDIR([t])
+AC_CONFIG_FILES([s/compile], [chmod +x s/compile])
+AC_CONFIG_FILES([erlang.conf])
+AC_OUTPUT
+]])
+cp "$abs_top_srcdir/build-aux/install-sh" pkg
+
+# File to pass info back to us
+AT_DATA([erlang.conf.in],
address@hidden@
address@hidden@
+]])
+
+# Erlang module to test:
+AT_DATA([s/testme.erl],
+[[-module(testme).
+-export([foo/1]).
+foo(1) -> one;
+foo(2) -> two;
+foo(_) -> other.
+]])
+
+# Corresponding Eunit unit test module:
+AT_DATA([s/testme_tests.erl],
+[[-module(testme_tests).
+-include_lib("eunit/include/eunit.hrl").
+foo_one_test() -> ?assertEqual(one, testme:foo(1)).
+foo_two_test() -> ?assertEqual(two, testme:foo(2)).
+foo_other_test() -> ?assertEqual(other, testme:foo(42)).
+]])
+
+# Compilation script:
+AT_DATA([s/compile.in],
+[["@ERLC@" -b beam testme.erl testme_tests.erl
+]])
+
+AT_CHECK_AT_PREP([suite],
+[[AT_INIT([suite to check EUnit integration])
+AT_SETUP([my only test])
+AT_CHECK_EUNIT([my_testsuite], [{module, testme}],
+              [-pa "${abs_top_builddir}/s"])
+AT_CLEANUP
+]], [], [], [], [t])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE
+. ./erlang.conf
+
+AT_CHECK([grep '^ERL='\''.*'\' t/atconfig], [], [ignore])
+AT_CHECK([grep '^ERLC='\''.*'\' t/atconfig], [], [ignore])
+AT_CHECK([grep '^ERLCFLAGS='\''.*'\' t/atconfig], [], [ignore])
+
+if test "$HAVE_ERLANG" = yes && test "$HAVE_EUNIT" = yes; then
+  AT_CHECK([cd s && $CONFIG_SHELL ./compile])
+fi
+
+AT_CHECK([cd t && $CONFIG_SHELL ./suite], [], [ignore])
+
+if test "$HAVE_EUNIT" = yes; then
+  AT_CHECK([grep 1.*successful t/suite.log], [], [ignore])
+  AT_CHECK([grep -v skipped t/suite.log], [], [ignore])
+else
+  AT_CHECK([grep 1.*skipped t/suite.log], [], [ignore])
+  AT_CHECK([grep 0.*successful t/suite.log], [], [ignore])
+fi
+
+AT_CLEANUP


hooks/post-receive
-- 
GNU Autoconf source repository




reply via email to

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