Add conditionals for non-Unix. Just g_error() unless G_OS_UNIX for now.

2007-11-25  Tor Lillqvist  <tml@novell.com>

	* glib/gtestutils.c: Add conditionals for non-Unix. Just g_error()
	unless G_OS_UNIX for now.


svn path=/trunk/; revision=5936
This commit is contained in:
Tor Lillqvist 2007-11-25 22:47:39 +00:00 committed by Tor Lillqvist
parent 5309d10f8f
commit 6fdcc7ddb2
3 changed files with 14 additions and 8 deletions

View File

@ -1,6 +1,7 @@
2007-11-25 Tor Lillqvist <tml@novell.com> 2007-11-25 Tor Lillqvist <tml@novell.com>
* glib/Makefile.am: Build gtestutils etc on OS_UNIX only. * glib/gtestutils.c: Add conditionals for non-Unix. Just g_error()
unless G_OS_UNIX for now.
2007-11-25 Matthias Clasen <mclasen@redhat.com> 2007-11-25 Matthias Clasen <mclasen@redhat.com>

View File

@ -19,12 +19,7 @@ gregex_c =
gregex_h = gregex_h =
endif endif
if OS_UNIX SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre . tests
gtestutils_c = gtestutils.c
tests_subdir = tests
endif
SUBDIRS = libcharset $(PRINTF_SUBDIR) $(MAYBE_PCRE) update-pcre . $(tests_subdir)
DIST_SUBDIRS = libcharset gnulib pcre update-pcre DIST_SUBDIRS = libcharset gnulib pcre update-pcre
@ -145,7 +140,7 @@ libglib_2_0_la_SOURCES = \
gstdio.c \ gstdio.c \
gstrfuncs.c \ gstrfuncs.c \
gstring.c \ gstring.c \
$(gtestutils_c) \ gtestutils.c \
gthread.c \ gthread.c \
gthreadprivate.h \ gthreadprivate.h \
gthreadpool.c \ gthreadpool.c \

View File

@ -21,11 +21,15 @@
#include "gtestutils.h" #include "gtestutils.h"
#include "galias.h" #include "galias.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef G_OS_UNIX
#include <sys/wait.h> #include <sys/wait.h>
#include <fcntl.h> #include <fcntl.h>
#endif
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
@ -1130,6 +1134,7 @@ g_strcmp0 (const char *str1,
return strcmp (str1, str2); return strcmp (str1, str2);
} }
#ifdef G_OS_UNIX
static int /* 0 on success */ static int /* 0 on success */
kill_child (int pid, kill_child (int pid,
int *status, int *status,
@ -1175,6 +1180,7 @@ kill_child (int pid,
while (wr < 0 && errno == EINTR); while (wr < 0 && errno == EINTR);
return wr; return wr;
} }
#endif
static inline int static inline int
g_string_must_read (GString *gstring, g_string_must_read (GString *gstring,
@ -1297,6 +1303,7 @@ gboolean
g_test_trap_fork (guint64 usec_timeout, g_test_trap_fork (guint64 usec_timeout,
GTestTrapFlags test_trap_flags) GTestTrapFlags test_trap_flags)
{ {
#ifdef G_OS_UNIX
int stdout_pipe[2] = { -1, -1 }; int stdout_pipe[2] = { -1, -1 };
int stderr_pipe[2] = { -1, -1 }; int stderr_pipe[2] = { -1, -1 };
int stdtst_pipe[2] = { -1, -1 }; int stdtst_pipe[2] = { -1, -1 };
@ -1424,6 +1431,9 @@ g_test_trap_fork (guint64 usec_timeout,
test_trap_last_stderr = g_string_free (serr, FALSE); test_trap_last_stderr = g_string_free (serr, FALSE);
return FALSE; return FALSE;
} }
#else
g_error ("Not implemented: g_test_trap_fork");
#endif
} }
/** /**