bug-gnulib
[Top][All Lists]
Advanced

[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 19:27:38 +0200
User-agent: KMail/1.9.9

Hi Eric,

> I will be pushing these later today as prerequisites to fixing fchdir and 
> splitting fdopendir into its own module.  This series avoids some compilation 
> warnings due to missing chmod on mingw, and allows me to run gnulib 
> testsuites 
> under cygwin while cross-compiling to mingw:
> 
> $ cross_compiling=yes gl_cv_func_open_slash=no CC='gcc -mno-cygwin' \
>    CFLAGS='-Wall -gdwarf-2' ./gnulib-tool --with-tests --test canonicalize
> ...
> for the situation where AC_CANONICAL_HOST is mis-detected as cygwin rather 
> than 
> mingw (as in my above gnulib-tool command line) ...

The arguments that you are passing to 'configure' here are invalid. The usual
and recommended way to compile from cygwin to mingw are like this (thanks for
your recent correction):

   PATH=/usr/local/mingw/bin:$PATH
   export PATH
   ./configure --host=i586-pc-mingw32 --prefix=/usr/local/mingw \
     CC="gcc -mno-cygwin" \
     CXX="g++ -mno-cygwin" \
     CPPFLAGS="-Wall -I/usr/local/mingw/include" \
     LDFLAGS="-L/usr/local/mingw/lib"

You are omitting the --host=i586-pc-mingw32 argument here. Of course, in this
situation, AC_CANONICAL_HOST will return *-*-cygwin here then.

IMO you need to split the "./gnulib-tool --test" command into
"./gnulib-tool --create-testdir" and subsequent
"./configure --host=i586-pc-mingw32 ...", even if it's a bit more verbose.

One could argue that gnulib-tool should allow to pass configure arguments
in "./gnulib-tool --test". But since ./gnulib-tool --test is just a commodity
anyway, it does not seem worth the complexity.

> --- a/lib/chown.c
> +++ b/lib/chown.c
> +#else /* !HAVE_CHOWN */
> +  errno = EOPNOTSUPP;
> +  return -1;
> +#endif
>  }
> --- a/lib/lchown.c
> +++ b/lib/lchown.c
> +#else /* !HAVE_CHOWN */
> +  errno = EOPNOTSUPP;
> +  return -1;
> +#endif
>  }

EOPNOTSUPP is an error code related to sockets. I also see it sometimes on
NFS mounts. POSIX [1] describes it as "Operation not supported on socket".
Probably ENOSYS ("Function not supported.") is a better error code.

> --- 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.

Bruno

[1] http://www.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html




reply via email to

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