Tests of module 'unistd' in C++ mode.
authorBruno Haible <bruno@clisp.org>
Mon, 8 Mar 2010 01:57:33 +0000 (02:57 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 8 Mar 2010 02:11:21 +0000 (03:11 +0100)
ChangeLog
m4/unistd_h.m4
modules/unistd-tests
tests/test-unistd-c++.cc [new file with mode: 0644]

index c8c367c..3b5d17f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-03-07  Bruno Haible  <bruno@clisp.org>
 
+       Tests of module 'unistd' in C++ mode.
+       * tests/test-unistd-c++.cc: New file.
+       * modules/unistd-tests (Files): Add it and tests/signature.h.
+       (Depends-on): Add ansi-c++-opt.
+       (Makefile.am): Arrange to compile and run test-unistd-c++.
+       * m4/unistd_h.m4 (gl_UNISTD_MODULE_INDICATOR): Invoke
+       gl_MODULE_INDICATOR.
+
        Tests of module 'time' in C++ mode.
        * tests/test-time-c++.cc: New file.
        * modules/time-tests (Files): Add it and tests/signature.h.
index 31d31c1..f6c35d2 100644 (file)
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 39
+# unistd_h.m4 serial 40
 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -47,6 +47,8 @@ AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
   GNULIB_[]m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./-],[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])=1
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR([$1])
 ])
 
 AC_DEFUN([gl_UNISTD_H_DEFAULTS],
index 486f9e1..6034fd5 100644 (file)
@@ -1,11 +1,20 @@
 Files:
 tests/test-unistd.c
+tests/test-unistd-c++.cc
+tests/signature.h
 
 Depends-on:
 verify
+ansi-c++-opt
 
 configure.ac:
 
 Makefile.am:
 TESTS += test-unistd
 check_PROGRAMS += test-unistd
+if ANSICXX
+TESTS += test-unistd-c++
+check_PROGRAMS += test-unistd-c++
+test_unistd_c___SOURCES = test-unistd-c++.cc
+test_unistd_c___LDADD = $(LDADD) $(LIBINTL) $(LIB_CLOCK_GETTIME)
+endif
diff --git a/tests/test-unistd-c++.cc b/tests/test-unistd-c++.cc
new file mode 100644 (file)
index 0000000..679ba85
--- /dev/null
@@ -0,0 +1,189 @@
+/* Test of <unistd.h> substitute in C++ mode.
+   Copyright (C) 2010 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
+
+#define GNULIB_NAMESPACE gnulib
+#include <config.h>
+
+#include <unistd.h>
+
+#include "signature.h"
+
+
+#if GNULIB_CHOWN
+SIGNATURE_CHECK (GNULIB_NAMESPACE::chown, int, (const char *, uid_t, gid_t));
+#endif
+
+#if GNULIB_CLOSE
+SIGNATURE_CHECK (GNULIB_NAMESPACE::close, int, (int));
+#endif
+
+SIGNATURE_CHECK (GNULIB_NAMESPACE::dup, int, (int));
+
+#if GNULIB_DUP2
+SIGNATURE_CHECK (GNULIB_NAMESPACE::dup2, int, (int, int));
+#endif
+
+#if GNULIB_DUP3
+SIGNATURE_CHECK (GNULIB_NAMESPACE::dup3, int, (int, int, int));
+#endif
+
+#if GNULIB_EUIDACCESS
+SIGNATURE_CHECK (GNULIB_NAMESPACE::euidaccess, int, (const char *, int));
+#endif
+
+#if GNULIB_FACCESSAT
+SIGNATURE_CHECK (GNULIB_NAMESPACE::faccessat, int,
+                 (int, char const *, int, int));
+#endif
+
+#if GNULIB_FCHDIR
+SIGNATURE_CHECK (GNULIB_NAMESPACE::fchdir, int, (int));
+#endif
+
+#if GNULIB_FCHOWNAT
+SIGNATURE_CHECK (GNULIB_NAMESPACE::fchownat, int,
+                 (int, char const *, uid_t, gid_t, int));
+#endif
+
+#if GNULIB_FSYNC
+SIGNATURE_CHECK (GNULIB_NAMESPACE::fsync, int, (int));
+#endif
+
+#if GNULIB_FTRUNCATE
+SIGNATURE_CHECK (GNULIB_NAMESPACE::ftruncate, int, (int, off_t));
+#endif
+
+#if GNULIB_GETCWD
+SIGNATURE_CHECK (GNULIB_NAMESPACE::getcwd, char *, (char *, size_t));
+#endif
+
+#if GNULIB_GETDOMAINNAME
+SIGNATURE_CHECK (GNULIB_NAMESPACE::getdomainname, int, (char *, size_t));
+#endif
+
+#if GNULIB_GETDTABLESIZE
+SIGNATURE_CHECK (GNULIB_NAMESPACE::getdtablesize, int, (void));
+#endif
+
+#if GNULIB_GETGROUPS
+SIGNATURE_CHECK (GNULIB_NAMESPACE::getgroups, int, (int, gid_t *));
+#endif
+
+#if GNULIB_GETHOSTNAME
+SIGNATURE_CHECK (GNULIB_NAMESPACE::gethostname, int, (char *, size_t));
+#endif
+
+#if GNULIB_GETLOGIN
+SIGNATURE_CHECK (GNULIB_NAMESPACE::getlogin, char *, (void));
+#endif
+
+#if GNULIB_GETLOGIN_R
+SIGNATURE_CHECK (GNULIB_NAMESPACE::getlogin_r, int, (char *, size_t));
+#endif
+
+#if GNULIB_GETPAGESIZE
+SIGNATURE_CHECK (GNULIB_NAMESPACE::getpagesize, int, (void));
+#endif
+
+#if GNULIB_GETUSERSHELL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::getusershell, char *, (void));
+#endif
+
+#if GNULIB_GETUSERSHELL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::setusershell, void, (void));
+#endif
+
+#if GNULIB_GETUSERSHELL
+SIGNATURE_CHECK (GNULIB_NAMESPACE::endusershell, void, (void));
+#endif
+
+#if GNULIB_LCHOWN
+SIGNATURE_CHECK (GNULIB_NAMESPACE::lchown, int, (char const *, uid_t, gid_t));
+#endif
+
+#if GNULIB_LINK
+SIGNATURE_CHECK (GNULIB_NAMESPACE::link, int, (const char *, const char *));
+#endif
+
+#if GNULIB_LINKAT
+SIGNATURE_CHECK (GNULIB_NAMESPACE::linkat, int,
+                 (int, const char *, int, const char *, int));
+#endif
+
+#if GNULIB_LSEEK
+SIGNATURE_CHECK (GNULIB_NAMESPACE::lseek, off_t, (int, off_t, int));
+#endif
+
+#if GNULIB_PIPE2
+SIGNATURE_CHECK (GNULIB_NAMESPACE::pipe2, int, (int[2], int));
+#endif
+
+#if GNULIB_PREAD
+SIGNATURE_CHECK (GNULIB_NAMESPACE::pread, ssize_t,
+                 (int, void *, size_t, off_t));
+#endif
+
+#if GNULIB_READLINK
+SIGNATURE_CHECK (GNULIB_NAMESPACE::readlink, ssize_t,
+                 (const char *, char *, size_t));
+#endif
+
+#if GNULIB_READLINKAT
+SIGNATURE_CHECK (GNULIB_NAMESPACE::readlinkat, ssize_t,
+                 (int, char const *, char *, size_t));
+#endif
+
+#if GNULIB_RMDIR
+SIGNATURE_CHECK (GNULIB_NAMESPACE::rmdir, int, (char const *));
+#endif
+
+#if GNULIB_SLEEP
+SIGNATURE_CHECK (GNULIB_NAMESPACE::sleep, unsigned int, (unsigned int));
+#endif
+
+#if GNULIB_SYMLINK
+SIGNATURE_CHECK (GNULIB_NAMESPACE::symlink, int, (char const *, char const *));
+#endif
+
+#if GNULIB_SYMLINKAT
+SIGNATURE_CHECK (GNULIB_NAMESPACE::symlinkat, int,
+                 (char const *, int, char const *));
+#endif
+
+#if GNULIB_UNLINK
+SIGNATURE_CHECK (GNULIB_NAMESPACE::unlink, int, (char const *));
+#endif
+
+#if GNULIB_UNLINKAT
+SIGNATURE_CHECK (GNULIB_NAMESPACE::unlinkat, int, (int, char const *, int));
+#endif
+
+#if GNULIB_USLEEP
+SIGNATURE_CHECK (GNULIB_NAMESPACE::usleep, int, (useconds_t));
+#endif
+
+#if GNULIB_WRITE
+SIGNATURE_CHECK (GNULIB_NAMESPACE::write, ssize_t,
+                 (int, const void *, size_t));
+#endif
+
+
+int
+main ()
+{
+}