summaryrefslogtreecommitdiff
path: root/gl/tests
diff options
context:
space:
mode:
Diffstat (limited to 'gl/tests')
-rw-r--r--gl/tests/Makefile.am29
-rw-r--r--gl/tests/ioctl.c27
-rw-r--r--gl/tests/sys_ioctl.in.h31
-rwxr-xr-xgl/tests/test-vc-list-files-git.sh6
4 files changed, 73 insertions, 20 deletions
diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am
index cdf9763658..ae662e8066 100644
--- a/gl/tests/Makefile.am
+++ b/gl/tests/Makefile.am
@@ -31,6 +31,7 @@ DISTCLEANFILES =
MAINTAINERCLEANFILES =
AM_CPPFLAGS = \
+ -D@gltests_WITNESS@=1 \
-I. -I$(srcdir) \
-I../.. -I$(srcdir)/../.. \
-I../../gl -I$(srcdir)/../../gl
@@ -95,6 +96,30 @@ EXTRA_DIST += test-arpa_inet.c
## end gnulib module arpa_inet-tests
+## begin gnulib module c++defs
+
+# The BUILT_SOURCES created by this Makefile snippet are not used via #include
+# statements but through direct file reference. Therefore this snippet must be
+# present in all Makefile.am that need it. This is ensured by the applicability
+# 'all' defined above.
+
+BUILT_SOURCES += c++defs.h
+# The c++defs.h that gets inserted into generated .h files is the same as
+# build-aux/c++defs.h, except that it has the copyright header cut off.
+c++defs.h: $(top_srcdir)/build-aux/c++defs.h
+ $(AM_V_GEN)rm -f $@-t $@ && \
+ sed -n -e '/_GL_CXXDEFS/,$$p' \
+ < $(top_srcdir)/build-aux/c++defs.h \
+ > $@-t && \
+ mv $@-t $@
+MOSTLYCLEANFILES += c++defs.h c++defs.h-t
+
+CXXDEFS_H=c++defs.h
+
+EXTRA_DIST += $(top_srcdir)/build-aux/c++defs.h
+
+## end gnulib module c++defs
+
## begin gnulib module c-ctype-tests
TESTS += test-c-ctype
@@ -324,7 +349,7 @@ BUILT_SOURCES += sys/ioctl.h
# We need the following in order to create <sys/ioctl.h> when the system
# does not have a complete one.
-sys/ioctl.h: sys_ioctl.in.h $(WARN_ON_USE_H)
+sys/ioctl.h: sys_ioctl.in.h $(CXXDEFS_H) $(WARN_ON_USE_H)
$(AM_V_at)$(MKDIR_P) sys
$(AM_V_GEN)rm -f $@-t $@ && \
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
@@ -335,6 +360,8 @@ sys/ioctl.h: sys_ioctl.in.h $(WARN_ON_USE_H)
-e 's|@''GNULIB_IOCTL''@|$(GNULIB_IOCTL)|g' \
-e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H)|g' \
-e 's|@''SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \
+ -e 's|@''REPLACE_IOCTL''@|$(REPLACE_IOCTL)|g' \
+ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
< $(srcdir)/sys_ioctl.in.h; \
} > $@-t && \
diff --git a/gl/tests/ioctl.c b/gl/tests/ioctl.c
index de3f82bd17..1d409c6712 100644
--- a/gl/tests/ioctl.c
+++ b/gl/tests/ioctl.c
@@ -23,12 +23,31 @@
#include <stdarg.h>
-#define WIN32_LEAN_AND_MEAN
+#if HAVE_IOCTL
+
+/* Provide a wrapper with the POSIX prototype. */
+# undef ioctl
+int
+rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */)
+{
+ void *buf;
+ va_list args;
+
+ va_start (args, request);
+ buf = va_arg (args, void *);
+ va_end (args);
+
+ return ioctl (fd, request, buf);
+}
+
+#else /* mingw */
+
+# define WIN32_LEAN_AND_MEAN
/* Get winsock2.h. */
-#include <sys/socket.h>
+# include <sys/socket.h>
/* Get set_winsock_errno, FD_TO_SOCKET etc. */
-#include "w32sock.h"
+# include "w32sock.h"
int
rpl_ioctl (int fd, int req, ...)
@@ -49,3 +68,5 @@ rpl_ioctl (int fd, int req, ...)
return r;
}
+
+#endif
diff --git a/gl/tests/sys_ioctl.in.h b/gl/tests/sys_ioctl.in.h
index 07a030f89c..32dacd4b84 100644
--- a/gl/tests/sys_ioctl.in.h
+++ b/gl/tests/sys_ioctl.in.h
@@ -36,22 +36,30 @@
# include <unistd.h>
#endif
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
+
/* The definition of _GL_WARN_ON_USE is copied here. */
/* Declare overridden functions. */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
#if @GNULIB_IOCTL@
-# if @SYS_IOCTL_H_HAVE_WINSOCK2_H@
-# undef ioctl
-# define ioctl rpl_ioctl
-extern int ioctl (int fd, int request, ... /* {void *,char *} arg */);
+# if @SYS_IOCTL_H_HAVE_WINSOCK2_H@ || @REPLACE_IOCTL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef ioctl
+# define ioctl rpl_ioctl
+# endif
+_GL_FUNCDECL_RPL (ioctl, int,
+ (int fd, int request, ... /* {void *,char *} arg */));
+_GL_CXXALIAS_RPL (ioctl, int,
+ (int fd, int request, ... /* {void *,char *} arg */));
+# else
+_GL_FUNCDECL_SYS (ioctl, int,
+ (int fd, int request, ... /* {void *,char *} arg */));
+_GL_CXXALIAS_SYS (ioctl, int,
+ (int fd, int request, ... /* {void *,char *} arg */));
# endif
+_GL_CXXALIASWARN (ioctl);
#elif @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
# undef ioctl
# define ioctl ioctl_used_without_requesting_gnulib_module_ioctl
@@ -64,10 +72,5 @@ _GL_WARN_ON_USE (ioctl, "ioctl does not portably work on sockets - "
#endif
-#ifdef __cplusplus
-}
-#endif
-
-
#endif /* _GL_SYS_IOCTL_H */
#endif /* _GL_SYS_IOCTL_H */
diff --git a/gl/tests/test-vc-list-files-git.sh b/gl/tests/test-vc-list-files-git.sh
index 7b7ff1a564..56a9a5b940 100755
--- a/gl/tests/test-vc-list-files-git.sh
+++ b/gl/tests/test-vc-list-files-git.sh
@@ -28,6 +28,8 @@ tmpdir=vc-git-$$
trap 'st=$?; cd '"`pwd`"' && rm -rf $tmpdir; exit $st' 0
trap '(exit $?); exit $?' 1 2 13 15
+GIT_DIR= GIT_WORK_TREE=; unset GIT_DIR GIT_WORK_TREE
+
fail=1
mkdir $tmpdir && cd $tmpdir &&
# without git, skip the test
@@ -36,8 +38,8 @@ mkdir $tmpdir && cd $tmpdir &&
|| { echo "Skipping test: git not found in PATH"; (exit 77); exit 77; }; } &&
mkdir d &&
touch d/a b c &&
- git config user.email "you@example.com"
- git config user.name "Your Name"
+ git config user.email "you@example.com" &&
+ git config user.name "Your Name" &&
git add . > /dev/null &&
git commit -q -a -m log &&
printf '%s\n' b c d/a > expected &&