[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] tests: allow tests to learn where a module is present
From: |
Eric Blake |
Subject: |
[PATCH 1/2] tests: allow tests to learn where a module is present |
Date: |
Wed, 4 May 2011 16:39:48 -0600 |
Set up framework to tell from within a test whether a module
exists in just tests or also in libs.
* m4/gnulib-common.m4 (gl_MODULE_INDICATOR): Refine definition.
* gnulib-tool (func_note_Makefile_am_edit): Update condition
output.
Signed-off-by: Eric Blake <address@hidden>
---
By making a module indicator 0 (not present), 1 (present in
the current compilation directory), or 2 (present by test
inheritance but not in the current compilation directory),
we can make smarter decisions about what to test.
ChangeLog | 5 +++++
gnulib-tool | 17 +++++++++--------
m4/gnulib-common.m4 | 4 ++--
3 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1501282..6a880d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2011-05-04 Eric Blake <address@hidden>
+ tests: allow tests to learn where a module is present
+ * m4/gnulib-common.m4 (gl_MODULE_INDICATOR): Refine definition.
+ * gnulib-tool (func_note_Makefile_am_edit): Update condition
+ output.
+
maint: make most gl_REPLACE macros one-shot
* m4/calloc.m4 (gl_REPLACE_CALLOC): Redefine on first use so that
LIBOBJ replacement only happens in one location.
diff --git a/gnulib-tool b/gnulib-tool
index f6c29f2..0bfe8ea 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -4966,6 +4966,15 @@ s,//*$,/,'
fi
echo " gl_m4_base='$m4base'"
func_emit_initmacro_start $macro_prefix
+ # Define a tests witness macro that depends on the package.
+ # PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by
AC_INIT.
+ # See <http://lists.gnu.org/archive/html/automake/2009-05/msg00145.html>.
+ echo "changequote(,)dnl"
+ echo " ${macro_prefix}tests_WITNESS=IN_\`echo
\"\${PACKAGE-\$PACKAGE_TARNAME}\" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'\`_GNULIB_TESTS"
+ echo "changequote([, ])dnl"
+ echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
+ echo "
gl_module_indicator_condition=\"(\$${macro_prefix}tests_WITNESS+1)\""
+ echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION],
[\$gl_module_indicator_condition])"
echo " gl_source_base='$sourcebase'"
func_emit_autoconf_snippets "$main_modules" func_verify_module true false
true
echo " # End of code from modules"
@@ -4974,15 +4983,7 @@ s,//*$,/,'
echo " gltests_ltlibdeps="
func_emit_initmacro_start ${macro_prefix}tests
echo " gl_source_base='$testsbase'"
- # Define a tests witness macro that depends on the package.
- # PACKAGE is defined by AM_INIT_AUTOMAKE, PACKAGE_TARNAME is defined by
AC_INIT.
- # See <http://lists.gnu.org/archive/html/automake/2009-05/msg00145.html>.
- echo "changequote(,)dnl"
- echo " ${macro_prefix}tests_WITNESS=IN_\`echo
\"\${PACKAGE-\$PACKAGE_TARNAME}\" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz
ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'\`_GNULIB_TESTS"
- echo "changequote([, ])dnl"
- echo " AC_SUBST([${macro_prefix}tests_WITNESS])"
echo " gl_module_indicator_condition=\$${macro_prefix}tests_WITNESS"
- echo " m4_pushdef([gl_MODULE_INDICATOR_CONDITION],
[\$gl_module_indicator_condition])"
func_emit_autoconf_snippets "$testsrelated_modules" func_verify_module
true true true
echo " m4_popdef([gl_MODULE_INDICATOR_CONDITION])"
func_emit_initmacro_end ${macro_prefix}tests
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index c4d7a20..1288412 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -65,7 +65,7 @@ AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE],
# | Value | Value |
# | in lib/ | in tests/ |
# --------------------------------------------+---------+-----------+
-# Module present among main modules: | 1 | 1 |
+# Module present among main modules: | 1 | 2 |
# --------------------------------------------+---------+-----------+
# Module present among tests-related modules: | 0 | 1 |
# --------------------------------------------+---------+-----------+
@@ -77,7 +77,7 @@ AC_DEFUN([gl_MODULE_INDICATOR],
[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___]),
[gl_MODULE_INDICATOR_CONDITION],
- [Define to a C preprocessor expression that evaluates to 1 or 0,
+ [Define to a C preprocessor expression that evaluates to 0, 1, or 2,
depending whether the gnulib module $1 shall be considered present.])
])
--
1.7.4.4
- gl_MODULE_INDICATOR, Eric Blake, 2011/05/04
- [PATCH 1/2] tests: allow tests to learn where a module is present,
Eric Blake <=
- Re: gl_MODULE_INDICATOR, Bruno Haible, 2011/05/05
- Re: gl_MODULE_INDICATOR, Eric Blake, 2011/05/05
- Re: two semantics of fclose(), Bruno Haible, 2011/05/05
- Re: two semantics of fclose(), Eric Blake, 2011/05/05
- Re: two semantics of fclose(), Jim Meyering, 2011/05/06
- Re: two semantics of fclose(), Bruno Haible, 2011/05/06
- [PATCH] fclose: guarantee behavior on seekable stdin, Eric Blake, 2011/05/06
- Re: [PATCH] fclose: guarantee behavior on seekable stdin, Bruno Haible, 2011/05/06