Hi Bruno,

Bruno Haible <br...@clisp.org> writes:

> And a unit test would be nice as well. You know, it's only through the
> unit tests that we discover the portability problems.
>
> I think such a unit test shouldn't use fork(), like tests/test-passfd.c
> does, since fork() doesn't exist on native Windows. But
> tests/test-nonblocking-socket-{main,child}.c looks like a good starting point.

Sounds like a good idea to me too. Perhaps test-sys_un{.c,cc} like usual
and another test program for UNIX socket functionality if <sys/un.h> or
<afunix.h> is found.

I'm thinking that for older versions of Windows and systems without UNIX
sockets they should all be skipped.

I don't think there is much point in defining 'struct sockaddr_un' if
AF_UNIX is not supported. Maybe the tests should all be like:

#if HAVE_UNIXSOCKET
int
main ()
{
  /* Do test.  */
}
#else
int
main
{
  /* Skip test.  */
  exit (77);
}
#endif

But let me know if you have a better idea.

Collin

Reply via email to