diff options
Diffstat (limited to 'lib/gl/tests')
47 files changed, 0 insertions, 4278 deletions
diff --git a/lib/gl/tests/Makefile.am b/lib/gl/tests/Makefile.am deleted file mode 100644 index 4be0a1f091..0000000000 --- a/lib/gl/tests/Makefile.am +++ /dev/null @@ -1,405 +0,0 @@ -## DO NOT EDIT! GENERATED AUTOMATICALLY! -## Process this file with automake to produce Makefile.in. -# Copyright (C) 2002-2010 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 -# Public License, this file may be distributed as part of a program -# that contains a configuration script generated by Autoconf, under -# the same distribution terms as the rest of that program. -# -# Generated by gnulib-tool. - -AUTOMAKE_OPTIONS = 1.5 foreign - -SUBDIRS = . -TESTS = -XFAIL_TESTS = -TESTS_ENVIRONMENT = -noinst_PROGRAMS = -check_PROGRAMS = -noinst_HEADERS = -noinst_LIBRARIES = -check_LIBRARIES = libtests.a -EXTRA_DIST = -BUILT_SOURCES = -SUFFIXES = -MOSTLYCLEANFILES = core *.stackdump -MOSTLYCLEANDIRS = -CLEANFILES = -DISTCLEANFILES = -MAINTAINERCLEANFILES = - -AM_CPPFLAGS = \ - -D@lgltests_WITNESS@=1 \ - -I. -I$(srcdir) \ - -I../.. -I$(srcdir)/../.. \ - -I../../gl -I$(srcdir)/../../gl - -LDADD = libtests.a ../../gl/liblgnu.la libtests.a $(LIBTESTS_LIBDEPS) - -libtests_a_SOURCES = -libtests_a_LIBADD = $(lgltests_LIBOBJS) -libtests_a_DEPENDENCIES = $(lgltests_LIBOBJS) -EXTRA_libtests_a_SOURCES = -AM_LIBTOOLFLAGS = --preserve-dup-deps - -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' srcdir='$(srcdir)' - -## begin gnulib module alloca-opt-tests - -TESTS += test-alloca-opt -check_PROGRAMS += test-alloca-opt - -EXTRA_DIST += test-alloca-opt.c - -## end gnulib module alloca-opt-tests - -## begin gnulib module arg-nonnull - -# The BUILT_SOURCES created by this Makefile snippet are not used via #include -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += arg-nonnull.h -# The arg-nonnull.h that gets inserted into generated .h files is the same as -# build-aux/arg-nonnull.h, except that it has the copyright header cut off. -arg-nonnull.h: $(top_srcdir)/build-aux/arg-nonnull.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/GL_ARG_NONNULL/,$$p' \ - < $(top_srcdir)/build-aux/arg-nonnull.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += arg-nonnull.h arg-nonnull.h-t - -ARG_NONNULL_H=arg-nonnull.h - -EXTRA_DIST += $(top_srcdir)/build-aux/arg-nonnull.h - -## end gnulib module arg-nonnull - -## begin gnulib module binary-io - -libtests_a_SOURCES += binary-io.h - -## end gnulib module binary-io - -## begin gnulib module binary-io-tests - -TESTS += test-binary-io.sh -check_PROGRAMS += test-binary-io - -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 -# statements but through direct file reference. Therefore this snippet must be -# present in all Makefile.am that need it. This is ensured by the applicability -# 'all' defined above. - -BUILT_SOURCES += c++defs.h -# The c++defs.h that gets inserted into generated .h files is the same as -# build-aux/c++defs.h, except that it has the copyright header cut off. -c++defs.h: $(top_srcdir)/build-aux/c++defs.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/_GL_CXXDEFS/,$$p' \ - < $(top_srcdir)/build-aux/c++defs.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += c++defs.h c++defs.h-t - -CXXDEFS_H=c++defs.h - -EXTRA_DIST += $(top_srcdir)/build-aux/c++defs.h - -## end gnulib module c++defs - -## begin gnulib module c-ctype-tests - -TESTS += test-c-ctype -check_PROGRAMS += test-c-ctype - -EXTRA_DIST += test-c-ctype.c macros.h - -## end gnulib module c-ctype-tests - -## begin gnulib module errno-tests - -TESTS += test-errno -check_PROGRAMS += test-errno - -EXTRA_DIST += test-errno.c - -## end gnulib module errno-tests - -## begin gnulib module fseeko-tests - -TESTS += test-fseeko.sh test-fseeko2.sh -check_PROGRAMS += test-fseeko -EXTRA_DIST += test-fseeko.c test-fseeko.sh test-fseeko2.sh signature.h macros.h - -## end gnulib module fseeko-tests - -## begin gnulib module ftello-tests - -TESTS += test-ftello.sh test-ftello2.sh test-ftello3 -check_PROGRAMS += test-ftello test-ftello3 -MOSTLYCLEANFILES += t-ftello3.tmp -EXTRA_DIST += test-ftello.c test-ftello.sh test-ftello2.sh test-ftello3.c signature.h macros.h - -## end gnulib module ftello-tests - -## begin gnulib module func-tests - -TESTS += test-func -check_PROGRAMS += test-func -EXTRA_DIST += test-func.c macros.h - -## end gnulib module func-tests - -## begin gnulib module getpagesize - - -EXTRA_DIST += getpagesize.c - -EXTRA_libtests_a_SOURCES += getpagesize.c - -## end gnulib module getpagesize - -## begin gnulib module intprops - - -EXTRA_DIST += intprops.h - -## end gnulib module intprops - -## begin gnulib module memchr-tests - -TESTS += test-memchr -check_PROGRAMS += test-memchr -EXTRA_DIST += test-memchr.c zerosize-ptr.h signature.h macros.h - -## end gnulib module memchr-tests - -## begin gnulib module netdb-tests - -TESTS += test-netdb -check_PROGRAMS += test-netdb -EXTRA_DIST += test-netdb.c - -## end gnulib module netdb-tests - -## begin gnulib module read-file-tests - -TESTS += test-read-file -check_PROGRAMS += test-read-file -EXTRA_DIST += test-read-file.c - -## end gnulib module read-file-tests - -## begin gnulib module snprintf-tests - -TESTS += test-snprintf -check_PROGRAMS += test-snprintf - -EXTRA_DIST += test-snprintf.c signature.h macros.h - -## end gnulib module snprintf-tests - -## begin gnulib module sockets-tests - -TESTS += test-sockets -check_PROGRAMS += test-sockets -test_sockets_LDADD = $(LDADD) @LIBSOCKET@ -EXTRA_DIST += test-sockets.c - -## end gnulib module sockets-tests - -## begin gnulib module stdbool-tests - -TESTS += test-stdbool -check_PROGRAMS += test-stdbool -EXTRA_DIST += test-stdbool.c - -## end gnulib module stdbool-tests - -## begin gnulib module stddef-tests - -TESTS += test-stddef -check_PROGRAMS += test-stddef -EXTRA_DIST += test-stddef.c - -## end gnulib module stddef-tests - -## begin gnulib module stdint-tests - -TESTS += test-stdint -check_PROGRAMS += test-stdint -EXTRA_DIST += test-stdint.c - -## end gnulib module stdint-tests - -## begin gnulib module stdio-tests - -TESTS += test-stdio -check_PROGRAMS += test-stdio -EXTRA_DIST += test-stdio.c - -## end gnulib module stdio-tests - -## begin gnulib module stdlib-tests - -TESTS += test-stdlib -check_PROGRAMS += test-stdlib -EXTRA_DIST += test-stdlib.c test-sys_wait.h - -## end gnulib module stdlib-tests - -## begin gnulib module string-tests - -TESTS += test-string -check_PROGRAMS += test-string -EXTRA_DIST += test-string.c - -## end gnulib module string-tests - -## begin gnulib module strings-tests - -TESTS += test-strings -check_PROGRAMS += test-strings -EXTRA_DIST += test-strings.c - -## end gnulib module strings-tests - -## begin gnulib module strverscmp-tests - -TESTS += test-strverscmp -check_PROGRAMS += test-strverscmp -EXTRA_DIST += test-strverscmp.c signature.h macros.h - -## end gnulib module strverscmp-tests - -## begin gnulib module sys_socket-tests - -TESTS += test-sys_socket -check_PROGRAMS += test-sys_socket -EXTRA_DIST += test-sys_socket.c - -## end gnulib module sys_socket-tests - -## begin gnulib module sys_stat-tests - -TESTS += test-sys_stat -check_PROGRAMS += test-sys_stat -EXTRA_DIST += test-sys_stat.c - -## end gnulib module sys_stat-tests - -## begin gnulib module time-tests - -TESTS += test-time -check_PROGRAMS += test-time -EXTRA_DIST += test-time.c - -## end gnulib module time-tests - -## begin gnulib module unistd-tests - -TESTS += test-unistd -check_PROGRAMS += test-unistd -EXTRA_DIST += test-unistd.c - -## end gnulib module unistd-tests - -## begin gnulib module vasnprintf-tests - -TESTS += test-vasnprintf -check_PROGRAMS += test-vasnprintf - -EXTRA_DIST += test-vasnprintf.c macros.h - -## end gnulib module vasnprintf-tests - -## begin gnulib module vasprintf-tests - -TESTS += test-vasprintf -check_PROGRAMS += test-vasprintf - -EXTRA_DIST += test-vasprintf.c signature.h macros.h - -## end gnulib module vasprintf-tests - -## begin gnulib module verify-tests - -TESTS_ENVIRONMENT += MAKE='$(MAKE)' -TESTS += test-verify test-verify.sh -check_PROGRAMS += test-verify -EXTRA_DIST += test-verify.c test-verify.sh init.sh - -## end gnulib module verify-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 -# The warn-on-use.h that gets inserted into generated .h files is the same as -# build-aux/warn-on-use.h, except that it has the copyright header cut off. -warn-on-use.h: $(top_srcdir)/build-aux/warn-on-use.h - $(AM_V_GEN)rm -f $@-t $@ && \ - sed -n -e '/^.ifndef/,$$p' \ - < $(top_srcdir)/build-aux/warn-on-use.h \ - > $@-t && \ - mv $@-t $@ -MOSTLYCLEANFILES += warn-on-use.h warn-on-use.h-t - -WARN_ON_USE_H=warn-on-use.h - -EXTRA_DIST += $(top_srcdir)/build-aux/warn-on-use.h - -## end gnulib module warn-on-use - -## begin gnulib module wchar-tests - -TESTS += test-wchar -check_PROGRAMS += test-wchar -EXTRA_DIST += test-wchar.c - -## end gnulib module wchar-tests - -## begin gnulib module dummy - -libtests_a_SOURCES += dummy.c - -## end gnulib module dummy - -# Clean up after Solaris cc. -clean-local: - rm -rf SunWS_cache - -mostlyclean-local: mostlyclean-generic - @for dir in '' $(MOSTLYCLEANDIRS); do \ - if test -n "$$dir" && test -d $$dir; then \ - echo "rmdir $$dir"; rmdir $$dir; \ - fi; \ - done; \ - : diff --git a/lib/gl/tests/binary-io.h b/lib/gl/tests/binary-io.h deleted file mode 100644 index 5451fd48f4..0000000000 --- a/lib/gl/tests/binary-io.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Binary mode I/O. - Copyright (C) 2001, 2003, 2005, 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/>. */ - -#ifndef _BINARY_H -#define _BINARY_H - -/* For systems that distinguish between text and binary I/O. - O_BINARY is usually declared in <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 -# if defined __EMX__ || defined __DJGPP__ || defined __CYGWIN__ -# include <io.h> /* declares setmode() */ -# else -# define setmode _setmode -# undef fileno -# define fileno _fileno -# endif -# ifdef __DJGPP__ -# include <unistd.h> /* declares isatty() */ - /* Avoid putting stdin/stdout in binary mode if it is connected to - the console, because that would make it impossible for the user - to interrupt the program through Ctrl-C or Ctrl-Break. */ -# define SET_BINARY(fd) ((void) (!isatty (fd) ? (setmode (fd, O_BINARY), 0) : 0)) -# else -# define SET_BINARY(fd) ((void) setmode (fd, O_BINARY)) -# 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 - -#endif /* _BINARY_H */ diff --git a/lib/gl/tests/dummy.c b/lib/gl/tests/dummy.c deleted file mode 100644 index 0f9a277962..0000000000 --- a/lib/gl/tests/dummy.c +++ /dev/null @@ -1,42 +0,0 @@ -/* A dummy file, to prevent empty libraries from breaking builds. - Copyright (C) 2004, 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/>. */ - -/* Some systems, reportedly OpenBSD and Mac OS X, refuse to create - libraries without any object files. You might get an error like: - - > ar cru .libs/libgl.a - > ar: no archive members specified - - Compiling this file, and adding its object file to the library, will - prevent the library from being empty. */ - -/* Some systems, such as Solaris with cc 5.0, refuse to work with libraries - that don't export any symbol. You might get an error like: - - > cc ... libgnu.a - > ild: (bad file) garbled symbol table in archive ../gllib/libgnu.a - - Compiling this file, and adding its object file to the library, will - prevent the library from exporting no symbols. */ - -#ifdef __sun -/* This declaration ensures that the library will export at least 1 symbol. */ -int gl_dummy_symbol; -#else -/* This declaration is solely to ensure that after preprocessing - this file is never empty. */ -typedef int dummy; -#endif diff --git a/lib/gl/tests/getpagesize.c b/lib/gl/tests/getpagesize.c deleted file mode 100644 index cc2526870f..0000000000 --- a/lib/gl/tests/getpagesize.c +++ /dev/null @@ -1,39 +0,0 @@ -/* getpagesize emulation for systems where it cannot be done in a C macro. - - 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 and Martin Lambers. */ - -#include <config.h> - -/* Specification. */ -#include <unistd.h> - -/* This implementation is only for native Win32 systems. */ -#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ - -# define WIN32_LEAN_AND_MEAN -# include <windows.h> - -int -getpagesize (void) -{ - SYSTEM_INFO system_info; - GetSystemInfo (&system_info); - return system_info.dwPageSize; -} - -#endif diff --git a/lib/gl/tests/init.sh b/lib/gl/tests/init.sh deleted file mode 100644 index 14f3b198d4..0000000000 --- a/lib/gl/tests/init.sh +++ /dev/null @@ -1,471 +0,0 @@ -# source this file; set up for tests - -# 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/>. - -# Using this file in a test -# ========================= -# -# The typical skeleton of a test looks like this: -# -# #!/bin/sh -# . "${srcdir=.}/init.sh"; path_prepend_ . -# Execute some commands. -# Note that these commands are executed in a subdirectory, therefore you -# need to prepend "../" to relative filenames in the build directory. -# Note that the "path_prepend_ ." is useful only if the body of your -# test invokes programs residing in the initial directory. -# For example, if the programs you want to test are in src/, and this test -# script is named tests/test-1, then you would use "path_prepend_ ../src", -# or perhaps export PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH" -# to all tests via automake's TESTS_ENVIRONMENT. -# Set the exit code 0 for success, 77 for skipped, or 1 or other for failure. -# Use the skip_ and fail_ functions to print a diagnostic and then exit -# with the corresponding exit code. -# Exit $? - -# Executing a test that uses this file -# ==================================== -# -# Running a single test: -# $ make check TESTS=test-foo.sh -# -# Running a single test, with verbose output: -# $ make check TESTS=test-foo.sh VERBOSE=yes -# -# Running a single test, with single-stepping: -# 1. Go into a sub-shell: -# $ bash -# 2. Set relevant environment variables from TESTS_ENVIRONMENT in the -# Makefile: -# $ export srcdir=../../tests # this is an example -# 3. Execute the commands from the test, copy&pasting them one by one: -# $ . "$srcdir/init.sh"; path_prepend_ . -# ... -# 4. Finally -# $ exit - -ME_=`expr "./$0" : '.*/\(.*\)$'` - -# We use a trap below for cleanup. This requires us to go through -# hoops to get the right exit status transported through the handler. -# So use `Exit STATUS' instead of `exit STATUS' inside of the tests. -# Turn off errexit here so that we don't trip the bug with OSF1/Tru64 -# sh inside this function. -Exit () { set +e; (exit $1); exit $1; } - -# Print warnings (e.g., about skipped and failed tests) to this file number. -# Override by defining to say, 9, in init.cfg, and putting say, -# "export ...ENVVAR_SETTINGS...; exec 9>&2; $(SHELL)" in the definition -# of TESTS_ENVIRONMENT in your tests/Makefile.am file. -# This is useful when using automake's parallel tests mode, to print -# 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; } - -# Sanitize this shell to POSIX mode, if possible. -DUALCASE=1; export DUALCASE -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; - esac -fi - -# We require $(...) support unconditionally. -# We require a few additional shell features only when $EXEEXT is nonempty, -# in order to support automatic $EXEEXT emulation: -# - hyphen-containing alias names -# - we prefer to use ${var#...} substitution, rather than having -# to work around lack of support for that feature. -# The following code attempts to find a shell with support for these features. -# If the current shell passes the test, we're done. Otherwise, test other -# shells until we find one that passes. If one is found, re-exec it. -# If no acceptable shell is found, skip the current test. -# -# The "...set -x; P=1 true 2>err..." test is to disqualify any shell that -# emits "P=1" into err, as /bin/sh from SunOS 5.11 and OpenBSD 4.7 do. -# -# Use "9" to indicate success (rather than 0), in case some shell acts -# like Solaris 10's /bin/sh but exits successfully instead of with status 2. - -# 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 -# ? - not ok -gl_shell_test_script_=' -test $(echo y) = y || exit 1 -score_=10 -if test "$VERBOSE" = yes; then - test -n "$( (exec 3>&1; set -x; P=1 true 2>&3) 2> /dev/null)" && score_=9 -fi -test -z "$EXEEXT" && exit $score_ -shopt -s expand_aliases -alias a-b="echo zoo" -v=abx - test ${v%x} = ab \ - && test ${v#a} = bx \ - && test $(a-b) = zoo \ - && exit $score_ -' - -if test "x$1" = "x--no-reexec"; then - shift -else - # Assume a working shell. Export to subshells (setup_ needs this). - gl_set_x_corrupts_stderr_=false - export gl_set_x_corrupts_stderr_ - - # Record the first marginally acceptable shell. - marginal_= - - # Search for a shell that meets our requirements. - for re_shell_ in __current__ "${CONFIG_SHELL:-no_shell}" \ - /bin/sh bash dash zsh pdksh fail - do - test "$re_shell_" = no_shell && continue - - # If we've made it all the way to the sentinel, "fail" without - # finding even a marginal shell, skip this test. - if test "$re_shell_" = fail; then - test -z "$marginal_" && skip_ failed to find an adequate shell - re_shell_=$marginal_ - break - fi - - # When testing the current shell, simply "eval" the test code. - # Otherwise, run it via $re_shell_ -c ... - if test "$re_shell_" = __current__; then - # 'eval'ing this code makes Solaris 10's /bin/sh exit with - # $? set to 2. It does not evaluate any of the code after the - # "unexpected" first `('. Thus, we must run it in a subshell. - ( eval "$gl_shell_test_script_" ) > /dev/null 2>&1 - else - "$re_shell_" -c "$gl_shell_test_script_" 2>/dev/null - fi - - st_=$? - - # $re_shell_ works just fine. Use it. - test $st_ = 10 && break - - # If this is our first marginally acceptable shell, remember it. - if test "$st_:$marginal_" = 9: ; then - marginal_="$re_shell_" - gl_set_x_corrupts_stderr_=true - fi - done - - if test "$re_shell_" != __current__; then - # Found a usable shell. Preserve -v and -x. - case $- in - *v*x* | *x*v*) opts_=-vx ;; - *v*) opts_=-v ;; - *x*) opts_=-x ;; - *) opts_= ;; - esac - exec "$re_shell_" $opts_ "$0" --no-reexec "$@" - echo "$ME_: exec failed" 1>&2 - exit 127 - fi -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 -# 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} -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_() { :; } - -if ( diff --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then - compare() { diff -u "$@"; } -elif ( cmp --version < /dev/null 2>&1 | grep GNU ) > /dev/null 2>&1; then - compare() { cmp -s "$@"; } -else - compare() { cmp "$@"; } -fi - -# An arbitrary prefix to help distinguish test directories. -testdir_prefix_() { printf gt; } - -# Run the user-overridable cleanup_ function, remove the temporary -# directory and exit with the incoming value of $?. -remove_tmp_() -{ - __st=$? - cleanup_ - # cd out of the directory we're about to remove - cd "$initial_cwd_" || cd / || cd /tmp - chmod -R u+rwx "$test_dir_" - # If removal fails and exit status was to be 0, then change it to 1. - rm -rf "$test_dir_" || { test $__st = 0 && __st=1; } - exit $__st -} - -# Given a directory name, DIR, if every entry in it that matches *.exe -# 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_() -{ - feb_dir_=$1 - feb_fail_=0 - feb_result_= - feb_sp_= - for feb_file_ in $feb_dir_/*.exe; do - # If there was no *.exe file, or there existed a file named "*.exe" that - # was deleted between the above glob expansion and the existence test - # below, just skip it. - test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \ - && 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. - feb_file_=${feb_file_##*/} - feb_file_=${feb_file_%.exe} - feb_result_="$feb_result_$feb_sp_$feb_file_";; - esac - feb_sp_=' ' - done - test $feb_fail_ = 0 && printf %s "$feb_result_" - return $feb_fail_ -} - -# Consider the files in directory, $1. -# For each file name of the form PROG.exe, create an alias named -# 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_() -{ - case $EXEEXT in - '') return 0 ;; - .exe) ;; - *) echo "$0: unexpected \$EXEEXT value: $EXEEXT" 1>&2; return 1 ;; - esac - - base_names_=`find_exe_basenames_ $1` \ - || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 1; } - - if test -n "$base_names_"; then - for base_ in $base_names_; do - alias "$base_"="$base_$EXEEXT" - done - fi - - return 0 -} - -# Use this function to prepend to PATH an absolute name for each -# specified, possibly-$initial_cwd_-relative, directory. -path_prepend_() -{ - while test $# != 0; do - path_dir_=$1 - case $path_dir_ in - '') fail_ "invalid path dir: '$1'";; - /*) abs_path_dir_=$path_dir_;; - *) abs_path_dir_=`cd "$initial_cwd_/$path_dir_" && echo "$PWD"` \ - || fail_ "invalid path dir: $path_dir_";; - esac - case $abs_path_dir_ in - *:*) fail_ "invalid path dir: '$abs_path_dir_'";; - esac - PATH="$abs_path_dir_:$PATH" - - # Create an alias, FOO, for each FOO.exe in this directory. - create_exe_shims_ "$abs_path_dir_" \ - || fail_ "something failed (above): $abs_path_dir_" - shift - done - export PATH -} - -setup_() -{ - if test "$VERBOSE" = yes; then - # Test whether set -x may cause the selected shell to corrupt an - # application's stderr. Many do, including zsh-4.3.10 and the /bin/sh - # from SunOS 5.11, OpenBSD 4.7 and Irix 5.x and 6.5. - # If enabling verbose output this way would cause trouble, simply - # issue a warning and refrain. - if $gl_set_x_corrupts_stderr_; then - warn_ "using SHELL=$SHELL with 'set -x' corrupts stderr" - else - set -x - fi - fi - - initial_cwd_=$PWD - - pfx_=`testdir_prefix_` - test_dir_=`mktempd_ "$initial_cwd_" "$pfx_-$ME_.XXXX"` \ - || fail_ "failed to create temporary directory in $initial_cwd_" - cd "$test_dir_" - - # As autoconf-generated configure scripts do, ensure that IFS - # is defined initially, so that saving and restoring $IFS works. - gl_init_sh_nl_=' -' - IFS=" "" $gl_init_sh_nl_" - - # This trap statement, along with a trap on 0 below, ensure that the - # temporary directory, $test_dir_, is removed upon exit as well as - # upon receipt of any of the listed signals. - for sig_ in 1 2 3 13 15; do - eval "trap 'Exit $(expr $sig_ + 128)' $sig_" - done -} - -# Create a temporary directory, much like mktemp -d does. -# Written by Jim Meyering. -# -# Usage: mktempd_ /tmp phoey.XXXXXXXXXX -# -# First, try to use the mktemp program. -# Failing that, we'll roll our own mktemp-like function: -# - try to get random bytes from /dev/urandom -# - failing that, generate output from a combination of quickly-varying -# sources and gzip. Ignore non-varying gzip header, and extract -# "random" bits from there. -# - given those bits, map to file-name bytes using tr, and try to create -# the desired directory. -# - make only $MAX_TRIES_ attempts - -# Helper function. Print $N pseudo-random bytes from a-zA-Z0-9. -rand_bytes_() -{ - n_=$1 - - # Maybe try openssl rand -base64 $n_prime_|tr '+/=\012' abcd first? - # But if they have openssl, they probably have mktemp, too. - - chars_=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 - dev_rand_=/dev/urandom - if test -r "$dev_rand_"; then - # Note: 256-length($chars_) == 194; 3 copies of $chars_ is 186 + 8 = 194. - dd ibs=$n_ count=1 if=$dev_rand_ 2>/dev/null \ - | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ - return - fi - - n_plus_50_=`expr $n_ + 50` - cmds_='date; date +%N; free; who -a; w; ps auxww; ps ef; netstat -n' - data_=` (eval "$cmds_") 2>&1 | gzip ` - - # Ensure that $data_ has length at least 50+$n_ - while :; do - len_=`echo "$data_"|wc -c` - test $n_plus_50_ -le $len_ && break; - data_=` (echo "$data_"; eval "$cmds_") 2>&1 | gzip ` - done - - echo "$data_" \ - | dd bs=1 skip=50 count=$n_ 2>/dev/null \ - | LC_ALL=C tr -c $chars_ 01234567$chars_$chars_$chars_ -} - -mktempd_() -{ - case $# in - 2);; - *) fail_ "Usage: $ME DIR TEMPLATE";; - esac - - destdir_=$1 - template_=$2 - - MAX_TRIES_=4 - - # Disallow any trailing slash on specified destdir: - # it would subvert the post-mktemp "case"-based destdir test. - case $destdir_ in - /) ;; - */) fail_ "invalid destination dir: remove trailing slash(es)";; - esac - - case $template_ in - *XXXX) ;; - *) 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 - - # The resulting name must be in the specified directory. - case $d in "$destdir_"*);; *) fail=1;; esac - - # It must have created the directory. - test -d "$d" || fail=1 - - # It must have 0700 permissions. Handle sticky "S" bits. - perms=`ls -dgo "$d" 2>/dev/null|tr S -` || fail=1 - case $perms in drwx------*) ;; *) fail=1;; esac - - test $fail = 0 && { - echo "$d" - return - } - - # If we reach this point, we'll have to create a directory manually. - - # Get a copy of the template without its suffix of X's. - base_template_=`echo "$template_"|sed 's/XX*$//'` - - # Calculate how many X's we've just removed. - template_length_=`echo "$template_" | wc -c` - nx_=`echo "$base_template_" | wc -c` - nx_=`expr $template_length_ - $nx_` - - err_= - i_=1 - while :; do - X_=`rand_bytes_ $nx_` - candidate_dir_="$destdir_/$base_template_$X_" - err_=`mkdir -m 0700 "$candidate_dir_" 2>&1` \ - && { echo "$candidate_dir_"; return; } - test $MAX_TRIES_ -le $i_ && break; - i_=`expr $i_ + 1` - done - fail_ "$err_" -} - -# If you want to override the testdir_prefix_ function, -# or to add more utility functions, use this file. -test -f "$srcdir/init.cfg" \ - && . "$srcdir/init.cfg" - -setup_ "$@" -# This trap is here, rather than in the setup_ function, because some -# shells run the exit trap at shell function exit, rather than script exit. -trap remove_tmp_ 0 diff --git a/lib/gl/tests/intprops.h b/lib/gl/tests/intprops.h deleted file mode 100644 index 0c2787582f..0000000000 --- a/lib/gl/tests/intprops.h +++ /dev/null @@ -1,87 +0,0 @@ -/* intprops.h -- properties of integer types - - Copyright (C) 2001, 2002, 2003, 2004, 2005, 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 Paul Eggert. */ - -#ifndef GL_INTPROPS_H -# define GL_INTPROPS_H - -# include <limits.h> - -/* The extra casts in the following macros work around compiler bugs, - e.g., in Cray C 5.0.3.0. */ - -/* True if the arithmetic type T is an integer type. bool counts as - an integer. */ -# define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) - -/* True if negative values of the signed integer type T use two's - complement, ones' complement, or signed magnitude representation, - respectively. Much GNU code assumes two's complement, but some - people like to be portable to all possible C hosts. */ -# define TYPE_TWOS_COMPLEMENT(t) ((t) ~ (t) 0 == (t) -1) -# define TYPE_ONES_COMPLEMENT(t) ((t) ~ (t) 0 == 0) -# define TYPE_SIGNED_MAGNITUDE(t) ((t) ~ (t) 0 < (t) -1) - -/* True if the arithmetic type T is signed. */ -# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) - -/* The maximum and minimum values for the integer type T. These - macros have undefined behavior if T is signed and has padding bits. - If this is a problem for you, please let us know how to fix it for - your host. */ -# define TYPE_MINIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) 0 \ - : TYPE_SIGNED_MAGNITUDE (t) \ - ? ~ (t) 0 \ - : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))) -# define TYPE_MAXIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) -1 \ - : ~ (~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)))) - -/* Return zero if T can be determined to be an unsigned type. - Otherwise, return 1. - When compiling with GCC, INT_STRLEN_BOUND uses this macro to obtain a - tighter bound. Otherwise, it overestimates the true bound by one byte - when applied to unsigned types of size 2, 4, 16, ... bytes. - The symbol signed_type_or_expr__ is private to this header file. */ -# if __GNUC__ >= 2 -# define signed_type_or_expr__(t) TYPE_SIGNED (__typeof__ (t)) -# else -# define signed_type_or_expr__(t) 1 -# endif - -/* Bound on length of the string representing an unsigned integer - value representable in B bits. log10 (2.0) < 146/485. The - smallest value of B where this bound is not tight is 2621. */ -# define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485) - -/* Bound on length of the string representing an integer type or expression T. - Subtract 1 for the sign bit if T is signed, and then add 1 more for - a minus sign if needed. */ -# define INT_STRLEN_BOUND(t) \ - (INT_BITS_STRLEN_BOUND (sizeof (t) * CHAR_BIT - signed_type_or_expr__ (t)) \ - + signed_type_or_expr__ (t)) - -/* Bound on buffer size needed to represent an integer type or expression T, - including the terminating null. */ -# define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) - -#endif /* GL_INTPROPS_H */ diff --git a/lib/gl/tests/macros.h b/lib/gl/tests/macros.h deleted file mode 100644 index 11db5a8af0..0000000000 --- a/lib/gl/tests/macros.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Common macros used by gnulib tests. - 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/>. */ - - -/* This file contains macros that are used by many gnulib tests. - Put here only frequently used macros, say, used by 10 tests or more. */ - -#include <stdio.h> -#include <stdlib.h> - -/* Define ASSERT_STREAM before including this file if ASSERT must - target a stream other than stderr. */ -#ifndef ASSERT_STREAM -# define ASSERT_STREAM stderr -#endif - -/* ASSERT (condition); - verifies that the specified condition is fulfilled. If not, a message - is printed to ASSERT_STREAM if defined (defaulting to stderr if - undefined) and the program is terminated with an error code. - - This macro has the following properties: - - The programmer specifies the expected condition, not the failure - condition. This simplifies thinking. - - The condition is tested always, regardless of compilation flags. - (Unlike the macro from <assert.h>.) - - On Unix platforms, the tester can debug the test program with a - debugger (provided core dumps are enabled: "ulimit -c unlimited"). - - For the sake of platforms where no debugger is available (such as - some mingw systems), an error message is printed on the error - stream that includes the source location of the ASSERT invocation. - */ -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (ASSERT_STREAM, "%s:%d: assertion failed\n", \ - __FILE__, __LINE__); \ - fflush (ASSERT_STREAM); \ - abort (); \ - } \ - } \ - while (0) - -/* SIZEOF (array) - returns the number of elements of an array. It works for arrays that are - declared outside functions and for local variables of array type. It does - *not* work for function parameters of array type, because they are actually - parameters of pointer type. */ -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) diff --git a/lib/gl/tests/signature.h b/lib/gl/tests/signature.h deleted file mode 100644 index 6e15c43a2a..0000000000 --- a/lib/gl/tests/signature.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Macro for checking that a function declaration is compliant. - 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/>. */ - -#ifndef SIGNATURE_CHECK - -/* Check that the function FN takes the specified arguments ARGS with - a return type of RET. This header is designed to be included after - <config.h> and the one system header that is supposed to contain - the function being checked, but prior to any other system headers - that are necessary for the unit test. Therefore, this file does - not include any system headers, nor reference anything outside of - the macro arguments. For an example, if foo.h should provide: - - extern int foo (char, float); - - then the unit test named test-foo.c would start out with: - - #include <config.h> - #include <foo.h> - #include "signature.h" - SIGNATURE_CHECK (foo, int, (char, float)); - #include <other.h> - ... -*/ -# define SIGNATURE_CHECK(fn, ret, args) \ - SIGNATURE_CHECK1 (fn, ret, args, __LINE__) - -/* Necessary to allow multiple SIGNATURE_CHECK lines in a unit test. - Note that the checks must not occupy the same line. */ -# define SIGNATURE_CHECK1(fn, ret, args, id) \ - SIGNATURE_CHECK2 (fn, ret, args, id) /* macroexpand line */ -# define SIGNATURE_CHECK2(fn, ret, args, id) \ - static ret (* _GL_UNUSED signature_check ## id) args = fn - -#endif /* SIGNATURE_CHECK */ diff --git a/lib/gl/tests/test-alloca-opt.c b/lib/gl/tests/test-alloca-opt.c deleted file mode 100644 index cfbecafcb9..0000000000 --- a/lib/gl/tests/test-alloca-opt.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Test of optional automatic memory allocation. - Copyright (C) 2005, 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 <alloca.h> - -#if HAVE_ALLOCA - -static void -do_allocation (int n) -{ - void *ptr = alloca (n); - (void) ptr; -} - -void (*func) (int) = do_allocation; - -#endif - -int -main () -{ -#if HAVE_ALLOCA - int i; - - /* Repeat a lot of times, to make sure there's no memory leak. */ - for (i = 0; i < 100000; i++) - { - /* Try various values. - n = 0 gave a crash on Alpha with gcc-2.5.8. - Some versions of MacOS X have a stack size limit of 512 KB. */ - func (34); - func (134); - func (399); - func (510823); - func (129321); - func (0); - func (4070); - func (4095); - func (1); - func (16582); - } -#endif - - return 0; -} diff --git a/lib/gl/tests/test-binary-io.c b/lib/gl/tests/test-binary-io.c deleted file mode 100644 index 125150b21f..0000000000 --- a/lib/gl/tests/test-binary-io.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Test of binary mode I/O. - Copyright (C) 2005, 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 Bruno Haible <bruno@clisp.org>, 2005. */ - -#include <config.h> - -#include "binary-io.h" - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> - -#include "macros.h" - -int -main () -{ - /* Test the O_BINARY macro. */ - { - int fd = - open ("t-bin-out2.tmp", O_CREAT | O_TRUNC | O_RDWR | O_BINARY, 0600); - if (write (fd, "Hello\n", 6) < 0) - exit (1); - close (fd); - } - { - struct stat statbuf; - if (stat ("t-bin-out2.tmp", &statbuf) < 0) - exit (1); - ASSERT (statbuf.st_size == 6); - } - unlink ("t-bin-out2.tmp"); - - /* Test the SET_BINARY macro. */ - SET_BINARY (1); - fputs ("Hello\n", stdout); - fclose (stdout); - fclose (stderr); - { - struct stat statbuf; - if (stat ("t-bin-out1.tmp", &statbuf) < 0) - exit (1); - ASSERT (statbuf.st_size == 6); - } - - return 0; -} diff --git a/lib/gl/tests/test-binary-io.sh b/lib/gl/tests/test-binary-io.sh deleted file mode 100755 index 33e128c309..0000000000 --- a/lib/gl/tests/test-binary-io.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -tmpfiles="" -trap 'rm -fr $tmpfiles' 1 2 3 15 - -tmpfiles="$tmpfiles t-bin-out1.tmp t-bin-out2.tmp" -./test-binary-io${EXEEXT} > t-bin-out1.tmp || exit 1 - -rm -fr $tmpfiles - -exit 0 diff --git a/lib/gl/tests/test-byteswap.c b/lib/gl/tests/test-byteswap.c deleted file mode 100644 index 0c036052f7..0000000000 --- a/lib/gl/tests/test-byteswap.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Test of <byteswap.h> substitute. - 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 Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <byteswap.h> - -#include "macros.h" - -int -main () -{ - ASSERT (bswap_16 (0xABCD) == 0xCDAB); - ASSERT (bswap_32 (0xDEADBEEF) == 0xEFBEADDE); - - return 0; -} diff --git a/lib/gl/tests/test-c-ctype.c b/lib/gl/tests/test-c-ctype.c deleted file mode 100644 index ebe594dd4f..0000000000 --- a/lib/gl/tests/test-c-ctype.c +++ /dev/null @@ -1,386 +0,0 @@ -/* Test of character handling in C locale. - Copyright (C) 2005, 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 Bruno Haible <bruno@clisp.org>, 2005. */ - -#include <config.h> - -#include "c-ctype.h" - -#include <locale.h> - -#include "macros.h" - -static void -test_all (void) -{ - int c; - - for (c = -0x80; c < 0x100; c++) - { - ASSERT (c_isascii (c) == (c >= 0 && c < 0x80)); - - switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - ASSERT (c_isalnum (c) == 1); - break; - default: - ASSERT (c_isalnum (c) == 0); - break; - } - - switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - ASSERT (c_isalpha (c) == 1); - break; - default: - ASSERT (c_isalpha (c) == 0); - break; - } - - switch (c) - { - case '\t': case ' ': - ASSERT (c_isblank (c) == 1); - break; - default: - ASSERT (c_isblank (c) == 0); - break; - } - - ASSERT (c_iscntrl (c) == ((c >= 0 && c < 0x20) || c == 0x7f)); - - switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - ASSERT (c_isdigit (c) == 1); - break; - default: - ASSERT (c_isdigit (c) == 0); - break; - } - - switch (c) - { - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': - case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': - case 's': case 't': case 'u': case 'v': case 'w': case 'x': - case 'y': case 'z': - ASSERT (c_islower (c) == 1); - break; - default: - ASSERT (c_islower (c) == 0); - break; - } - - ASSERT (c_isgraph (c) == ((c >= 0x20 && c < 0x7f) && c != ' ')); - - ASSERT (c_isprint (c) == (c >= 0x20 && c < 0x7f)); - - ASSERT (c_ispunct (c) == (c_isgraph (c) && !c_isalnum (c))); - - switch (c) - { - case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': - ASSERT (c_isspace (c) == 1); - break; - default: - ASSERT (c_isspace (c) == 0); - break; - } - - switch (c) - { - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': - case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': - case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': - case 'Y': case 'Z': - ASSERT (c_isupper (c) == 1); - break; - default: - ASSERT (c_isupper (c) == 0); - break; - } - - switch (c) - { - case '0': case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - ASSERT (c_isxdigit (c) == 1); - break; - default: - ASSERT (c_isxdigit (c) == 0); - break; - } - - switch (c) - { - case 'A': - ASSERT (c_tolower (c) == 'a'); - ASSERT (c_toupper (c) == c); - break; - case 'B': - ASSERT (c_tolower (c) == 'b'); - ASSERT (c_toupper (c) == c); - break; - case 'C': - ASSERT (c_tolower (c) == 'c'); - ASSERT (c_toupper (c) == c); - break; - case 'D': - ASSERT (c_tolower (c) == 'd'); - ASSERT (c_toupper (c) == c); - break; - case 'E': - ASSERT (c_tolower (c) == 'e'); - ASSERT (c_toupper (c) == c); - break; - case 'F': - ASSERT (c_tolower (c) == 'f'); - ASSERT (c_toupper (c) == c); - break; - case 'G': - ASSERT (c_tolower (c) == 'g'); - ASSERT (c_toupper (c) == c); - break; - case 'H': - ASSERT (c_tolower (c) == 'h'); - ASSERT (c_toupper (c) == c); - break; - case 'I': - ASSERT (c_tolower (c) == 'i'); - ASSERT (c_toupper (c) == c); - break; - case 'J': - ASSERT (c_tolower (c) == 'j'); - ASSERT (c_toupper (c) == c); - break; - case 'K': - ASSERT (c_tolower (c) == 'k'); - ASSERT (c_toupper (c) == c); - break; - case 'L': - ASSERT (c_tolower (c) == 'l'); - ASSERT (c_toupper (c) == c); - break; - case 'M': - ASSERT (c_tolower (c) == 'm'); - ASSERT (c_toupper (c) == c); - break; - case 'N': - ASSERT (c_tolower (c) == 'n'); - ASSERT (c_toupper (c) == c); - break; - case 'O': - ASSERT (c_tolower (c) == 'o'); - ASSERT (c_toupper (c) == c); - break; - case 'P': - ASSERT (c_tolower (c) == 'p'); - ASSERT (c_toupper (c) == c); - break; - case 'Q': - ASSERT (c_tolower (c) == 'q'); - ASSERT (c_toupper (c) == c); - break; - case 'R': - ASSERT (c_tolower (c) == 'r'); - ASSERT (c_toupper (c) == c); - break; - case 'S': - ASSERT (c_tolower (c) == 's'); - ASSERT (c_toupper (c) == c); - break; - case 'T': - ASSERT (c_tolower (c) == 't'); - ASSERT (c_toupper (c) == c); - break; - case 'U': - ASSERT (c_tolower (c) == 'u'); - ASSERT (c_toupper (c) == c); - break; - case 'V': - ASSERT (c_tolower (c) == 'v'); - ASSERT (c_toupper (c) == c); - break; - case 'W': - ASSERT (c_tolower (c) == 'w'); - ASSERT (c_toupper (c) == c); - break; - case 'X': - ASSERT (c_tolower (c) == 'x'); - ASSERT (c_toupper (c) == c); - break; - case 'Y': - ASSERT (c_tolower (c) == 'y'); - ASSERT (c_toupper (c) == c); - break; - case 'Z': - ASSERT (c_tolower (c) == 'z'); - ASSERT (c_toupper (c) == c); - break; - case 'a': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'A'); - break; - case 'b': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'B'); - break; - case 'c': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'C'); - break; - case 'd': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'D'); - break; - case 'e': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'E'); - break; - case 'f': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'F'); - break; - case 'g': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'G'); - break; - case 'h': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'H'); - break; - case 'i': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'I'); - break; - case 'j': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'J'); - break; - case 'k': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'K'); - break; - case 'l': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'L'); - break; - case 'm': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'M'); - break; - case 'n': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'N'); - break; - case 'o': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'O'); - break; - case 'p': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'P'); - break; - case 'q': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'Q'); - break; - case 'r': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'R'); - break; - case 's': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'S'); - break; - case 't': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'T'); - break; - case 'u': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'U'); - break; - case 'v': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'V'); - break; - case 'w': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'W'); - break; - case 'x': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'X'); - break; - case 'y': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'Y'); - break; - case 'z': - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == 'Z'); - break; - default: - ASSERT (c_tolower (c) == c); - ASSERT (c_toupper (c) == c); - break; - } - } -} - -int -main () -{ - test_all (); - - setlocale (LC_ALL, "de_DE"); - test_all (); - - setlocale (LC_ALL, "ja_JP.EUC-JP"); - test_all (); - - return 0; -} diff --git a/lib/gl/tests/test-errno.c b/lib/gl/tests/test-errno.c deleted file mode 100644 index 129b236fe9..0000000000 --- a/lib/gl/tests/test-errno.c +++ /dev/null @@ -1,117 +0,0 @@ -/* Test of <errno.h> substitute. - 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 <errno.h> - -/* Verify that the POSIX mandated errno values exist and can be used as - initializers outside of a function. - The variable names happen to match the Linux/x86 error numbers. */ -int e1 = EPERM; -int e2 = ENOENT; -int e3 = ESRCH; -int e4 = EINTR; -int e5 = EIO; -int e6 = ENXIO; -int e7 = E2BIG; -int e8 = ENOEXEC; -int e9 = EBADF; -int e10 = ECHILD; -int e11 = EAGAIN; -int e11a = EWOULDBLOCK; -int e12 = ENOMEM; -int e13 = EACCES; -int e14 = EFAULT; -int e16 = EBUSY; -int e17 = EEXIST; -int e18 = EXDEV; -int e19 = ENODEV; -int e20 = ENOTDIR; -int e21 = EISDIR; -int e22 = EINVAL; -int e23 = ENFILE; -int e24 = EMFILE; -int e25 = ENOTTY; -int e26 = ETXTBSY; -int e27 = EFBIG; -int e28 = ENOSPC; -int e29 = ESPIPE; -int e30 = EROFS; -int e31 = EMLINK; -int e32 = EPIPE; -int e33 = EDOM; -int e34 = ERANGE; -int e35 = EDEADLK; -int e36 = ENAMETOOLONG; -int e37 = ENOLCK; -int e38 = ENOSYS; -int e39 = ENOTEMPTY; -int e40 = ELOOP; -int e42 = ENOMSG; -int e43 = EIDRM; -int e67 = ENOLINK; -int e71 = EPROTO; -int e72 = EMULTIHOP; -int e74 = EBADMSG; -int e75 = EOVERFLOW; -int e84 = EILSEQ; -int e88 = ENOTSOCK; -int e89 = EDESTADDRREQ; -int e90 = EMSGSIZE; -int e91 = EPROTOTYPE; -int e92 = ENOPROTOOPT; -int e93 = EPROTONOSUPPORT; -int e95 = EOPNOTSUPP; -int e95a = ENOTSUP; -int e97 = EAFNOSUPPORT; -int e98 = EADDRINUSE; -int e99 = EADDRNOTAVAIL; -int e100 = ENETDOWN; -int e101 = ENETUNREACH; -int e102 = ENETRESET; -int e103 = ECONNABORTED; -int e104 = ECONNRESET; -int e105 = ENOBUFS; -int e106 = EISCONN; -int e107 = ENOTCONN; -int e110 = ETIMEDOUT; -int e111 = ECONNREFUSED; -int e113 = EHOSTUNREACH; -int e114 = EALREADY; -int e115 = EINPROGRESS; -int e116 = ESTALE; -int e122 = EDQUOT; -int e125 = ECANCELED; - -/* Don't verify that these errno values are all different, except for possibly - EWOULDBLOCK == EAGAIN. Even Linux/x86 does not pass this check: it has - ENOTSUP == EOPNOTSUPP. */ - -int -main () -{ - /* Verify that errno can be assigned. */ - errno = EOVERFLOW; - - /* snprintf() callers want to distinguish EINVAL and EOVERFLOW. */ - if (errno == EINVAL) - return 1; - - return 0; -} diff --git a/lib/gl/tests/test-fseeko.c b/lib/gl/tests/test-fseeko.c deleted file mode 100644 index be2a78dce1..0000000000 --- a/lib/gl/tests/test-fseeko.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Test of fseeko() function. - Copyright (C) 2007, 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>, 2007. */ - -#include <config.h> - -/* None of the files accessed by this test are large, so disable the - fseek link warning if we are not using the gnulib fseek module. */ -#define _GL_NO_LARGE_FILES -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (fseeko, int, (FILE *, off_t, int)); - - -#include "macros.h" - -#ifndef FUNC_UNGETC_BROKEN -# define FUNC_UNGETC_BROKEN 0 -#endif - -int -main (int argc, char **argv _GL_UNUSED) -{ - /* Assume stdin is non-empty, seekable, and starts with '#!/bin/sh' - iff argc > 1. */ - int expected = argc > 1 ? 0 : -1; - /* Exit with success only if fseek/fseeko agree. */ - int r1 = fseeko (stdin, 0, SEEK_CUR); - int r2 = fseek (stdin, 0, SEEK_CUR); - ASSERT (r1 == r2 && r1 == expected); - if (argc > 1) - { - /* Test that fseek discards previously read ungetc data. */ - int ch = fgetc (stdin); - ASSERT (ch == '#'); - ASSERT (ungetc (ch, stdin) == ch); - ASSERT (fseeko (stdin, 2, SEEK_SET) == 0); - ch = fgetc (stdin); - ASSERT (ch == '/'); - if (2 < argc) - { - if (FUNC_UNGETC_BROKEN) - { - fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n", - stderr); - return 77; - } - /* Test that fseek discards random ungetc data. */ - ASSERT (ungetc (ch ^ 0xff, stdin) == (ch ^ 0xff)); - } - ASSERT (fseeko (stdin, 0, SEEK_END) == 0); - ASSERT (fgetc (stdin) == EOF); - /* Test that fseek resets end-of-file marker. */ - ASSERT (feof (stdin)); - ASSERT (fseeko (stdin, 0, SEEK_END) == 0); - ASSERT (!feof (stdin)); - } - return 0; -} diff --git a/lib/gl/tests/test-fseeko.sh b/lib/gl/tests/test-fseeko.sh deleted file mode 100755 index 5c558272cb..0000000000 --- a/lib/gl/tests/test-fseeko.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -./test-fseeko${EXEEXT} 1 < "$srcdir/test-fseeko.sh" || exit 1 -echo hi | ./test-fseeko${EXEEXT} || exit 1 -exit 0 diff --git a/lib/gl/tests/test-fseeko2.sh b/lib/gl/tests/test-fseeko2.sh deleted file mode 100755 index 6e1130cf58..0000000000 --- a/lib/gl/tests/test-fseeko2.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec ./test-fseeko${EXEEXT} 1 2 < "$srcdir/test-fseeko2.sh" diff --git a/lib/gl/tests/test-ftello.c b/lib/gl/tests/test-ftello.c deleted file mode 100644 index 5fae570f28..0000000000 --- a/lib/gl/tests/test-ftello.c +++ /dev/null @@ -1,118 +0,0 @@ -/* Test of ftello() function. - Copyright (C) 2007, 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>, 2007. */ - -#include <config.h> - -/* None of the files accessed by this test are large, so disable the - fseek link warning if we are not using the gnulib fseek module. */ -#define _GL_NO_LARGE_FILES -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (ftello, off_t, (FILE *)); - -#include "binary-io.h" -#include "macros.h" - -#ifndef FUNC_UNGETC_BROKEN -# define FUNC_UNGETC_BROKEN 0 -#endif - -int -main (int argc, char **argv _GL_UNUSED) -{ - int ch; - /* Assume stdin is seekable iff argc > 1. */ - if (argc == 1) - { - ASSERT (ftell (stdin) == -1); - ASSERT (ftello (stdin) == -1); - return 0; - } - - /* mingw ftell is unreliable on text mode input. */ - SET_BINARY (0); - - /* Simple tests. For each test, make sure ftell and ftello agree. */ - ASSERT (ftell (stdin) == 0); - ASSERT (ftello (stdin) == 0); - - ch = fgetc (stdin); - ASSERT (ch == '#'); - ASSERT (ftell (stdin) == 1); - ASSERT (ftello (stdin) == 1); - - /* Test ftell after ungetc of read input. */ - ch = ungetc ('#', stdin); - ASSERT (ch == '#'); - ASSERT (ftell (stdin) == 0); - ASSERT (ftello (stdin) == 0); - - ch = fgetc (stdin); - ASSERT (ch == '#'); - ASSERT (ftell (stdin) == 1); - ASSERT (ftello (stdin) == 1); - - /* Test ftell after fseek. */ - ASSERT (fseek (stdin, 2, SEEK_SET) == 0); - ASSERT (ftell (stdin) == 2); - ASSERT (ftello (stdin) == 2); - - /* Test ftell after random ungetc. */ - ch = fgetc (stdin); - ASSERT (ch == '/'); - ch = ungetc ('@', stdin); - ASSERT (ch == '@'); - ASSERT (ftell (stdin) == 2); - ASSERT (ftello (stdin) == 2); - - ch = fgetc (stdin); - ASSERT (ch == '@'); - ASSERT (ftell (stdin) == 3); - ASSERT (ftello (stdin) == 3); - - if (2 < argc) - { - if (FUNC_UNGETC_BROKEN) - { - fputs ("Skipping test: ungetc cannot handle arbitrary bytes\n", - stderr); - return 77; - } - /* Test ftell after ungetc without read. */ - ASSERT (fseek (stdin, 0, SEEK_CUR) == 0); - ASSERT (ftell (stdin) == 3); - ASSERT (ftello (stdin) == 3); - - ch = ungetc ('~', stdin); - ASSERT (ch == '~'); - ASSERT (ftell (stdin) == 2); - ASSERT (ftello (stdin) == 2); - } - -#if !defined __MINT__ /* FreeMiNT has problems seeking past end of file */ - /* Test ftell beyond end of file. */ - ASSERT (fseek (stdin, 0, SEEK_END) == 0); - ch = ftello (stdin); - ASSERT (fseek (stdin, 10, SEEK_END) == 0); - ASSERT (ftell (stdin) == ch + 10); - ASSERT (ftello (stdin) == ch + 10); -#endif - - return 0; -} diff --git a/lib/gl/tests/test-ftello.sh b/lib/gl/tests/test-ftello.sh deleted file mode 100755 index 33d2e838db..0000000000 --- a/lib/gl/tests/test-ftello.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -./test-ftello${EXEEXT} 1 < "$srcdir/test-ftello.sh" || exit 1 -echo hi | ./test-ftello${EXEEXT} || exit 1 -exit 0 diff --git a/lib/gl/tests/test-ftello2.sh b/lib/gl/tests/test-ftello2.sh deleted file mode 100755 index ba750b003d..0000000000 --- a/lib/gl/tests/test-ftello2.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec ./test-ftello${EXEEXT} 1 2 < "$srcdir/test-ftello2.sh" diff --git a/lib/gl/tests/test-ftello3.c b/lib/gl/tests/test-ftello3.c deleted file mode 100644 index b07ba64610..0000000000 --- a/lib/gl/tests/test-ftello3.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Test of ftello() 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/>. */ - -#include <config.h> - -/* None of the files accessed by this test are large, so disable the - fseek link warning if we are not using the gnulib fseek module. */ -#define _GL_NO_LARGE_FILES -#include <stdio.h> - -#include <string.h> - -#include "macros.h" - -#define TESTFILE "t-ftello3.tmp" - -int -main (void) -{ - FILE *fp; - - /* Create a file with some contents. */ - fp = fopen (TESTFILE, "w"); - if (fp == NULL) - goto skip; - if (fwrite ("foogarsh", 1, 8, fp) < 8) - goto skip; - if (fclose (fp)) - goto skip; - - /* The file's contents is now "foogarsh". */ - - /* Try writing after reading to EOF. */ - fp = fopen (TESTFILE, "r+"); - if (fp == NULL) - goto skip; - if (fseek (fp, -1, SEEK_END)) - goto skip; - ASSERT (getc (fp) == 'h'); - ASSERT (getc (fp) == EOF); - ASSERT (ftello (fp) == 8); - ASSERT (ftello (fp) == 8); - ASSERT (putc ('!', fp) == '!'); - ASSERT (ftello (fp) == 9); - ASSERT (fclose (fp) == 0); - fp = fopen (TESTFILE, "r"); - if (fp == NULL) - goto skip; - { - char buf[10]; - ASSERT (fread (buf, 1, 10, fp) == 9); - ASSERT (memcmp (buf, "foogarsh!", 9) == 0); - } - ASSERT (fclose (fp) == 0); - - /* The file's contents is now "foogarsh!". */ - - remove (TESTFILE); - return 0; - - skip: - fprintf (stderr, "Skipping test: prerequisite file operations failed.\n"); - remove (TESTFILE); - return 77; -} diff --git a/lib/gl/tests/test-func.c b/lib/gl/tests/test-func.c deleted file mode 100644 index 476e04dd9e..0000000000 --- a/lib/gl/tests/test-func.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Test whether __func__ is available - 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 Bruno Haible <bruno@clisp.org>, 2008. */ - -#include <config.h> - -#include <string.h> - -#include "macros.h" - -int -main () -{ - ASSERT (strlen (__func__) > 0); - - /* On SunPRO C 5.9, sizeof __func__ evaluates to 0. The compiler warns: - "warning: null dimension: sizeof()". */ -#if !defined __SUNPRO_C - ASSERT (strlen (__func__) + 1 == sizeof __func__); -#endif - - ASSERT (strcmp (__func__, "main") == 0 - || strcmp (__func__, "<unknown function>") == 0); - - return 0; -} diff --git a/lib/gl/tests/test-memchr.c b/lib/gl/tests/test-memchr.c deleted file mode 100644 index 05e1bfaed2..0000000000 --- a/lib/gl/tests/test-memchr.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 2008-2010 Free Software Foundation, Inc. - * Written by Eric Blake and Bruno Haible - * - * 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/>. */ - -#include <config.h> - -#include <string.h> - -#include "signature.h" -SIGNATURE_CHECK (memchr, void *, (void const *, int, size_t)); - -#include <stdlib.h> - -#include "zerosize-ptr.h" -#include "macros.h" - -/* Calculating void * + int is not portable, so this wrapper converts - to char * to make the tests easier to write. */ -#define MEMCHR (char *) memchr - -int -main (void) -{ - size_t n = 0x100000; - char *input = malloc (n); - ASSERT (input); - - input[0] = 'a'; - input[1] = 'b'; - memset (input + 2, 'c', 1024); - memset (input + 1026, 'd', n - 1028); - input[n - 2] = 'e'; - input[n - 1] = 'a'; - - /* Basic behavior tests. */ - ASSERT (MEMCHR (input, 'a', n) == input); - - ASSERT (MEMCHR (input, 'a', 0) == NULL); - ASSERT (MEMCHR (zerosize_ptr (), 'a', 0) == NULL); - - ASSERT (MEMCHR (input, 'b', n) == input + 1); - ASSERT (MEMCHR (input, 'c', n) == input + 2); - ASSERT (MEMCHR (input, 'd', n) == input + 1026); - - ASSERT (MEMCHR (input + 1, 'a', n - 1) == input + n - 1); - ASSERT (MEMCHR (input + 1, 'e', n - 1) == input + n - 2); - ASSERT (MEMCHR (input + 1, 0x789abc00 | 'e', n - 1) == input + n - 2); - - ASSERT (MEMCHR (input, 'f', n) == NULL); - ASSERT (MEMCHR (input, '\0', n) == NULL); - - /* Check that a very long haystack is handled quickly if the byte is - found near the beginning. */ - { - size_t repeat = 10000; - for (; repeat > 0; repeat--) - { - ASSERT (MEMCHR (input, 'c', n) == input + 2); - } - } - - /* Alignment tests. */ - { - int i, j; - for (i = 0; i < 32; i++) - { - for (j = 0; j < 256; j++) - input[i + j] = j; - for (j = 0; j < 256; j++) - { - ASSERT (MEMCHR (input + i, j, 256) == input + i + j); - } - } - } - - /* Check that memchr() does not read past the first occurrence of the - byte being searched. See the Austin Group's clarification - <http://www.opengroup.org/austin/docs/austin_454.txt>. - Test both '\0' and something else, since some implementations - special-case searching for NUL. - */ - { - char *page_boundary = (char *) zerosize_ptr (); - /* Too small, and we miss cache line boundary tests; too large, - and the test takes cubically longer to complete. */ - int limit = 257; - - if (page_boundary != NULL) - { - for (n = 1; n <= limit; n++) - { - char *mem = page_boundary - n; - memset (mem, 'X', n); - ASSERT (MEMCHR (mem, 'U', n) == NULL); - ASSERT (MEMCHR (mem, 0, n) == NULL); - - { - size_t i; - size_t k; - - for (i = 0; i < n; i++) - { - mem[i] = 'U'; - for (k = i + 1; k < n + limit; k++) - ASSERT (MEMCHR (mem, 'U', k) == mem + i); - mem[i] = 0; - for (k = i + 1; k < n + limit; k++) - ASSERT (MEMCHR (mem, 0, k) == mem + i); - mem[i] = 'X'; - } - } - } - } - } - - free (input); - - return 0; -} diff --git a/lib/gl/tests/test-netdb.c b/lib/gl/tests/test-netdb.c deleted file mode 100644 index 697bbc8dbf..0000000000 --- a/lib/gl/tests/test-netdb.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Test of <netdb.h> substitute. - Copyright (C) 2007-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 Simon Josefsson <simon@josefsson.org>, 2008. */ - -#include <config.h> -#include <netdb.h> - -/* Check that the 'struct hostent' type is defined. */ -struct hostent t1; - -/* Check that the 'socklen_t' type is defined. */ -socklen_t t2; - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-read-file.c b/lib/gl/tests/test-read-file.c deleted file mode 100644 index daa61668c6..0000000000 --- a/lib/gl/tests/test-read-file.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2006-2007, 2010 Free Software Foundation, Inc. - * Written by Simon Josefsson - * - * 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/>. */ - -#include <config.h> - -#include "read-file.h" - -#include <stdio.h> -#include <stdlib.h> -#include <sys/stat.h> - -#define FILE1 "/etc/resolv.conf" -#define FILE2 "/dev/null" - -int -main (void) -{ - struct stat statbuf; - int err = 0; - - /* We can perform the test only if the file exists and is readable. - Test whether it exists, then assume it is world-readable. */ - if (stat (FILE1, &statbuf) >= 0) - { - size_t len; - char *out = read_file (FILE1, &len); - - if (!out) - { - perror ("Could not read file"); - err = 1; - } - else - { - if (out[len] != '\0') - { - perror ("BAD: out[len] not zero"); - err = 1; - } - - if (S_ISREG (statbuf.st_mode)) - { - /* FILE1 is a regular file or a symlink to a regular file. */ - if (len != statbuf.st_size) - { - fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE1); - err = 1; - } - } - else - { - /* Assume FILE1 is not empty. */ - if (len == 0) - { - fprintf (stderr, "Read nothing from %s\n", FILE1); - err = 1; - } - } - free (out); - } - } - - /* We can perform the test only if the file exists and is readable. - Test whether it exists, then assume it is world-readable. */ - if (stat (FILE2, &statbuf) >= 0) - { - size_t len; - char *out = read_file (FILE2, &len); - - if (!out) - { - perror ("Could not read file"); - err = 1; - } - else - { - if (out[len] != '\0') - { - perror ("BAD: out[len] not zero"); - err = 1; - } - - /* /dev/null should always be empty. Ignore statbuf.st_size, since it - is not a regular file. */ - if (len != 0) - { - fprintf (stderr, "Read %ld from %s...\n", (unsigned long) len, FILE2); - err = 1; - } - free (out); - } - } - - return err; -} diff --git a/lib/gl/tests/test-snprintf.c b/lib/gl/tests/test-snprintf.c deleted file mode 100644 index 62a411bf91..0000000000 --- a/lib/gl/tests/test-snprintf.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Test of snprintf() 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 Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (snprintf, int, (char *, size_t, char const *, ...)); - -#include <string.h> - -#include "macros.h" - -int -main (int argc, char *argv[]) -{ - char buf[8]; - int size; - int retval; - - for (size = 0; size <= 8; size++) - { - memcpy (buf, "DEADBEEF", 8); - retval = snprintf (buf, size, "%d", 12345); - if (size < 6) - { -#if CHECK_SNPRINTF_POSIX - ASSERT (retval < 0 || retval >= size); -#endif - if (size > 0) - { - ASSERT (memcmp (buf, "12345", size - 1) == 0); - ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size); - } -#if !CHECK_SNPRINTF_POSIX - if (size > 0) -#endif - ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); - } - else - { - ASSERT (retval == 5); - ASSERT (memcmp (buf, "12345\0EF", 8) == 0); - } - } - - return 0; -} diff --git a/lib/gl/tests/test-sockets.c b/lib/gl/tests/test-sockets.c deleted file mode 100644 index ab5460ad46..0000000000 --- a/lib/gl/tests/test-sockets.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. - * Written by Simon Josefsson. - * - * 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/>. */ - -#include <config.h> - -#include <stdio.h> - -#include "sockets.h" - -int -main (void) -{ - int err; - - err = gl_sockets_startup (SOCKETS_1_1); - if (err != 0) - { - printf ("wsastartup failed %d\n", err); - return 1; - } - - err = gl_sockets_cleanup (); - if (err != 0) - { - printf ("wsacleanup failed %d\n", err); - return 1; - } - - (void) gl_fd_to_handle (0); - - return 0; -} diff --git a/lib/gl/tests/test-stdbool.c b/lib/gl/tests/test-stdbool.c deleted file mode 100644 index 2103d8bab9..0000000000 --- a/lib/gl/tests/test-stdbool.c +++ /dev/null @@ -1,95 +0,0 @@ -/* Test of <stdbool.h> substitute. - Copyright (C) 2002-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. */ - -/* We want this test to succeed even when using gcc's -Werror; but to - do that requires a pragma that didn't exist before 4.3.0. */ -#ifndef __GNUC__ -# define ADDRESS_CHECK_OKAY -#elif __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) -/* No way to silence -Waddress. */ -#else -# pragma GCC diagnostic ignored "-Waddress" -# define ADDRESS_CHECK_OKAY -#endif - -#include <config.h> - -#include <stdbool.h> - -#ifndef bool - "error: bool is not defined" -#endif -#ifndef false - "error: false is not defined" -#endif -#if false - "error: false is not 0" -#endif -#ifndef true - "error: true is not defined" -#endif -#if true != 1 - "error: true is not 1" -#endif -#ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" -#endif - -/* 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__ -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. */ -char d[(bool) 0.5 == true ? 1 : -1]; -# ifdef ADDRESS_CHECK_OKAY -bool e = &s; -# 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. */ -char i[sizeof s.t]; -#endif -enum { j = false, k = true, l = false * true, m = true * 256 }; -_Bool n[m]; -char o[sizeof n == m * sizeof n[0] ? 1 : -1]; -char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; -/* Catch a bug in an HP-UX C compiler. See - http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html - */ -_Bool q = true; -_Bool *pq = &q; - -int -main () -{ - /* 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]; -} diff --git a/lib/gl/tests/test-stddef.c b/lib/gl/tests/test-stddef.c deleted file mode 100644 index 2c392c7547..0000000000 --- a/lib/gl/tests/test-stddef.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Test of <stddef.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 <stddef.h> - -#include "verify.h" - -/* Check that appropriate types are defined. */ -wchar_t a = 'c'; -ptrdiff_t b = 1; -size_t c = 2; - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -/* Check that offsetof produces integer constants with correct type. */ -struct d -{ - char e; - char f; -}; -/* Solaris 10 has a bug where offsetof is under-parenthesized, and - cannot be used as an arbitrary expression. However, since it is - unlikely to bite real code, we ignore that short-coming. */ -/* verify (sizeof offsetof (struct d, e) == sizeof (size_t)); */ -verify (sizeof (offsetof (struct d, e)) == sizeof (size_t)); -verify (offsetof (struct d, e) < -1); /* Must be unsigned. */ -verify (offsetof (struct d, f) == 1); - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-stdint.c b/lib/gl/tests/test-stdint.c deleted file mode 100644 index d64057a256..0000000000 --- a/lib/gl/tests/test-stdint.c +++ /dev/null @@ -1,361 +0,0 @@ -/* Test of <stdint.h> substitute. - 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 Bruno Haible <bruno@clisp.org>, 2006. */ - -#include <config.h> - -/* Whether to enable pedantic checks. */ -#define DO_PEDANTIC 0 - -#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ -#define __STDC_CONSTANT_MACROS 1 /* likewise */ -#include <stdint.h> - -#include "verify.h" -#include "intprops.h" - -#if __GNUC__ >= 2 && DO_PEDANTIC -# define verify_same_types(expr1,expr2) \ - extern void _verify_func(__LINE__) (__typeof__ (expr1) *); \ - extern void _verify_func(__LINE__) (__typeof__ (expr2) *); -# define _verify_func(line) _verify_func2(line) -# define _verify_func2(line) verify_func_ ## line -#else -# define verify_same_types(expr1,expr2) extern void verify_func (int) -#endif - -/* 7.18.1.1. Exact-width integer types */ -/* 7.18.2.1. Limits of exact-width integer types */ - -int8_t a1[3] = { INT8_C (17), INT8_MIN, INT8_MAX }; -verify (TYPE_MINIMUM (int8_t) == INT8_MIN); -verify (TYPE_MAXIMUM (int8_t) == INT8_MAX); -verify_same_types (INT8_MIN, (int8_t) 0 + 0); -verify_same_types (INT8_MAX, (int8_t) 0 + 0); - -int16_t a2[3] = { INT16_C (17), INT16_MIN, INT16_MAX }; -verify (TYPE_MINIMUM (int16_t) == INT16_MIN); -verify (TYPE_MAXIMUM (int16_t) == INT16_MAX); -verify_same_types (INT16_MIN, (int16_t) 0 + 0); -verify_same_types (INT16_MAX, (int16_t) 0 + 0); - -int32_t a3[3] = { INT32_C (17), INT32_MIN, INT32_MAX }; -verify (TYPE_MINIMUM (int32_t) == INT32_MIN); -verify (TYPE_MAXIMUM (int32_t) == INT32_MAX); -verify_same_types (INT32_MIN, (int32_t) 0 + 0); -verify_same_types (INT32_MAX, (int32_t) 0 + 0); - -#ifdef INT64_MAX -int64_t a4[3] = { INT64_C (17), INT64_MIN, INT64_MAX }; -verify (TYPE_MINIMUM (int64_t) == INT64_MIN); -verify (TYPE_MAXIMUM (int64_t) == INT64_MAX); -verify_same_types (INT64_MIN, (int64_t) 0 + 0); -verify_same_types (INT64_MAX, (int64_t) 0 + 0); -#endif - -uint8_t b1[2] = { UINT8_C (17), UINT8_MAX }; -verify (TYPE_MAXIMUM (uint8_t) == UINT8_MAX); -verify_same_types (UINT8_MAX, (uint8_t) 0 + 0); - -uint16_t b2[2] = { UINT16_C (17), UINT16_MAX }; -verify (TYPE_MAXIMUM (uint16_t) == UINT16_MAX); -verify_same_types (UINT16_MAX, (uint16_t) 0 + 0); - -uint32_t b3[2] = { UINT32_C (17), UINT32_MAX }; -verify (TYPE_MAXIMUM (uint32_t) == UINT32_MAX); -verify_same_types (UINT32_MAX, (uint32_t) 0 + 0); - -#ifdef UINT64_MAX -uint64_t b4[2] = { UINT64_C (17), UINT64_MAX }; -verify (TYPE_MAXIMUM (uint64_t) == UINT64_MAX); -verify_same_types (UINT64_MAX, (uint64_t) 0 + 0); -#endif - -#if INT8_MIN && INT8_MAX && INT16_MIN && INT16_MAX && INT32_MIN && INT32_MAX -/* ok */ -#else -err or; -#endif - -#if UINT8_MAX && UINT16_MAX && UINT32_MAX -/* ok */ -#else -err or; -#endif - -/* 7.18.1.2. Minimum-width integer types */ -/* 7.18.2.2. Limits of minimum-width integer types */ - -int_least8_t c1[3] = { 17, INT_LEAST8_MIN, INT_LEAST8_MAX }; -verify (TYPE_MINIMUM (int_least8_t) == INT_LEAST8_MIN); -verify (TYPE_MAXIMUM (int_least8_t) == INT_LEAST8_MAX); -verify_same_types (INT_LEAST8_MIN, (int_least8_t) 0 + 0); -verify_same_types (INT_LEAST8_MAX, (int_least8_t) 0 + 0); - -int_least16_t c2[3] = { 17, INT_LEAST16_MIN, INT_LEAST16_MAX }; -verify (TYPE_MINIMUM (int_least16_t) == INT_LEAST16_MIN); -verify (TYPE_MAXIMUM (int_least16_t) == INT_LEAST16_MAX); -verify_same_types (INT_LEAST16_MIN, (int_least16_t) 0 + 0); -verify_same_types (INT_LEAST16_MAX, (int_least16_t) 0 + 0); - -int_least32_t c3[3] = { 17, INT_LEAST32_MIN, INT_LEAST32_MAX }; -verify (TYPE_MINIMUM (int_least32_t) == INT_LEAST32_MIN); -verify (TYPE_MAXIMUM (int_least32_t) == INT_LEAST32_MAX); -verify_same_types (INT_LEAST32_MIN, (int_least32_t) 0 + 0); -verify_same_types (INT_LEAST32_MAX, (int_least32_t) 0 + 0); - -#ifdef INT_LEAST64_MAX -int_least64_t c4[3] = { 17, INT_LEAST64_MIN, INT_LEAST64_MAX }; -verify (TYPE_MINIMUM (int_least64_t) == INT_LEAST64_MIN); -verify (TYPE_MAXIMUM (int_least64_t) == INT_LEAST64_MAX); -verify_same_types (INT_LEAST64_MIN, (int_least64_t) 0 + 0); -verify_same_types (INT_LEAST64_MAX, (int_least64_t) 0 + 0); -#endif - -uint_least8_t d1[2] = { 17, UINT_LEAST8_MAX }; -verify (TYPE_MAXIMUM (uint_least8_t) == UINT_LEAST8_MAX); -verify_same_types (UINT_LEAST8_MAX, (uint_least8_t) 0 + 0); - -uint_least16_t d2[2] = { 17, UINT_LEAST16_MAX }; -verify (TYPE_MAXIMUM (uint_least16_t) == UINT_LEAST16_MAX); -verify_same_types (UINT_LEAST16_MAX, (uint_least16_t) 0 + 0); - -uint_least32_t d3[2] = { 17, UINT_LEAST32_MAX }; -verify (TYPE_MAXIMUM (uint_least32_t) == UINT_LEAST32_MAX); -verify_same_types (UINT_LEAST32_MAX, (uint_least32_t) 0 + 0); - -#ifdef UINT_LEAST64_MAX -uint_least64_t d4[2] = { 17, UINT_LEAST64_MAX }; -verify (TYPE_MAXIMUM (uint_least64_t) == UINT_LEAST64_MAX); -verify_same_types (UINT_LEAST64_MAX, (uint_least64_t) 0 + 0); -#endif - -#if INT_LEAST8_MIN && INT_LEAST8_MAX && INT_LEAST16_MIN && INT_LEAST16_MAX && INT_LEAST32_MIN && INT_LEAST32_MAX -/* ok */ -#else -err or; -#endif - -#if UINT_LEAST8_MAX && UINT_LEAST16_MAX && UINT_LEAST32_MAX -/* ok */ -#else -err or; -#endif - -/* 7.18.1.3. Fastest minimum-width integer types */ -/* 7.18.2.3. Limits of fastest minimum-width integer types */ - -int_fast8_t e1[3] = { 17, INT_FAST8_MIN, INT_FAST8_MAX }; -verify (TYPE_MINIMUM (int_fast8_t) == INT_FAST8_MIN); -verify (TYPE_MAXIMUM (int_fast8_t) == INT_FAST8_MAX); -verify_same_types (INT_FAST8_MIN, (int_fast8_t) 0 + 0); -verify_same_types (INT_FAST8_MAX, (int_fast8_t) 0 + 0); - -int_fast16_t e2[3] = { 17, INT_FAST16_MIN, INT_FAST16_MAX }; -verify (TYPE_MINIMUM (int_fast16_t) == INT_FAST16_MIN); -verify (TYPE_MAXIMUM (int_fast16_t) == INT_FAST16_MAX); -verify_same_types (INT_FAST16_MIN, (int_fast16_t) 0 + 0); -verify_same_types (INT_FAST16_MAX, (int_fast16_t) 0 + 0); - -int_fast32_t e3[3] = { 17, INT_FAST32_MIN, INT_FAST32_MAX }; -verify (TYPE_MINIMUM (int_fast32_t) == INT_FAST32_MIN); -verify (TYPE_MAXIMUM (int_fast32_t) == INT_FAST32_MAX); -verify_same_types (INT_FAST32_MIN, (int_fast32_t) 0 + 0); -verify_same_types (INT_FAST32_MAX, (int_fast32_t) 0 + 0); - -#ifdef INT_FAST64_MAX -int_fast64_t e4[3] = { 17, INT_FAST64_MIN, INT_FAST64_MAX }; -verify (TYPE_MINIMUM (int_fast64_t) == INT_FAST64_MIN); -verify (TYPE_MAXIMUM (int_fast64_t) == INT_FAST64_MAX); -verify_same_types (INT_FAST64_MIN, (int_fast64_t) 0 + 0); -verify_same_types (INT_FAST64_MAX, (int_fast64_t) 0 + 0); -#endif - -uint_fast8_t f1[2] = { 17, UINT_FAST8_MAX }; -verify (TYPE_MAXIMUM (uint_fast8_t) == UINT_FAST8_MAX); -verify_same_types (UINT_FAST8_MAX, (uint_fast8_t) 0 + 0); - -uint_fast16_t f2[2] = { 17, UINT_FAST16_MAX }; -verify (TYPE_MAXIMUM (uint_fast16_t) == UINT_FAST16_MAX); -verify_same_types (UINT_FAST16_MAX, (uint_fast16_t) 0 + 0); - -uint_fast32_t f3[2] = { 17, UINT_FAST32_MAX }; -verify (TYPE_MAXIMUM (uint_fast32_t) == UINT_FAST32_MAX); -verify_same_types (UINT_FAST32_MAX, (uint_fast32_t) 0 + 0); - -#ifdef UINT_FAST64_MAX -uint_fast64_t f4[2] = { 17, UINT_FAST64_MAX }; -verify (TYPE_MAXIMUM (uint_fast64_t) == UINT_FAST64_MAX); -verify_same_types (UINT_FAST64_MAX, (uint_fast64_t) 0 + 0); -#endif - -#if INT_FAST8_MIN && INT_FAST8_MAX && INT_FAST16_MIN && INT_FAST16_MAX && INT_FAST32_MIN && INT_FAST32_MAX -/* ok */ -#else -err or; -#endif - -#if UINT_FAST8_MAX && UINT_FAST16_MAX && UINT_FAST32_MAX -/* ok */ -#else -err or; -#endif - -/* 7.18.1.4. Integer types capable of holding object pointers */ -/* 7.18.2.4. Limits of integer types capable of holding object pointers */ - -intptr_t g[3] = { 17, INTPTR_MIN, INTPTR_MAX }; -verify (TYPE_MINIMUM (intptr_t) == INTPTR_MIN); -verify (TYPE_MAXIMUM (intptr_t) == INTPTR_MAX); -verify_same_types (INTPTR_MIN, (intptr_t) 0 + 0); -verify_same_types (INTPTR_MAX, (intptr_t) 0 + 0); - -uintptr_t h[2] = { 17, UINTPTR_MAX }; -verify (TYPE_MAXIMUM (uintptr_t) == UINTPTR_MAX); -verify_same_types (UINTPTR_MAX, (uintptr_t) 0 + 0); - -#if INTPTR_MIN && INTPTR_MAX && UINTPTR_MAX -/* ok */ -#else -err or; -#endif - -/* 7.18.1.5. Greatest-width integer types */ -/* 7.18.2.5. Limits of greatest-width integer types */ - -intmax_t i[3] = { INTMAX_C (17), INTMAX_MIN, INTMAX_MAX }; -verify (TYPE_MINIMUM (intmax_t) == INTMAX_MIN); -verify (TYPE_MAXIMUM (intmax_t) == INTMAX_MAX); -verify_same_types (INTMAX_MIN, (intmax_t) 0 + 0); -verify_same_types (INTMAX_MAX, (intmax_t) 0 + 0); - -uintmax_t j[2] = { UINTMAX_C (17), UINTMAX_MAX }; -verify (TYPE_MAXIMUM (uintmax_t) == UINTMAX_MAX); -verify_same_types (UINTMAX_MAX, (uintmax_t) 0 + 0); - -/* As of 2007, Sun C and HP-UX 10.20 cc don't support 'long long' constants in - the preprocessor. */ -#if !(defined __SUNPRO_C || (defined __hpux && !defined __GNUC__)) -#if INTMAX_MIN && INTMAX_MAX && UINTMAX_MAX -/* ok */ -#else -err or; -#endif -#endif - -/* 7.18.3. Limits of other integer types */ - -#include <stddef.h> - -verify (TYPE_MINIMUM (ptrdiff_t) == PTRDIFF_MIN); -verify (TYPE_MAXIMUM (ptrdiff_t) == PTRDIFF_MAX); -verify_same_types (PTRDIFF_MIN, (ptrdiff_t) 0 + 0); -verify_same_types (PTRDIFF_MAX, (ptrdiff_t) 0 + 0); - -#if PTRDIFF_MIN && PTRDIFF_MAX -/* ok */ -#else -err or; -#endif - -#include <signal.h> - -verify (TYPE_MINIMUM (sig_atomic_t) == SIG_ATOMIC_MIN); -verify (TYPE_MAXIMUM (sig_atomic_t) == SIG_ATOMIC_MAX); -verify_same_types (SIG_ATOMIC_MIN, (sig_atomic_t) 0 + 0); -verify_same_types (SIG_ATOMIC_MAX, (sig_atomic_t) 0 + 0); - -#if SIG_ATOMIC_MIN != 17 && SIG_ATOMIC_MAX -/* ok */ -#else -err or; -#endif - -verify (TYPE_MAXIMUM (size_t) == SIZE_MAX); -verify_same_types (SIZE_MAX, (size_t) 0 + 0); - -#if SIZE_MAX -/* ok */ -#else -err or; -#endif - -#if HAVE_WCHAR_T -verify (TYPE_MINIMUM (wchar_t) == WCHAR_MIN); -verify (TYPE_MAXIMUM (wchar_t) == WCHAR_MAX); -verify_same_types (WCHAR_MIN, (wchar_t) 0 + 0); -verify_same_types (WCHAR_MAX, (wchar_t) 0 + 0); - -# if WCHAR_MIN != 17 && WCHAR_MAX -/* ok */ -# else -err or; -# endif -#endif - -#if HAVE_WINT_T -# include <wchar.h> - -verify (TYPE_MINIMUM (wint_t) == WINT_MIN); -verify (TYPE_MAXIMUM (wint_t) == WINT_MAX); -verify_same_types (WINT_MIN, (wint_t) 0 + 0); -verify_same_types (WINT_MAX, (wint_t) 0 + 0); - -# if WINT_MIN != 17 && WINT_MAX -/* ok */ -# else -err or; -# endif -#endif - -/* 7.18.4. Macros for integer constants */ - -verify (INT8_C (17) == 17); -verify_same_types (INT8_C (17), (int_least8_t)0 + 0); -verify (UINT8_C (17) == 17); -verify_same_types (UINT8_C (17), (uint_least8_t)0 + 0); - -verify (INT16_C (17) == 17); -verify_same_types (INT16_C (17), (int_least16_t)0 + 0); -verify (UINT16_C (17) == 17); -verify_same_types (UINT16_C (17), (uint_least16_t)0 + 0); - -verify (INT32_C (17) == 17); -verify_same_types (INT32_C (17), (int_least32_t)0 + 0); -verify (UINT32_C (17) == 17); -verify_same_types (UINT32_C (17), (uint_least32_t)0 + 0); - -#ifdef INT64_C -verify (INT64_C (17) == 17); -verify_same_types (INT64_C (17), (int_least64_t)0 + 0); -#endif -#ifdef UINT64_C -verify (UINT64_C (17) == 17); -verify_same_types (UINT64_C (17), (uint_least64_t)0 + 0); -#endif - -verify (INTMAX_C (17) == 17); -verify_same_types (INTMAX_C (17), (intmax_t)0 + 0); -verify (UINTMAX_C (17) == 17); -verify_same_types (UINTMAX_C (17), (uintmax_t)0 + 0); - - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-stdio.c b/lib/gl/tests/test-stdio.c deleted file mode 100644 index 87100576f0..0000000000 --- a/lib/gl/tests/test-stdio.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Test of <stdio.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 <stdio.h> - -#include "verify.h" - -/* Check that the various SEEK_* macros are defined. */ -int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -/* Check that the types are all defined. */ -fpos_t t1; -off_t t2; -size_t t3; -ssize_t t4; -va_list t5; - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-stdlib.c b/lib/gl/tests/test-stdlib.c deleted file mode 100644 index 1e7956b68c..0000000000 --- a/lib/gl/tests/test-stdlib.c +++ /dev/null @@ -1,54 +0,0 @@ -/* Test of <stdlib.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 <stdlib.h> - -#include "verify.h" - -/* Check that EXIT_SUCCESS is 0, per POSIX. */ -static int exitcode = EXIT_SUCCESS; -#if EXIT_SUCCESS -"oops" -#endif - -/* Check for GNU value (not guaranteed by POSIX, but is guaranteed by - gnulib). */ -#if EXIT_FAILURE != 1 -"oops" -#endif - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -#if GNULIB_TEST_SYSTEM_POSIX -# include "test-sys_wait.h" -#else -# define test_sys_wait_macros() 0 -#endif - -int -main (void) -{ - if (test_sys_wait_macros ()) - return 1; - - return exitcode; -} diff --git a/lib/gl/tests/test-string.c b/lib/gl/tests/test-string.c deleted file mode 100644 index 019a8174ac..0000000000 --- a/lib/gl/tests/test-string.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Test of <string.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 <string.h> - -#include "verify.h" - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-strings.c b/lib/gl/tests/test-strings.c deleted file mode 100644 index caba95cd2a..0000000000 --- a/lib/gl/tests/test-strings.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Test of <strings.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 <strings.h> - -int -main () -{ - return 0; -} diff --git a/lib/gl/tests/test-strverscmp.c b/lib/gl/tests/test-strverscmp.c deleted file mode 100644 index d7348150e1..0000000000 --- a/lib/gl/tests/test-strverscmp.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Test of strverscmp() 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. */ - -/* Written by Eric Blake <ebb9@byu.net>, 2008. */ - -#include <config.h> - -#include <string.h> - -#include "signature.h" -SIGNATURE_CHECK (strverscmp, int, (const char *, const char *)); - -#include "macros.h" - -int -main (void) -{ - ASSERT (strverscmp ("", "") == 0); - ASSERT (strverscmp ("a", "a") == 0); - ASSERT (strverscmp ("a", "b") < 0); - ASSERT (strverscmp ("b", "a") > 0); - ASSERT (strverscmp ("000", "00") < 0); - ASSERT (strverscmp ("00", "000") > 0); - ASSERT (strverscmp ("a0", "a") > 0); - ASSERT (strverscmp ("00", "01") < 0); - ASSERT (strverscmp ("01", "010") < 0); - ASSERT (strverscmp ("010", "09") < 0); - ASSERT (strverscmp ("09", "0") < 0); - ASSERT (strverscmp ("9", "10") < 0); - ASSERT (strverscmp ("0a", "0") > 0); - return 0; -} diff --git a/lib/gl/tests/test-sys_socket.c b/lib/gl/tests/test-sys_socket.c deleted file mode 100644 index e976ff6a7b..0000000000 --- a/lib/gl/tests/test-sys_socket.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Test of <sys/socket.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 <sys/socket.h> - -#include <errno.h> - -#if HAVE_SHUTDOWN -/* Check some integer constant expressions. */ -int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR }; -#endif - -/* Check that the 'socklen_t' type is defined. */ -socklen_t t1; - -int -main (void) -{ - struct sockaddr_storage x; - sa_family_t i; - - /* Check some errno values. */ - switch (0) - { - case ENOTSOCK: - case EADDRINUSE: - case ENETRESET: - case ECONNABORTED: - case ECONNRESET: - case ENOTCONN: - case ESHUTDOWN: - break; - } - - x.ss_family = 42; - i = 42; - - /* Tell the compiler that these variables are used. */ - (void) x; - (void) i; - - return 0; -} diff --git a/lib/gl/tests/test-sys_stat.c b/lib/gl/tests/test-sys_stat.c deleted file mode 100644 index 5f1aacd1cc..0000000000 --- a/lib/gl/tests/test-sys_stat.c +++ /dev/null @@ -1,288 +0,0 @@ -/* Test of <sys/stat.h> substitute. - 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 Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <sys/stat.h> - -#include "verify.h" - -/* Check the existence of some macros. */ -int a[] = - { - S_IFMT, - S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFREG, -#ifdef S_IFLNK /* missing on mingw and djgpp */ - S_IFLNK, -#endif -#ifdef S_IFSOCK /* missing on mingw and djgpp */ - S_IFSOCK, -#endif - S_IRWXU, S_IRUSR, S_IWUSR, S_IXUSR, - S_IRWXG, S_IRGRP, S_IWGRP, S_IXGRP, - S_IRWXO, S_IROTH, S_IWOTH, S_IXOTH, - S_ISUID, S_ISGID, S_ISVTX, - S_ISBLK (S_IFREG), - S_ISCHR (S_IFREG), - S_ISDIR (S_IFREG), - S_ISFIFO (S_IFREG), - S_ISREG (S_IFREG), - S_ISLNK (S_IFREG), - S_ISSOCK (S_IFREG), - S_ISDOOR (S_IFREG), - S_ISMPB (S_IFREG), - S_ISNAM (S_IFREG), - S_ISNWK (S_IFREG), - S_ISPORT (S_IFREG), - S_ISCTG (S_IFREG), - S_ISOFD (S_IFREG), - S_ISOFL (S_IFREG), - S_ISWHT (S_IFREG) - }; - -/* Sanity checks. */ - -verify (S_IRWXU == (S_IRUSR | S_IWUSR | S_IXUSR)); -verify (S_IRWXG == (S_IRGRP | S_IWGRP | S_IXGRP)); -verify (S_IRWXO == (S_IROTH | S_IWOTH | S_IXOTH)); - -verify (S_ISBLK (S_IFBLK)); -verify (!S_ISBLK (S_IFCHR)); -verify (!S_ISBLK (S_IFDIR)); -verify (!S_ISBLK (S_IFIFO)); -verify (!S_ISBLK (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISBLK (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISBLK (S_IFSOCK)); -#endif - -verify (!S_ISCHR (S_IFBLK)); -verify (S_ISCHR (S_IFCHR)); -verify (!S_ISCHR (S_IFDIR)); -verify (!S_ISCHR (S_IFIFO)); -verify (!S_ISCHR (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISCHR (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISCHR (S_IFSOCK)); -#endif - -verify (!S_ISDIR (S_IFBLK)); -verify (!S_ISDIR (S_IFCHR)); -verify (S_ISDIR (S_IFDIR)); -verify (!S_ISDIR (S_IFIFO)); -verify (!S_ISDIR (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISDIR (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISDIR (S_IFSOCK)); -#endif - -verify (!S_ISFIFO (S_IFBLK)); -verify (!S_ISFIFO (S_IFCHR)); -verify (!S_ISFIFO (S_IFDIR)); -verify (S_ISFIFO (S_IFIFO)); -verify (!S_ISFIFO (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISFIFO (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISFIFO (S_IFSOCK)); -#endif - -verify (!S_ISREG (S_IFBLK)); -verify (!S_ISREG (S_IFCHR)); -verify (!S_ISREG (S_IFDIR)); -verify (!S_ISREG (S_IFIFO)); -verify (S_ISREG (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISREG (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISREG (S_IFSOCK)); -#endif - -verify (!S_ISLNK (S_IFBLK)); -verify (!S_ISLNK (S_IFCHR)); -verify (!S_ISLNK (S_IFDIR)); -verify (!S_ISLNK (S_IFIFO)); -verify (!S_ISLNK (S_IFREG)); -#ifdef S_IFLNK -verify (S_ISLNK (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISLNK (S_IFSOCK)); -#endif - -verify (!S_ISSOCK (S_IFBLK)); -verify (!S_ISSOCK (S_IFCHR)); -verify (!S_ISSOCK (S_IFDIR)); -verify (!S_ISSOCK (S_IFIFO)); -verify (!S_ISSOCK (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISSOCK (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (S_ISSOCK (S_IFSOCK)); -#endif - -verify (!S_ISDOOR (S_IFBLK)); -verify (!S_ISDOOR (S_IFCHR)); -verify (!S_ISDOOR (S_IFDIR)); -verify (!S_ISDOOR (S_IFIFO)); -verify (!S_ISDOOR (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISDOOR (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISDOOR (S_IFSOCK)); -#endif - -verify (!S_ISMPB (S_IFBLK)); -verify (!S_ISMPB (S_IFCHR)); -verify (!S_ISMPB (S_IFDIR)); -verify (!S_ISMPB (S_IFIFO)); -verify (!S_ISMPB (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISMPB (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISMPB (S_IFSOCK)); -#endif - -verify (!S_ISNAM (S_IFBLK)); -verify (!S_ISNAM (S_IFCHR)); -verify (!S_ISNAM (S_IFDIR)); -verify (!S_ISNAM (S_IFIFO)); -verify (!S_ISNAM (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISNAM (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISNAM (S_IFSOCK)); -#endif - -verify (!S_ISNWK (S_IFBLK)); -verify (!S_ISNWK (S_IFCHR)); -verify (!S_ISNWK (S_IFDIR)); -verify (!S_ISNWK (S_IFIFO)); -verify (!S_ISNWK (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISNWK (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISNWK (S_IFSOCK)); -#endif - -verify (!S_ISPORT (S_IFBLK)); -verify (!S_ISPORT (S_IFCHR)); -verify (!S_ISPORT (S_IFDIR)); -verify (!S_ISPORT (S_IFIFO)); -verify (!S_ISPORT (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISPORT (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISPORT (S_IFSOCK)); -#endif - -verify (!S_ISCTG (S_IFBLK)); -verify (!S_ISCTG (S_IFCHR)); -verify (!S_ISCTG (S_IFDIR)); -verify (!S_ISCTG (S_IFIFO)); -verify (!S_ISCTG (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISCTG (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISCTG (S_IFSOCK)); -#endif - -verify (!S_ISOFD (S_IFBLK)); -verify (!S_ISOFD (S_IFCHR)); -verify (!S_ISOFD (S_IFDIR)); -verify (!S_ISOFD (S_IFIFO)); -verify (!S_ISOFD (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISOFD (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISOFD (S_IFSOCK)); -#endif - -verify (!S_ISOFL (S_IFBLK)); -verify (!S_ISOFL (S_IFCHR)); -verify (!S_ISOFL (S_IFDIR)); -verify (!S_ISOFL (S_IFIFO)); -verify (!S_ISOFL (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISOFL (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISOFL (S_IFSOCK)); -#endif - -verify (!S_ISWHT (S_IFBLK)); -verify (!S_ISWHT (S_IFCHR)); -verify (!S_ISWHT (S_IFDIR)); -verify (!S_ISWHT (S_IFIFO)); -verify (!S_ISWHT (S_IFREG)); -#ifdef S_IFLNK -verify (!S_ISWHT (S_IFLNK)); -#endif -#ifdef S_IFSOCK -verify (!S_ISWHT (S_IFSOCK)); -#endif - -/* POSIX 2008 requires traditional encoding of permission constants. */ -verify (S_IRWXU == 00700); -verify (S_IRUSR == 00400); -verify (S_IWUSR == 00200); -verify (S_IXUSR == 00100); -verify (S_IRWXG == 00070); -verify (S_IRGRP == 00040); -verify (S_IWGRP == 00020); -verify (S_IXGRP == 00010); -verify (S_IRWXO == 00007); -verify (S_IROTH == 00004); -verify (S_IWOTH == 00002); -verify (S_IXOTH == 00001); -verify (S_ISUID == 04000); -verify (S_ISGID == 02000); -verify (S_ISVTX == 01000); - -#if ((0 <= UTIME_NOW && UTIME_NOW < 1000000000) \ - || (0 <= UTIME_OMIT && UTIME_OMIT < 1000000000) \ - || UTIME_NOW == UTIME_OMIT) -invalid UTIME macros -#endif - -/* Check the existence of some types. */ -nlink_t t1; - -struct timespec t2; - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-sys_wait.h b/lib/gl/tests/test-sys_wait.h deleted file mode 100644 index bb10450867..0000000000 --- a/lib/gl/tests/test-sys_wait.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Test of macros shared between <sys/wait.h> and <stdlib.h>. - Copyright (C) 2010 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* Written by Eric Blake <ebb9@byu.net>, 2010. */ - -static int -test_sys_wait_macros (void) -{ - /* Check subset of <sys/wait.h> macros that must be visible here. - Note that some of these macros are only portable when operating - on an lvalue. */ - int i; - for (i = 0; i < 0x8000; i = (i ? i << 1 : 1)) - { - /* POSIX requires that for all valid process statuses, that - exactly one of these three macros is true. But not all - possible 16-bit values map to valid process status. - Traditionally, 8 of the bits are for WIFEXITED, 7 of the bits - to tell between WIFSIGNALED and WIFSTOPPED, and either 0x80 - or 0x8000 to flag that core was also dumped. Since we don't - know which byte is WIFEXITED, we skip the both possible bits - that can signal core dump. */ - if (i == 0x80) - continue; - if (!!WIFSIGNALED (i) + !!WIFEXITED (i) + !!WIFSTOPPED (i) != 1) - return 1; - } - i = WEXITSTATUS (i) + WSTOPSIG (i) + WTERMSIG (i); - - switch (i) - { -#if 0 - /* Gnulib doesn't guarantee these, yet. */ - case WNOHANG: - case WUNTRACED: -#endif - break; - } - return 0; -} diff --git a/lib/gl/tests/test-time.c b/lib/gl/tests/test-time.c deleted file mode 100644 index 8e250bd2d5..0000000000 --- a/lib/gl/tests/test-time.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Test of <time.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 <time.h> - -#include "verify.h" - -struct timespec a; - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-unistd.c b/lib/gl/tests/test-unistd.c deleted file mode 100644 index ec02eeefca..0000000000 --- a/lib/gl/tests/test-unistd.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Test of <unistd.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 <unistd.h> - -#include "verify.h" - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -/* Check that the various SEEK_* macros are defined. */ -int sk[] = { SEEK_CUR, SEEK_END, SEEK_SET }; - -/* Check that the various *_FILENO macros are defined. */ -#if ! (defined STDIN_FILENO \ - && (STDIN_FILENO + STDOUT_FILENO + STDERR_FILENO == 3)) -missing or broken *_FILENO macros -#endif - -/* Check that the types are all defined. */ -size_t t1; -ssize_t t2; -#ifdef TODO /* Not implemented in gnulib yet */ -uid_t t3; -gid_t t4; -#endif -off_t t5; -pid_t t6; -#ifdef TODO -useconds_t t7; -intptr_t t8; -#endif - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/test-vasnprintf.c b/lib/gl/tests/test-vasnprintf.c deleted file mode 100644 index 15401eb4ca..0000000000 --- a/lib/gl/tests/test-vasnprintf.c +++ /dev/null @@ -1,94 +0,0 @@ -/* Test of vasnprintf() and asnprintf() functions. - 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 Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include "vasnprintf.h" - -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> - -#include "macros.h" - -static void -test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) -{ - char buf[8]; - int size; - - for (size = 0; size <= 8; size++) - { - size_t length = size; - char *result = my_asnprintf (NULL, &length, "%d", 12345); - ASSERT (result != NULL); - ASSERT (strcmp (result, "12345") == 0); - ASSERT (length == 5); - free (result); - } - - for (size = 0; size <= 8; size++) - { - size_t length; - char *result; - - memcpy (buf, "DEADBEEF", 8); - length = size; - result = my_asnprintf (buf, &length, "%d", 12345); - ASSERT (result != NULL); - ASSERT (strcmp (result, "12345") == 0); - ASSERT (length == 5); - if (size < 6) - ASSERT (result != buf); - ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); - if (result != buf) - free (result); - } -} - -static char * -my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) -{ - va_list args; - char *ret; - - va_start (args, format); - ret = vasnprintf (resultbuf, lengthp, format, args); - va_end (args); - return ret; -} - -static void -test_vasnprintf () -{ - test_function (my_asnprintf); -} - -static void -test_asnprintf () -{ - test_function (asnprintf); -} - -int -main (int argc, char *argv[]) -{ - test_vasnprintf (); - test_asnprintf (); - return 0; -} diff --git a/lib/gl/tests/test-vasprintf.c b/lib/gl/tests/test-vasprintf.c deleted file mode 100644 index cfde4f49c7..0000000000 --- a/lib/gl/tests/test-vasprintf.c +++ /dev/null @@ -1,103 +0,0 @@ -/* Test of vasprintf() and asprintf() functions. - 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 Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (asprintf, int, (char **, char const *, ...)); -SIGNATURE_CHECK (vasprintf, int, (char **, char const *, va_list)); - -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> - -#include "macros.h" - -static int -my_asprintf (char **result, const char *format, ...) -{ - va_list args; - int ret; - - va_start (args, format); - ret = vasprintf (result, format, args); - va_end (args); - return ret; -} - -static void -test_vasprintf () -{ - int repeat; - - for (repeat = 0; repeat <= 8; repeat++) - { - char *result; - int retval = my_asprintf (&result, "%d", 12345); - ASSERT (retval == 5); - ASSERT (result != NULL); - ASSERT (strcmp (result, "12345") == 0); - free (result); - } - - for (repeat = 0; repeat <= 8; repeat++) - { - char *result; - int retval = my_asprintf (&result, "%08lx", 12345UL); - ASSERT (retval == 8); - ASSERT (result != NULL); - ASSERT (strcmp (result, "00003039") == 0); - free (result); - } -} - -static void -test_asprintf () -{ - int repeat; - - for (repeat = 0; repeat <= 8; repeat++) - { - char *result; - int retval = asprintf (&result, "%d", 12345); - ASSERT (retval == 5); - ASSERT (result != NULL); - ASSERT (strcmp (result, "12345") == 0); - free (result); - } - - for (repeat = 0; repeat <= 8; repeat++) - { - char *result; - int retval = asprintf (&result, "%08lx", 12345UL); - ASSERT (retval == 8); - ASSERT (result != NULL); - ASSERT (strcmp (result, "00003039") == 0); - free (result); - } -} - -int -main (int argc, char *argv[]) -{ - test_vasprintf (); - test_asprintf (); - return 0; -} diff --git a/lib/gl/tests/test-verify.c b/lib/gl/tests/test-verify.c deleted file mode 100644 index 3f89ba9058..0000000000 --- a/lib/gl/tests/test-verify.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Test the "verify" module. - - Copyright (C) 2005, 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. */ - -#include <config.h> - -#include "verify.h" - -#ifndef EXP_FAIL -# define EXP_FAIL 0 -#endif - -int x; -enum { a, b, c }; - -#if EXP_FAIL == 1 -verify (x >= 0); /* should give ERROR: non-constant expression */ -#endif -verify (c == 2); /* should be ok */ -#if EXP_FAIL == 2 -verify (1 + 1 == 3); /* should give ERROR */ -#endif -verify (1 == 1); verify (1 == 1); /* should be ok */ - -enum -{ - item = verify_true (1 == 1) * 0 + 17 /* should be ok */ -}; - -static int -function (int n) -{ -#if EXP_FAIL == 3 - verify (n >= 0); /* should give ERROR: non-constant expression */ -#endif - verify (c == 2); /* should be ok */ -#if EXP_FAIL == 4 - verify (1 + 1 == 3); /* should give ERROR */ -#endif - verify (1 == 1); verify (1 == 1); /* should be ok */ - - if (n) - return ((void) verify_true (1 == 1), verify_true (1 == 1) + 7); /* should be ok */ -#if EXP_FAIL == 5 - return (verify_true (1 == 2), 5); /* should give ERROR */ -#endif - return 0; -} - -int -main (void) -{ - return !(function (0) == 0 && function (1) == 8); -} diff --git a/lib/gl/tests/test-verify.sh b/lib/gl/tests/test-verify.sh deleted file mode 100755 index 3e7676148a..0000000000 --- a/lib/gl/tests/test-verify.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -. "${srcdir=.}/init.sh" - -# We are not interested in triggering bugs in the compilers and tools -# (such as gcc 4.3.1 on openSUSE 11.0). -unset MALLOC_PERTURB_ - -# Rather than figure out how to invoke the compiler with the right -# include path ourselves, we let make do it: -(cd "$initial_cwd_" && rm -f test-verify.o \ - && $MAKE test-verify.o >/dev/null 2>&1) \ - || skip_ "cannot compile error-free" - -# Now, prove that we encounter all expected compilation failures: -: >out -: >err -for i in 1 2 3 4 5; do - (cd "$initial_cwd_" - rm -f test-verify.o - $MAKE CFLAGS=-DEXP_FAIL=$i test-verify.o) >>out 2>>err \ - && { warn_ "compiler didn't detect verification failure $i"; fail=1; } -done - -Exit $fail diff --git a/lib/gl/tests/test-vsnprintf.c b/lib/gl/tests/test-vsnprintf.c deleted file mode 100644 index 1bfa5540f7..0000000000 --- a/lib/gl/tests/test-vsnprintf.c +++ /dev/null @@ -1,77 +0,0 @@ -/* Test of vsnprintf() 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 Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <stdio.h> - -#include "signature.h" -SIGNATURE_CHECK (vsnprintf, int, (char *, size_t, char const *, va_list)); - -#include <stdarg.h> -#include <string.h> - -#include "macros.h" - -static int -my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} - -int -main (int argc, char *argv[]) -{ - char buf[8]; - int size; - int retval; - - for (size = 0; size <= 8; size++) - { - memcpy (buf, "DEADBEEF", 8); - retval = my_snprintf (buf, size, "%d", 12345); - if (size < 6) - { -#if CHECK_VSNPRINTF_POSIX - ASSERT (retval < 0 || retval >= size); -#endif - if (size > 0) - { - ASSERT (memcmp (buf, "12345", size - 1) == 0); - ASSERT (buf[size - 1] == '\0' || buf[size - 1] == '0' + size); - } -#if !CHECK_VSNPRINTF_POSIX - if (size > 0) -#endif - ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0); - } - else - { - ASSERT (retval == 5); - ASSERT (memcmp (buf, "12345\0EF", 8) == 0); - } - } - - return 0; -} diff --git a/lib/gl/tests/test-wchar.c b/lib/gl/tests/test-wchar.c deleted file mode 100644 index 2a03d6b669..0000000000 --- a/lib/gl/tests/test-wchar.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Test of <wchar.h> substitute. - 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 Bruno Haible <bruno@clisp.org>, 2007. */ - -#include <config.h> - -#include <wchar.h> - -#include "verify.h" - -/* Check that the types wchar_t and wint_t are defined. */ -wchar_t a = 'c'; -wint_t b = 'x'; - -/* Check that NULL can be passed through varargs as a pointer type, - per POSIX 2008. */ -verify (sizeof NULL == sizeof (void *)); - -int -main (void) -{ - return 0; -} diff --git a/lib/gl/tests/zerosize-ptr.h b/lib/gl/tests/zerosize-ptr.h deleted file mode 100644 index cfab200871..0000000000 --- a/lib/gl/tests/zerosize-ptr.h +++ /dev/null @@ -1,68 +0,0 @@ -/* Return a pointer to a zero-size object in memory. - 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/>. */ - -/* ISO C 99 does not allow memcmp(), memchr() etc. to be invoked with a NULL - argument. Therefore this file produces a non-NULL pointer which cannot - be dereferenced, if possible. */ - -#include <stdlib.h> - -/* Test whether mmap() and mprotect() are available. - We don't use HAVE_MMAP, because AC_FUNC_MMAP would not define it on HP-UX. - HAVE_MPROTECT is not enough, because mingw does not have mmap() but has an - mprotect() function in libgcc.a. */ -#if HAVE_SYS_MMAN_H && HAVE_MPROTECT -# include <fcntl.h> -# include <unistd.h> -# include <sys/types.h> -# include <sys/mman.h> -/* Define MAP_FILE when it isn't otherwise. */ -# ifndef MAP_FILE -# define MAP_FILE 0 -# endif -#endif - -/* Return a pointer to a zero-size object in memory (that is, actually, a - pointer to a page boundary where the previous page is readable and writable - and the next page is neither readable not writable), if possible. - Return NULL otherwise. */ - -static void * -zerosize_ptr (void) -{ -/* Use mmap and mprotect when they exist. Don't test HAVE_MMAP, because it is - not defined on HP-UX 11 (since it does not support MAP_FIXED). */ -#if HAVE_SYS_MMAN_H && HAVE_MPROTECT -# if HAVE_MAP_ANONYMOUS - const int flags = MAP_ANONYMOUS | MAP_PRIVATE; - const int fd = -1; -# else /* !HAVE_MAP_ANONYMOUS */ - const int flags = MAP_FILE | MAP_PRIVATE; - int fd = open ("/dev/zero", O_RDONLY, 0666); - if (fd >= 0) -# endif - { - int pagesize = getpagesize (); - char *two_pages = - (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, - flags, fd, 0); - if (two_pages != (char *)(-1) - && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) - return two_pages + pagesize; - } -#endif - return NULL; -} |