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

index a4bda62..204deea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-03-07  Bruno Haible  <bruno@clisp.org>
 
+       Tests of module 'spawn' in C++ mode.
+       * tests/test-spawn-c++.cc: New file.
+       * modules/spawn-tests (Files): Add it and tests/signature.h.
+       (Depends-on): Add ansi-c++-opt.
+       (Makefile.am): Arrange to compile and run test-spawn-c++.
+       * m4/spawn_h.m4 (gl_SPAWN_MODULE_INDICATOR): Invoke
+       gl_MODULE_INDICATOR.
+
        Tests of module 'signal' in C++ mode.
        * tests/test-signal-c++.cc: New file.
        * modules/signal-tests (Files): Add it and tests/signature.h.
index a9bd161..fb789f0 100644 (file)
@@ -1,4 +1,4 @@
-# spawn_h.m4 serial 6
+# spawn_h.m4 serial 7
 dnl Copyright (C) 2008-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,
@@ -62,6 +62,8 @@ AC_DEFUN([gl_SPAWN_MODULE_INDICATOR],
   dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
   AC_REQUIRE([gl_SPAWN_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_SPAWN_H_DEFAULTS],
index c576fdd..f416226 100644 (file)
@@ -1,10 +1,19 @@
 Files:
 tests/test-spawn.c
+tests/test-spawn-c++.cc
+tests/signature.h
 
 Depends-on:
+ansi-c++-opt
 
 configure.ac:
 
 Makefile.am:
 TESTS += test-spawn
 check_PROGRAMS += test-spawn
+if ANSICXX
+TESTS += test-spawn-c++
+check_PROGRAMS += test-spawn-c++
+test_spawn_c___SOURCES = test-spawn-c++.cc
+test_spawn_c___LDADD = $(LDADD) $(LIBINTL)
+endif
diff --git a/tests/test-spawn-c++.cc b/tests/test-spawn-c++.cc
new file mode 100644 (file)
index 0000000..11d4766
--- /dev/null
@@ -0,0 +1,139 @@
+/* Test of <spawn.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 <spawn.h>
+
+#include "signature.h"
+
+
+#if GNULIB_POSIX_SPAWN
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawn, int,
+                 (pid_t *, const char *, const posix_spawn_file_actions_t *,
+                  const posix_spawnattr_t *, char *const[], char *const[]));
+#endif
+
+#if GNULIB_POSIX_SPAWNP
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnp, int,
+                 (pid_t *, const char *, const posix_spawn_file_actions_t *,
+                  const posix_spawnattr_t *, char *const[], char *const[]));
+#endif
+
+#if GNULIB_POSIX_SPAWNATTR_INIT
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnattr_init, int,
+                 (posix_spawnattr_t *));
+#endif
+
+#if GNULIB_POSIX_SPAWNATTR_DESTROY
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnattr_destroy, int,
+                 (posix_spawnattr_t *));
+#endif
+
+#if GNULIB_POSIX_SPAWNATTR_GETSIGDEFAULT
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnattr_getsigdefault, int,
+                 (const posix_spawnattr_t *, sigset_t *));
+#endif
+
+#if GNULIB_POSIX_SPAWNATTR_SETSIGDEFAULT
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnattr_setsigdefault, int,
+                 (posix_spawnattr_t *, const sigset_t *));
+#endif
+
+#if GNULIB_POSIX_SPAWNATTR_GETSIGMASK
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnattr_getsigmask, int,
+                 (const posix_spawnattr_t *, sigset_t *));
+#endif
+
+#if GNULIB_POSIX_SPAWNATTR_SETSIGMASK
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnattr_setsigmask, int,
+                 (posix_spawnattr_t *, const sigset_t *));
+#endif
+
+#if GNULIB_POSIX_SPAWNATTR_GETFLAGS
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnattr_getflags, int,
+                 (const posix_spawnattr_t *, short int *));
+#endif
+
+#if GNULIB_POSIX_SPAWNATTR_SETFLAGS
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnattr_setflags, int,
+                 (posix_spawnattr_t *, short int));
+#endif
+
+#if GNULIB_POSIX_SPAWNATTR_GETPGROUP
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnattr_getpgroup, int,
+                 (const posix_spawnattr_t *, pid_t *));
+#endif
+
+#if GNULIB_POSIX_SPAWNATTR_SETPGROUP
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnattr_setpgroup, int,
+                 (posix_spawnattr_t *, pid_t));
+#endif
+
+#if GNULIB_POSIX_SPAWNATTR_GETSCHEDPOLICY
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnattr_getschedpolicy, int,
+                 (const posix_spawnattr_t *, int *));
+#endif
+
+#if GNULIB_POSIX_SPAWNATTR_SETSCHEDPOLICY
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnattr_setschedpolicy, int,
+                 (posix_spawnattr_t *, int));
+#endif
+
+#if GNULIB_POSIX_SPAWNATTR_GETSCHEDPARAM
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnattr_getschedparam, int,
+                 (const posix_spawnattr_t *, struct sched_param *));
+#endif
+
+#if GNULIB_POSIX_SPAWNATTR_SETSCHEDPARAM
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawnattr_setschedparam, int,
+                 (posix_spawnattr_t *, const struct sched_param *));
+#endif
+
+#if GNULIB_POSIX_SPAWN_FILE_ACTIONS_INIT
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawn_file_actions_init, int,
+                 (posix_spawn_file_actions_t *));
+#endif
+
+#if GNULIB_POSIX_SPAWN_FILE_ACTIONS_DESTROY
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawn_file_actions_destroy, int,
+                 (posix_spawn_file_actions_t *));
+#endif
+
+#if GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDOPEN
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawn_file_actions_addopen, int,
+                 (posix_spawn_file_actions_t *, int, const char *, int,
+                  mode_t));
+#endif
+
+#if GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDCLOSE
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawn_file_actions_addclose, int,
+                 (posix_spawn_file_actions_t *, int));
+#endif
+
+#if GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDDUP2
+SIGNATURE_CHECK (GNULIB_NAMESPACE::posix_spawn_file_actions_adddup2, int,
+                 (posix_spawn_file_actions_t *, int, int));
+#endif
+
+
+int
+main ()
+{
+}