[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mingw test cleanups
From: |
Bruno Haible |
Subject: |
Re: mingw test cleanups |
Date: |
Sun, 6 Sep 2009 22:52:09 +0200 |
User-agent: |
KMail/1.9.9 |
Eric Blake wrote:
> But my shortcut
> is generally adequate enough to shave time and limp by with a single step
> instead of two (it is already time-consuming enough to use gnulib-tool on
> cygwin, due to slow forks).
gnulib-tool is there to make your life easier. So, you would probably like
it to have a way to specify 'configure' arguments? Rather than knowingly
configuring incorrectly. Probably it should be an environment variable,
so it can be set in the same way as CC and CFLAGS?
> >> --- a/modules/canonicalize-lgpl-tests
> >> +++ b/modules/canonicalize-lgpl-tests
> >> @@ -5,9 +5,12 @@ tests/test-canonicalize-lgpl.c
> >> Depends-on:
> >>
> >> configure.ac:
> >> +AC_CHECK_FUNCS_ONCE([symlink])
> >> +HAVE_SYMLINK=ac_cv_func_symlink
> >> +AC_SUBST([HAVE_SYMLINK])
> >> diff --git a/modules/canonicalize-tests b/modules/canonicalize-tests
> >> index 875984e..092b9ef 100644
> >> --- a/modules/canonicalize-tests
> >> +++ b/modules/canonicalize-tests
> >> @@ -5,9 +5,12 @@ tests/test-canonicalize.c
> >> Depends-on:
> >>
> >> configure.ac:
> >> +AC_CHECK_FUNCS_ONCE([symlink])
> >> +HAVE_SYMLINK=ac_cv_func_symlink
> >> +AC_SUBST([HAVE_SYMLINK])
> >
> > Setting the value of the same variable in two different configure.ac
> > snippets
> > is going to break the next time someone will modify one of the two files but
> > forget about the other one. If you cannot move these to a common .m4 file,
> > I would use two different variable names, instead of 2x HAVE_SYMLINK.
>
> Yes, I could see the benefit of refactoring m4/readlink.m4 to make it
> easier to call just a detection portion from other modules without having
> to depend on the readlink module and compile readlink.c, as well as the
> creation of m4/symlink.m4 to do likewise. In fact, it probably makes
> sense to consolidate on a single witness - mingw doesn't support either
> symlink or readlink, but gnulib provides a readlink replacement, so is it
> better to use HAVE_SYMLINK or HAVE_READLINK as the witness that symlinks work?
A single test is more reasonable that testing for 'readlink' in one place and
for 'symlink' in another. The essential part in m4/readlink.m4 is:
AC_CHECK_FUNCS_ONCE([readlink])
It's a one-liner that you can copy to elsewhere. One more reason to prefer
testing for readlink is that test-canonicalize uses the readlink() function,
not the symlink() function.
So what I propose is this:
2009-09-06 Bruno Haible <address@hidden>
* modules/canonicalize-tests (CANONICALIZE_HAVE_SYMLINKS): Renamed from
HAVE_SYMLINK. Check for readlink(), not for symlink().
* tests/test-canonicalize.sh: Update.
* modules/canonicalize-lgpl-tests (CANONICALIZE_LGPL_HAVE_SYMLINKS):
Renamed from HAVE_SYMLINK. Check for readlink(), not for symlink().
* tests/test-canonicalize-lgpl.sh: Update.
--- modules/canonicalize-lgpl-tests.orig 2009-09-06 22:49:42.000000000
+0200
+++ modules/canonicalize-lgpl-tests 2009-09-06 22:49:01.000000000 +0200
@@ -5,12 +5,12 @@
Depends-on:
configure.ac:
-AC_CHECK_FUNCS_ONCE([symlink])
-HAVE_SYMLINK=$ac_cv_func_symlink
-AC_SUBST([HAVE_SYMLINK])
+AC_CHECK_FUNCS_ONCE([readlink])
+CANONICALIZE_LGPL_HAVE_SYMLINKS=$ac_cv_func_readlink
+AC_SUBST([CANONICALIZE_LGPL_HAVE_SYMLINKS])
Makefile.am:
TESTS += test-canonicalize-lgpl.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' HAVE_SYMLINK='$(HAVE_SYMLINK)'
+TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
CANONICALIZE_LGPL_HAVE_SYMLINKS='$(CANONICALIZE_LGPL_HAVE_SYMLINKS)'
check_PROGRAMS += test-canonicalize-lgpl
test_canonicalize_lgpl_LDADD = $(LDADD)
--- modules/canonicalize-tests.orig 2009-09-06 22:49:42.000000000 +0200
+++ modules/canonicalize-tests 2009-09-06 22:49:01.000000000 +0200
@@ -5,12 +5,12 @@
Depends-on:
configure.ac:
-AC_CHECK_FUNCS_ONCE([symlink])
-HAVE_SYMLINK=$ac_cv_func_symlink
-AC_SUBST([HAVE_SYMLINK])
+AC_CHECK_FUNCS_ONCE([readlink])
+CANONICALIZE_HAVE_SYMLINKS=$ac_cv_func_readlink
+AC_SUBST([CANONICALIZE_HAVE_SYMLINKS])
Makefile.am:
TESTS += test-canonicalize.sh
-TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' HAVE_SYMLINK='$(HAVE_SYMLINK)'
+TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@'
CANONICALIZE_HAVE_SYMLINKS='$(CANONICALIZE_HAVE_SYMLINKS)'
check_PROGRAMS += test-canonicalize
test_canonicalize_LDADD = $(LDADD) @LIBINTL@
--- tests/test-canonicalize-lgpl.sh.orig 2009-09-06 22:49:42.000000000
+0200
+++ tests/test-canonicalize-lgpl.sh 2009-09-06 22:49:01.000000000 +0200
@@ -5,7 +5,7 @@
tmpfiles="$tmpfiles t-can-lgpl.tmp ise"
mkdir t-can-lgpl.tmp
-test "x$HAVE_SYMLINK" = xyes \
+test "x$CANONICALIZE_LGPL_HAVE_SYMLINKS" = xyes \
&& ln -s t-can-lgpl.tmp/ket ise \
|| { echo "Skipping test: symbolic links not supported on this filesystem"
rm -fr $tmpfiles
--- tests/test-canonicalize.sh.orig 2009-09-06 22:49:42.000000000 +0200
+++ tests/test-canonicalize.sh 2009-09-06 22:49:01.000000000 +0200
@@ -5,7 +5,7 @@
tmpfiles="$tmpfiles t-can.tmp ise"
mkdir t-can.tmp
-test "x$HAVE_SYMLINK" = xyes \
+test "x$CANONICALIZE_HAVE_SYMLINKS" = xyes \
&& ln -s t-can.tmp/ket ise \
|| { echo "Skipping test: symbolic links not supported on this filesystem"
rm -fr $tmpfiles