[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnulib-tool: make --with-tests more useful
From: |
Bruno Haible |
Subject: |
gnulib-tool: make --with-tests more useful |
Date: |
Sat, 27 Jan 2007 14:53:07 +0100 (MET) |
User-agent: |
KMail/1.5.4 |
Hi,
The directories created by --create-testdir --with-tests and
--create-megatestdir --with-tests currently don't test a lot when doing
cross-compiles. Because when cross-compiling, you cannot run "make check" -
it would try to execute the test programs, which always fails.
So, to detect link errors during "make", rather than during "make check",
one needs to turn the check_PROGRAMS into noinst_PROGRAMS. This patch
implements it.
2007-01-27 Bruno Haible <address@hidden>
* gnulib-tool (func_emit_lib_Makefile_am): If $for_test is true, turn
check_PROGRAMS into noinst_PROGRAMS.
(func_emit_tests_Makefile_am): Likewise. Also don't initialize
check_PROGRAMS in this case.
(func_import): Set for_test to false.
(func_create_testdir): Set for_test to true.
*** gnulib-tool 21 Jan 2007 20:07:09 -0000 1.217
--- gnulib-tool 27 Jan 2007 13:44:35 -0000
***************
*** 1180,1185 ****
--- 1180,1186 ----
# - libtool true if libtool will be used, false or blank otherwise
# - macro_prefix prefix of gl_LIBOBJS macros to use
# - actioncmd (optional) command that will reproduce this invocation
+ # - for_test true if creating a package for testing, false otherwise
# Output:
# - uses_subdirs nonempty if object files in subdirs exist
func_emit_lib_Makefile_am ()
***************
*** 1200,1205 ****
--- 1201,1215 ----
perhapsLT=
sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
fi
+ if $for_test; then
+ # When creating a package for testing: Attempt to provoke failures,
+ # especially link errors, already during "make" rather than during
+ # "make check", because "make check" is not possible in a cross-compiling
+ # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
+ sed_transform_check_PROGRAMS='s,check_PROGRAMS,noinst_PROGRAMS,g'
+ else
+ sed_transform_check_PROGRAMS=
+ fi
echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
echo "## Process this file with automake to produce Makefile.in."
func_emit_copyright_notice
***************
*** 1219,1225 ****
sed -e "$sed_eliminate_LDFLAGS" |
sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' |
sed -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
! -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g'
if test "$module" = 'alloca'; then
echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
--- 1229,1236 ----
sed -e "$sed_eliminate_LDFLAGS" |
sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' |
sed -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
! -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' |
! sed -e "$sed_transform_check_PROGRAMS"
if test "$module" = 'alloca'; then
echo "${libname}_${libext}_LIBADD += @${perhapsLT}ALLOCA@"
echo "${libname}_${libext}_DEPENDENCIES += @${perhapsLT}ALLOCA@"
***************
*** 1318,1323 ****
--- 1329,1335 ----
# - sourcebase relative directory containing lib source code
# - m4base relative directory containing autoconf macros
# - testsbase relative directory containing unit test code
+ # - for_test true if creating a package for testing, false otherwise
func_emit_tests_Makefile_am ()
{
if test "$libtool" = true; then
***************
*** 1332,1337 ****
--- 1344,1358 ----
libext=a
sed_eliminate_LDFLAGS='/^lib_LDFLAGS[ ]*+=/d'
fi
+ if $for_test; then
+ # When creating a package for testing: Attempt to provoke failures,
+ # especially link errors, already during "make" rather than during
+ # "make check", because "make check" is not possible in a cross-compiling
+ # situation. Turn check_PROGRAMS into noinst_PROGRAMS.
+ sed_transform_check_PROGRAMS='s,check_PROGRAMS,noinst_PROGRAMS,g'
+ else
+ sed_transform_check_PROGRAMS=
+ fi
testsbase_inverse=`echo "$testsbase" | sed -e 's,/$,,' | sed -e
's,[^/][^/]*,..,g'`
echo "## DO NOT EDIT! GENERATED AUTOMATICALLY!"
echo "## Process this file with automake to produce Makefile.in."
***************
*** 1353,1359 ****
sed -e "$sed_eliminate_LDFLAGS" |
sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' |
sed -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
! -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g'
} > amsnippet.tmp
# Skip the contents if its entirely empty.
if grep '[^ ]' amsnippet.tmp > /dev/null ; then
--- 1374,1381 ----
sed -e "$sed_eliminate_LDFLAGS" |
sed -e 's,lib_\([A-Z][A-Z]*\),'"${libname}_${libext}"'_\1,g' |
sed -e 's,lib%_LIBRARIES,lib_LIBRARIES,g' \
! -e 's,lib%_LTLIBRARIES,lib_LTLIBRARIES,g' |
! sed -e "$sed_transform_check_PROGRAMS"
} > amsnippet.tmp
# Skip the contents if its entirely empty.
if grep '[^ ]' amsnippet.tmp > /dev/null ; then
***************
*** 1374,1380 ****
echo "TESTS ="
echo "TESTS_ENVIRONMENT ="
echo "noinst_PROGRAMS ="
! echo "check_PROGRAMS ="
echo "noinst_HEADERS ="
if grep '^pkgdata_DATA *+=' allsnippets.tmp > /dev/null; then
echo "pkgdata_DATA ="
--- 1396,1404 ----
echo "TESTS ="
echo "TESTS_ENVIRONMENT ="
echo "noinst_PROGRAMS ="
! if ! $for_test; then
! echo "check_PROGRAMS ="
! fi
echo "noinst_HEADERS ="
if grep '^pkgdata_DATA *+=' allsnippets.tmp > /dev/null; then
echo "pkgdata_DATA ="
***************
*** 1942,1947 ****
--- 1966,1974 ----
makefile_am=Makefile.am
fi
+ # Create normal Makefile.ams.
+ for_test=false
+
# Create library makefile.
func_dest_tmpfilename $sourcebase/$makefile_am
func_emit_lib_Makefile_am > "$tmpfile"
***************
*** 2373,2378 ****
--- 2400,2408 ----
exec 0<&5 5<&-
}
+ # Create Makefile.ams that are for testing.
+ for_test=true
+
# Create $sourcebase/Makefile.am.
mkdir -p "$testdir/$sourcebase"
func_emit_lib_Makefile_am > "$testdir/$sourcebase/Makefile.am"
- gnulib-tool: make --with-tests more useful,
Bruno Haible <=