bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fix building tests under Windows


From: Pavel Fedin
Subject: [PATCH] Fix building tests under Windows
Date: Wed, 01 Jul 2015 10:18:11 +0300

1. grantpt.c seems to be never used on Windows, however it's still present in
tests/ subdirectory of the final project. Therefore it breaks 'make check'.

2. Windows has no PTYs, therefore gnulib's openpty() will just return -ENOSYS.
The main problem is test-openpty.c which expects termios to be there. Just make
it building and silently passing the test.

Signed-off-by: Pavel Fedin <address@hidden>
---
 lib/grantpt.c        | 2 +-
 tests/test-openpty.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/grantpt.c b/lib/grantpt.c
index a740091..3658fcd 100644
--- a/lib/grantpt.c
+++ b/lib/grantpt.c
@@ -46,7 +46,7 @@
 int
 grantpt (int fd)
 {
-#if defined __OpenBSD__
+#if (defined __OpenBSD__) || (defined _WIN32)
   /* On OpenBSD, master and slave of a pseudo-terminal are allocated together,
      through an ioctl on /dev/ptm.  There is no need for grantpt().  */
   return 0;
diff --git a/tests/test-openpty.c b/tests/test-openpty.c
index 9fc4ed2..ee36fe6 100644
--- a/tests/test-openpty.c
+++ b/tests/test-openpty.c
@@ -34,6 +34,7 @@ int
 main ()
 {
   {
+#ifndef _WIN32
     int master;
     int slave;
 
@@ -103,6 +104,7 @@ main ()
     /* Close the master side before the slave side gets closed.
        This is necessary on Mac OS X 10.4.11.  */
     close (master);
+#endif
   }
 
   return 0;
-- 
1.9.5.msysgit.0





reply via email to

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