diff options
Diffstat (limited to 'gl/tests')
66 files changed, 549 insertions, 2333 deletions
diff --git a/gl/tests/.gitignore b/gl/tests/.gitignore new file mode 100644 index 0000000000..fd28609a7e --- /dev/null +++ b/gl/tests/.gitignore @@ -0,0 +1,22 @@ +/intprops.h +/test-byteswap.c +/test-func.c +/test-hmac-md5.c +/test-md5.c +/test-strings.c +/test-strverscmp.c +/test-vasprintf.c +/test-vsnprintf.c +/test-netinet_in.c +/test-fseeko.c +/test-fseeko.sh +/test-fseeko2.sh +/test-getdelim.c +/test-getline.c +/test-u64.c +/test-version-etc.c +/test-version-etc.sh +/version-etc-fsf.c +/dummy.c +/test-gettimeofday.c +/test-sys_time.c diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am index acfc33e34c..3b5778b79b 100644 --- a/gl/tests/Makefile.am +++ b/gl/tests/Makefile.am @@ -1,6 +1,6 @@ ## DO NOT EDIT! GENERATED AUTOMATICALLY! ## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2010 Free Software Foundation, Inc. +# Copyright (C) 2002-2011 Free Software Foundation, Inc. # # This file is free software, distributed under the terms of the GNU # General Public License. As a special exception to the GNU General @@ -46,15 +46,6 @@ AM_LIBTOOLFLAGS = --preserve-dup-deps TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' -## begin gnulib module alignof-tests - -TESTS += test-alignof -check_PROGRAMS += test-alignof - -EXTRA_DIST += test-alignof.c - -## end gnulib module alignof-tests - ## begin gnulib module alloca-opt-tests TESTS += test-alloca-opt @@ -88,14 +79,6 @@ EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h ## end gnulib module arg-nonnull -## begin gnulib module arpa_inet-tests - -TESTS += test-arpa_inet -check_PROGRAMS += test-arpa_inet -EXTRA_DIST += test-arpa_inet.c - -## end gnulib module arpa_inet-tests - ## begin gnulib module binary-io libtests_a_SOURCES += binary-io.h @@ -111,6 +94,14 @@ EXTRA_DIST += test-binary-io.sh test-binary-io.c macros.h ## end gnulib module binary-io-tests +## begin gnulib module byteswap-tests + +TESTS += test-byteswap +check_PROGRAMS += test-byteswap +EXTRA_DIST += test-byteswap.c macros.h + +## end gnulib module byteswap-tests + ## begin gnulib module c++defs # The BUILT_SOURCES created by this Makefile snippet are not used via #include @@ -144,6 +135,22 @@ EXTRA_DIST += test-c-ctype.c macros.h ## end gnulib module c-ctype-tests +## begin gnulib module crypto/hmac-md5-tests + +TESTS += test-hmac-md5 +check_PROGRAMS += test-hmac-md5 +EXTRA_DIST += test-hmac-md5.c + +## end gnulib module crypto/hmac-md5-tests + +## begin gnulib module crypto/md5-tests + +TESTS += test-md5 +check_PROGRAMS += test-md5 +EXTRA_DIST += test-md5.c + +## end gnulib module crypto/md5-tests + ## begin gnulib module errno-tests TESTS += test-errno @@ -153,6 +160,47 @@ EXTRA_DIST += test-errno.c ## end gnulib module errno-tests +## begin gnulib module fcntl-h + +BUILT_SOURCES += fcntl.h + +# We need the following in order to create <fcntl.h> when the system +# doesn't have one that works with the given compiler. +fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ + -e 's|@''GNULIB_FCNTL''@|$(GNULIB_FCNTL)|g' \ + -e 's|@''GNULIB_OPEN''@|$(GNULIB_OPEN)|g' \ + -e 's|@''GNULIB_OPENAT''@|$(GNULIB_OPENAT)|g' \ + -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ + -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ + -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ + -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ + -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/fcntl.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += fcntl.h fcntl.h-t + +EXTRA_DIST += fcntl.in.h + +## end gnulib module fcntl-h + +## begin gnulib module fcntl-h-tests + +TESTS += test-fcntl-h +check_PROGRAMS += test-fcntl-h +EXTRA_DIST += test-fcntl-h.c + +## end gnulib module fcntl-h-tests + ## begin gnulib module fseeko-tests TESTS += test-fseeko.sh test-fseeko2.sh @@ -170,14 +218,13 @@ EXTRA_DIST += test-ftello.c test-ftello.sh test-ftello2.sh test-ftello3.c signat ## end gnulib module ftello-tests -## begin gnulib module getaddrinfo-tests +## begin gnulib module func-tests -TESTS += test-getaddrinfo -check_PROGRAMS += test-getaddrinfo -test_getaddrinfo_LDADD = $(LDADD) @GETADDRINFO_LIB@ @LIBINTL@ -EXTRA_DIST += signature.h test-getaddrinfo.c +TESTS += test-func +check_PROGRAMS += test-func +EXTRA_DIST += test-func.c macros.h -## end gnulib module getaddrinfo-tests +## end gnulib module func-tests ## begin gnulib module getdelim-tests @@ -215,40 +262,12 @@ EXTRA_DIST += signature.h test-gettimeofday.c ## end gnulib module gettimeofday-tests -## begin gnulib module inet_ntop-tests - -TESTS += test-inet_ntop -check_PROGRAMS += test-inet_ntop -test_inet_ntop_LDADD = $(LDADD) @INET_NTOP_LIB@ -EXTRA_DIST += test-inet_ntop.c signature.h macros.h - -## end gnulib module inet_ntop-tests - -## begin gnulib module inet_pton-tests - -TESTS += test-inet_pton -check_PROGRAMS += test-inet_pton -test_inet_pton_LDADD = $(LDADD) @INET_PTON_LIB@ -EXTRA_DIST += test-inet_pton.c signature.h macros.h - -## end gnulib module inet_pton-tests - -## begin gnulib module ioctl +## begin gnulib module intprops -EXTRA_DIST += ioctl.c w32sock.h +EXTRA_DIST += intprops.h -EXTRA_libtests_a_SOURCES += ioctl.c - -## end gnulib module ioctl - -## begin gnulib module lseek-tests - -TESTS += test-lseek.sh -check_PROGRAMS += test-lseek -EXTRA_DIST += test-lseek.c test-lseek.sh signature.h macros.h - -## end gnulib module lseek-tests +## end gnulib module intprops ## begin gnulib module memchr-tests @@ -274,14 +293,6 @@ EXTRA_DIST += test-netinet_in.c ## end gnulib module netinet_in-tests -## begin gnulib module perror-tests - -TESTS += test-perror.sh -check_PROGRAMS += test-perror -EXTRA_DIST += signature.h test-perror.c test-perror.sh - -## end gnulib module perror-tests - ## begin gnulib module read-file-tests TESTS += test-read-file @@ -290,18 +301,6 @@ EXTRA_DIST += test-read-file.c ## end gnulib module read-file-tests -## begin gnulib module select-tests - -TESTS += test-select test-select-in.sh test-select-out.sh -# test-select-stdin has to be run by hand. -check_PROGRAMS += test-select test-select-fd test-select-stdin -test_select_LDADD = $(LDADD) @LIBSOCKET@ $(INET_PTON_LIB) -test_select_fd_LDADD = $(LDADD) @LIBSOCKET@ -test_select_stdin_LDADD = $(LDADD) @LIBSOCKET@ -EXTRA_DIST += macros.h signature.h test-select.c test-select-fd.c test-select-in.sh test-select-out.sh test-select-stdin.c - -## end gnulib module select-tests - ## begin gnulib module snprintf-tests TESTS += test-snprintf @@ -360,14 +359,6 @@ EXTRA_DIST += test-stdlib.c test-sys_wait.h ## end gnulib module stdlib-tests -## begin gnulib module strerror-tests - -TESTS += test-strerror -check_PROGRAMS += test-strerror -EXTRA_DIST += test-strerror.c signature.h macros.h - -## end gnulib module strerror-tests - ## begin gnulib module string-tests TESTS += test-string @@ -376,52 +367,21 @@ EXTRA_DIST += test-string.c ## end gnulib module string-tests -## begin gnulib module sys_ioctl +## begin gnulib module strings-tests -BUILT_SOURCES += sys/ioctl.h +TESTS += test-strings +check_PROGRAMS += test-strings +EXTRA_DIST += test-strings.c -# 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 $(CXXDEFS_H) $(WARN_ON_USE_H) - $(AM_V_at)$(MKDIR_P) sys - $(AM_V_GEN)rm -f $@-t $@ && \ - { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ - sed -e 's|@''HAVE_SYS_IOCTL_H''@|$(HAVE_SYS_IOCTL_H)|g' \ - -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ - -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ - -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ - -e 's|@''NEXT_SYS_IOCTL_H''@|$(NEXT_SYS_IOCTL_H)|g' \ - -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 && \ - mv $@-t $@ -MOSTLYCLEANFILES += sys/ioctl.h sys/ioctl.h-t -MOSTLYCLEANDIRS += sys - -EXTRA_DIST += sys_ioctl.in.h - -## end gnulib module sys_ioctl - -## begin gnulib module sys_ioctl-tests +## end gnulib module strings-tests -TESTS += test-sys_ioctl -check_PROGRAMS += test-sys_ioctl -EXTRA_DIST += test-sys_ioctl.c +## begin gnulib module strverscmp-tests -## end gnulib module sys_ioctl-tests +TESTS += test-strverscmp +check_PROGRAMS += test-strverscmp +EXTRA_DIST += test-strverscmp.c signature.h macros.h -## begin gnulib module sys_select-tests - -TESTS += test-sys_select -check_PROGRAMS += test-sys_select -EXTRA_DIST += test-sys_select.c - -## end gnulib module sys_select-tests +## end gnulib module strverscmp-tests ## begin gnulib module sys_socket-tests @@ -455,6 +415,14 @@ EXTRA_DIST += test-time.c ## end gnulib module time-tests +## begin gnulib module u64-tests + +TESTS += test-u64 +check_PROGRAMS += test-u64 +EXTRA_DIST += test-u64.c + +## end gnulib module u64-tests + ## begin gnulib module unistd-tests TESTS += test-unistd @@ -463,14 +431,6 @@ EXTRA_DIST += test-unistd.c ## end gnulib module unistd-tests -## begin gnulib module update-copyright-tests - -TESTS += test-update-copyright.sh -TESTS_ENVIRONMENT += abs_aux_dir='$(abs_aux_dir)' -EXTRA_DIST += test-update-copyright.sh - -## end gnulib module update-copyright-tests - ## begin gnulib module vasnprintf-tests TESTS += test-vasnprintf @@ -480,14 +440,14 @@ EXTRA_DIST += test-vasnprintf.c macros.h ## end gnulib module vasnprintf-tests -## begin gnulib module vc-list-files-tests +## begin gnulib module vasprintf-tests + +TESTS += test-vasprintf +check_PROGRAMS += test-vasprintf -TESTS += test-vc-list-files-git.sh -TESTS += test-vc-list-files-cvs.sh -TESTS_ENVIRONMENT += abs_aux_dir='$(abs_aux_dir)' -EXTRA_DIST += test-vc-list-files-git.sh test-vc-list-files-cvs.sh init.sh +EXTRA_DIST += test-vasprintf.c signature.h macros.h -## end gnulib module vc-list-files-tests +## end gnulib module vasprintf-tests ## begin gnulib module verify-tests @@ -507,6 +467,15 @@ EXTRA_DIST += test-version-etc.c test-version-etc.sh ## end gnulib module version-etc-tests +## begin gnulib module vsnprintf-tests + +TESTS += test-vsnprintf +check_PROGRAMS += test-vsnprintf + +EXTRA_DIST += test-vsnprintf.c signature.h macros.h + +## end gnulib module vsnprintf-tests + ## begin gnulib module warn-on-use BUILT_SOURCES += warn-on-use.h diff --git a/gl/tests/binary-io.h b/gl/tests/binary-io.h index 5451fd48f4..c09dbf5799 100644 --- a/gl/tests/binary-io.h +++ b/gl/tests/binary-io.h @@ -1,6 +1,5 @@ /* Binary mode I/O. - Copyright (C) 2001, 2003, 2005, 2008, 2009, 2010 Free Software Foundation, - Inc. + Copyright (C) 2001, 2003, 2005, 2008-2011 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 @@ -19,24 +18,13 @@ #define _BINARY_H /* For systems that distinguish between text and binary I/O. - O_BINARY is usually declared in <fcntl.h>. */ + O_BINARY is guaranteed by the gnulib <fcntl.h>. */ #include <fcntl.h> /* The MSVC7 <stdio.h> doesn't like to be included after '#define fileno ...', so we include it here first. */ #include <stdio.h> -#if !defined O_BINARY && defined _O_BINARY - /* For MSC-compatible compilers. */ -# define O_BINARY _O_BINARY -# define O_TEXT _O_TEXT -#endif -#if defined __BEOS__ || defined __HAIKU__ - /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */ -# undef O_BINARY -# undef O_TEXT -#endif - /* SET_BINARY (fd); changes the file descriptor fd to perform binary I/O. */ #if O_BINARY @@ -58,8 +46,6 @@ # endif #else /* On reasonable systems, binary I/O is the default. */ -# undef O_BINARY -# define O_BINARY 0 # define SET_BINARY(fd) /* do nothing */ ((void) 0) #endif diff --git a/gl/tests/dummy.c b/gl/tests/dummy.c index 0f9a277962..c958ea05d8 100644 --- a/gl/tests/dummy.c +++ b/gl/tests/dummy.c @@ -1,5 +1,5 @@ /* A dummy file, to prevent empty libraries from breaking builds. - Copyright (C) 2004, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2004, 2007, 2009-2011 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 diff --git a/gl/tests/fcntl.in.h b/gl/tests/fcntl.in.h new file mode 100644 index 0000000000..18cac454ab --- /dev/null +++ b/gl/tests/fcntl.in.h @@ -0,0 +1,308 @@ +/* Like <fcntl.h>, but with non-working flags defined to 0. + + Copyright (C) 2006-2011 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 Paul Eggert */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined __need_system_fcntl_h +/* Special invocation convention. */ + +#include <sys/types.h> +/* On some systems other than glibc, <sys/stat.h> is a prerequisite of + <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. + But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an + extern "C" { ... } block, which leads to errors in C++ mode with the + overridden <sys/stat.h> from gnulib. These errors are known to be gone + with g++ version >= 4.3. */ +#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) +# include <sys/stat.h> +#endif +#@INCLUDE_NEXT@ @NEXT_FCNTL_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _GL_FCNTL_H + +#include <sys/types.h> +/* On some systems other than glibc, <sys/stat.h> is a prerequisite of + <fcntl.h>. On glibc systems, we would like to avoid namespace pollution. + But on glibc systems, <fcntl.h> includes <sys/stat.h> inside an + extern "C" { ... } block, which leads to errors in C++ mode with the + overridden <sys/stat.h> from gnulib. These errors are known to be gone + with g++ version >= 4.3. */ +#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) +# include <sys/stat.h> +#endif +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_FCNTL_H@ + +#ifndef _GL_FCNTL_H +#define _GL_FCNTL_H + +#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */ +# include <unistd.h> +#endif + + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + +/* Declare overridden functions. */ + +#if @GNULIB_FCNTL@ +# if @REPLACE_FCNTL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fcntl +# define fcntl rpl_fcntl +# endif +_GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...)); +_GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...)); +# else +# if !@HAVE_FCNTL@ +_GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...)); +# endif +_GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...)); +# endif +_GL_CXXALIASWARN (fcntl); +#elif defined GNULIB_POSIXCHECK +# undef fcntl +# if HAVE_RAW_DECL_FCNTL +_GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - " + "use gnulib module fcntl for portability"); +# endif +#endif + +#if @GNULIB_OPEN@ +# if @REPLACE_OPEN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef open +# define open rpl_open +# endif +_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); +# else +_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); +# endif +/* On HP-UX 11, in C++ mode, open() is defined as an inline function with a + default argument. _GL_CXXALIASWARN does not work in this case. */ +# if !defined __hpux +_GL_CXXALIASWARN (open); +# endif +#elif defined GNULIB_POSIXCHECK +# undef open +/* Assume open is always declared. */ +_GL_WARN_ON_USE (open, "open is not always POSIX compliant - " + "use gnulib module open for portability"); +#endif + +#if @GNULIB_OPENAT@ +# if @REPLACE_OPENAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef openat +# define openat rpl_openat +# endif +_GL_FUNCDECL_RPL (openat, int, + (int fd, char const *file, int flags, /* mode_t mode */ ...) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (openat, int, + (int fd, char const *file, int flags, /* mode_t mode */ ...)); +# else +# if !@HAVE_OPENAT@ +_GL_FUNCDECL_SYS (openat, int, + (int fd, char const *file, int flags, /* mode_t mode */ ...) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (openat, int, + (int fd, char const *file, int flags, /* mode_t mode */ ...)); +# endif +_GL_CXXALIASWARN (openat); +#elif defined GNULIB_POSIXCHECK +# undef openat +# if HAVE_RAW_DECL_OPENAT +_GL_WARN_ON_USE (openat, "openat is not portable - " + "use gnulib module openat for portability"); +# endif +#endif + + +/* Fix up the FD_* macros, only known to be missing on mingw. */ + +#ifndef FD_CLOEXEC +# define FD_CLOEXEC 1 +#endif + +/* Fix up the supported F_* macros. Intentionally leave other F_* + macros undefined. Only known to be missing on mingw. */ + +#ifndef F_DUPFD_CLOEXEC +# define F_DUPFD_CLOEXEC 0x40000000 +/* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise. */ +# define GNULIB_defined_F_DUPFD_CLOEXEC 1 +#else +# define GNULIB_defined_F_DUPFD_CLOEXEC 0 +#endif + +#ifndef F_DUPFD +# define F_DUPFD 1 +#endif + +#ifndef F_GETFD +# define F_GETFD 2 +#endif + +/* Fix up the O_* macros. */ + +#if !defined O_DIRECT && defined O_DIRECTIO +/* Tru64 spells it `O_DIRECTIO'. */ +# define O_DIRECT O_DIRECTIO +#endif + +#if !defined O_CLOEXEC && defined O_NOINHERIT +/* Mingw spells it `O_NOINHERIT'. Intentionally leave it + undefined if not available. */ +# define O_CLOEXEC O_NOINHERIT +#endif + +#ifndef O_CLOEXEC +# define O_CLOEXEC 0 +#endif + +#ifndef O_DIRECT +# define O_DIRECT 0 +#endif + +#ifndef O_DIRECTORY +# define O_DIRECTORY 0 +#endif + +#ifndef O_DSYNC +# define O_DSYNC 0 +#endif + +#ifndef O_EXEC +# define O_EXEC O_RDONLY /* This is often close enough in older systems. */ +#endif + +#ifndef O_NDELAY +# define O_NDELAY 0 +#endif + +#ifndef O_NOATIME +# define O_NOATIME 0 +#endif + +#ifndef O_NONBLOCK +# define O_NONBLOCK O_NDELAY +#endif + +#ifndef O_NOCTTY +# define O_NOCTTY 0 +#endif + +#ifndef O_NOFOLLOW +# define O_NOFOLLOW 0 +#endif + +#ifndef O_NOLINKS +# define O_NOLINKS 0 +#endif + +#ifndef O_RSYNC +# define O_RSYNC 0 +#endif + +#ifndef O_SEARCH +# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */ +#endif + +#ifndef O_SYNC +# define O_SYNC 0 +#endif + +#ifndef O_TTY_INIT +# define O_TTY_INIT 0 +#endif + +/* For systems that distinguish between text and binary I/O. + O_BINARY is usually declared in fcntl.h */ +#if !defined O_BINARY && defined _O_BINARY + /* For MSC-compatible compilers. */ +# define O_BINARY _O_BINARY +# define O_TEXT _O_TEXT +#endif + +#if defined __BEOS__ || defined __HAIKU__ + /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */ +# undef O_BINARY +# undef O_TEXT +#endif + +#ifndef O_BINARY +# define O_BINARY 0 +# define O_TEXT 0 +#endif + +/* Fix up the AT_* macros. */ + +/* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its + value exceeds INT_MAX, so its use as an int doesn't conform to the + C standard, and GCC and Sun C complain in some cases. If the bug + is present, undef AT_FDCWD here, so it can be redefined below. */ +#if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553 +# undef AT_FDCWD +#endif + +/* Use the same bit pattern as Solaris 9, but with the proper + signedness. The bit pattern is important, in case this actually is + Solaris with the above workaround. */ +#ifndef AT_FDCWD +# define AT_FDCWD (-3041965) +#endif + +/* Use the same values as Solaris 9. This shouldn't matter, but + there's no real reason to differ. */ +#ifndef AT_SYMLINK_NOFOLLOW +# define AT_SYMLINK_NOFOLLOW 4096 +#endif + +#ifndef AT_REMOVEDIR +# define AT_REMOVEDIR 1 +#endif + +/* Solaris 9 lacks these two, so just pick unique values. */ +#ifndef AT_SYMLINK_FOLLOW +# define AT_SYMLINK_FOLLOW 2 +#endif + +#ifndef AT_EACCESS +# define AT_EACCESS 4 +#endif + + +#endif /* _GL_FCNTL_H */ +#endif /* _GL_FCNTL_H */ +#endif diff --git a/gl/tests/getpagesize.c b/gl/tests/getpagesize.c index cc2526870f..d7c1ba807a 100644 --- a/gl/tests/getpagesize.c +++ b/gl/tests/getpagesize.c @@ -1,6 +1,6 @@ /* getpagesize emulation for systems where it cannot be done in a C macro. - Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 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 diff --git a/gl/tests/init.sh b/gl/tests/init.sh index 14f3b198d4..71c6516962 100644 --- a/gl/tests/init.sh +++ b/gl/tests/init.sh @@ -1,6 +1,6 @@ # source this file; set up for tests -# Copyright (C) 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 2009-2011 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 @@ -74,10 +74,10 @@ Exit () { set +e; (exit $1); exit $1; } # the reason for skip/failure to console, rather than to the .log files. : ${stderr_fileno_=2} -warn_() { echo "$@" 1>&$stderr_fileno_; } -fail_() { warn_ "$ME_: failed test: $@"; Exit 1; } -skip_() { warn_ "$ME_: skipped test: $@"; Exit 77; } -framework_failure_() { warn_ "$ME_: set-up failure: $@"; Exit 99; } +warn_ () { echo "$@" 1>&$stderr_fileno_; } +fail_ () { warn_ "$ME_: failed test: $@"; Exit 1; } +skip_ () { warn_ "$ME_: skipped test: $@"; Exit 77; } +framework_failure_ () { warn_ "$ME_: set-up failure: $@"; Exit 99; } # Sanitize this shell to POSIX mode, if possible. DUALCASE=1; export DUALCASE @@ -111,7 +111,7 @@ fi # Eval this code in a subshell to determine a shell's suitability. # 10 - passes all tests; ok to use -# 9 - ok, but enabling "set -x" corrupts application stderr; prefer higher score +# 9 - ok, but enabling "set -x" corrupts app stderr; prefer higher score # ? - not ok gl_shell_test_script_=' test $(echo y) = y || exit 1 @@ -193,7 +193,7 @@ fi test -n "$EXEEXT" && shopt -s expand_aliases # Enable glibc's malloc-perturbing option. -# This is cheap and useful for exposing code that depends on the fact that +# This is useful for exposing code that depends on the fact that # malloc-related functions often return memory that is mostly zeroed. # If you have the time and cycles, use valgrind to do an even better job. : ${MALLOC_PERTURB_=87} @@ -202,22 +202,22 @@ export MALLOC_PERTURB_ # This is a stub function that is run upon trap (upon regular exit and # interrupt). Override it with a per-test function, e.g., to unmount # a partition, or to undo any other global state changes. -cleanup_() { :; } +cleanup_ () { :; } if ( diff --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then - compare() { diff -u "$@"; } + compare () { diff -u "$@"; } elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then - compare() { cmp -s "$@"; } + compare () { cmp -s "$@"; } else - compare() { cmp "$@"; } + compare () { cmp "$@"; } fi # An arbitrary prefix to help distinguish test directories. -testdir_prefix_() { printf gt; } +testdir_prefix_ () { printf gt; } # Run the user-overridable cleanup_ function, remove the temporary # directory and exit with the incoming value of $?. -remove_tmp_() +remove_tmp_ () { __st=$? cleanup_ @@ -233,7 +233,7 @@ remove_tmp_() # contains only the specified bytes (see the case stmt below), then print # a space-separated list of those names and return 0. Otherwise, don't # print anything and return 1. Naming constraints apply also to DIR. -find_exe_basenames_() +find_exe_basenames_ () { feb_dir_=$1 feb_fail_=0 @@ -245,6 +245,9 @@ find_exe_basenames_() # below, just skip it. test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \ && continue + # Exempt [.exe, since we can't create a function by that name, yet + # we can't invoke [ by PATH search anyways due to shell builtins. + test "x$feb_file_" = "x$feb_dir_/[.exe" && continue case $feb_file_ in *[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;; *) # Remove leading file name components as well as the .exe suffix. @@ -263,7 +266,7 @@ find_exe_basenames_() # PROG that simply invokes PROG.exe, then return 0. If any selected # file name or the directory name, $1, contains an unexpected character, # define no alias and return 1. -create_exe_shims_() +create_exe_shims_ () { case $EXEEXT in '') return 0 ;; @@ -272,7 +275,7 @@ create_exe_shims_() esac base_names_=`find_exe_basenames_ $1` \ - || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 1; } + || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 0; } if test -n "$base_names_"; then for base_ in $base_names_; do @@ -285,7 +288,7 @@ create_exe_shims_() # Use this function to prepend to PATH an absolute name for each # specified, possibly-$initial_cwd_-relative, directory. -path_prepend_() +path_prepend_ () { while test $# != 0; do path_dir_=$1 @@ -308,7 +311,7 @@ path_prepend_() export PATH } -setup_() +setup_ () { if test "$VERBOSE" = yes; then # Test whether set -x may cause the selected shell to corrupt an @@ -324,6 +327,7 @@ setup_() fi initial_cwd_=$PWD + fail=0 pfx_=`testdir_prefix_` test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \ @@ -360,7 +364,7 @@ setup_() # - make only $MAX_TRIES_ attempts # Helper function. Print $N pseudo-random bytes from a-zA-Z0-9. -rand_bytes_() +rand_bytes_ () { n_=$1 @@ -392,7 +396,7 @@ rand_bytes_() | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ } -mktempd_() +mktempd_ () { case $# in 2);; @@ -413,11 +417,10 @@ mktempd_() case $template_ in *XXXX) ;; - *) fail_ "invalid template: $template_ (must have a suffix of at least 4 X's)";; + *) fail_ \ + "invalid template: $template_ (must have a suffix of at least 4 X's)";; esac - fail=0 - # First, try to use mktemp. d=`unset TMPDIR; mktemp -d -t -p "$destdir_" "$template_" 2>/dev/null` \ || fail=1 diff --git a/gl/tests/ioctl.c b/gl/tests/ioctl.c deleted file mode 100644 index 91eb3be1b9..0000000000 --- a/gl/tests/ioctl.c +++ /dev/null @@ -1,72 +0,0 @@ -/* ioctl.c --- wrappers for Windows ioctl function - - Copyright (C) 2008, 2009, 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 Paolo Bonzini */ - -#include <config.h> - -#include <sys/ioctl.h> - -#include <stdarg.h> - -#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> - -/* Get set_winsock_errno, FD_TO_SOCKET etc. */ -# include "w32sock.h" - -int -ioctl (int fd, int req, ...) -{ - void *buf; - va_list args; - SOCKET sock; - int r; - - va_start (args, req); - buf = va_arg (args, void *); - va_end (args); - - sock = FD_TO_SOCKET (fd); - r = ioctlsocket (sock, req, buf); - if (r < 0) - set_winsock_errno (); - - return r; -} - -#endif diff --git a/gl/tests/macros.h b/gl/tests/macros.h index 11db5a8af0..89226758ec 100644 --- a/gl/tests/macros.h +++ b/gl/tests/macros.h @@ -1,5 +1,5 @@ /* Common macros used by gnulib tests. - Copyright (C) 2006-2010 Free Software Foundation, Inc. + Copyright (C) 2006-2011 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 diff --git a/gl/tests/signature.h b/gl/tests/signature.h index 6e15c43a2a..8256989d0e 100644 --- a/gl/tests/signature.h +++ b/gl/tests/signature.h @@ -1,5 +1,5 @@ /* Macro for checking that a function declaration is compliant. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 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 diff --git a/gl/tests/sys_ioctl.in.h b/gl/tests/sys_ioctl.in.h deleted file mode 100644 index 871b676981..0000000000 --- a/gl/tests/sys_ioctl.in.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Substitute for and wrapper around <sys/ioctl.h>. - Copyright (C) 2008-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, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef _GL_SYS_IOCTL_H - -#if __GNUC__ >= 3 -@PRAGMA_SYSTEM_HEADER@ -#endif -@PRAGMA_COLUMNS@ - -/* The include_next requires a split double-inclusion guard. */ -#if @HAVE_SYS_IOCTL_H@ -# @INCLUDE_NEXT@ @NEXT_SYS_IOCTL_H@ -#endif - -#ifndef _GL_SYS_IOCTL_H -#define _GL_SYS_IOCTL_H - -/* AIX 5.1 and Solaris 10 declare ioctl() in <unistd.h> and in <stropts.h>, - but not in <sys/ioctl.h>. - But avoid namespace pollution on glibc systems. */ -#ifndef __GLIBC__ -# 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. */ - -#if @GNULIB_IOCTL@ -# if @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 -# if @SYS_IOCTL_H_HAVE_WINSOCK2_H@ || 1 -_GL_FUNCDECL_SYS (ioctl, int, - (int fd, int request, ... /* {void *,char *} arg */)); -# endif -_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 -#elif defined GNULIB_POSIXCHECK -# undef ioctl -# if HAVE_RAW_DECL_IOCTL -_GL_WARN_ON_USE (ioctl, "ioctl does not portably work on sockets - " - "use gnulib module ioctl for portability"); -# endif -#endif - - -#endif /* _GL_SYS_IOCTL_H */ -#endif /* _GL_SYS_IOCTL_H */ diff --git a/gl/tests/test-alignof.c b/gl/tests/test-alignof.c deleted file mode 100644 index a8b6d18996..0000000000 --- a/gl/tests/test-alignof.c +++ /dev/null @@ -1,59 +0,0 @@ -/* Test of <alignof.h>. - Copyright (C) 2009, 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>, 2009. */ - -#include <config.h> - -#include <alignof.h> - -#include <stddef.h> -#include <stdint.h> - -#include "verify.h" - -typedef long double longdouble; -typedef struct { char a[1]; } struct1; -typedef struct { char a[2]; } struct2; -typedef struct { char a[3]; } struct3; -typedef struct { char a[4]; } struct4; - -#define CHECK(type) \ - typedef struct { char slot1; type slot2; } type##_helper; \ - verify (alignof_slot (type) == offsetof (type##_helper, slot2)); \ - const int type##_slot_alignment = alignof_slot (type); \ - const int type##_type_alignment = alignof_type (type); - -CHECK (char) -CHECK (short) -CHECK (int) -CHECK (long) -CHECK (float) -CHECK (double) -CHECK (longdouble) -#ifdef INT64_MAX -CHECK (int64_t) -#endif -CHECK (struct1) -CHECK (struct2) -CHECK (struct3) -CHECK (struct4) - -int -main () -{ - return 0; -} diff --git a/gl/tests/test-alloca-opt.c b/gl/tests/test-alloca-opt.c index cfbecafcb9..5aa16455d0 100644 --- a/gl/tests/test-alloca-opt.c +++ b/gl/tests/test-alloca-opt.c @@ -1,5 +1,5 @@ /* Test of optional automatic memory allocation. - Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2009-2011 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 diff --git a/gl/tests/test-arpa_inet.c b/gl/tests/test-arpa_inet.c deleted file mode 100644 index 262686ac47..0000000000 --- a/gl/tests/test-arpa_inet.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test of <arpa/inet.h> substitute. - Copyright (C) 2007, 2009, 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>, 2007. */ - -#include <config.h> - -#include <arpa/inet.h> - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-binary-io.c b/gl/tests/test-binary-io.c index 125150b21f..8e5d193f69 100644 --- a/gl/tests/test-binary-io.c +++ b/gl/tests/test-binary-io.c @@ -1,5 +1,5 @@ /* Test of binary mode I/O. - Copyright (C) 2005, 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2011 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 diff --git a/gl/tests/test-c-ctype.c b/gl/tests/test-c-ctype.c index ebe594dd4f..9d748ffe88 100644 --- a/gl/tests/test-c-ctype.c +++ b/gl/tests/test-c-ctype.c @@ -1,5 +1,5 @@ /* Test of character handling in C locale. - Copyright (C) 2005, 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2011 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 diff --git a/gl/tests/test-errno.c b/gl/tests/test-errno.c index 129b236fe9..7851c22d0f 100644 --- a/gl/tests/test-errno.c +++ b/gl/tests/test-errno.c @@ -1,5 +1,5 @@ /* Test of <errno.h> substitute. - Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 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 diff --git a/gl/tests/test-sys_select.c b/gl/tests/test-fcntl-h.c index 3a06c64828..dd20fbb406 100644 --- a/gl/tests/test-sys_select.c +++ b/gl/tests/test-fcntl-h.c @@ -1,5 +1,5 @@ -/* Test of <sys/select.h> substitute. - Copyright (C) 2007-2010 Free Software Foundation, Inc. +/* Test of <fcntl.h> substitute. + Copyright (C) 2007, 2009-2011 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 @@ -18,18 +18,21 @@ #include <config.h> -#include <sys/select.h> +#include <fcntl.h> -/* Check that the 'struct timeval' type is defined. */ -struct timeval t1; +/* Check that the various O_* macros are defined. */ +int o = O_DIRECT | O_DIRECTORY | O_DSYNC | O_NDELAY | O_NOATIME | O_NONBLOCK + | O_NOCTTY | O_NOFOLLOW | O_NOLINKS | O_RSYNC | O_SYNC | O_TTY_INIT + | O_BINARY | O_TEXT; + +/* Check that the various SEEK_* macros are defined. */ +int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; + +/* Check that the FD_* macros are defined. */ +int fd = FD_CLOEXEC; int main (void) { - /* Check that FD_ZERO can be used. This should not yield a warning - such as "warning: implicit declaration of function 'memset'". */ - fd_set fds; - FD_ZERO (&fds); - return 0; } diff --git a/gl/tests/test-fseeko.c b/gl/tests/test-fseeko.c index be2a78dce1..ad5eec8de9 100644 --- a/gl/tests/test-fseeko.c +++ b/gl/tests/test-fseeko.c @@ -1,5 +1,5 @@ /* Test of fseeko() function. - Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 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 diff --git a/gl/tests/test-ftello.c b/gl/tests/test-ftello.c index 5fae570f28..636da81190 100644 --- a/gl/tests/test-ftello.c +++ b/gl/tests/test-ftello.c @@ -1,5 +1,5 @@ /* Test of ftello() function. - Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 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 diff --git a/gl/tests/test-ftello3.c b/gl/tests/test-ftello3.c index b07ba64610..50d4b882fd 100644 --- a/gl/tests/test-ftello3.c +++ b/gl/tests/test-ftello3.c @@ -1,5 +1,5 @@ /* Test of ftello() function. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 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 diff --git a/gl/tests/test-getaddrinfo.c b/gl/tests/test-getaddrinfo.c deleted file mode 100644 index 15d6569b4a..0000000000 --- a/gl/tests/test-getaddrinfo.c +++ /dev/null @@ -1,168 +0,0 @@ -/* Test the getaddrinfo module. - - Copyright (C) 2006-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 Simon Josefsson. */ - -#include <config.h> - -#include <netdb.h> - -#include "signature.h" -SIGNATURE_CHECK (freeaddrinfo, void, (struct addrinfo *)); -SIGNATURE_CHECK (gai_strerror, char const *, (int)); -SIGNATURE_CHECK (getaddrinfo, int, (char const *, char const *, - struct addrinfo const *, - struct addrinfo **)); - -#include <arpa/inet.h> -#include <errno.h> -#include <netinet/in.h> -#include <stdio.h> -#include <string.h> - -/* Whether to print debugging messages. */ -#define ENABLE_DEBUGGING 0 - -#if ENABLE_DEBUGGING -# define dbgprintf printf -#else -# define dbgprintf if (0) printf -#endif - -/* BeOS does not have AF_UNSPEC. */ -#ifndef AF_UNSPEC -# define AF_UNSPEC 0 -#endif - -#ifndef EAI_SERVICE -# define EAI_SERVICE 0 -#endif - -static int -simple (char const *host, char const *service) -{ - char buf[BUFSIZ]; - static int skip = 0; - struct addrinfo hints; - struct addrinfo *ai0, *ai; - int res; - int err; - - /* Once we skipped the test, do not try anything else */ - if (skip) - return 0; - - dbgprintf ("Finding %s service %s...\n", host, service); - - /* This initializes "hints" but does not use it. Is there a reason - for this? If so, please fix this comment. */ - memset (&hints, 0, sizeof (hints)); - hints.ai_flags = AI_CANONNAME; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - - res = getaddrinfo (host, service, 0, &ai0); - err = errno; - - dbgprintf ("res %d: %s\n", res, gai_strerror (res)); - - if (res != 0) - { - /* EAI_AGAIN is returned if no network is available. Don't fail - the test merely because someone is down the country on their - in-law's farm. */ - if (res == EAI_AGAIN) - { - skip++; - fprintf (stderr, "skipping getaddrinfo test: no network?\n"); - return 77; - } - /* IRIX reports EAI_NONAME for "https". Don't fail the test - merely because of this. */ - if (res == EAI_NONAME) - return 0; - /* Solaris reports EAI_SERVICE for "http" and "https". Don't - fail the test merely because of this. */ - if (res == EAI_SERVICE) - return 0; -#ifdef EAI_NODATA - /* AIX reports EAI_NODATA for "https". Don't fail the test - merely because of this. */ - if (res == EAI_NODATA) - return 0; -#endif - /* Provide details if errno was set. */ - if (res == EAI_SYSTEM) - dbgprintf ("system error: %s\n", strerror (err)); - - return 1; - } - - for (ai = ai0; ai; ai = ai->ai_next) - { - dbgprintf ("\tflags %x\n", ai->ai_flags); - dbgprintf ("\tfamily %x\n", ai->ai_family); - dbgprintf ("\tsocktype %x\n", ai->ai_socktype); - dbgprintf ("\tprotocol %x\n", ai->ai_protocol); - dbgprintf ("\taddrlen %ld: ", (unsigned long) ai->ai_addrlen); - dbgprintf ("\tFound %s\n", - inet_ntop (ai->ai_family, - &((struct sockaddr_in *) - ai->ai_addr)->sin_addr, - buf, sizeof (buf) - 1)); - if (ai->ai_canonname) - dbgprintf ("\tFound %s...\n", ai->ai_canonname); - - { - char ipbuf[BUFSIZ]; - char portbuf[BUFSIZ]; - - res = getnameinfo (ai->ai_addr, ai->ai_addrlen, - ipbuf, sizeof (ipbuf) - 1, - portbuf, sizeof (portbuf) - 1, - NI_NUMERICHOST|NI_NUMERICSERV); - dbgprintf ("\t\tgetnameinfo %d: %s\n", res, gai_strerror (res)); - if (res == 0) - { - dbgprintf ("\t\tip %s\n", ipbuf); - dbgprintf ("\t\tport %s\n", portbuf); - } - } - - } - - freeaddrinfo (ai0); - - return 0; -} - -#define HOST1 "www.gnu.org" -#define SERV1 "http" -#define HOST2 "www.ibm.com" -#define SERV2 "https" -#define HOST3 "microsoft.com" -#define SERV3 "http" -#define HOST4 "google.org" -#define SERV4 "ldap" - -int main (void) -{ - return simple (HOST1, SERV1) - + simple (HOST2, SERV2) - + simple (HOST3, SERV3) - + simple (HOST4, SERV4); -} diff --git a/gl/tests/test-getdelim.c b/gl/tests/test-getdelim.c index a5df49f1dd..f4d1c9d506 100644 --- a/gl/tests/test-getdelim.c +++ b/gl/tests/test-getdelim.c @@ -1,5 +1,5 @@ /* Test of getdelim() function. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 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 diff --git a/gl/tests/test-getline.c b/gl/tests/test-getline.c index 6a661ce530..bead4b6aad 100644 --- a/gl/tests/test-getline.c +++ b/gl/tests/test-getline.c @@ -1,5 +1,5 @@ /* Test of getline() function. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 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 diff --git a/gl/tests/test-gettimeofday.c b/gl/tests/test-gettimeofday.c index ff2bc72b54..7d09fc3ad0 100644 --- a/gl/tests/test-gettimeofday.c +++ b/gl/tests/test-gettimeofday.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc. + * Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc. * Written by Jim Meyering. * * This program is free software: you can redistribute it and/or modify diff --git a/gl/tests/test-inet_ntop.c b/gl/tests/test-inet_ntop.c deleted file mode 100644 index d3b045c353..0000000000 --- a/gl/tests/test-inet_ntop.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Test of inet_ntop function. - Copyright (C) 2009, 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>, 2009. */ - -#include <config.h> - -#include <arpa/inet.h> - -#include "signature.h" -SIGNATURE_CHECK (inet_ntop, char const *, (int, void const *, char *, - socklen_t)); - -#include <netinet/in.h> -#include <sys/socket.h> -#include <string.h> - -#include "macros.h" - -int -main (void) -{ -#if defined AF_INET /* HAVE_IPV4 */ - { - struct in_addr internal; - char printable[16]; - const char *result; - - /* This machine was for a long time known as - ma2s2.mathematik.uni-karlsruhe.de. */ -# ifdef WORDS_BIGENDIAN - internal.s_addr = 0x810D7302; -# else - internal.s_addr = 0x02730D81; -# endif - result = inet_ntop (AF_INET, &internal, printable, sizeof (printable)); - ASSERT (result != NULL); - ASSERT (strcmp (result, "129.13.115.2") == 0); - } -#endif - - return 0; -} diff --git a/gl/tests/test-inet_pton.c b/gl/tests/test-inet_pton.c deleted file mode 100644 index 74afc0c07b..0000000000 --- a/gl/tests/test-inet_pton.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Test of inet_pton function. - Copyright (C) 2009, 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>, 2009. */ - -#include <config.h> - -#include <arpa/inet.h> - -#include "signature.h" -SIGNATURE_CHECK (inet_pton, int, (int, const char *, void *)); - -#include <netinet/in.h> -#include <sys/socket.h> - -#include "macros.h" - -int -main (void) -{ -#if defined AF_INET /* HAVE_IPV4 */ - { - /* This machine was for a long time known as - ma2s2.mathematik.uni-karlsruhe.de. */ - const char printable[] = "129.13.115.2"; - struct in_addr internal; - int ret; - - ret = inet_pton (AF_INET, printable, &internal); - ASSERT (ret == 1); - /* Verify that internal is filled in network byte order. */ - ASSERT (((unsigned char *) &internal)[0] == 0x81); - ASSERT (((unsigned char *) &internal)[1] == 0x0D); - ASSERT (((unsigned char *) &internal)[2] == 0x73); - ASSERT (((unsigned char *) &internal)[3] == 0x02); -# ifdef WORDS_BIGENDIAN - ASSERT (internal.s_addr == 0x810D7302); -# else - ASSERT (internal.s_addr == 0x02730D81); -# endif - } -#endif - - return 0; -} diff --git a/gl/tests/test-lseek.c b/gl/tests/test-lseek.c deleted file mode 100644 index 3d893a0d05..0000000000 --- a/gl/tests/test-lseek.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Test of lseek() function. - Copyright (C) 2007-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 Eric Blake, 2007. */ - -#include <config.h> - -#include <unistd.h> - -#include "signature.h" -SIGNATURE_CHECK (lseek, off_t, (int, off_t, int)); - -#include <errno.h> - -#include "macros.h" - -/* ARGC must be 2; *ARGV[1] is '0' if stdin and stdout are files, '1' - if they are pipes, and '2' if they are closed. Check for proper - semantics of lseek. */ -int -main (int argc, char **argv) -{ - if (argc != 2) - return 2; - switch (*argv[1]) - { - case '0': /* regular files */ - ASSERT (lseek (0, (off_t)2, SEEK_SET) == 2); - ASSERT (lseek (0, (off_t)-4, SEEK_CUR) == -1); - ASSERT (errno == EINVAL); - errno = 0; -#if ! defined __BEOS__ - /* POSIX says that the last lseek call, when failing, does not change - the current offset. But BeOS sets it to 0. */ - ASSERT (lseek (0, (off_t)0, SEEK_CUR) == 2); -#endif -#if 0 /* leads to SIGSYS on IRIX 6.5 */ - ASSERT (lseek (0, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1); - ASSERT (errno == EINVAL); -#endif - ASSERT (lseek (1, (off_t)2, SEEK_SET) == 2); - errno = 0; - ASSERT (lseek (1, (off_t)-4, SEEK_CUR) == -1); - ASSERT (errno == EINVAL); - errno = 0; -#if ! defined __BEOS__ - /* POSIX says that the last lseek call, when failing, does not change - the current offset. But BeOS sets it to 0. */ - ASSERT (lseek (1, (off_t)0, SEEK_CUR) == 2); -#endif -#if 0 /* leads to SIGSYS on IRIX 6.5 */ - ASSERT (lseek (1, (off_t)0, (SEEK_SET | SEEK_CUR | SEEK_END) + 1) == -1); - ASSERT (errno == EINVAL); -#endif - break; - - case '1': /* pipes */ - errno = 0; - ASSERT (lseek (0, (off_t)0, SEEK_CUR) == -1); - ASSERT (errno == ESPIPE); - errno = 0; - ASSERT (lseek (1, (off_t)0, SEEK_CUR) == -1); - ASSERT (errno == ESPIPE); - break; - - case '2': /* closed */ - /* Explicitly close file descriptors 0 and 1. The <&- and >&- in the - invoking shell are not enough on HP-UX. - close (0); calling close fails on mingw -- simon@josefsson.org - close (1); */ - errno = 0; - ASSERT (lseek (0, (off_t)0, SEEK_CUR) == -1); - ASSERT (errno == EBADF); - errno = 0; - ASSERT (lseek (1, (off_t)0, SEEK_CUR) == -1); - ASSERT (errno == EBADF); - break; - - default: - return 1; - } - return 0; -} diff --git a/gl/tests/test-lseek.sh b/gl/tests/test-lseek.sh deleted file mode 100755 index c0c2946c43..0000000000 --- a/gl/tests/test-lseek.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -tmpfiles= -trap 'rm -fr $tmpfiles' 1 2 3 15 - -tmpfiles=t-lseek.tmp -# seekable files -./test-lseek${EXEEXT} 0 < "$srcdir/test-lseek.sh" > t-lseek.tmp || exit 1 - -# pipes -echo hi | { ./test-lseek${EXEEXT} 1; echo $? > t-lseek.tmp; cat > /dev/null; } | cat -test "`cat t-lseek.tmp`" = "0" || exit 1 - -# closed descriptors -# Doesn't work under mingw -- simon@josefsson.org -#./test-lseek${EXEEXT} 2 <&- >&- || exit 1 - -rm -rf $tmpfiles -exit 0 diff --git a/gl/tests/test-memchr.c b/gl/tests/test-memchr.c index 05e1bfaed2..a11f6cdb97 100644 --- a/gl/tests/test-memchr.c +++ b/gl/tests/test-memchr.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2010 Free Software Foundation, Inc. + * Copyright (C) 2008-2011 Free Software Foundation, Inc. * Written by Eric Blake and Bruno Haible * * This program is free software: you can redistribute it and/or modify diff --git a/gl/tests/test-netdb.c b/gl/tests/test-netdb.c index 697bbc8dbf..13a8925fbe 100644 --- a/gl/tests/test-netdb.c +++ b/gl/tests/test-netdb.c @@ -1,5 +1,5 @@ /* Test of <netdb.h> substitute. - Copyright (C) 2007-2008, 2010 Free Software Foundation, Inc. + Copyright (C) 2007-2008, 2010-2011 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 diff --git a/gl/tests/test-netinet_in.c b/gl/tests/test-netinet_in.c index af403ed323..b1edc66add 100644 --- a/gl/tests/test-netinet_in.c +++ b/gl/tests/test-netinet_in.c @@ -1,5 +1,5 @@ /* Test of <netinet/in.h> substitute. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 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 diff --git a/gl/tests/test-perror.c b/gl/tests/test-perror.c deleted file mode 100644 index 2b7640c06a..0000000000 --- a/gl/tests/test-perror.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Test of perror() function. - Copyright (C) 2008, 2009, 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, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (perror, void, (char const *)); - -#include <errno.h> - -int -main (int argc, char **argv) -{ - const char *prefix = (argc > 1 ? argv[1] : NULL); - - errno = EACCES; perror (prefix); - errno = ETIMEDOUT; perror (prefix); - errno = EOVERFLOW; perror (prefix); - - return 0; -} diff --git a/gl/tests/test-perror.sh b/gl/tests/test-perror.sh deleted file mode 100755 index f2c8fdc336..0000000000 --- a/gl/tests/test-perror.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -tmpfiles="" -trap 'rm -fr $tmpfiles' 1 2 3 15 - -# Test NULL prefix. Result should not contain a number. -tmpfiles="$tmpfiles t-perror.tmp" -./test-perror${EXEEXT} 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror.tmp -if grep '[0-9]' t-perror.tmp > /dev/null; then - rm -fr $tmpfiles; exit 1 -fi - -# Test empty prefix. Result should be the same. -tmpfiles="$tmpfiles t-perror1.tmp" -./test-perror${EXEEXT} '' 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror1.tmp -diff t-perror.tmp t-perror1.tmp -test $? = 0 || { rm -fr $tmpfiles; exit 1; } - -# Test non-empty prefix. -tmpfiles="$tmpfiles t-perror2.tmp t-perror3.tmp" -./test-perror${EXEEXT} 'foo' 2>&1 >/dev/null | LC_ALL=C tr -d '\r' > t-perror3.tmp -sed -e 's/^/foo: /' < t-perror.tmp > t-perror2.tmp -diff t-perror2.tmp t-perror3.tmp -test $? = 0 || { rm -fr $tmpfiles; exit 1; } - -rm -fr $tmpfiles -exit 0 diff --git a/gl/tests/test-read-file.c b/gl/tests/test-read-file.c index daa61668c6..de7a0bb9f3 100644 --- a/gl/tests/test-read-file.c +++ b/gl/tests/test-read-file.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2007, 2010 Free Software Foundation, Inc. + * Copyright (C) 2006-2007, 2010-2011 Free Software Foundation, Inc. * Written by Simon Josefsson * * This program is free software: you can redistribute it and/or modify diff --git a/gl/tests/test-select-fd.c b/gl/tests/test-select-fd.c deleted file mode 100644 index 4527a2fb49..0000000000 --- a/gl/tests/test-select-fd.c +++ /dev/null @@ -1,72 +0,0 @@ -/* Test of select() substitute, reading or writing from a given file descriptor. - Copyright (C) 2008, 2009, 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>, 2008. */ - -#include <config.h> - -#include <stdio.h> -#include <stdlib.h> -#include <sys/select.h> - -int -main (int argc, char *argv[]) -{ - if (argc == 4) - { - char mode = argv[1][0]; - - if (mode == 'r' || mode == 'w') - { - int fd = atoi (argv[2]); - - if (fd >= 0) - { - const char *result_file_name = argv[3]; - FILE *result_file = fopen (result_file_name, "wb"); - - if (result_file != NULL) - { - fd_set fds; - struct timeval timeout; - int ret; - - FD_ZERO (&fds); - FD_SET (fd, &fds); - timeout.tv_sec = 0; - timeout.tv_usec = 10000; - ret = (mode == 'r' - ? select (fd + 1, &fds, NULL, NULL, &timeout) - : select (fd + 1, NULL, &fds, NULL, &timeout)); - if (ret < 0) - { - perror ("select failed"); - exit (1); - } - if ((ret == 0) != ! FD_ISSET (fd, &fds)) - { - fprintf (stderr, "incorrect return value\n"); - exit (1); - } - fprintf (result_file, "%d\n", ret); - exit (0); - } - } - } - } - fprintf (stderr, "Usage: test-select-fd mode fd result-file-name\n"); - exit (1); -} diff --git a/gl/tests/test-select-in.sh b/gl/tests/test-select-in.sh deleted file mode 100755 index 2a8b742268..0000000000 --- a/gl/tests/test-select-in.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# Test select() on file descriptors opened for reading. - -# This test is known to fail on Solaris 2.6 and older, due to its handling -# of /dev/null. - -tmpfiles="" -trap 'rm -fr $tmpfiles' 1 2 3 15 - -tmpfiles="$tmpfiles t-select-in.tmp" - -# Regular files. - -rm -f t-select-in.tmp -./test-select-fd${EXEEXT} r 0 t-select-in.tmp < ./test-select-fd${EXEEXT} -test `cat t-select-in.tmp` = "1" || exit 1 - -# Pipes. - -rm -f t-select-in.tmp -{ sleep 1; echo abc; } | \ - { ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; cat > /dev/null; } -test `cat t-select-in.tmp` = "0" || exit 1 - -rm -f t-select-in.tmp -echo abc | { sleep 1; ./test-select-fd${EXEEXT} r 0 t-select-in.tmp; } -test `cat t-select-in.tmp` = "1" || exit 1 - -# Special files. -# This part of the test is known to fail on Solaris 2.6 and older. - -# Doesn't work under mingw -- simon@josefsson.org -#rm -f t-select-in.tmp -#./test-select-fd${EXEEXT} r 0 t-select-in.tmp < /dev/null -#test `cat t-select-in.tmp` = "1" || exit 1 - -rm -fr $tmpfiles - -exit 0 diff --git a/gl/tests/test-select-out.sh b/gl/tests/test-select-out.sh deleted file mode 100755 index c5fd8619f6..0000000000 --- a/gl/tests/test-select-out.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# Test select() on file descriptors opened for writing. - -tmpfiles="" -trap 'rm -fr $tmpfiles' 1 2 3 15 - -tmpfiles="$tmpfiles t-select-out.out t-select-out.tmp" - -# Regular files. - -rm -f t-select-out.tmp -./test-select-fd${EXEEXT} w 1 t-select-out.tmp > t-select-out.out -test `cat t-select-out.tmp` = "1" || exit 1 - -# Pipes. - -if false; then # This test fails on some platforms. - rm -f t-select-out.tmp - ( { echo abc; ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | { sleep 1; cat; } ) > /dev/null - test `cat t-select-out.tmp` = "0" || exit 1 -fi - -rm -f t-select-out.tmp -( { sleep 1; echo abc; ./test-select-fd${EXEEXT} w 1 t-select-out.tmp; } | cat) > /dev/null -test `cat t-select-out.tmp` = "1" || exit 1 - -# Special files. - -rm -f t-select-out.tmp -./test-select-fd${EXEEXT} w 1 t-select-out.tmp > /dev/null -test `cat t-select-out.tmp` = "1" || exit 1 - -rm -fr $tmpfiles - -exit 0 diff --git a/gl/tests/test-select-stdin.c b/gl/tests/test-select-stdin.c deleted file mode 100644 index c88698cd3f..0000000000 --- a/gl/tests/test-select-stdin.c +++ /dev/null @@ -1,83 +0,0 @@ -/* Test of select() substitute, reading from stdin. - Copyright (C) 2008, 2009, 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>, 2008. */ - -#include <config.h> - -#include <stdio.h> -#include <stdlib.h> -#include <sys/select.h> -#include <sys/time.h> -#include <unistd.h> - -#include "macros.h" - -int -main (void) -{ - printf ("Applying select() from standard input. Press Ctrl-C to abort.\n"); - for (;;) - { - struct timeval before; - struct timeval after; - unsigned long spent_usec; - fd_set readfds; - struct timeval timeout; - int ret; - - gettimeofday (&before, NULL); - - FD_ZERO (&readfds); - FD_SET (0, &readfds); - timeout.tv_sec = 0; - timeout.tv_usec = 500000; - ret = select (1, &readfds, NULL, NULL, &timeout); - - gettimeofday (&after, NULL); - spent_usec = (after.tv_sec - before.tv_sec) * 1000000 - + after.tv_usec - before.tv_usec; - - if (ret < 0) - { - perror ("select failed"); - exit (1); - } - if ((ret == 0) != ! FD_ISSET (0, &readfds)) - { - fprintf (stderr, "incorrect return value\n"); - exit (1); - } - if (ret == 0) - { - if (spent_usec < 250000) - { - fprintf (stderr, "returned too early\n"); - exit (1); - } - /* Timeout */ - printf ("."); - ASSERT (fflush (stdout) == 0); - } - else - { - char c; - - printf ("Input available! Trying to read 1 byte...\n"); - ASSERT (read (0, &c, 1) == 1); - } - } -} diff --git a/gl/tests/test-select.c b/gl/tests/test-select.c deleted file mode 100644 index 9c895c3b21..0000000000 --- a/gl/tests/test-select.c +++ /dev/null @@ -1,393 +0,0 @@ -/* Test of select() substitute. - Copyright (C) 2008-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 Paolo Bonzini, 2008. */ - -#include <config.h> - -#include <sys/select.h> - -#include "signature.h" -SIGNATURE_CHECK (select, int, (int, fd_set *, fd_set *, fd_set *, - struct timeval *)); -/* The following may be macros without underlying functions, so only - check signature if they are not macros. */ -#ifndef FD_CLR -SIGNATURE_CHECK (FD_CLR, void, (int, fd_set *)); -#endif -#ifndef FD_ISSET -SIGNATURE_CHECK (FD_ISSET, void, (int, fd_set *)); -#endif -#ifndef FD_SET -SIGNATURE_CHECK (FD_SET, int, (int, fd_set *)); -#endif -#ifndef FD_ZERO -SIGNATURE_CHECK (FD_ZERO, void, (fd_set *)); -#endif - -#include <stdio.h> -#include <string.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <fcntl.h> -#include <stdlib.h> -#include <stdbool.h> -#include <sys/ioctl.h> -#include <errno.h> - -#include "macros.h" - -enum { SEL_IN = 1, SEL_OUT = 2, SEL_EXC = 4 }; - -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ -# define WIN32_NATIVE -#endif - -#ifdef WIN32_NATIVE -#include <io.h> -#define pipe(x) _pipe(x, 256, O_BINARY) -#endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_SYS_WAIT_H -#include <sys/wait.h> -#endif - -#ifndef SO_REUSEPORT -#define SO_REUSEPORT SO_REUSEADDR -#endif - -#define TEST_PORT 12345 - - -/* Minimal testing infrastructure. */ - -static int failures; - -static void -failed (const char *reason) -{ - if (++failures > 1) - printf (" "); - printf ("failed (%s)\n", reason); -} - -static int -test (void (*fn) (void), const char *msg) -{ - failures = 0; - printf ("%s... ", msg); - fflush (stdout); - fn (); - - if (!failures) - printf ("passed\n"); - - return failures; -} - - -/* Funny socket code. */ - -static int -open_server_socket (void) -{ - int s, x; - struct sockaddr_in ia; - - s = socket (AF_INET, SOCK_STREAM, 0); - - memset (&ia, 0, sizeof (ia)); - ia.sin_family = AF_INET; - inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr); - ia.sin_port = htons (TEST_PORT); - if (bind (s, (struct sockaddr *) &ia, sizeof (ia)) < 0) - { - perror ("bind"); - exit (77); - } - - x = 1; - setsockopt (s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof (x)); - - if (listen (s, 1) < 0) - { - perror ("listen"); - exit (77); - } - - return s; -} - -static int -connect_to_socket (int blocking) -{ - int s; - struct sockaddr_in ia; - - s = socket (AF_INET, SOCK_STREAM, 0); - - memset (&ia, 0, sizeof (ia)); - ia.sin_family = AF_INET; - inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr); - ia.sin_port = htons (TEST_PORT); - - if (!blocking) - { -#ifdef WIN32_NATIVE - unsigned long iMode = 1; - ioctl (s, FIONBIO, (char *) &iMode); - -#elif defined F_GETFL - int oldflags = fcntl (s, F_GETFL, NULL); - - if (!(oldflags & O_NONBLOCK)) - fcntl (s, F_SETFL, oldflags | O_NONBLOCK); -#endif - } - - if (connect (s, (struct sockaddr *) &ia, sizeof (ia)) < 0 - && (blocking || errno != EINPROGRESS)) - { - perror ("connect"); - exit (77); - } - - return s; -} - - -/* A slightly more convenient interface to select(2). */ - -static int -do_select (int fd, int ev, struct timeval *tv) -{ - fd_set rfds, wfds, xfds; - int r, rev; - - FD_ZERO (&rfds); - FD_ZERO (&wfds); - FD_ZERO (&xfds); - if (ev & SEL_IN) - FD_SET (fd, &rfds); - if (ev & SEL_OUT) - FD_SET (fd, &wfds); - if (ev & SEL_EXC) - FD_SET (fd, &xfds); - r = select (fd + 1, &rfds, &wfds, &xfds, tv); - if (r < 0) - return r; - - rev = 0; - if (FD_ISSET (fd, &rfds)) - rev |= SEL_IN; - if (FD_ISSET (fd, &wfds)) - rev |= SEL_OUT; - if (FD_ISSET (fd, &xfds)) - rev |= SEL_EXC; - if (rev && r == 0) - failed ("select returned 0"); - if (rev & ~ev) - failed ("select returned unrequested events"); - - return rev; -} - -static int -do_select_nowait (int fd, int ev) -{ - static struct timeval tv0; - return do_select (fd, ev, &tv0); -} - -static int -do_select_wait (int fd, int ev) -{ - return do_select (fd, ev, NULL); -} - - -/* Test poll(2) for TTYs. */ - -#ifdef INTERACTIVE -static void -test_tty (void) -{ - if (do_select_nowait (0, SEL_IN) != 0) - failed ("can read"); - if (do_select_nowait (0, SEL_OUT) == 0) - failed ("cannot write"); - - if (do_select_wait (0, SEL_IN) == 0) - failed ("return with infinite timeout"); - - getchar (); - if (do_select_nowait (0, SEL_IN) != 0) - failed ("can read after getc"); -} -#endif - - -/* Test poll(2) for unconnected nonblocking sockets. */ - -static void -test_connect_first (void) -{ - int s = open_server_socket (); - struct sockaddr_in ia; - socklen_t addrlen; - - int c1, c2; - - if (do_select_nowait (s, SEL_IN | SEL_EXC) != 0) - failed ("can read, socket not connected"); - - c1 = connect_to_socket (false); - - if (do_select_wait (s, SEL_IN | SEL_EXC) != SEL_IN) - failed ("expecting readability on passive socket"); - if (do_select_nowait (s, SEL_IN | SEL_EXC) != SEL_IN) - failed ("expecting readability on passive socket"); - - addrlen = sizeof (ia); - c2 = accept (s, (struct sockaddr *) &ia, &addrlen); - ASSERT (close (s) == 0); - ASSERT (close (c1) == 0); - ASSERT (close (c2) == 0); -} - - -/* Test poll(2) for unconnected blocking sockets. */ - -static void -test_accept_first (void) -{ -#ifndef WIN32_NATIVE - int s = open_server_socket (); - struct sockaddr_in ia; - socklen_t addrlen; - char buf[3]; - int c, pid; - - pid = fork (); - if (pid < 0) - return; - - if (pid == 0) - { - addrlen = sizeof (ia); - c = accept (s, (struct sockaddr *) &ia, &addrlen); - ASSERT (close (s) == 0); - ASSERT (write (c, "foo", 3) == 3); - ASSERT (read (c, buf, 3) == 3); - shutdown (c, SHUT_RD); - ASSERT (close (c) == 0); - exit (0); - } - else - { - ASSERT (close (s) == 0); - c = connect_to_socket (true); - if (do_select_nowait (c, SEL_OUT) != SEL_OUT) - failed ("cannot write after blocking connect"); - ASSERT (write (c, "foo", 3) == 3); - wait (&pid); - if (do_select_wait (c, SEL_IN) != SEL_IN) - failed ("cannot read data left in the socket by closed process"); - ASSERT (read (c, buf, 3) == 3); - ASSERT (write (c, "foo", 3) == 3); - ASSERT (close (c) == 0); - } -#endif -} - - -/* Common code for pipes and connected sockets. */ - -static void -test_pair (int rd, int wd) -{ - char buf[3]; - if (do_select_wait (wd, SEL_IN | SEL_OUT | SEL_EXC) != SEL_OUT) - failed ("expecting writability before writing"); - if (do_select_nowait (wd, SEL_IN | SEL_OUT | SEL_EXC) != SEL_OUT) - failed ("expecting writability before writing"); - - ASSERT (write (wd, "foo", 3) == 3); - if (do_select_wait (rd, SEL_IN) != SEL_IN) - failed ("expecting readability after writing"); - if (do_select_nowait (rd, SEL_IN) != SEL_IN) - failed ("expecting readability after writing"); - - ASSERT (read (rd, buf, 3) == 3); -} - - -/* Test poll(2) on connected sockets. */ - -static void -test_socket_pair (void) -{ - struct sockaddr_in ia; - - socklen_t addrlen = sizeof (ia); - int s = open_server_socket (); - int c1 = connect_to_socket (false); - int c2 = accept (s, (struct sockaddr *) &ia, &addrlen); - - ASSERT (close (s) == 0); - - test_pair (c1, c2); - ASSERT (close (c1) == 0); - ASSERT (write (c2, "foo", 3) == 3); - ASSERT (close (c2) == 0); -} - - -/* Test poll(2) on pipes. */ - -static void -test_pipe (void) -{ - int fd[2]; - - ASSERT (pipe (fd) == 0); - test_pair (fd[0], fd[1]); - ASSERT (close (fd[0]) == 0); - ASSERT (close (fd[1]) == 0); -} - - -/* Do them all. */ - -int -main (void) -{ - int result; - -#ifdef INTERACTIVE - printf ("Please press Enter\n"); - test (test_tty, "TTY"); -#endif - - result = test (test_connect_first, "Unconnected socket test"); - result += test (test_socket_pair, "Connected sockets test"); - result += test (test_accept_first, "General socket test with fork"); - result += test (test_pipe, "Pipe test"); - - exit (result); -} diff --git a/gl/tests/test-snprintf.c b/gl/tests/test-snprintf.c index 62a411bf91..95a352dc5e 100644 --- a/gl/tests/test-snprintf.c +++ b/gl/tests/test-snprintf.c @@ -1,5 +1,5 @@ /* Test of snprintf() function. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 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 @@ -34,15 +34,16 @@ main (int argc, char *argv[]) int size; int retval; + retval = snprintf (NULL, 0, "%d", 12345); + ASSERT (retval == 5); + for (size = 0; size <= 8; size++) { memcpy (buf, "DEADBEEF", 8); retval = snprintf (buf, size, "%d", 12345); + ASSERT (retval == 5); if (size < 6) { -#if CHECK_SNPRINTF_POSIX - ASSERT (retval < 0 || retval >= size); -#endif if (size > 0) { ASSERT (memcmp (buf, "12345", size - 1) == 0); @@ -55,7 +56,6 @@ main (int argc, char *argv[]) } else { - ASSERT (retval == 5); ASSERT (memcmp (buf, "12345\0EF", 8) == 0); } } diff --git a/gl/tests/test-sockets.c b/gl/tests/test-sockets.c index ab5460ad46..0170d3754d 100644 --- a/gl/tests/test-sockets.c +++ b/gl/tests/test-sockets.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. + * Copyright (C) 2008-2011 Free Software Foundation, Inc. * Written by Simon Josefsson. * * This program is free software: you can redistribute it and/or modify diff --git a/gl/tests/test-stdbool.c b/gl/tests/test-stdbool.c index 2103d8bab9..e115ba2940 100644 --- a/gl/tests/test-stdbool.c +++ b/gl/tests/test-stdbool.c @@ -1,5 +1,5 @@ /* Test of <stdbool.h> substitute. - Copyright (C) 2002-2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2002-2007, 2009-2011 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 @@ -52,23 +52,28 @@ /* Several tests cannot be guaranteed with gnulib's <stdbool.h>, at least, not for all compilers and compiler options. */ -#if HAVE_STDBOOL_H || defined __GNUC__ +#if HAVE_STDBOOL_H || 3 <= __GNUC__ struct s { _Bool s: 1; _Bool t; } s; #endif char a[true == 1 ? 1 : -1]; char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; -#if HAVE_STDBOOL_H || defined __GNUC__ /* See above. */ +#if HAVE_STDBOOL_H || 3 <= __GNUC__ /* See above. */ char d[(bool) 0.5 == true ? 1 : -1]; -# ifdef ADDRESS_CHECK_OKAY +# ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning. */ +/* C99 may plausibly be interpreted as not requiring support for a cast from + a variable's address to bool in a static initializer. So treat it like a + GCC extension. */ +# ifdef __GNUC__ bool e = &s; +# endif # endif char f[(_Bool) 0.0 == false ? 1 : -1]; #endif char g[true]; char h[sizeof (_Bool)]; -#if HAVE_STDBOOL_H || defined __GNUC__ /* See above. */ +#if HAVE_STDBOOL_H || 3 <= __GNUC__ /* See above. */ char i[sizeof s.t]; #endif enum { j = false, k = true, l = false * true, m = true * 256 }; @@ -85,11 +90,29 @@ _Bool *pq = &q; int main () { + int error = 0; + +#if HAVE_STDBOOL_H || 3 <= __GNUC__ /* See above. */ +# ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning. */ + /* A cast from a variable's address to bool is valid in expressions. */ + { + bool e1 = &s; + if (!e1) + error = 1; + } +# endif +#endif + /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 reported by James Lemley on 2005-10-05; see http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html This is a runtime test, since a corresponding compile-time test would rely on initializer extensions. */ - char digs[] = "0123456789"; - return &(digs + 5)[-2 + (bool) 1] != &digs[4]; + { + char digs[] = "0123456789"; + if (&(digs + 5)[-2 + (bool) 1] != &digs[4]) + error = 1; + } + + return error; } diff --git a/gl/tests/test-stddef.c b/gl/tests/test-stddef.c index 2c392c7547..c929af837a 100644 --- a/gl/tests/test-stddef.c +++ b/gl/tests/test-stddef.c @@ -1,5 +1,5 @@ /* Test of <stddef.h> substitute. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 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 diff --git a/gl/tests/test-stdint.c b/gl/tests/test-stdint.c index d64057a256..f606cc3e24 100644 --- a/gl/tests/test-stdint.c +++ b/gl/tests/test-stdint.c @@ -1,5 +1,5 @@ /* Test of <stdint.h> substitute. - Copyright (C) 2006-2010 Free Software Foundation, Inc. + Copyright (C) 2006-2011 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 diff --git a/gl/tests/test-stdio.c b/gl/tests/test-stdio.c index 87100576f0..7e7a206b7c 100644 --- a/gl/tests/test-stdio.c +++ b/gl/tests/test-stdio.c @@ -1,5 +1,5 @@ /* Test of <stdio.h> substitute. - Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 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 diff --git a/gl/tests/test-stdlib.c b/gl/tests/test-stdlib.c index 1e7956b68c..210aab4055 100644 --- a/gl/tests/test-stdlib.c +++ b/gl/tests/test-stdlib.c @@ -1,5 +1,5 @@ /* Test of <stdlib.h> substitute. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 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 diff --git a/gl/tests/test-strerror.c b/gl/tests/test-strerror.c deleted file mode 100644 index 11ab7e3939..0000000000 --- a/gl/tests/test-strerror.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Test of strerror() function. - Copyright (C) 2007-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, 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, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ - -/* Written by Eric Blake <ebb9@byu.net>, 2007. */ - -#include <config.h> - -#include <string.h> - -#include "signature.h" -SIGNATURE_CHECK (strerror, char *, (int)); - -#include <errno.h> - -#include "macros.h" - -int -main (void) -{ - char *str; - - str = strerror (EACCES); - ASSERT (str); - ASSERT (*str); - - str = strerror (ETIMEDOUT); - ASSERT (str); - ASSERT (*str); - - str = strerror (EOVERFLOW); - ASSERT (str); - ASSERT (*str); - - str = strerror (0); - ASSERT (str); - ASSERT (*str); - - str = strerror (-3); - ASSERT (str); - ASSERT (*str); - - return 0; -} diff --git a/gl/tests/test-string.c b/gl/tests/test-string.c index 019a8174ac..54c49a9735 100644 --- a/gl/tests/test-string.c +++ b/gl/tests/test-string.c @@ -1,5 +1,5 @@ /* Test of <string.h> substitute. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 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 diff --git a/gl/tests/test-sys_ioctl.c b/gl/tests/test-sys_ioctl.c deleted file mode 100644 index 1f44d4a1ad..0000000000 --- a/gl/tests/test-sys_ioctl.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test of <sys/ioctl.h> substitute. - Copyright (C) 2009, 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 Eric Blake <ebb9@byu.net>, 2009. */ - -#include <config.h> - -#include <sys/ioctl.h> - -int -main (void) -{ - return 0; -} diff --git a/gl/tests/test-sys_socket.c b/gl/tests/test-sys_socket.c index e976ff6a7b..8f323ca1d9 100644 --- a/gl/tests/test-sys_socket.c +++ b/gl/tests/test-sys_socket.c @@ -1,5 +1,5 @@ /* Test of <sys/socket.h> substitute. - Copyright (C) 2007, 2009-2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 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 diff --git a/gl/tests/test-sys_stat.c b/gl/tests/test-sys_stat.c index 5f1aacd1cc..cd07d86e87 100644 --- a/gl/tests/test-sys_stat.c +++ b/gl/tests/test-sys_stat.c @@ -1,5 +1,5 @@ /* Test of <sys/stat.h> substitute. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 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 diff --git a/gl/tests/test-sys_time.c b/gl/tests/test-sys_time.c index 2ab849e927..da64b85c02 100644 --- a/gl/tests/test-sys_time.c +++ b/gl/tests/test-sys_time.c @@ -1,5 +1,5 @@ /* Test of <sys/time.h> substitute. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 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 diff --git a/gl/tests/test-sys_wait.h b/gl/tests/test-sys_wait.h index bb10450867..3c9b32293b 100644 --- a/gl/tests/test-sys_wait.h +++ b/gl/tests/test-sys_wait.h @@ -1,5 +1,5 @@ /* Test of macros shared between <sys/wait.h> and <stdlib.h>. - Copyright (C) 2010 Free Software Foundation, Inc. + Copyright (C) 2010-2011 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 diff --git a/gl/tests/test-time.c b/gl/tests/test-time.c index 8e250bd2d5..0c78f36c66 100644 --- a/gl/tests/test-time.c +++ b/gl/tests/test-time.c @@ -1,5 +1,5 @@ /* Test of <time.h> substitute. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 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 diff --git a/gl/tests/test-unistd.c b/gl/tests/test-unistd.c index ec02eeefca..be1ae06910 100644 --- a/gl/tests/test-unistd.c +++ b/gl/tests/test-unistd.c @@ -1,5 +1,5 @@ /* Test of <unistd.h> substitute. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009-2011 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 diff --git a/gl/tests/test-update-copyright.sh b/gl/tests/test-update-copyright.sh deleted file mode 100755 index ea700c902b..0000000000 --- a/gl/tests/test-update-copyright.sh +++ /dev/null @@ -1,537 +0,0 @@ -#!/bin/sh -# Test suite for update-copyright. -# Copyright (C) 2009-2010 Free Software Foundation, Inc. -# This file is part of the GNUlib Library. -# -# 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/>. - -diffout=`diff -u /dev/null /dev/null 2>&1` -if test x"$diffout" = x"" && test $? -eq 0; then - compare() { diff -u "$@"; } -else - compare() { cmp "$@"; } -fi - -# Ensure the update-copyright program gets found. -PATH=$abs_aux_dir:$PATH -export PATH - -TMP_BASE=update-copyright.test -trap 'rm -f $TMP_BASE*' 0 1 2 3 15 - -## --------------------------------- ## -## Skip if user does not have perl. ## -## --------------------------------- ## - -TMP=$TMP_BASE -s=$TMP-script -cat <<\EOF > $s -eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" ${1+"$@"}' - & eval 'exec perl -wS -0777 -pi "$0" $argv:q' - if 0; -s/a/b/ -EOF -chmod a+x $s -echo a > $TMP-in -./$s $TMP-in 2>/dev/null && test b = "`cat $TMP-in 2>/dev/null`" || - { - printf '%s\n' "$0: skipping this test;" \ - 'your system has insufficient support for Perl' 1>&2 - exit 77 - } - -# Skip this test if Perl is too old. FIXME: 5.8.0 is just a guess. -# We have a report that 5.6.1 is inadequate and that 5.8.0 works. -perl -e 'require 5.8.0' || { - echo '$0: skipping this test; Perl version is too old' 1>&2 - exit 77 -} - -# Do not let a different envvar setting perturb results. -UPDATE_COPYRIGHT_MAX_LINE_LENGTH=72 -export UPDATE_COPYRIGHT_MAX_LINE_LENGTH - -## ----------------------------- ## -## Examples from documentation. ## -## ----------------------------- ## - -TMP=$TMP_BASE-ex -cat > $TMP.1 <<EOF -Copyright @copyright{} 1990-2005, 2007-2009 Free Software -Foundation, Inc. -EOF -cat > $TMP.2 <<EOF -# Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF -cat > $TMP.3 <<EOF -/* - * Copyright © 90,2005,2007-2009 - * Free Software Foundation, Inc. - */ -EOF -cat > $TMP.4 <<EOF -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF -cat > $TMP.5 <<EOF -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. -EOF -cat > $TMP.6 <<EOF -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. - -Copyright (C) 1990-2005, 2007-2009 Free Software Foundation, -Inc. -EOF -cat > $TMP.7 <<EOF -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. - -# Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF - -rm -f $TMP.*.bak -UPDATE_COPYRIGHT_YEAR=2009 \ - update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare - $TMP-stderr <<EOF || exit 1 -$TMP.4: warning: FSF copyright statement not found -$TMP.5: warning: FSF copyright statement not found -EOF -compare - $TMP.1 <<EOF || exit 1 -Copyright @copyright{} 1990-2005, 2007-2009 Free Software -Foundation, Inc. -EOF -compare - $TMP.2 <<EOF || exit 1 -# Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF -compare - $TMP.3 <<EOF || exit 1 -/* - * Copyright © 90,2005,2007-2009 - * Free Software Foundation, Inc. - */ -EOF -compare - $TMP.4 <<EOF || exit 1 -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF -compare - $TMP.5 <<EOF || exit 1 -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. -EOF -compare - $TMP.6 <<EOF || exit 1 -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. - -Copyright (C) 1990-2005, 2007-2009 Free Software Foundation, -Inc. -EOF -compare - $TMP.7 <<EOF || exit 1 -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. - -# Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF - -rm -f $TMP.*.bak -UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_USE_INTERVALS=1 \ - update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare - $TMP-stderr <<EOF || exit 1 -$TMP.4: warning: FSF copyright statement not found -$TMP.5: warning: FSF copyright statement not found -EOF -compare - $TMP.1 <<EOF || exit 1 -Copyright @copyright{} 1990-2005, 2007-2010 Free Software Foundation, -Inc. -EOF -compare - $TMP.2 <<EOF || exit 1 -# Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc. -EOF -compare - $TMP.3 <<EOF || exit 1 -/* - * Copyright © 1990, 2005, 2007-2010 Free Software Foundation, Inc. - */ -EOF -compare - $TMP.4 <<EOF || exit 1 -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF -compare - $TMP.5 <<EOF || exit 1 -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. -EOF -compare - $TMP.6 <<EOF || exit 1 -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. - -Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc. -EOF -compare - $TMP.7 <<EOF || exit 1 -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. - -# Copyright (C) 1990-2005, 2007-2010 Free Software Foundation, Inc. -EOF - -rm -f $TMP.*.bak -UPDATE_COPYRIGHT_YEAR=2010 UPDATE_COPYRIGHT_FORCE=1 \ - update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare - $TMP-stderr <<EOF || exit 1 -$TMP.4: warning: FSF copyright statement not found -$TMP.5: warning: FSF copyright statement not found -EOF -compare - $TMP.1 <<EOF || exit 1 -Copyright @copyright{} 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, -1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 -Free Software Foundation, Inc. -EOF -compare - $TMP.2 <<EOF || exit 1 -# Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free -# Software Foundation, Inc. -EOF -compare - $TMP.3 <<EOF || exit 1 -/* - * Copyright © 1990, 2005, 2007, 2008, 2009, 2010 Free Software - * Foundation, Inc. - */ -EOF -compare - $TMP.4 <<EOF || exit 1 -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. -EOF -compare - $TMP.5 <<EOF || exit 1 -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. -EOF -compare - $TMP.6 <<EOF || exit 1 -## Copyright (C) 1990-2005, 2007-2009 Free Software -# Foundation, Inc. - -Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free -Software Foundation, Inc. -EOF -compare - $TMP.7 <<EOF || exit 1 -Copyright (C) 1990-2005, 2007-2009 Acme, Inc. - -# Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free -# Software Foundation, Inc. -EOF - -rm $TMP* - -## -------------- ## -## Current year. ## -## -------------- ## - -TMP=$TMP_BASE-current-year -YEAR=`date +%Y` -cat > $TMP <<EOF -'\" Copyright (C) 2006 -'\" Free Software Foundation, -'\" Inc. -EOF -update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 -'\" Copyright (C) 2006, $YEAR Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_USE_INTERVALS=1 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 -'\" Copyright (C) 2006, $YEAR Free Software Foundation, Inc. -EOF -rm $TMP* - -## ------------------ ## -## Surrounding text. ## -## ------------------ ## - -TMP=$TMP_BASE-surrounding-text -cat > $TMP <<EOF - Undisturbed text. -dnl Undisturbed text. -dnl Copyright (C) 89 -dnl Free Software Foundation, Inc. -dnl Undisturbed text. -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 - Undisturbed text. -dnl Undisturbed text. -dnl Copyright (C) 1989, 2010 Free Software Foundation, Inc. -dnl Undisturbed text. -EOF -rm $TMP* - -## --------------- ## -## Widest prefix. ## -## --------------- ## - -TMP=$TMP_BASE-widest-prefix -cat > $TMP <<EOF -#### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, -#### 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -#### 2008 Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 -#### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, -#### 1985, 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, -#### 2006, 2007, 2008, 2010 Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 -#### Copyright (C) 1976-1988, 1999-2008, 2010-2011 Free Software -#### Foundation, Inc. -EOF -rm $TMP* - -## ------------------- ## -## Prefix too large. ## -## ------------------- ## - -TMP=$TMP_BASE-prefix-too-large -cat > $TMP <<EOF -#### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, -#### 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -#### 2008 Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare - $TMP-stderr <<EOF || exit 1 -$TMP: warning: FSF copyright statement not found -EOF -compare - $TMP <<EOF || exit 1 -#### Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, -#### 1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -#### 2008 Free Software Foundation, Inc. -EOF -rm $TMP* - -## ------------- ## -## Blank lines. ## -## ------------- ## - -TMP=$TMP_BASE-blank-lines -cat > $TMP <<EOF -#Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, -# -#1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -#2008 Free Software Foundation, Inc. - -Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, - -1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -2008 Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare - $TMP-stderr <<EOF || exit 1 -$TMP: warning: FSF copyright statement not found -EOF -compare - $TMP <<EOF || exit 1 -#Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, -# -#1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -#2008 Free Software Foundation, Inc. - -Copyright (C) 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, - -1986, 1987, 1988, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, -2008 Free Software Foundation, Inc. -EOF -rm $TMP* - -## -------------- ## -## Leading tabs. ## -## -------------- ## - -TMP=$TMP_BASE-leading-tabs -cat > $TMP <<EOF - Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 98, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free - Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 - Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, - 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010 Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 - Copyright (C) 1987-1988, 1991-2011 Free Software Foundation, - Inc. -EOF -rm $TMP* - -## -------------------- ## -## Unusual whitespace. ## -## -------------------- ## - -TMP=$TMP_BASE-unusual-ws -cat > $TMP <<EOF - # Copyright (C) 87-88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - # 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - # 2009 Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 - # Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, - # 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - # 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software - # Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2011 UPDATE_COPYRIGHT_USE_INTERVALS=1 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 - # Copyright (C) 1987-1988, 1991-2011 Free Software - # Foundation, Inc. -EOF -rm $TMP* - -## --------- ## -## DOS EOL. ## -## --------- ## - -TMP=$TMP_BASE-dos-eol -tr @ '\015' > $TMP <<\EOF -Rem Copyright (C) 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@ -Rem 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,@ -Rem 2009 Free Software Foundation, Inc.@ -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -tr @ '\015' > $TMP-exp <<\EOF -Rem Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,@ -Rem 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,@ -Rem 2009, 2010 Free Software Foundation, Inc.@ -EOF -compare $TMP-exp $TMP || exit 1 -rm $TMP* - -## --------------- ## -## Omitted "(C)". ## -## --------------- ## - -TMP=$TMP_BASE-omitted-circle-c -cat > $TMP <<EOF - Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009 Free Software Foundation, Inc. -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP <<EOF || exit 1 - Copyright 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. -EOF -rm $TMP* - -## ------------------ ## -## C-style comments. ## -## ------------------ ## - -TMP=$TMP_BASE-c-style-comments -cat > $TMP.star <<EOF -/* Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - * 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - * 2009 Free Software Foundation, Inc. */ -EOF -cat > $TMP.space <<EOF - /*Copyright 87, 88, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 98, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009 Free Software Foundation, Inc. */ -EOF -cat > $TMP.single-line <<EOF -/* Copyright 87, 1991, 1992 Free Software Foundation, Inc. */ -EOF -cat > $TMP.single-line-wrapped <<EOF - /* Copyright 1988, 1991, 1992, 1993 Free Software Foundation, Inc. */ -EOF -cat > $TMP.extra-text-star <<EOF - /* Copyright 1987, 1988, 1991, 1992 Free Software Foundation, Inc. End - * More comments. */ -EOF -cat > $TMP.extra-text-space <<EOF - /* Copyright 1987, 1988, 1991, 1992 Free Software Foundation, Inc. *** - * End of comments. */ -EOF -UPDATE_COPYRIGHT_YEAR=2010 \ - update-copyright $TMP.* 1> $TMP-stdout 2> $TMP-stderr -compare /dev/null $TMP-stdout || exit 1 -compare /dev/null $TMP-stderr || exit 1 -compare - $TMP.star <<EOF || exit 1 -/* Copyright 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - * 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - * 2009, 2010 Free Software Foundation, Inc. */ -EOF -compare - $TMP.space <<EOF || exit 1 - /*Copyright 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010 Free Software Foundation, Inc. */ -EOF -compare - $TMP.single-line <<EOF || exit 1 -/* Copyright 1987, 1991, 1992, 2010 Free Software Foundation, Inc. */ -EOF -compare - $TMP.single-line-wrapped <<EOF || exit 1 - /* Copyright 1988, 1991, 1992, 1993, 2010 Free Software Foundation, - * Inc. */ -EOF -compare - $TMP.extra-text-star <<EOF || exit 1 - /* Copyright 1987, 1988, 1991, 1992, 2010 Free Software Foundation, - * Inc. End - * More comments. */ -EOF -compare - $TMP.extra-text-space <<EOF || exit 1 - /* Copyright 1987, 1988, 1991, 1992, 2010 Free Software Foundation, - Inc. *** - * End of comments. */ -EOF -rm $TMP* - -exit 0 diff --git a/gl/tests/test-vasnprintf.c b/gl/tests/test-vasnprintf.c index 15401eb4ca..6b2a0ff05a 100644 --- a/gl/tests/test-vasnprintf.c +++ b/gl/tests/test-vasnprintf.c @@ -1,5 +1,5 @@ /* Test of vasnprintf() and asnprintf() functions. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 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 diff --git a/gl/tests/test-vc-list-files-cvs.sh b/gl/tests/test-vc-list-files-cvs.sh deleted file mode 100755 index 017b8d2460..0000000000 --- a/gl/tests/test-vc-list-files-cvs.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh -# Unit tests for vc-list-files -# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. -# This file is part of the GNUlib Library. -# -# 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/>. */ - -: ${srcdir=.} -. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" . - -tmpdir=vc-cvs -repo=`pwd`/$tmpdir/repo - -fail=0 -for i in with-cvsu without; do - # On the first iteration, test using cvsu, if it's in your path. - # On the second iteration, ensure that cvsu fails, so we'll - # exercise the awk-using code. - if test $i = without; then - printf '%s\n' '#!/bin/sh' 'exit 1' > cvsu - chmod a+x cvsu - PATH=`pwd`:$PATH - export PATH - fi - ok=0 - mkdir $tmpdir && cd $tmpdir && - # without cvs, skip the test - # The double use of 'exit' is needed for the reference to $? inside the trap. - { ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 \ - || skip_ "cvs not found in PATH"; } && - mkdir w && cd w && - mkdir d && - touch d/a b c && - cvs -Q -d "$repo" import -m imp m M M0 && - cvs -Q -d "$repo" co m && cd m && - printf '%s\n' b c d/a > expected && - vc-list-files | sort > actual && - compare expected actual && - ok=1 - test $ok = 0 && fail=1 -done - -Exit $fail diff --git a/gl/tests/test-vc-list-files-git.sh b/gl/tests/test-vc-list-files-git.sh deleted file mode 100755 index 262d2ea3d2..0000000000 --- a/gl/tests/test-vc-list-files-git.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# Unit tests for vc-list-files -# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. -# This file is part of the GNUlib Library. -# -# 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/>. */ - -: ${srcdir=.} -. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" . - -tmpdir=vc-git-$$ -GIT_DIR= GIT_WORK_TREE=; unset GIT_DIR GIT_WORK_TREE - -fail=1 -mkdir $tmpdir && cd $tmpdir && - # without git, skip the test - # The double use of 'exit' is needed for the reference to $? inside the trap. - { ( git init -q ) > /dev/null 2>&1 \ - || skip_ "git not found in PATH"; } && - mkdir d && - touch d/a b c && - 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 && - vc-list-files > actual && - compare expected actual && - fail=0 - -Exit $fail diff --git a/gl/tests/test-verify.c b/gl/tests/test-verify.c index 3f89ba9058..512c021b7d 100644 --- a/gl/tests/test-verify.c +++ b/gl/tests/test-verify.c @@ -1,6 +1,6 @@ /* Test the "verify" module. - Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2005, 2009-2011 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 diff --git a/gl/tests/test-version-etc.c b/gl/tests/test-version-etc.c index fcc86218f8..00a5d7c6f9 100644 --- a/gl/tests/test-version-etc.c +++ b/gl/tests/test-version-etc.c @@ -1,5 +1,5 @@ /* Test suite for version-etc. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. This file is part of the GNUlib Library. This program is free software: you can redistribute it and/or modify diff --git a/gl/tests/test-version-etc.sh b/gl/tests/test-version-etc.sh index 61d404684f..c1ed827e40 100755 --- a/gl/tests/test-version-etc.sh +++ b/gl/tests/test-version-etc.sh @@ -1,6 +1,6 @@ #! /bin/sh # Test suite for version-etc. -# Copyright (C) 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 2009-2011 Free Software Foundation, Inc. # This file is part of the GNUlib Library. # # This program is free software: you can redistribute it and/or modify diff --git a/gl/tests/test-wchar.c b/gl/tests/test-wchar.c index 2a03d6b669..2d3bad7546 100644 --- a/gl/tests/test-wchar.c +++ b/gl/tests/test-wchar.c @@ -1,5 +1,5 @@ /* Test of <wchar.h> substitute. - Copyright (C) 2007-2010 Free Software Foundation, Inc. + Copyright (C) 2007-2011 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 diff --git a/gl/tests/w32sock.h b/gl/tests/w32sock.h deleted file mode 100644 index b472bd0501..0000000000 --- a/gl/tests/w32sock.h +++ /dev/null @@ -1,61 +0,0 @@ -/* w32sock.h --- internal auxilliary functions for Windows socket functions - - Copyright (C) 2008, 2009, 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 Paolo Bonzini */ - -#include <errno.h> - -/* Get O_RDWR and O_BINARY. */ -#include <fcntl.h> - -/* Get _get_osfhandle() and _open_osfhandle(). */ -#include <io.h> - -#define FD_TO_SOCKET(fd) ((SOCKET) _get_osfhandle ((fd))) -#define SOCKET_TO_FD(fh) (_open_osfhandle ((long) (fh), O_RDWR | O_BINARY)) - -static inline void -set_winsock_errno (void) -{ - int err = WSAGetLastError (); - - /* Map some WSAE* errors to the runtime library's error codes. */ - switch (err) - { - case WSA_INVALID_HANDLE: - errno = EBADF; - break; - case WSA_NOT_ENOUGH_MEMORY: - errno = ENOMEM; - break; - case WSA_INVALID_PARAMETER: - errno = EINVAL; - break; - case WSAEWOULDBLOCK: - errno = EWOULDBLOCK; - break; - case WSAENAMETOOLONG: - errno = ENAMETOOLONG; - break; - case WSAENOTEMPTY: - errno = ENOTEMPTY; - break; - default: - errno = (err > 10000 && err < 10025) ? err - 10000 : err; - break; - } -} diff --git a/gl/tests/zerosize-ptr.h b/gl/tests/zerosize-ptr.h index cfab200871..beeb3da3e0 100644 --- a/gl/tests/zerosize-ptr.h +++ b/gl/tests/zerosize-ptr.h @@ -1,5 +1,5 @@ /* Return a pointer to a zero-size object in memory. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2011 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 |