summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2006-08-22 01:56:31 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2006-08-22 01:56:31 +0000
commitc969ef4b8fc1d06c13203b36f8cf5bb61a7730f0 (patch)
treeeb2da173a5661b2b2e615045f26f7b69e774290d
parentfea84e591f94b025ef7c2da843ae80b809f93dbe (diff)
downloaduClibc-alpine-c969ef4b8fc1d06c13203b36f8cf5bb61a7730f0.tar.bz2
uClibc-alpine-c969ef4b8fc1d06c13203b36f8cf5bb61a7730f0.tar.xz
Merge from trunk. Whoa crap.
-rw-r--r--test/Makefile42
-rw-r--r--test/Rules.mak90
-rw-r--r--test/args/Makefile11
-rw-r--r--test/args/arg_test.c22
-rw-r--r--test/args/arg_test_glibc.out.good13
-rw-r--r--test/assert/Makefile7
-rw-r--r--test/assert/assert.c22
-rw-r--r--test/crypt/Makefile70
-rw-r--r--test/crypt/crypt.out.good172
-rw-r--r--test/ctype/Makefile4
-rw-r--r--test/ctype/ctype.c20
-rw-r--r--test/dlopen/Makefile91
-rw-r--r--test/dlopen/dltest2.c1
-rw-r--r--test/dlopen/libtest3.c1
-rw-r--r--test/inet/Makefile4
-rw-r--r--test/inet/bug-if1.c54
-rw-r--r--test/inet/if_nameindex.c2
-rw-r--r--test/inet/tst-aton.c80
-rw-r--r--test/inet/tst-network.c73
-rw-r--r--test/inet/tst-ntoa.c36
-rw-r--r--test/malloc/Makefile5
-rw-r--r--test/malloc/testmalloc.c5
-rw-r--r--test/malloc/tst-calloc.c126
-rw-r--r--test/malloc/tst-malloc.c73
-rw-r--r--test/malloc/tst-mallocfork.c51
-rw-r--r--test/malloc/tst-mcheck.c96
-rw-r--r--test/malloc/tst-obstack.c64
-rw-r--r--test/malloc/tst-valloc.c23
-rw-r--r--test/math/Makefile110
-rw-r--r--test/math/basic-test.c123
-rw-r--r--test/math/fenv.h3
-rw-r--r--test/math/libm-test.inc993
-rw-r--r--test/math/test-fpucw.c43
-rw-r--r--test/math/tst-definitions.c47
-rw-r--r--test/misc/Makefile6
-rw-r--r--test/misc/bug-glob1.c94
-rw-r--r--test/misc/bug-readdir1.c38
-rw-r--r--test/misc/dirent.c42
-rw-r--r--test/misc/dirent64.c1
-rw-r--r--test/misc/fdopen.c22
-rw-r--r--test/misc/opendir-tst1.c95
-rw-r--r--test/misc/popen.c47
-rw-r--r--test/misc/seek.c79
-rw-r--r--test/misc/sem.c72
-rw-r--r--test/misc/stdarg.c23
-rw-r--r--test/misc/tst-fnmatch.c444
-rw-r--r--test/misc/tst-fnmatch.input755
-rw-r--r--test/misc/tst-gnuglob.c447
-rw-r--r--test/misc/tst-seekdir.c80
-rw-r--r--test/misc/tst-utmp.c404
-rw-r--r--test/mmap/Makefile4
-rw-r--r--test/mmap/mmap64.c3
-rw-r--r--test/nptl/Makefile128
-rw-r--r--test/pthread/Makefile108
-rw-r--r--test/pthread/ex3.c10
-rw-r--r--test/pthread/ex7.c2
-rw-r--r--test/pwd_grp/Makefile187
-rw-r--r--test/pwd_grp/test_grp.c15
-rw-r--r--test/pwd_grp/test_pwd.c15
-rw-r--r--test/regex/Makefile2
-rw-r--r--test/rpc/Makefile40
-rw-r--r--test/setjmp/Makefile4
-rw-r--r--test/setjmp/bug269-setjmp.c107
-rw-r--r--test/setjmp/jmpbug.c40
-rw-r--r--test/setjmp/tst-setjmp.c (renamed from test/setjmp/setjmp_test.c)0
-rw-r--r--test/signal/Makefile74
-rw-r--r--test/signal/sigchld.c11
-rw-r--r--test/signal/signal.c24
-rw-r--r--test/signal/tst-raise.c63
-rw-r--r--test/signal/tst-signal.c44
-rw-r--r--test/signal/tst-sigset.c45
-rw-r--r--test/signal/tst-sigsimple.c57
-rw-r--r--test/silly/Makefile8
-rw-r--r--test/stat/Makefile102
-rw-r--r--test/stat/stat64.c1
-rw-r--r--test/stdlib/Makefile183
-rw-r--r--test/string/Makefile105
-rw-r--r--test/string/bug-strcoll1.c24
-rw-r--r--test/string/bug-strncat1.c31
-rw-r--r--test/string/bug-strpbrk1.c19
-rw-r--r--test/string/bug-strspn1.c19
-rw-r--r--test/string/stratcliff.c349
-rw-r--r--test/string/test-ffs.c66
-rw-r--r--test/string/testcopy.c34
-rw-r--r--test/string/tester.c (renamed from test/string/string.c)172
-rw-r--r--test/string/tst-bswap.c74
-rw-r--r--test/string/tst-inlcall.c83
-rw-r--r--test/string/tst-strlen.c45
-rw-r--r--test/string/tst-strtok.c23
-rw-r--r--test/string/tst-strxfrm.c80
-rw-r--r--test/termios/Makefile54
-rw-r--r--test/termios/termios.c2
-rw-r--r--test/test-skeleton.c20
-rw-r--r--test/testsuite.h28
-rw-r--r--test/time/Makefile2
-rw-r--r--test/unistd/Makefile15
-rw-r--r--test/unistd/clone.c29
-rw-r--r--test/unistd/clone_cruft.h24
-rw-r--r--test/unistd/errno.c3
-rw-r--r--test/unistd/fork.c34
-rw-r--r--test/unistd/getcwd.c22
-rw-r--r--test/unistd/preadwrite.c150
-rw-r--r--test/unistd/tst-preadwrite.c105
-rw-r--r--test/unistd/tst-preadwrite64.c24
-rw-r--r--test/unistd/vfork.c21
105 files changed, 6332 insertions, 1828 deletions
diff --git a/test/Makefile b/test/Makefile
index a259ae49a..4063e60ee 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -7,30 +7,33 @@
top_builddir=../
-include $(top_builddir).config
+include Rules.mak
-.EXPORT_ALL_VARIABLES:
+ALL_SUBDIRS := $(patsubst %/Makefile,%,$(wildcard */Makefile))
-
-ALL_SUBDIRS = \
- args assert crypt ctype pwd_grp signal silly stdlib string unistd \
- #misc
DIRS := $(ALL_SUBDIRS)
-
-ifeq ($(HAVE_SHARED),y)
- DIRS += dlopen
-ALL_SUBDIRS += dlopen
+ifneq ($(HAVE_SHARED)$(UCLIBC_HAS_THREADS),yy)
+ DIRS := $(filter-out dlopen,$(DIRS))
+endif
+ifneq ($(findstring -static,$(LDFLAGS)),)
+ DIRS := $(filter-out dlopen,$(DIRS))
+endif
+ifneq ($(UCLIBC_HAS_THREADS),y)
+ DIRS := $(filter-out pthread,$(DIRS))
+endif
+ifneq ($(UCLIBC_HAS_FULL_RPC),y)
+ DIRS := $(filter-out rpc,$(DIRS))
endif
-ifeq ($(UCLIBC_HAS_THREADS),y)
- DIRS += pthread
-ALL_SUBDIRS += pthread
+ifneq ($(UCLIBC_HAS_REGEX),y)
+ DIRS := $(filter-out regex,$(DIRS))
endif
-ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
- DIRS += tls nptl
-ALL_SUBDIRS += tls nptl
+ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y)
+ DIRS += $(filter-out tls nptl,$(DIRS))
endif
+DIRS := $(filter-out math,$(DIRS))
-all: subdirs
+test check all: subdirs
tags:
ctags -R
@@ -41,10 +44,9 @@ subdirs: $(patsubst %, _dir_%, $(DIRS))
subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
$(patsubst %, _dir_%, $(DIRS)) : dummy
- @echo "Making test in $(patsubst _dir_%,%,$@)"
- $(MAKE) -C $(patsubst _dir_%, %, $@)
+ $(Q)$(MAKE) -C $(patsubst _dir_%, %, $@)
$(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
- $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
+ $(Q)$(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
-.PHONY: dummy
+.PHONY: all check clean dummy subdirs subdirs_clean test
diff --git a/test/Rules.mak b/test/Rules.mak
index 57e329d95..430f789da 100644
--- a/test/Rules.mak
+++ b/test/Rules.mak
@@ -1,10 +1,11 @@
# Rules.mak for uClibc test subdirs
#
-# Copyright (C) 2001 by Lineo, inc.
-# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
+
+#
# Note: This does not read the top level Rules.mak file
#
@@ -13,12 +14,10 @@ TESTDIR=$(top_builddir)test/
-include $(top_builddir).config
-ifndef UCLIBC_LDSO
-UCLIBC_LDSO := ld-uClibc.so.0
-endif
+UCLIBC_LDSO ?= $(firstword $(wildcard $(top_builddir)lib/ld*))
#--------------------------------------------------------
-# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
+# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
LC_ALL:= C
export LC_ALL
@@ -51,23 +50,13 @@ export TARGET_ARCH
CROSS = $(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
CC = $(CROSS)gcc
-STRIPTOOL = $(CROSS)strip
RM = rm -f
-ifeq ($(LDSO_LDD_SUPPORT),y)
-LDD = $(top_builddir)utils/ldd
-else
-LDD = @true
-endif
# Select the compiler needed to build binaries for your development system
HOSTCC = gcc
-BUILD_CFLAGS = -O2 -Wall
#--------------------------------------------------------
-# Check if 'ls -sh' works or not
-LSFLAGS = -l
-
# A nifty macro to make testing gcc features easier
check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
then echo "$(1)"; else echo "$(2)"; fi)
@@ -75,36 +64,73 @@ check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1;
# use '-Os' optimization if available, else use -O2, allow Config to override
# Override optimization settings when debugging
ifeq ($(DODEBUG),y)
- ifeq ($(strip $(TARGET_ARCH)),mips)
-OPTIMIZATION = -O1
- else
OPTIMIZATION = -O0
- endif
else
OPTIMIZATION += $(call check_gcc,-Os,-O2)
endif
-XWARNINGS = $(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes
-XARCH_CFLAGS = $(subst ",, $(strip $(ARCH_CFLAGS)))
-CFLAGS = $(XWARNINGS) $(OPTIMIZATION) $(XARCH_CFLAGS)
-GLIBC_CFLAGS += $(XWARNINGS) $(OPTIMIZATION)
-LDFLAGS =
+XWARNINGS := $(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes
+XARCH_CFLAGS := $(subst ",, $(strip $(ARCH_CFLAGS)))
+XCOMMON_CFLAGS := -D_GNU_SOURCE -I$(top_builddir)test
+CFLAGS += $(XWARNINGS) $(OPTIMIZATION) $(XCOMMON_CFLAGS) $(XARCH_CFLAGS) -I$(top_builddir)include
+HOST_CFLAGS += $(XWARNINGS) $(OPTIMIZATION) $(XCOMMON_CFLAGS)
ifeq ($(DODEBUG),y)
CFLAGS += -g
- GLIBC_CFLAGS += -g
+ HOST_CFLAGS += -g
LDFLAGS += -g -Wl,-warn-common
- GLIBC_LDFLAGS = -g -Wl,-warn-common
- STRIPTOOL = true -Since_we_are_debugging
+ HOST_LDFLAGS += -g -Wl,-warn-common
else
LDFLAGS += -s -Wl,-warn-common
- GLIBC_LDFLAGS = -s -Wl,-warn-common
- STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG)
+ HOST_LDFLAGS += -s -Wl,-warn-common
endif
ifneq ($(strip $(HAVE_SHARED)),y)
LDFLAGS += -static
- GLIBC_LDFLAGS += -static
+ HOST_LDFLAGS += -static
+endif
+LDFLAGS += -B$(top_builddir)lib -Wl,-rpath,$(top_builddir)lib -Wl,-rpath-link,$(top_builddir)lib
+ifeq ($(findstring -static,$(LDFLAGS)),)
+LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO)
+endif
+
+
+# Filter output
+MAKEFLAGS += --no-print-directory
+ifneq ($(findstring s,$(MAKEFLAGS)),)
+DISP := sil
+Q := @
+SCAT := -@true
else
- LDFLAGS += -Wl,-dynamic-linker,$(top_builddir)lib/$(UCLIBC_LDSO)
+ifneq ($(V)$(VERBOSE),)
+DISP := ver
+Q :=
+SCAT := cat
+else
+DISP := pur
+Q := @
+SCAT := -@true
+endif
endif
+
+banner := ---------------------------------
+pur_showclean = echo " "CLEAN $(notdir $(CURDIR))
+pur_showdiff = echo " "TEST_DIFF $(notdir $(CURDIR))/
+pur_showlink = echo " "TEST_LINK $(notdir $(CURDIR))/ $@
+pur_showtest = echo " "TEST_EXEC $(notdir $(CURDIR))/ $@
+sil_showclean =
+sil_showdiff = true
+sil_showlink = true
+sil_showtest = true
+ver_showclean =
+ver_showdiff = true echo
+ver_showlink = true echo
+ver_showtest = printf "\n$(banner)\nTEST $(notdir $(PWD))/ $@\n$(banner)\n"
+do_showclean = $($(DISP)_showclean)
+do_showdiff = $($(DISP)_showdiff)
+do_showlink = $($(DISP)_showlink)
+do_showtest = $($(DISP)_showtest)
+showclean = @$(do_showclean)
+showdiff = @$(do_showdiff)
+showlink = @$(do_showlink)
+showtest = @$(do_showtest)
diff --git a/test/args/Makefile b/test/args/Makefile
index 29a5af967..7ba8a31b4 100644
--- a/test/args/Makefile
+++ b/test/args/Makefile
@@ -1,12 +1,11 @@
# uClibc args tests
-# Licensed under the GNU Library General Public License, see COPYING.LIB
-
-TESTS = arg_test
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
include ../Test.mak
-export WRAPPER_arg_test = \
+OPTS_arg_test = a b c d e f g h
+WRAPPER_arg_test = \
env -i \
ENVVAR=123 \
- SOMETHING=sldajfasdf
-export OPTS_arg_test = a b c d e f g h
+ SOMETHING=sldajfasdf \
+ BLAHBLAH=" hi hi "
diff --git a/test/args/arg_test.c b/test/args/arg_test.c
index acc4465d9..86f31575a 100644
--- a/test/args/arg_test.c
+++ b/test/args/arg_test.c
@@ -1,25 +1,9 @@
/* vi: set sw=4 ts=4: */
/*
* Test application for argc and argv handling
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
*
- * Copyright (C) 2000 by Lineo, inc. and Erik Andersen
- * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
- * Written by Erik Andersen <andersen@uclibc.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 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 Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#include <stdio.h>
@@ -40,7 +24,7 @@ int main(int argc, char **argv)
}
}
#endif
-
+
printf("argc=%d\n", argc);
for(i=0;i<argc;i++) {
diff --git a/test/args/arg_test_glibc.out.good b/test/args/arg_test_glibc.out.good
new file mode 100644
index 000000000..af0efcb8c
--- /dev/null
+++ b/test/args/arg_test_glibc.out.good
@@ -0,0 +1,13 @@
+argc=9
+argv[0]='./arg_test_glibc'
+argv[1]='a'
+argv[2]='b'
+argv[3]='c'
+argv[4]='d'
+argv[5]='e'
+argv[6]='f'
+argv[7]='g'
+argv[8]='h'
+environ[0]='ENVVAR=123'
+environ[1]='SOMETHING=sldajfasdf'
+environ[2]='BLAHBLAH= hi hi '
diff --git a/test/assert/Makefile b/test/assert/Makefile
index fc908cf87..1c557fc84 100644
--- a/test/assert/Makefile
+++ b/test/assert/Makefile
@@ -1,8 +1,7 @@
# uClibc assert tests
-# Licensed under the GNU Library General Public License, see COPYING.LIB
-
-TESTS = assert
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
include ../Test.mak
-export RET_assert = 134
+RET_assert := 134
+WRAPPER_assert := trap ":" ABRT ;
diff --git a/test/assert/assert.c b/test/assert/assert.c
index b63903e89..095609411 100644
--- a/test/assert/assert.c
+++ b/test/assert/assert.c
@@ -1,25 +1,9 @@
/* vi: set sw=4 ts=4: */
/*
* Test application for functions defined in ctype.h
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
*
- * Copyright (C) 2000 by Lineo, inc. and Erik Andersen
- * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
- * Written by Erik Andersen <andersen@uclibc.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 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 Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#include <stdio.h>
@@ -38,7 +22,7 @@ void aborthandler(int junk)
int main( int argc, char **argv)
{
signal(SIGABRT, aborthandler);
-
+
init_testsuite("Testing functions defined in assert.h:\n\t");
got_abort=0;
diff --git a/test/crypt/Makefile b/test/crypt/Makefile
index b2a72ced3..11d420d9e 100644
--- a/test/crypt/Makefile
+++ b/test/crypt/Makefile
@@ -1,68 +1,8 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2002 Erik Andersen <andersen@uclibc.org>
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 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 Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# uClibc crypt tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-include ../Rules.mak
+include ../Test.mak
-TARGETS=crypt crypt_glibc diff md5c-test
-EXTRA_LIBS=-lcrypt
+EXTRA_LDFLAGS := -lcrypt
-all: $(TARGETS)
-
-crypt: crypt.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ < crypt.input > $@.out 2>&1
- -@ echo " "
-
-crypt_glibc: crypt.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ < crypt.input > $@.out 2>&1
- -@ echo " "
-
-diff: crypt_glibc crypt
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing output: "
- -@ echo " "
- diff -u crypt_glibc.out crypt.out
- -@ echo " "
-
-md5c-test: md5c-test.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-clean:
- $(RM) *.[oa] *~ core crypt_glibc crypt crypt_glibc.out crypt.out md5c-test
+OPTS_crypt = < crypt.input
diff --git a/test/crypt/crypt.out.good b/test/crypt/crypt.out.good
new file mode 100644
index 000000000..073ab2be0
--- /dev/null
+++ b/test/crypt/crypt.out.good
@@ -0,0 +1,172 @@
+ K: 0101010101010101 P: 95f8a5e5dd31d900 C: 8000000000000000 OK
+ K: 0101010101010101 P: dd7f121ca5015619 C: 4000000000000000 OK
+ K: 0101010101010101 P: 2e8653104f3834ea C: 2000000000000000 OK
+ K: 0101010101010101 P: 4bd388ff6cd81d4f C: 1000000000000000 OK
+ K: 0101010101010101 P: 20b9e767b2fb1456 C: 0800000000000000 OK
+ K: 0101010101010101 P: 55579380d77138ef C: 0400000000000000 OK
+ K: 0101010101010101 P: 6cc5defaaf04512f C: 0200000000000000 OK
+ K: 0101010101010101 P: 0d9f279ba5d87260 C: 0100000000000000 OK
+ K: 0101010101010101 P: d9031b0271bd5a0a C: 0080000000000000 OK
+ K: 0101010101010101 P: 424250b37c3dd951 C: 0040000000000000 OK
+ K: 0101010101010101 P: b8061b7ecd9a21e5 C: 0020000000000000 OK
+ K: 0101010101010101 P: f15d0f286b65bd28 C: 0010000000000000 OK
+ K: 0101010101010101 P: add0cc8d6e5deba1 C: 0008000000000000 OK
+ K: 0101010101010101 P: e6d5f82752ad63d1 C: 0004000000000000 OK
+ K: 0101010101010101 P: ecbfe3bd3f591a5e C: 0002000000000000 OK
+ K: 0101010101010101 P: f356834379d165cd C: 0001000000000000 OK
+ K: 0101010101010101 P: 2b9f982f20037fa9 C: 0000800000000000 OK
+ K: 0101010101010101 P: 889de068a16f0be6 C: 0000400000000000 OK
+ K: 0101010101010101 P: e19e275d846a1298 C: 0000200000000000 OK
+ K: 0101010101010101 P: 329a8ed523d71aec C: 0000100000000000 OK
+ K: 0101010101010101 P: e7fce22557d23c97 C: 0000080000000000 OK
+ K: 0101010101010101 P: 12a9f5817ff2d65d C: 0000040000000000 OK
+ K: 0101010101010101 P: a484c3ad38dc9c19 C: 0000020000000000 OK
+ K: 0101010101010101 P: fbe00a8a1ef8ad72 C: 0000010000000000 OK
+ K: 0101010101010101 P: 750d079407521363 C: 0000008000000000 OK
+ K: 0101010101010101 P: 64feed9c724c2faf C: 0000004000000000 OK
+ K: 0101010101010101 P: f02b263b328e2b60 C: 0000002000000000 OK
+ K: 0101010101010101 P: 9d64555a9a10b852 C: 0000001000000000 OK
+ K: 0101010101010101 P: d106ff0bed5255d7 C: 0000000800000000 OK
+ K: 0101010101010101 P: e1652c6b138c64a5 C: 0000000400000000 OK
+ K: 0101010101010101 P: e428581186ec8f46 C: 0000000200000000 OK
+ K: 0101010101010101 P: aeb5f5ede22d1a36 C: 0000000100000000 OK
+ K: 0101010101010101 P: e943d7568aec0c5c C: 0000000080000000 OK
+ K: 0101010101010101 P: df98c8276f54b04b C: 0000000040000000 OK
+ K: 0101010101010101 P: b160e4680f6c696f C: 0000000020000000 OK
+ K: 0101010101010101 P: fa0752b07d9c4ab8 C: 0000000010000000 OK
+ K: 0101010101010101 P: ca3a2b036dbc8502 C: 0000000008000000 OK
+ K: 0101010101010101 P: 5e0905517bb59bcf C: 0000000004000000 OK
+ K: 0101010101010101 P: 814eeb3b91d90726 C: 0000000002000000 OK
+ K: 0101010101010101 P: 4d49db1532919c9f C: 0000000001000000 OK
+ K: 0101010101010101 P: 25eb5fc3f8cf0621 C: 0000000000800000 OK
+ K: 0101010101010101 P: ab6a20c0620d1c6f C: 0000000000400000 OK
+ K: 0101010101010101 P: 79e90dbc98f92cca C: 0000000000200000 OK
+ K: 0101010101010101 P: 866ecedd8072bb0e C: 0000000000100000 OK
+ K: 0101010101010101 P: 8b54536f2f3e64a8 C: 0000000000080000 OK
+ K: 0101010101010101 P: ea51d3975595b86b C: 0000000000040000 OK
+ K: 0101010101010101 P: caffc6ac4542de31 C: 0000000000020000 OK
+ K: 0101010101010101 P: 8dd45a2ddf90796c C: 0000000000010000 OK
+ K: 0101010101010101 P: 1029d55e880ec2d0 C: 0000000000008000 OK
+ K: 0101010101010101 P: 5d86cb23639dbea9 C: 0000000000004000 OK
+ K: 0101010101010101 P: 1d1ca853ae7c0c5f C: 0000000000002000 OK
+ K: 0101010101010101 P: ce332329248f3228 C: 0000000000001000 OK
+ K: 0101010101010101 P: 8405d1abe24fb942 C: 0000000000000800 OK
+ K: 0101010101010101 P: e643d78090ca4207 C: 0000000000000400 OK
+ K: 0101010101010101 P: 48221b9937748a23 C: 0000000000000200 OK
+ K: 0101010101010101 P: dd7c0bbd61fafd54 C: 0000000000000100 OK
+ K: 0101010101010101 P: 2fbc291a570db5c4 C: 0000000000000080 OK
+ K: 0101010101010101 P: e07c30d7e4e26e12 C: 0000000000000040 OK
+ K: 0101010101010101 P: 0953e2258e8e90a1 C: 0000000000000020 OK
+ K: 0101010101010101 P: 5b711bc4ceebf2ee C: 0000000000000010 OK
+ K: 0101010101010101 P: cc083f1e6d9e85f6 C: 0000000000000008 OK
+ K: 0101010101010101 P: d2fd8867d50d2dfe C: 0000000000000004 OK
+ K: 0101010101010101 P: 06e7ea22ce92708f C: 0000000000000002 OK
+ K: 0101010101010101 P: 166b40b44aba4bd6 C: 0000000000000001 OK
+ K: 8001010101010101 P: 0000000000000000 C: 95a8d72813daa94d OK
+ K: 4001010101010101 P: 0000000000000000 C: 0eec1487dd8c26d5 OK
+ K: 2001010101010101 P: 0000000000000000 C: 7ad16ffb79c45926 OK
+ K: 1001010101010101 P: 0000000000000000 C: d3746294ca6a6cf3 OK
+ K: 0801010101010101 P: 0000000000000000 C: 809f5f873c1fd761 OK
+ K: 0401010101010101 P: 0000000000000000 C: c02faffec989d1fc OK
+ K: 0201010101010101 P: 0000000000000000 C: 4615aa1d33e72f10 OK
+ K: 0180010101010101 P: 0000000000000000 C: 2055123350c00858 OK
+ K: 0140010101010101 P: 0000000000000000 C: df3b99d6577397c8 OK
+ K: 0120010101010101 P: 0000000000000000 C: 31fe17369b5288c9 OK
+ K: 0110010101010101 P: 0000000000000000 C: dfdd3cc64dae1642 OK
+ K: 0108010101010101 P: 0000000000000000 C: 178c83ce2b399d94 OK
+ K: 0104010101010101 P: 0000000000000000 C: 50f636324a9b7f80 OK
+ K: 0102010101010101 P: 0000000000000000 C: a8468ee3bc18f06d OK
+ K: 0101800101010101 P: 0000000000000000 C: a2dc9e92fd3cde92 OK
+ K: 0101400101010101 P: 0000000000000000 C: cac09f797d031287 OK
+ K: 0101200101010101 P: 0000000000000000 C: 90ba680b22aeb525 OK
+ K: 0101100101010101 P: 0000000000000000 C: ce7a24f350e280b6 OK
+ K: 0101080101010101 P: 0000000000000000 C: 882bff0aa01a0b87 OK
+ K: 0101040101010101 P: 0000000000000000 C: 25610288924511c2 OK
+ K: 0101020101010101 P: 0000000000000000 C: c71516c29c75d170 OK
+ K: 0101018001010101 P: 0000000000000000 C: 5199c29a52c9f059 OK
+ K: 0101014001010101 P: 0000000000000000 C: c22f0a294a71f29f OK
+ K: 0101012001010101 P: 0000000000000000 C: ee371483714c02ea OK
+ K: 0101011001010101 P: 0000000000000000 C: a81fbd448f9e522f OK
+ K: 0101010801010101 P: 0000000000000000 C: 4f644c92e192dfed OK
+ K: 0101010401010101 P: 0000000000000000 C: 1afa9a66a6df92ae OK
+ K: 0101010201010101 P: 0000000000000000 C: b3c1cc715cb879d8 OK
+ K: 0101010180010101 P: 0000000000000000 C: 19d032e64ab0bd8b OK
+ K: 0101010140010101 P: 0000000000000000 C: 3cfaa7a7dc8720dc OK
+ K: 0101010120010101 P: 0000000000000000 C: b7265f7f447ac6f3 OK
+ K: 0101010110010101 P: 0000000000000000 C: 9db73b3c0d163f54 OK
+ K: 0101010108010101 P: 0000000000000000 C: 8181b65babf4a975 OK
+ K: 0101010104010101 P: 0000000000000000 C: 93c9b64042eaa240 OK
+ K: 0101010102010101 P: 0000000000000000 C: 5570530829705592 OK
+ K: 0101010101800101 P: 0000000000000000 C: 8638809e878787a0 OK
+ K: 0101010101400101 P: 0000000000000000 C: 41b9a79af79ac208 OK
+ K: 0101010101200101 P: 0000000000000000 C: 7a9be42f2009a892 OK
+ K: 0101010101100101 P: 0000000000000000 C: 29038d56ba6d2745 OK
+ K: 0101010101080101 P: 0000000000000000 C: 5495c6abf1e5df51 OK
+ K: 0101010101040101 P: 0000000000000000 C: ae13dbd561488933 OK
+ K: 0101010101020101 P: 0000000000000000 C: 024d1ffa8904e389 OK
+ K: 0101010101018001 P: 0000000000000000 C: d1399712f99bf02e OK
+ K: 0101010101014001 P: 0000000000000000 C: 14c1d7c1cffec79e OK
+ K: 0101010101012001 P: 0000000000000000 C: 1de5279dae3bed6f OK
+ K: 0101010101011001 P: 0000000000000000 C: e941a33f85501303 OK
+ K: 0101010101010801 P: 0000000000000000 C: da99dbbc9a03f379 OK
+ K: 0101010101010401 P: 0000000000000000 C: b7fc92f91d8e92e9 OK
+ K: 0101010101010201 P: 0000000000000000 C: ae8e5caa3ca04e85 OK
+ K: 0101010101010180 P: 0000000000000000 C: 9cc62df43b6eed74 OK
+ K: 0101010101010140 P: 0000000000000000 C: d863dbb5c59a91a0 OK
+ K: 0101010101010120 P: 0000000000000000 C: a1ab2190545b91d7 OK
+ K: 0101010101010110 P: 0000000000000000 C: 0875041e64c570f7 OK
+ K: 0101010101010108 P: 0000000000000000 C: 5a594528bebef1cc OK
+ K: 0101010101010104 P: 0000000000000000 C: fcdb3291de21f0c0 OK
+ K: 0101010101010102 P: 0000000000000000 C: 869efd7f9f265a09 OK
+ K: 1046913489980131 P: 0000000000000000 C: 88d55e54f54c97b4 OK
+ K: 1007103489988020 P: 0000000000000000 C: 0c0cc00c83ea48fd OK
+ K: 10071034c8980120 P: 0000000000000000 C: 83bc8ef3a6570183 OK
+ K: 1046103489988020 P: 0000000000000000 C: df725dcad94ea2e9 OK
+ K: 1086911519190101 P: 0000000000000000 C: e652b53b550be8b0 OK
+ K: 1086911519580101 P: 0000000000000000 C: af527120c485cbb0 OK
+ K: 5107b01519580101 P: 0000000000000000 C: 0f04ce393db926d5 OK
+ K: 1007b01519190101 P: 0000000000000000 C: c9f00ffc74079067 OK
+ K: 3107915498080101 P: 0000000000000000 C: 7cfd82a593252b4e OK
+ K: 3107919498080101 P: 0000000000000000 C: cb49a2f9e91363e3 OK
+ K: 10079115b9080140 P: 0000000000000000 C: 00b588be70d23f56 OK
+ K: 3107911598080140 P: 0000000000000000 C: 406a9a6ab43399ae OK
+ K: 1007d01589980101 P: 0000000000000000 C: 6cb773611dca9ada OK
+ K: 9107911589980101 P: 0000000000000000 C: 67fd21c17dbb5d70 OK
+ K: 9107d01589190101 P: 0000000000000000 C: 9592cb4110430787 OK
+ K: 1007d01598980120 P: 0000000000000000 C: a6b7ff68a318ddd3 OK
+ K: 1007940498190101 P: 0000000000000000 C: 4d102196c914ca16 OK
+ K: 0107910491190401 P: 0000000000000000 C: 2dfa9f4573594965 OK
+ K: 0107910491190101 P: 0000000000000000 C: b46604816c0e0774 OK
+ K: 0107940491190401 P: 0000000000000000 C: 6e7e6221a4f34e87 OK
+ K: 19079210981a0101 P: 0000000000000000 C: aa85e74643233199 OK
+ K: 1007911998190801 P: 0000000000000000 C: 2e5a19db4d1962d6 OK
+ K: 10079119981a0801 P: 0000000000000000 C: 23a866a809d30894 OK
+ K: 1007921098190101 P: 0000000000000000 C: d812d961f017d320 OK
+ K: 100791159819010b P: 0000000000000000 C: 055605816e58608f OK
+ K: 1004801598190101 P: 0000000000000000 C: abd88e8b1b7716f1 OK
+ K: 1004801598190102 P: 0000000000000000 C: 537ac95be69da1e1 OK
+ K: 1004801598190108 P: 0000000000000000 C: aed0f6ae3c25cdd8 OK
+ K: 1002911598100104 P: 0000000000000000 C: b3e35a5ee53e7b8d OK
+ K: 1002911598190104 P: 0000000000000000 C: 61c79c71921a2ef8 OK
+ K: 1002911598100201 P: 0000000000000000 C: e2f5728f0995013c OK
+ K: 1002911698100101 P: 0000000000000000 C: 1aeac39a61f0a464 OK
+ K: 7ca110454a1a6e57 P: 01a1d6d039776742 C: 690f5b0d9a26939b OK
+ K: 0131d9619dc1376e P: 5cd54ca83def57da C: 7a389d10354bd271 OK
+ K: 07a1133e4a0b2686 P: 0248d43806f67172 C: 868ebb51cab4599a OK
+ K: 3849674c2602319e P: 51454b582ddf440a C: 7178876e01f19b2a OK
+ K: 04b915ba43feb5b6 P: 42fd443059577fa2 C: af37fb421f8c4095 OK
+ K: 0113b970fd34f2ce P: 059b5e0851cf143a C: 86a560f10ec6d85b OK
+ K: 0170f175468fb5e6 P: 0756d8e0774761d2 C: 0cd3da020021dc09 OK
+ K: 43297fad38e373fe P: 762514b829bf486a C: ea676b2cb7db2b7a OK
+ K: 07a7137045da2a16 P: 3bdd119049372802 C: dfd64a815caf1a0f OK
+ K: 04689104c2fd3b2f P: 26955f6835af609a C: 5c513c9c4886c088 OK
+ K: 37d06bb516cb7546 P: 164d5e404f275232 C: 0a2aeeae3ff4ab77 OK
+ K: 1f08260d1ac2465e P: 6b056e18759f5cca C: ef1bf03e5dfa575a OK
+ K: 584023641aba6176 P: 004bd6ef09176062 C: 88bf0db6d70dee56 OK
+ K: 025816164629b007 P: 480d39006ee762f2 C: a1f9915541020b56 OK
+ K: 49793ebc79b3258f P: 437540c8698f3cfa C: 6fbf1cafcffd0556 OK
+ K: 4fb05e1515ab73a7 P: 072d43a077075292 C: 2f22e49bab7ca1ac OK
+ K: 49e95d6d4ca229bf P: 02fe55778117f12a C: 5a6b612cc26cce4a OK
+ K: 018310dc409b26d6 P: 1d9d5c5018f728c2 C: 5f4c038ed12b2e41 OK
+ K: 1c587f1c13924fef P: 305532286d6f295a C: 63fac0d034d9f793 OK
+Passed DES validation suite
diff --git a/test/ctype/Makefile b/test/ctype/Makefile
index ce212cd09..d2b7bc5de 100644
--- a/test/ctype/Makefile
+++ b/test/ctype/Makefile
@@ -1,6 +1,6 @@
# uClibc ctype tests
-# Licensed under the GNU Library General Public License, see COPYING.LIB
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-TESTS = ctype
+TESTS := ctype
include ../Test.mak
diff --git a/test/ctype/ctype.c b/test/ctype/ctype.c
index dd9b72aaf..352b2d2c8 100644
--- a/test/ctype/ctype.c
+++ b/test/ctype/ctype.c
@@ -1,25 +1,9 @@
/* vi: set sw=4 ts=4: */
/*
* Test application for functions defined in ctype.h
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
*
- * Copyright (C) 2000 by Lineo, inc. and Erik Andersen
- * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
- * Written by Erik Andersen <andersen@uclibc.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 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 Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#include <stdio.h>
diff --git a/test/dlopen/Makefile b/test/dlopen/Makefile
index 48d5e29cc..8c6032238 100644
--- a/test/dlopen/Makefile
+++ b/test/dlopen/Makefile
@@ -1,74 +1,31 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 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 Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# uClibc dlopen tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-include ../Rules.mak
+# rules need a little love to work with glibc ...
+export UCLIBC_ONLY := 1
-DEBUG_LIBS=X
-#DEBUG_LIBS=LD_DEBUG
+TESTS := dltest dltest2 test1 test2 test3
-all: run
+include ../Test.mak
-test1: test1.c
- $(CC) $(CFLAGS) $(LDFLAGS) -o test1 test1.c -ldl
+CFLAGS_dltest := -DLIBNAME="\"./libtest.so\""
+CFLAGS_dltest2 := -DLIBNAME="\"./libtest3.so\""
-test2: test2.c
- $(CC) $(CFLAGS) $(LDFLAGS) -o test2 test2.c -ldl
+LDFLAGS_dltest := -ldl -lpthread
+LDFLAGS_dltest2 := -ldl -lpthread
+LDFLAGS_test1 := -ldl
+LDFLAGS_test2 := -ldl
+LDFLAGS_test3 := -ldl ./libtest1.so ./libtest2.so -Wl,-rpath,.
-test3: test3.c
- $(CC) $(CFLAGS) $(LDFLAGS) -o test3 test3.c -ldl ./libtest1.so ./libtest2.so
+DEBUG_LIBS := X
+WRAPPER := env $(DEBUG_LIBS)=all LD_LIBRARY_PATH="$$PWD:.:$(LD_LIBRARY_PATH)"
-libtest1.o: libtest1.c
- $(CC) $(CFLAGS) $(LDFLAGS) -fPIC -c libtest1.c -o libtest1.o
-
-libtest2.o: libtest2.c
- $(CC) $(CFLAGS) $(LDFLAGS) -fPIC -c libtest2.c -o libtest2.o
-
-libtest1.so: libtest1.o
- $(CC) $(CFLAGS) -fPIC -shared -o libtest1.so -Wl,-soname,libtest1.so libtest1.o ./libtest2.so
-
-libtest2.so: libtest2.o
- $(CC) $(CFLAGS) -fPIC -shared -o libtest2.so -Wl,-soname,libtest2.so libtest2.o
-
-dltest: dltest.c
- $(CC) $(CFLAGS) $(LDFLAGS) -DLIBNAME="\"./libtest.so\"" dltest.c -ldl -lpthread -o dltest
-
-libtest.so: libtest.c
- $(CC) $(CFLAGS) -fPIC -shared -Wl,-soname,libtest.so libtest.c -o libtest.so
-
-# Second time, directly link libtest3.so with libpthread
-dltest2: dltest.c
- $(CC) $(CFLAGS) $(LDFLAGS) -DLIBNAME="\"./libtest3.so\"" dltest.c -ldl -lpthread -o dltest2
-
-libtest3.so: libtest.c
- $(CC) $(CFLAGS) -fPIC -shared -Wl,-soname,libtest3.so libtest.c -o libtest3.so -lpthread
-
-run: libtest2.so libtest1.so test1 test2 test3 dltest libtest.so dltest2 libtest3.so
- @echo "----------running test 1--------------"
- LD_LIBRARY_PATH=`pwd`:. $(DEBUG_LIBS)=all ./test1
- @echo "----------running test 2--------------"
- LD_LIBRARY_PATH=`pwd`:. $(DEBUG_LIBS)=all ./test2
- @echo "----------running test 3--------------"
- LD_LIBRARY_PATH=`pwd`:. $(DEBUG_LIBS)=all ./test3
- @echo "----------running test 3--------------"
- $(DEBUG_LIBS)=all ./dltest2
- @echo "----------running test 4--------------"
- $(DEBUG_LIBS)=all ./dltest
-
-clean:
- $(RM) *.o libtest1.so* libtest2.so* test1 test2 test3 \
- dltest dltest2 libtest.so libtest3.so
+dltest: libtest.so
+dltest2: libtest3.so
+test1: libtest1.so
+test2: libtest1.so libtest2.so
+test3: libtest1.so libtest2.so
+libtest1.so: libtest2.so
+LDFLAGS_libtest1.so := ./libtest2.so -Wl,-rpath,.
+LDFLAGS_libtest2.so := -Wl,-rpath,.
+LDFLAGS_libtest3.so := -lpthread -Wl,-rpath,.
diff --git a/test/dlopen/dltest2.c b/test/dlopen/dltest2.c
new file mode 100644
index 000000000..127b3b52c
--- /dev/null
+++ b/test/dlopen/dltest2.c
@@ -0,0 +1 @@
+#include "dltest.c"
diff --git a/test/dlopen/libtest3.c b/test/dlopen/libtest3.c
new file mode 100644
index 000000000..1d4bd7e67
--- /dev/null
+++ b/test/dlopen/libtest3.c
@@ -0,0 +1 @@
+#include "libtest.c"
diff --git a/test/inet/Makefile b/test/inet/Makefile
new file mode 100644
index 000000000..91927e42e
--- /dev/null
+++ b/test/inet/Makefile
@@ -0,0 +1,4 @@
+# uClibc inet tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+include ../Test.mak
diff --git a/test/inet/bug-if1.c b/test/inet/bug-if1.c
new file mode 100644
index 000000000..6bcd175eb
--- /dev/null
+++ b/test/inet/bug-if1.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include <net/if.h>
+
+
+static int
+do_test (void)
+{
+ char buf[IF_NAMESIZE];
+ /* Index 0 is always invalid (see RFC 3493). */
+ char *cp = if_indextoname (0, buf);
+ if (cp != NULL)
+ {
+ printf ("invalid index returned result \"%s\"\n", cp);
+ return 1;
+ }
+ else if (errno != ENXIO)
+ {
+ int err = errno;
+ char errbuf1[256];
+ char errbuf2[256];
+
+ printf ("errno = %d (%s), expected %d (%s)\n",
+ err, strerror_r (err, errbuf1, sizeof (errbuf1)),
+ ENXIO, strerror_r (ENXIO, errbuf2, sizeof (errbuf2)));
+ return 1;
+ }
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/test/inet/if_nameindex.c b/test/inet/if_nameindex.c
index 96d9b0113..069d96d99 100644
--- a/test/inet/if_nameindex.c
+++ b/test/inet/if_nameindex.c
@@ -52,7 +52,7 @@ void test_if_nametoindex(void)
printf("if_nametoindex(%s) = %i\n", ifname, ifindex);
}
-int main()
+int main(void)
{
test_if_nameindex();
test_if_indextoname();
diff --git a/test/inet/tst-aton.c b/test/inet/tst-aton.c
new file mode 100644
index 000000000..3e945f130
--- /dev/null
+++ b/test/inet/tst-aton.c
@@ -0,0 +1,80 @@
+#include <stdio.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+/* Note: uClibc only supports the standard notation 'a.b.c.d' */
+
+static struct tests
+{
+ const char *input;
+ int valid;
+ uint32_t result;
+} tests[] =
+{
+ { "", 0, 0 },
+ { "-1", 0, 0 },
+/*
+ { "256", 1, 0x00000100 },
+*/
+ { "256.", 0, 0 },
+ { "256a", 0, 0 },
+/*
+ { "0x100", 1, 0x00000100 },
+ { "0200.0x123456", 1, 0x80123456 },
+ { "0300.0x89123456.", 0 ,0 },
+ { "0100.-0xffff0000", 0, 0 },
+ { "0.0xffffff", 1, 0x00ffffff },
+ { "0.0x1000000", 0, 0 },
+ { "0377.16777215", 1, 0xffffffff },
+ { "0377.16777216", 0, 0 },
+ { "0x87.077777777", 1, 0x87ffffff },
+ { "0x87.0100000000", 0, 0 },
+ { "0.1.3", 1, 0x00010003 },
+*/
+ { "0.256.3", 0, 0 },
+ { "256.1.3", 0, 0 },
+/*
+ { "0.1.0x10000", 0, 0 },
+ { "0.1.0xffff", 1, 0x0001ffff },
+*/
+ { "0.1a.3", 0, 0 },
+ { "0.1.a3", 0, 0 },
+ { "1.2.3.4", 1, 0x01020304 },
+ { "0400.2.3.4", 0, 0 },
+ { "1.0x100.3.4", 0, 0 },
+ { "1.2.256.4", 0, 0 },
+ { "1.2.3.0x100", 0, 0 },
+ { "323543357756889", 0, 0 },
+ { "10.1.2.3.4", 0, 0},
+};
+
+
+int
+main (int argc, char *argv[])
+{
+ int result = 0;
+ size_t cnt;
+
+ for (cnt = 0; cnt < sizeof (tests) / sizeof (tests[0]); ++cnt)
+ {
+ struct in_addr addr;
+
+ if ((int) inet_aton (tests[cnt].input, &addr) != tests[cnt].valid)
+ {
+ if (tests[cnt].valid)
+ printf ("\"%s\" not seen as valid IP address\n", tests[cnt].input);
+ else
+ printf ("\"%s\" seen as valid IP address\n", tests[cnt].input);
+ result = 1;
+ }
+ else if (tests[cnt].valid && addr.s_addr != ntohl (tests[cnt].result))
+ {
+ printf ("\"%s\" not converted correctly: is %08x, should be %08x\n",
+ tests[cnt].input, addr.s_addr, tests[cnt].result);
+ result = 1;
+ }
+ }
+
+ return result;
+}
diff --git a/test/inet/tst-network.c b/test/inet/tst-network.c
new file mode 100644
index 000000000..428388805
--- /dev/null
+++ b/test/inet/tst-network.c
@@ -0,0 +1,73 @@
+/* Test for inet_network.
+ Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 2000.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdio.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+struct
+{
+ const char *network;
+ uint32_t number;
+} tests [] =
+{
+ {"1.0.0.0", 0x1000000},
+ {"1.0.0", 0x10000},
+ {"1.0", 0x100},
+ {"1", 0x1},
+ {"192.168.0.0", 0xC0A80000},
+ /* Now some invalid addresses. */
+ {"141.30.225.2800", INADDR_NONE},
+ {"141.76.1.1.1", INADDR_NONE},
+ {"141.76.1.11.", INADDR_NONE},
+ {"1410", INADDR_NONE},
+ {"1.1410", INADDR_NONE},
+ {"1.1410.", INADDR_NONE},
+ {"1.1410", INADDR_NONE},
+ {"141.76.1111", INADDR_NONE},
+ {"141.76.1111.", INADDR_NONE}
+};
+
+
+int
+main (void)
+{
+ int errors = 0;
+ size_t i;
+ uint32_t res;
+
+ for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
+ {
+ printf ("Testing: %s\n", tests[i].network);
+ res = inet_network (tests[i].network);
+
+ if (res != tests[i].number)
+ {
+ printf ("Test failed for inet_network (\"%s\"):\n",
+ tests[i].network);
+ printf ("Expected return value %u (0x%x) but got %u (0x%x).\n",
+ tests[i].number, tests[i].number, res, res);
+ }
+
+ }
+
+ return errors != 0;
+}
diff --git a/test/inet/tst-ntoa.c b/test/inet/tst-ntoa.c
new file mode 100644
index 000000000..9be91eb51
--- /dev/null
+++ b/test/inet/tst-ntoa.c
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include <string.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+
+
+static int
+test (unsigned int inaddr, const char *expected)
+{
+ struct in_addr addr;
+ char *res;
+ int fail;
+
+ addr.s_addr = htonl (inaddr);
+ res = inet_ntoa (addr);
+ fail = strcmp (res, expected);
+
+ printf ("%#010x -> \"%s\" -> %s%s\n", inaddr, res,
+ fail ? "fail, expected" : "ok", fail ? expected : "");
+
+ return fail;
+}
+
+
+int
+main (void)
+{
+ int result = 0;
+
+ result |= test (INADDR_LOOPBACK, "127.0.0.1");
+ result |= test (INADDR_BROADCAST, "255.255.255.255");
+ result |= test (INADDR_ANY, "0.0.0.0");
+ result |= test (0xc0060746, "192.6.7.70");
+
+ return result;
+}
diff --git a/test/malloc/Makefile b/test/malloc/Makefile
index a05b3aae1..3e92e6cdb 100644
--- a/test/malloc/Makefile
+++ b/test/malloc/Makefile
@@ -1,7 +1,6 @@
# uClibc malloc tests
-# Licensed under the GNU Library General Public License, see COPYING.LIB
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-TESTS = malloc mallocbug realloc0 testmalloc
-#time_malloc
+TESTS_DISABLED := time_malloc
include ../Test.mak
diff --git a/test/malloc/testmalloc.c b/test/malloc/testmalloc.c
index 158bf4236..caf08a9e1 100644
--- a/test/malloc/testmalloc.c
+++ b/test/malloc/testmalloc.c
@@ -67,7 +67,10 @@ int main(void)
goto Failed;
}
}
- realloc(lp, 0);
+ {
+ void *unused_ret = realloc(lp, 0);
+ (void) unused_ret;
+ }
printf("Allocate another 100 nodes 600 bytes each\n");
save = 0;
diff --git a/test/malloc/tst-calloc.c b/test/malloc/tst-calloc.c
new file mode 100644
index 000000000..b3594c937
--- /dev/null
+++ b/test/malloc/tst-calloc.c
@@ -0,0 +1,126 @@
+/* Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <error.h>
+#include <limits.h>
+#include <malloc.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+
+/* Number of samples per size. */
+#define N 50000
+
+
+static void
+fixed_test (int size)
+{
+ char *ptrs[N];
+ int i;
+
+ for (i = 0; i < N; ++i)
+ {
+ int j;
+
+ ptrs[i] = (char *) calloc (1, size);
+
+ if (ptrs[i] == NULL)
+ break;
+
+ for (j = 0; j < size; ++j)
+ {
+ if (ptrs[i][j] != '\0')
+ error (EXIT_FAILURE, 0,
+ "byte not cleared (size %d, element %d, byte %d)",
+ size, i, j);
+ ptrs[i][j] = '\xff';
+ }
+ }
+
+ while (i-- > 0)
+ free (ptrs[i]);
+}
+
+
+static void
+random_test (void)
+{
+ char *ptrs[N];
+ int i;
+
+ for (i = 0; i < N; ++i)
+ {
+ int j;
+ int n = 1 + random () % 10;
+ int elem = 1 + random () % 100;
+ int size = n * elem;
+
+ ptrs[i] = (char *) calloc (n, elem);
+
+ if (ptrs[i] == NULL)
+ break;
+
+ for (j = 0; j < size; ++j)
+ {
+ if (ptrs[i][j] != '\0')
+ error (EXIT_FAILURE, 0,
+ "byte not cleared (size %d, element %d, byte %d)",
+ size, i, j);
+ ptrs[i][j] = '\xff';
+ }
+ }
+
+ while (i-- > 0)
+ free (ptrs[i]);
+}
+
+
+static void
+null_test (void)
+{
+ /* If the size is 0 the result is implementation defined. Just make
+ sure the program doesn't crash. */
+ calloc (0, 0);
+ calloc (0, UINT_MAX);
+ calloc (UINT_MAX, 0);
+ calloc (0, ~((size_t) 0));
+ calloc (~((size_t) 0), 0);
+}
+
+
+int
+main (void)
+{
+ /* We are allocating blocks with `calloc' and check whether every
+ block is completely cleared. We first try this for some fixed
+ times and then with random size. */
+ fixed_test (15);
+ fixed_test (5);
+ fixed_test (17);
+ fixed_test (6);
+ fixed_test (31);
+ fixed_test (96);
+
+ random_test ();
+
+ null_test ();
+
+ return 0;
+}
diff --git a/test/malloc/tst-malloc.c b/test/malloc/tst-malloc.c
new file mode 100644
index 000000000..468e1d4ba
--- /dev/null
+++ b/test/malloc/tst-malloc.c
@@ -0,0 +1,73 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <malloc.h>
+#include <stdio.h>
+#include <features.h>
+
+static int errors = 0;
+
+static void
+merror (const char *msg)
+{
+ ++errors;
+ printf ("Error: %s\n", msg);
+}
+
+int
+main (void)
+{
+ void *p;
+ int save;
+
+ errno = 0;
+
+ p = malloc (-1);
+ save = errno;
+
+ if (p != NULL)
+ merror ("malloc (-1) succeeded.");
+
+ if (p == NULL && save != ENOMEM)
+ merror ("errno is not set correctly");
+
+ p = malloc (10);
+ if (p == NULL)
+ merror ("malloc (10) failed.");
+
+ /* realloc (p, 0) == free (p). */
+ p = realloc (p, 0);
+ if (p != NULL)
+ merror ("realloc (p, 0) failed.");
+
+ p = malloc (0);
+#if !defined(__UCLIBC__) || defined(__MALLOC_GLIBC_COMPAT__)
+ if (p == NULL)
+#else
+ if (p != NULL)
+#endif
+ merror ("malloc (0) failed.");
+
+ p = realloc (p, 0);
+ if (p != NULL)
+ merror ("realloc (p, 0) failed.");
+
+ return errors != 0;
+}
diff --git a/test/malloc/tst-mallocfork.c b/test/malloc/tst-mallocfork.c
new file mode 100644
index 000000000..5bb1d7628
--- /dev/null
+++ b/test/malloc/tst-mallocfork.c
@@ -0,0 +1,51 @@
+/* Derived from the test case in
+ http://sourceware.org/bugzilla/show_bug.cgi?id=838. */
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+static void
+sig_handler (int signum)
+{
+ pid_t child = vfork ();
+ if (child == 0)
+ exit (0);
+ TEMP_FAILURE_RETRY (waitpid (child, NULL, 0));
+}
+
+static int
+do_test (void)
+{
+ pid_t parent = getpid ();
+
+ struct sigaction action = { .sa_handler = sig_handler };
+ sigemptyset (&action.sa_mask);
+
+ malloc (sizeof (int));
+
+ if (sigaction (SIGALRM, &action, NULL) != 0)
+ {
+ puts ("sigaction failed");
+ return 1;
+ }
+
+ /* Create a child that sends the signal to be caught. */
+ pid_t child = vfork ();
+ if (child == 0)
+ {
+ if (kill (parent, SIGALRM) == -1)
+ perror ("kill");
+ exit (0);
+ }
+
+ TEMP_FAILURE_RETRY (waitpid (child, NULL, 0));
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/test/malloc/tst-mcheck.c b/test/malloc/tst-mcheck.c
new file mode 100644
index 000000000..af72c042b
--- /dev/null
+++ b/test/malloc/tst-mcheck.c
@@ -0,0 +1,96 @@
+/* Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2005.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <features.h>
+
+static int errors = 0;
+
+static void
+merror (const char *msg)
+{
+ ++errors;
+ printf ("Error: %s\n", msg);
+}
+
+int
+main (void)
+{
+ void *p, *q;
+
+ errno = 0;
+
+ p = malloc (-1);
+
+ if (p != NULL)
+ merror ("malloc (-1) succeeded.");
+ else if (errno != ENOMEM)
+ merror ("errno is not set correctly.");
+
+ p = malloc (10);
+ if (p == NULL)
+ merror ("malloc (10) failed.");
+
+ p = realloc (p, 0);
+ if (p != NULL)
+ merror ("realloc (p, 0) failed.");
+
+ p = malloc (0);
+#if !defined(__UCLIBC__) || defined(__MALLOC_GLIBC_COMPAT__)
+ if (p == NULL)
+#else
+ if (p != NULL)
+#endif
+ merror ("malloc (0) failed.");
+
+ p = realloc (p, 0);
+ if (p != NULL)
+ merror ("realloc (p, 0) failed.");
+
+ q = malloc (256);
+ if (q == NULL)
+ merror ("malloc (256) failed.");
+
+ p = malloc (512);
+ if (p == NULL)
+ merror ("malloc (512) failed.");
+
+ if (realloc (p, -256) != NULL)
+ merror ("realloc (p, -256) succeeded.");
+ else if (errno != ENOMEM)
+ merror ("errno is not set correctly.");
+
+ free (p);
+
+ p = malloc (512);
+ if (p == NULL)
+ merror ("malloc (512) failed.");
+
+ if (realloc (p, -1) != NULL)
+ merror ("realloc (p, -1) succeeded.");
+ else if (errno != ENOMEM)
+ merror ("errno is not set correctly.");
+
+ free (p);
+ free (q);
+
+ return errors != 0;
+}
diff --git a/test/malloc/tst-obstack.c b/test/malloc/tst-obstack.c
new file mode 100644
index 000000000..769697f18
--- /dev/null
+++ b/test/malloc/tst-obstack.c
@@ -0,0 +1,64 @@
+/* Test case by Alexandre Duret-Lutz <duret_g@epita.fr>. */
+#include <obstack.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define obstack_chunk_alloc verbose_malloc
+#define obstack_chunk_free verbose_free
+#define ALIGN_BOUNDARY 64
+#define ALIGN_MASK (ALIGN_BOUNDARY - 1)
+#define OBJECT_SIZE 1000
+
+static void *
+verbose_malloc (size_t size)
+{
+ void *buf = malloc (size);
+ printf ("malloc (%zu) => %p\n", size, buf);
+ return buf;
+}
+
+static void
+verbose_free (void *buf)
+{
+ free (buf);
+ printf ("free (%p)\n", buf);
+}
+
+int
+main (void)
+{
+ int result = 0;
+ int align = 2;
+
+ while (align <= 64)
+ {
+ struct obstack obs;
+ int i;
+ int align_mask = align - 1;
+
+ printf ("\n Alignment mask: %d\n", align_mask);
+
+ obstack_init (&obs);
+ obstack_alignment_mask (&obs) = align_mask;
+ /* finish an empty object to take alignment into account */
+ obstack_finish (&obs);
+
+ /* let's allocate some objects and print their addresses */
+ for (i = 15; i > 0; --i)
+ {
+ void *obj = obstack_alloc (&obs, OBJECT_SIZE);
+
+ printf ("obstack_alloc (%u) => %p \t%s\n", OBJECT_SIZE, obj,
+ ((uintptr_t) obj & align_mask) ? "(not aligned)" : "");
+ result |= ((uintptr_t) obj & align_mask) != 0;
+ }
+
+ /* clean up */
+ obstack_free (&obs, 0);
+
+ align <<= 1;
+ }
+
+ return result;
+}
diff --git a/test/malloc/tst-valloc.c b/test/malloc/tst-valloc.c
new file mode 100644
index 000000000..643a0dda4
--- /dev/null
+++ b/test/malloc/tst-valloc.c
@@ -0,0 +1,23 @@
+/* Test case by Stephen Tweedie <sct@redhat.com>. */
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main (void)
+{
+ char *p;
+ int pagesize = getpagesize ();
+ int i;
+
+ p = valloc (pagesize);
+ i = (long int) p;
+
+ if ((i & (pagesize-1)) != 0)
+ {
+ fprintf (stderr, "Alignment problem: valloc returns %p\n", p);
+ exit (1);
+ }
+
+ return 0;
+}
diff --git a/test/math/Makefile b/test/math/Makefile
index 568e1ae6d..7ad92b10b 100644
--- a/test/math/Makefile
+++ b/test/math/Makefile
@@ -1,101 +1,21 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 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 Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# uClibc math tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-include ../Rules.mak
+TESTS := basic-test rint tst-definitions test-fpucw
+# test-double test-idouble
+# test-float test-ifloat
+# test-ldouble test-ildouble
-CFLAGS+=-D_GNU_SOURCE -DNO_LONG_DOUBLE
-EXTRA_LIBS=-lm
-PERL=/usr/bin/perl
+include ../Test.mak
-TARGETS:=
-libm-tests=libm-test.c
-libm-tests+= test-double test-idouble
-libm-tests+= diff
-#libm-tests+= test-float test-ifloat
-#libm-tests+= test-ldouble test-ildouble
-libm-tests.o = $(addsuffix .o,$(libm-tests))
+DODIFF_rint := 1
-libm-tests-generated = libm-test-ulps.h libm-test.c
-generated += $(libm-tests-generated) libm-test.stmp
-TARGETS += $(libm-tests) #$(libm-tests-generated)
-
-all: $(TARGETS)
-
-test-double: test-double.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- ./$@
-test-idouble: test-idouble.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- ./$@
-test-float: test-float.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- ./$@
-test-ifloat: test-ifloat.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- ./$@
-test-ldouble: test-ldouble.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- ./$@
-test-ildouble: test-ildoubl.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- ./$@
-
-rint: rint.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ > $@.out 2>&1
- -@ echo " "
-
-rint_glibc: rint.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ > $@.out 2>&1
- -@ echo " "
-
-diff: rint_glibc rint
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing output: "
- -@ echo " "
- -diff -u rint_glibc.out rint.out
- -@ echo " "
-
-test-float.o: libm-test.c
-test-ifloat.o: libm-test.c
-test-double.o: libm-test.c
-test-idouble.o: libm-test.c
-test-ldouble.o: libm-test.c
-test-ildoubl.o: libm-test.c
-
-ulps-file = $(firstword $(wildcard $(config-sysdirs:%=$(..)%/libm-test-ulps)))
+EXTRA_CFLAGS := -DNO_LONG_DOUBLE -fno-builtin
+EXTRA_LDFLAGS := -lm
+PERL := /usr/bin/perl
+ulps-file := $(firstword $(wildcard $(config-sysdirs:%=$(..)%/libm-test-ulps)))
libm-test.c: $(ulps-file) libm-test.inc gen-libm-test.pl
- $(PERL) ./gen-libm-test.pl -u $< ./libm-test.inc -o "." 2>&1 > /dev/null
-
-clean:
- $(RM) *.[oa] *~ core $(TARGETS) $(generated) rint_glibc.out rint.out
+ $(Q)$(PERL) ./gen-libm-test.pl -u $< ./libm-test.inc -o "." 2>&1 > /dev/null
+EXTRA_CLEAN := libm-test.c
+$(TARGETS): libm-test.c
diff --git a/test/math/basic-test.c b/test/math/basic-test.c
new file mode 100644
index 000000000..e42c01457
--- /dev/null
+++ b/test/math/basic-test.c
@@ -0,0 +1,123 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <math.h>
+#include <float.h>
+#include <stdio.h>
+
+static int errors = 0;
+
+
+static void
+check (const char *testname, int result)
+{
+ if (!result) {
+ printf ("Failure: %s\n", testname);
+ errors++;
+ }
+}
+
+#define TEST_FUNC(NAME, FLOAT, NANFUNC, EPSILON, HUGEVAL) \
+static void \
+NAME (void) \
+{ \
+ /* Variables are declared volatile to forbid some compiler \
+ optimizations. */ \
+ volatile FLOAT Inf_var, NaN_var, zero_var, one_var; \
+ FLOAT x1, x2; \
+ \
+ zero_var = 0.0; \
+ one_var = 1.0; \
+ NaN_var = zero_var/zero_var; \
+ Inf_var = one_var / zero_var; \
+ \
+ (void) &zero_var; \
+ (void) &one_var; \
+ (void) &NaN_var; \
+ (void) &Inf_var; \
+ \
+ \
+ check (#FLOAT " isinf (inf) == 1", isinf (Inf_var) == 1); \
+ check (#FLOAT " isinf (-inf) == -1", isinf (-Inf_var) == -1); \
+ check (#FLOAT " !isinf (1)", !(isinf (one_var))); \
+ check (#FLOAT " !isinf (NaN)", !(isinf (NaN_var))); \
+ \
+ check (#FLOAT " isnan (NaN)", isnan (NaN_var)); \
+ check (#FLOAT " isnan (-NaN)", isnan (-NaN_var)); \
+ check (#FLOAT " !isnan (1)", !(isnan (one_var))); \
+ check (#FLOAT " !isnan (inf)", !(isnan (Inf_var))); \
+ \
+ check (#FLOAT " inf == inf", Inf_var == Inf_var); \
+ check (#FLOAT " -inf == -inf", -Inf_var == -Inf_var); \
+ check (#FLOAT " inf != -inf", Inf_var != -Inf_var); \
+ check (#FLOAT " NaN != NaN", NaN_var != NaN_var); \
+ \
+ /* \
+ the same tests but this time with NAN from <bits/nan.h> \
+ NAN is a double const \
+ */ \
+ check (#FLOAT " isnan (NAN)", isnan (NAN)); \
+ check (#FLOAT " isnan (-NAN)", isnan (-NAN)); \
+ check (#FLOAT " !isinf (NAN)", !(isinf (NAN))); \
+ check (#FLOAT " !isinf (-NAN)", !(isinf (-NAN))); \
+ check (#FLOAT " NAN != NAN", NAN != NAN); \
+ \
+ /* \
+ And again with the value returned by the `nan' function. \
+ */ \
+ check (#FLOAT " isnan (NAN)", isnan (NANFUNC (""))); \
+ check (#FLOAT " isnan (-NAN)", isnan (-NANFUNC (""))); \
+ check (#FLOAT " !isinf (NAN)", !(isinf (NANFUNC ("")))); \
+ check (#FLOAT " !isinf (-NAN)", !(isinf (-NANFUNC ("")))); \
+ check (#FLOAT " NAN != NAN", NANFUNC ("") != NANFUNC ("")); \
+ \
+ /* test if EPSILON is ok */ \
+ x1 = 1.0; \
+ x2 = x1 + EPSILON; \
+ check (#FLOAT " 1 != 1+EPSILON", x1 != x2); \
+ \
+ x1 = 1.0; \
+ x2 = x1 - EPSILON; \
+ check (#FLOAT " 1 != 1-EPSILON", x1 != x2); \
+ \
+ /* test if HUGE_VALx is ok */ \
+ x1 = HUGEVAL; \
+ check (#FLOAT " isinf (HUGE_VALx) == +1", isinf (x1) == +1); \
+ x1 = - HUGEVAL; \
+ check (#FLOAT " isinf (-HUGE_VALx) == -1", isinf (x1) == -1); \
+}
+
+TEST_FUNC (float_test, float, nanf, FLT_EPSILON, HUGE_VALF)
+TEST_FUNC (double_test, double, nan, DBL_EPSILON, HUGE_VAL)
+#ifndef NO_LONG_DOUBLE
+TEST_FUNC (ldouble_test, long double, nanl, LDBL_EPSILON, HUGE_VALL)
+#endif
+
+int
+main (void)
+{
+ float_test ();
+ double_test ();
+
+#ifndef NO_LONG_DOUBLE
+ ldouble_test ();
+#endif
+
+ return errors != 0;
+}
diff --git a/test/math/fenv.h b/test/math/fenv.h
new file mode 100644
index 000000000..0025a62cc
--- /dev/null
+++ b/test/math/fenv.h
@@ -0,0 +1,3 @@
+/* until we support fenv ... */
+#define feclearexcept(X)
+#define fetestexcept(X) (0)
diff --git a/test/math/libm-test.inc b/test/math/libm-test.inc
index bcd941c1a..c0cb6be52 100644
--- a/test/math/libm-test.inc
+++ b/test/math/libm-test.inc
@@ -1,6 +1,6 @@
-/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1997.
+ Contributed by Andreas Jaeger <aj@suse.de>, 1997.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -22,7 +22,7 @@
This file is processed by a perl script. The resulting file has to
be included by a master file that defines:
- Makros:
+ Macros:
FUNC(function): converts general function name (like cos) to
name with correct suffix (e.g. cosl or cosf)
MATHCONST(x): like FUNC but for constants (e.g convert 0.0 to 0.0L)
@@ -51,14 +51,14 @@
pow, remainder, remquo, rint, lrint, llrint,
round, lround, llround,
scalb, scalbn, scalbln, signbit, sin, sincos, sinh, sqrt, tan, tanh, tgamma, trunc,
- y0, y1, yn
+ y0, y1, yn, significand
and for the following complex math functions:
cabs, cacos, cacosh, carg, casin, casinh, catan, catanh,
ccos, ccosh, cexp, clog, cpow, cproj, csin, csinh, csqrt, ctan, ctanh.
At the moment the following functions aren't tested:
- drem, significand, nan
+ drem, nan
Parameter handling is primitive in the moment:
--verbose=[0..3] for different levels of output:
@@ -84,7 +84,7 @@
aren't checked at the moment.
NaN values: There exist signalling and quiet NaNs. This implementation
- only uses signalling NaN as parameter but does not differenciate
+ only uses quiet NaN as parameter but does not differenciate
between the two kinds of NaNs as result.
Inline functions: Inlining functions should give an improvement in
@@ -107,9 +107,10 @@
To Do: All parameter should be numbers that can be represented as
- exact floating point values. Currently some values cannot be represented
- exactly and therefore the result is not the expected result.
-*/
+ exact floating point values. Currently some values cannot be
+ represented exactly and therefore the result is not the expected
+ result. For this we will use 36 digits so that numbers can be
+ represented exactly. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
@@ -119,6 +120,7 @@
#include <complex.h>
#include <math.h>
#include <float.h>
+#include "fenv.h"
#include <limits.h>
#include <errno.h>
@@ -127,10 +129,6 @@
#include <string.h>
#include <getopt.h>
-//#include <fenv.h>
-#define feclearexcept(X)
-#define fetestexcept(X) 0
-
/* Possible exceptions */
#define NO_EXCEPTION 0x0
#define INVALID_EXCEPTION 0x1
@@ -155,6 +153,7 @@
#define M_PI2_LOG10El M_PI_2l * M_LOG10El
#define M_PI4_LOG10El M_PI_4l * M_LOG10El
#define M_PI_LOG10El M_PIl * M_LOG10El
+#define M_SQRT_2_2 0.70710678118654752440084436210484903L /* sqrt (2) / 2 */
static FILE *ulps_file; /* File to document difference. */
static int output_ulps; /* Should ulps printed? */
@@ -171,7 +170,7 @@ static int output_points; /* Should the single function results printed? */
static int ignore_max_ulp; /* Should we ignore max_ulp? */
static FLOAT minus_zero, plus_zero;
-static FLOAT plus_infty, minus_infty, nan_value;
+static FLOAT plus_infty, minus_infty, nan_value, max_value, min_value;
static FLOAT max_error, real_max_error, imag_max_error;
@@ -499,7 +498,7 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
&& computed == 0.0 && expected == 0.0
&& signbit(computed) != signbit (expected))
ok = 0;
- else if (ulp == 0.0 || (ulp <= max_ulp && !ignore_max_ulp))
+ else if (ulp <= 0.5 || (ulp <= max_ulp && !ignore_max_ulp))
ok = 1;
else
{
@@ -726,8 +725,8 @@ acos_test (void)
TEST_f_f (acos, nan_value, nan_value);
/* |x| > 1: */
- TEST_f_f (acos, 1.1L, nan_value, INVALID_EXCEPTION);
- TEST_f_f (acos, -1.1L, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (acos, 1.125L, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (acos, -1.125L, nan_value, INVALID_EXCEPTION);
TEST_f_f (acos, 0, M_PI_2l);
TEST_f_f (acos, minus_zero, M_PI_2l);
@@ -735,8 +734,9 @@ acos_test (void)
TEST_f_f (acos, -1, M_PIl);
TEST_f_f (acos, 0.5, M_PI_6l*2.0);
TEST_f_f (acos, -0.5, M_PI_6l*4.0);
- TEST_f_f (acos, 0.7L, 0.79539883018414355549096833892476432L);
-
+ TEST_f_f (acos, 0.75L, 0.722734247813415611178377352641333362L);
+ TEST_f_f (acos, 2e-17L, 1.57079632679489659923132169163975144L);
+ TEST_f_f (acos, 0.0625L, 1.50825556499840522843072005474337068L);
END (acos);
}
@@ -755,10 +755,10 @@ acosh_test (void)
TEST_f_f (acosh, minus_infty, nan_value, INVALID_EXCEPTION);
/* x < 1: */
- TEST_f_f (acosh, -1.1L, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (acosh, -1.125L, nan_value, INVALID_EXCEPTION);
TEST_f_f (acosh, 1, 0);
- TEST_f_f (acosh, 7, 2.633915793849633417250092694615937L);
+ TEST_f_f (acosh, 7, 2.63391579384963341725009269461593689L);
END (acosh);
}
@@ -779,8 +779,8 @@ asin_test (void)
TEST_f_f (asin, nan_value, nan_value);
/* asin x == NaN plus invalid exception for |x| > 1. */
- TEST_f_f (asin, 1.1L, nan_value, INVALID_EXCEPTION);
- TEST_f_f (asin, -1.1L, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (asin, 1.125L, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (asin, -1.125L, nan_value, INVALID_EXCEPTION);
TEST_f_f (asin, 0, 0);
TEST_f_f (asin, minus_zero, minus_zero);
@@ -788,7 +788,7 @@ asin_test (void)
TEST_f_f (asin, -0.5, -M_PI_6l);
TEST_f_f (asin, 1.0, M_PI_2l);
TEST_f_f (asin, -1.0, -M_PI_2l);
- TEST_f_f (asin, 0.7L, 0.77539749661075306374035335271498708L);
+ TEST_f_f (asin, 0.75L, 0.848062078981481008052944338998418080L);
END (asin);
}
@@ -811,7 +811,7 @@ asinh_test (void)
TEST_f_f (asinh, minus_infty, minus_infty);
#endif
TEST_f_f (asinh, nan_value, nan_value);
- TEST_f_f (asinh, 0.7L, 0.652666566082355786L);
+ TEST_f_f (asinh, 0.75L, 0.693147180559945309417232121458176568L);
END (asinh);
}
@@ -837,7 +837,7 @@ atan_test (void)
TEST_f_f (atan, 1, M_PI_4l);
TEST_f_f (atan, -1, -M_PI_4l);
- TEST_f_f (atan, 0.7L, 0.61072596438920861654375887649023613L);
+ TEST_f_f (atan, 0.75L, 0.643501108793284386802809228717322638L);
END (atan);
}
@@ -864,10 +864,10 @@ atanh_test (void)
TEST_f_f (atanh, nan_value, nan_value);
/* atanh (x) == NaN plus invalid exception if |x| > 1. */
- TEST_f_f (atanh, 1.1L, nan_value, INVALID_EXCEPTION);
- TEST_f_f (atanh, -1.1L, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (atanh, 1.125L, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (atanh, -1.125L, nan_value, INVALID_EXCEPTION);
- TEST_f_f (atanh, 0.7L, 0.8673005276940531944L);
+ TEST_f_f (atanh, 0.75L, 0.972955074527656652552676371721589865L);
END (atanh);
}
@@ -937,17 +937,18 @@ atan2_test (void)
TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l);
TEST_ff_f (atan2, nan_value, nan_value, nan_value);
- TEST_ff_f (atan2, 0.7L, 1, 0.61072596438920861654375887649023613L);
- TEST_ff_f (atan2, -0.7L, 1.0L, -0.61072596438920861654375887649023613L);
- TEST_ff_f (atan2, 0.7L, -1.0L, 2.530866689200584621918884506789267L);
- TEST_ff_f (atan2, -0.7L, -1.0L, -2.530866689200584621918884506789267L);
- TEST_ff_f (atan2, 0.4L, 0.0003L, 1.5700463269355215717704032607580829L);
- TEST_ff_f (atan2, 1.4L, -0.93L, 2.1571487668237843754887415992772736L);
+ TEST_ff_f (atan2, 0.75L, 1, 0.643501108793284386802809228717322638L);
+ TEST_ff_f (atan2, -0.75L, 1.0L, -0.643501108793284386802809228717322638L);
+ TEST_ff_f (atan2, 0.75L, -1.0L, 2.49809154479650885165983415456218025L);
+ TEST_ff_f (atan2, -0.75L, -1.0L, -2.49809154479650885165983415456218025L);
+ TEST_ff_f (atan2, 0.390625L, .00029L, 1.57005392693128974780151246612928941L);
+ TEST_ff_f (atan2, 1.390625L, 0.9296875L, 0.981498387184244311516296577615519772L);
+
+ TEST_ff_f (atan2, -0.00756827042671106339L, -.001792735857538728036L, -1.80338464113663849327153994379639112L);
END (atan2);
}
-
static void
cabs_test (void)
{
@@ -972,28 +973,29 @@ cabs_test (void)
TEST_c_f (cabs, nan_value, nan_value, nan_value);
/* cabs (x,y) == cabs (y,x). */
- TEST_c_f (cabs, 0.7L, 12.4L, 12.419742348374220601176836866763271L);
+ TEST_c_f (cabs, 0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
/* cabs (x,y) == cabs (-x,y). */
- TEST_c_f (cabs, -12.4L, 0.7L, 12.419742348374220601176836866763271L);
+ TEST_c_f (cabs, -12.390625L, 0.75L, 12.4133028598606664302388810868156657L);
/* cabs (x,y) == cabs (-y,x). */
- TEST_c_f (cabs, -0.7L, 12.4L, 12.419742348374220601176836866763271L);
+ TEST_c_f (cabs, -0.75L, 12.390625L, 12.4133028598606664302388810868156657L);
/* cabs (x,y) == cabs (-x,-y). */
- TEST_c_f (cabs, -12.4L, -0.7L, 12.419742348374220601176836866763271L);
+ TEST_c_f (cabs, -12.390625L, -0.75L, 12.4133028598606664302388810868156657L);
/* cabs (x,y) == cabs (-y,-x). */
- TEST_c_f (cabs, -0.7L, -12.4L, 12.419742348374220601176836866763271L);
+ TEST_c_f (cabs, -0.75L, -12.390625L, 12.4133028598606664302388810868156657L);
/* cabs (x,0) == fabs (x). */
- TEST_c_f (cabs, -0.7L, 0, 0.7L);
- TEST_c_f (cabs, 0.7L, 0, 0.7L);
+ TEST_c_f (cabs, -0.75L, 0, 0.75L);
+ TEST_c_f (cabs, 0.75L, 0, 0.75L);
TEST_c_f (cabs, -1.0L, 0, 1.0L);
TEST_c_f (cabs, 1.0L, 0, 1.0L);
TEST_c_f (cabs, -5.7e7L, 0, 5.7e7L);
TEST_c_f (cabs, 5.7e7L, 0, 5.7e7L);
- TEST_c_f (cabs, 0.7L, 1.2L, 1.3892443989449804508432547041028554L);
+ TEST_c_f (cabs, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
END (cabs);
}
+
#if 0
static void
cacos_test (void)
@@ -1052,13 +1054,12 @@ cacos_test (void)
TEST_c_c (cacos, nan_value, nan_value, nan_value, nan_value);
- TEST_c_c (cacos, 0.7L, 1.2L, 1.1351827477151551088992008271819053L, -1.0927647857577371459105272080819308L);
+ TEST_c_c (cacos, 0.75L, 1.25L, 1.11752014915610270578240049553777969L, -1.13239363160530819522266333696834467L);
TEST_c_c (cacos, -2, -3, 2.1414491111159960199416055713254211L, 1.9833870299165354323470769028940395L);
END (cacos, complex);
}
-
static void
cacosh_test (void)
{
@@ -1115,12 +1116,13 @@ cacosh_test (void)
TEST_c_c (cacosh, nan_value, nan_value, nan_value, nan_value);
- TEST_c_c (cacosh, 0.7L, 1.2L, 1.0927647857577371459105272080819308L, 1.1351827477151551088992008271819053L);
- TEST_c_c (cacosh, -2, -3, -1.9833870299165354323470769028940395L, 2.1414491111159960199416055713254211L);
+ TEST_c_c (cacosh, 0.75L, 1.25L, 1.13239363160530819522266333696834467L, 1.11752014915610270578240049553777969L);
+ TEST_c_c (cacosh, -2, -3, 1.9833870299165354323470769028940395L, -2.1414491111159960199416055713254211L);
END (cacosh, complex);
}
+
static void
carg_test (void)
{
@@ -1245,7 +1247,7 @@ casin_test (void)
TEST_c_c (casin, nan_value, nan_value, nan_value, nan_value);
- TEST_c_c (casin, 0.7L, 1.2L, 0.4356135790797415103321208644578462L, 1.0927647857577371459105272080819308L);
+ TEST_c_c (casin, 0.75L, 1.25L, 0.453276177638793913448921196101971749L, 1.13239363160530819522266333696834467L);
TEST_c_c (casin, -2, -3, -0.57065278432109940071028387968566963L, -1.9833870299165354323470769028940395L);
END (casin, complex);
@@ -1309,7 +1311,7 @@ casinh_test (void)
TEST_c_c (casinh, nan_value, nan_value, nan_value, nan_value);
- TEST_c_c (casinh, 0.7L, 1.2L, 0.97865459559367387689317593222160964L, 0.91135418953156011567903546856170941L);
+ TEST_c_c (casinh, 0.75L, 1.25L, 1.03171853444778027336364058631006594L, 0.911738290968487636358489564316731207L);
TEST_c_c (casinh, -2, -3, -1.9686379257930962917886650952454982L, -0.96465850440760279204541105949953237L);
END (casinh, complex);
@@ -1377,8 +1379,7 @@ catan_test (void)
TEST_c_c (catan, nan_value, nan_value, nan_value, nan_value);
- TEST_c_c (catan, 0.7L, 1.2L, 1.0785743834118921877443707996386368L, 0.57705737765343067644394541889341712L);
-
+ TEST_c_c (catan, 0.75L, 1.25L, 1.10714871779409050301706546017853704L, 0.549306144334054845697622618461262852L);
TEST_c_c (catan, -2, -3, -1.4099210495965755225306193844604208L, -0.22907268296853876629588180294200276L);
END (catan, complex);
@@ -1444,7 +1445,7 @@ catanh_test (void)
TEST_c_c (catanh, nan_value, nan_value, nan_value, nan_value);
- TEST_c_c (catanh, 0.7L, 1.2L, 0.2600749516525135959200648705635915L, 0.97024030779509898497385130162655963L);
+ TEST_c_c (catanh, 0.75L, 1.25L, 0.261492138795671927078652057366532140L, 0.996825126463918666098902241310446708L);
TEST_c_c (catanh, -2, -3, -0.14694666622552975204743278515471595L, -1.3389725222944935611241935759091443L);
END (catanh, complex);
@@ -1472,12 +1473,13 @@ cbrt_test (void)
TEST_f_f (cbrt, -0.001L, -0.1L);
TEST_f_f (cbrt, 8, 2);
TEST_f_f (cbrt, -27.0, -3.0);
- TEST_f_f (cbrt, 0.970299L, 0.99L);
- TEST_f_f (cbrt, 0.7L, 0.8879040017426007084L);
+ TEST_f_f (cbrt, 0.9921875L, 0.997389022060725270579075195353955217L);
+ TEST_f_f (cbrt, 0.75L, 0.908560296416069829445605878163630251L);
END (cbrt);
}
+
#if 0
static void
ccos_test (void)
@@ -1540,9 +1542,8 @@ ccos_test (void)
TEST_c_c (ccos, nan_value, nan_value, nan_value, nan_value);
- TEST_c_c (ccos, 0.7L, 1.2L, 1.3848657645312111080L, -0.97242170335830028619L);
-
- TEST_c_c (ccos, -2, -3, -4.1896256909688072301L, -9.1092278937553365979L);
+ TEST_c_c (ccos, 0.75L, 1.25L, 1.38173873063425888530729933139078645L, -1.09193013555397466170919531722024128L);
+ TEST_c_c (ccos, -2, -3, -4.18962569096880723013255501961597373L, -9.10922789375533659797919726277886212L);
END (ccos, complex);
}
@@ -1609,14 +1610,15 @@ ccosh_test (void)
TEST_c_c (ccosh, nan_value, nan_value, nan_value, nan_value);
- TEST_c_c (ccosh, 0.7L, 1.2L, 0.4548202223691477654L, 0.7070296600921537682L);
+ TEST_c_c (ccosh, 0.75L, 1.25L, 0.408242591877968807788852146397499084L, 0.780365930845853240391326216300863152L);
- TEST_c_c (ccosh, -2, -3, -3.7245455049153225654L, 0.5118225699873846088L);
+ TEST_c_c (ccosh, -2, -3, -3.72454550491532256547397070325597253L, 0.511822569987384608834463849801875634L);
END (ccosh, complex);
}
#endif
+
static void
ceil_test (void)
{
@@ -1630,10 +1632,58 @@ ceil_test (void)
TEST_f_f (ceil, M_PIl, 4.0);
TEST_f_f (ceil, -M_PIl, -3.0);
+ TEST_f_f (ceil, 0.25, 1.0);
+ TEST_f_f (ceil, -0.25, minus_zero);
+
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (ceil, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (ceil, 4503599627370496.25L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370496.5L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (ceil, 4503599627370497.5L, 4503599627370498.0L);
+
+ TEST_f_f (ceil, -4503599627370495.5L, -4503599627370495.0L);
+ TEST_f_f (ceil, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (ceil, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (ceil, -4503599627370496.75L, -4503599627370496.0L);
+ TEST_f_f (ceil, -4503599627370497.5L, -4503599627370497.0L);
+
+ TEST_f_f (ceil, 9007199254740991.5L, 9007199254740992.0L);
+ TEST_f_f (ceil, 9007199254740992.25L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740992.5L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (ceil, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (ceil, -9007199254740991.5L, -9007199254740991.0L);
+ TEST_f_f (ceil, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740992.5L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740992.75L, -9007199254740992.0L);
+ TEST_f_f (ceil, -9007199254740993.5L, -9007199254740993.0L);
+
+ TEST_f_f (ceil, 72057594037927935.5L, 72057594037927936.0L);
+ TEST_f_f (ceil, 72057594037927936.25L, 72057594037927937.0L);
+ TEST_f_f (ceil, 72057594037927936.5L, 72057594037927937.0L);
+ TEST_f_f (ceil, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (ceil, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (ceil, -72057594037927935.5L, -72057594037927935.0L);
+ TEST_f_f (ceil, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927936.75L, -72057594037927936.0L);
+ TEST_f_f (ceil, -72057594037927937.5L, -72057594037927937.0L);
+
+ TEST_f_f (ceil, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.25L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (ceil, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
END (ceil);
}
+
#if 0
static void
cexp_test (void)
@@ -1692,12 +1742,13 @@ cexp_test (void)
TEST_c_c (cexp, 1, nan_value, nan_value, nan_value, INVALID_EXCEPTION_OK);
TEST_c_c (cexp, nan_value, nan_value, nan_value, nan_value);
- TEST_c_c (cexp, 0.7L, 1.2L, 0.72969890915032360123451688642930727L, 1.8768962328348102821139467908203072L);
+ TEST_c_c (cexp, 0.75L, 1.25L, 0.667537446429131586942201977015932112L, 2.00900045494094876258347228145863909L);
TEST_c_c (cexp, -2.0, -3.0, -0.13398091492954261346140525546115575L, -0.019098516261135196432576240858800925L);
END (cexp, complex);
}
+
static void
cimag_test (void)
{
@@ -1772,6 +1823,8 @@ clog_test (void)
TEST_c_c (clog, nan_value, -5, nan_value, nan_value, INVALID_EXCEPTION_OK);
TEST_c_c (clog, nan_value, nan_value, nan_value, nan_value);
+
+ TEST_c_c (clog, 0.75L, 1.25L, 0.376885901188190075998919126749298416L, 1.03037682652431246378774332703115153L);
TEST_c_c (clog, -2, -3, 1.2824746787307683680267437207826593L, -2.1587989303424641704769327722648368L);
END (clog, complex);
@@ -1837,13 +1890,15 @@ clog10_test (void)
TEST_c_c (clog10, nan_value, nan_value, nan_value, nan_value);
- TEST_c_c (clog10, 0.7L, 1.2L, 0.1427786545038868803L, 0.4528483579352493248L);
- TEST_c_c (clog10, -2, -3, 0.5569716761534183846L, -0.9375544629863747085L);
+ TEST_c_c (clog10, 0.75L, 1.25L, 0.163679467193165171449476605077428975L, 0.447486970040493067069984724340855636L);
+ TEST_c_c (clog10, -2, -3, 0.556971676153418384603252578971164214L, -0.937554462986374708541507952140189646L);
END (clog10, complex);
}
#endif
+
+#if 0
static void
conj_test (void)
{
@@ -1858,6 +1913,7 @@ conj_test (void)
END (conj, complex);
}
+#endif
static void
@@ -1889,6 +1945,7 @@ copysign_test (void)
END (copysign);
}
+
static void
cos_test (void)
{
@@ -1910,11 +1967,16 @@ cos_test (void)
TEST_f_f (cos, M_PI_6l * 4.0, -0.5);
TEST_f_f (cos, M_PI_2l, 0);
- TEST_f_f (cos, 0.7L, 0.76484218728448842625585999019186495L);
+ TEST_f_f (cos, 0.75L, 0.731688868873820886311838753000084544L);
+
+#ifdef TEST_DOUBLE
+ TEST_f_f (cos, 0.80190127184058835, 0.69534156199418473);
+#endif
END (cos);
}
+
static void
cosh_test (void)
{
@@ -1934,10 +1996,12 @@ cosh_test (void)
#endif
TEST_f_f (cosh, nan_value, nan_value);
- TEST_f_f (cosh, 0.7L, 1.255169005630943018L);
+ TEST_f_f (cosh, 0.75L, 1.29468328467684468784170818539018176L);
+
END (cosh);
}
+
#if 0
static void
cpow_test (void)
@@ -1958,9 +2022,15 @@ cpow_test (void)
TEST_cc_c (cpow, nan_value, nan_value, nan_value, nan_value, nan_value, nan_value);
+ TEST_cc_c (cpow, 0.75L, 1.25L, 0.75L, 1.25L, 0.117506293914473555420279832210420483L, 0.346552747708338676483025352060418001L);
+ TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 1.0L, 0.0846958290317209430433805274189191353L, 0.513285749182902449043287190519090481L);
+ TEST_cc_c (cpow, 0.75L, 1.25L, 1.0L, 0.0L, 0.75L, 1.25L);
+ TEST_cc_c (cpow, 0.75L, 1.25L, 0.0L, 1.0L, 0.331825439177608832276067945276730566L, 0.131338600281188544930936345230903032L);
+
END (cpow, complex);
}
+
static void
cproj_test (void)
{
@@ -1983,6 +2053,7 @@ cproj_test (void)
END (cproj, complex);
}
+
static void
creal_test (void)
{
@@ -2059,9 +2130,8 @@ csin_test (void)
TEST_c_c (csin, nan_value, nan_value, nan_value, nan_value);
- TEST_c_c (csin, 0.7L, 1.2L, 1.1664563419657581376L, 1.1544997246948547371L);
-
- TEST_c_c (csin, -2, -3, -9.1544991469114295734L, 4.1689069599665643507L);
+ TEST_c_c (csin, 0.75L, 1.25L, 1.28722291002649188575873510790565441L, 1.17210635989270256101081285116138863L);
+ TEST_c_c (csin, -2, -3, -9.15449914691142957346729954460983256L, 4.16890695996656435075481305885375484L);
END (csin, complex);
}
@@ -2128,12 +2198,13 @@ csinh_test (void)
TEST_c_c (csinh, nan_value, nan_value, nan_value, nan_value);
- TEST_c_c (csinh, 0.7L, 1.2L, 0.27487868678117583582L, 1.1698665727426565139L);
- TEST_c_c (csinh, -2, -3, 3.5905645899857799520L, -0.5309210862485198052L);
+ TEST_c_c (csinh, 0.75L, 1.25L, 0.259294854551162779153349830618433028L, 1.22863452409509552219214606515777594L);
+ TEST_c_c (csinh, -2, -3, 3.59056458998577995201256544779481679L, -0.530921086248519805267040090660676560L);
END (csinh, complex);
}
+
static void
csqrt_test (void)
{
@@ -2193,9 +2264,12 @@ csqrt_test (void)
TEST_c_c (csqrt, -1, 0, 0.0, 1.0);
TEST_c_c (csqrt, 0, 2, 1.0, 1.0);
TEST_c_c (csqrt, 119, 120, 12.0, 5.0);
- TEST_c_c (csqrt, 0.7L, 1.2L, 1.022067610030026450706487883081139L, 0.58704531296356521154977678719838035L);
+ TEST_c_c (csqrt, 0.75L, 1.25L, 1.05065169626078392338656675760808326L, 0.594868882070379067881984030639932657L);
TEST_c_c (csqrt, -2, -3, 0.89597747612983812471573375529004348L, -1.6741492280355400404480393008490519L);
TEST_c_c (csqrt, -2, 3, 0.89597747612983812471573375529004348L, 1.6741492280355400404480393008490519L);
+ /* Principal square root should be returned (i.e., non-negative real
+ part). */
+ TEST_c_c (csqrt, 0, -1, M_SQRT_2_2, -M_SQRT_2_2);
END (csqrt, complex);
}
@@ -2251,8 +2325,8 @@ ctan_test (void)
TEST_c_c (ctan, nan_value, nan_value, nan_value, nan_value);
- TEST_c_c (ctan, 0.7L, 1.2L, 0.1720734197630349001L, 0.9544807059989405538L);
- TEST_c_c (ctan, -2, -3, 0.0037640256415042482L, -1.0032386273536098014L);
+ TEST_c_c (ctan, 0.75L, 1.25L, 0.160807785916206426725166058173438663L, 0.975363285031235646193581759755216379L);
+ TEST_c_c (ctan, -2, -3, 0.376402564150424829275122113032269084e-2L, -1.00323862735360980144635859782192726L);
END (ctan, complex);
}
@@ -2310,13 +2384,14 @@ ctanh_test (void)
TEST_c_c (ctanh, 0, M_PI_4l, 0.0, 1.0);
- TEST_c_c (ctanh, 0.7L, 1.2L, 1.3472197399061191630L, 0.4778641038326365540L);
- TEST_c_c (ctanh, -2, -3, -0.9653858790221331242L, 0.0098843750383224937L);
+ TEST_c_c (ctanh, 0.75L, 1.25L, 1.37260757053378320258048606571226857L, 0.385795952609750664177596760720790220L);
+ TEST_c_c (ctanh, -2, -3, -0.965385879022133124278480269394560686L, 0.988437503832249372031403430350121098e-2L);
END (ctanh, complex);
}
#endif
+
static void
erf_test (void)
{
@@ -2334,12 +2409,12 @@ erf_test (void)
TEST_f_f (erf, minus_infty, -1);
TEST_f_f (erf, nan_value, nan_value);
- TEST_f_f (erf, 0.7L, 0.67780119383741847297L);
-
- TEST_f_f (erf, 1.2L, 0.91031397822963538024L);
- TEST_f_f (erf, 2.0, 0.99532226501895273416L);
- TEST_f_f (erf, 4.1L, 0.99999999329997234592L);
- TEST_f_f (erf, 27, 1.0L);
+ TEST_f_f (erf, 0.125L, 0.140316204801333817393029446521623398L);
+ TEST_f_f (erf, 0.75L, 0.711155633653515131598937834591410777L);
+ TEST_f_f (erf, 1.25L, 0.922900128256458230136523481197281140L);
+ TEST_f_f (erf, 2.0L, 0.995322265018952734162069256367252929L);
+ TEST_f_f (erf, 4.125L, 0.999999994576599200434933994687765914L);
+ TEST_f_f (erf, 27.0L, 1.0L);
END (erf);
}
@@ -2362,16 +2437,22 @@ erfc_test (void)
TEST_f_f (erfc, minus_zero, 1.0);
TEST_f_f (erfc, nan_value, nan_value);
- TEST_f_f (erfc, 0.7L, 0.32219880616258152702L);
-
- TEST_f_f (erfc, 1.2L, 0.089686021770364619762L);
- TEST_f_f (erfc, 2.0, 0.0046777349810472658379L);
- TEST_f_f (erfc, 4.1L, 0.67000276540848983727e-8L);
- TEST_f_f (erfc, 9, 0.41370317465138102381e-36L);
+ TEST_f_f (erfc, 0.125L, 0.859683795198666182606970553478376602L);
+ TEST_f_f (erfc, 0.75L, 0.288844366346484868401062165408589223L);
+ TEST_f_f (erfc, 1.25L, 0.0770998717435417698634765188027188596L);
+ TEST_f_f (erfc, 2.0L, 0.00467773498104726583793074363274707139L);
+ TEST_f_f (erfc, 4.125L, 0.542340079956506600531223408575531062e-8L);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+# if LDBL_MIN_10_EXP < -319
+ TEST_f_f (erfc, 27.0L, 0.523704892378925568501606768284954709e-318L);
+# endif
+#endif
END (erfc);
}
+
static void
exp_test (void)
{
@@ -2395,12 +2476,13 @@ exp_test (void)
TEST_f_f (exp, 2, M_E2l);
TEST_f_f (exp, 3, M_E3l);
- TEST_f_f (exp, 0.7L, 2.0137527074704765216L);
+ TEST_f_f (exp, 0.75L, 2.11700001661267466854536981983709561L);
TEST_f_f (exp, 50.0L, 5184705528587072464087.45332293348538L);
#ifdef TEST_LDOUBLE
/* The result can only be represented in long double. */
TEST_f_f (exp, 1000.0L, 0.197007111401704699388887935224332313e435L);
#endif
+
END (exp);
}
@@ -2427,11 +2509,12 @@ exp10_test (void)
TEST_f_f (exp10, -1, 0.1L);
TEST_f_f (exp10, 1e6, plus_infty);
TEST_f_f (exp10, -1e6, 0);
- TEST_f_f (exp10, 0.7L, 5.0118723362727228500155418688494574L);
+ TEST_f_f (exp10, 0.75L, 5.62341325190349080394951039776481231L);
END (exp10);
}
+
static void
exp2_test (void)
{
@@ -2453,12 +2536,13 @@ exp2_test (void)
TEST_f_f (exp2, -1, 0.5);
TEST_f_f (exp2, 1e6, plus_infty);
TEST_f_f (exp2, -1e6, 0);
- TEST_f_f (exp2, 0.7L, 1.6245047927124710452L);
+ TEST_f_f (exp2, 0.75L, 1.68179283050742908606225095246642979L);
END (exp2);
}
#endif
+
static void
expm1_test (void)
{
@@ -2480,11 +2564,12 @@ expm1_test (void)
TEST_f_f (expm1, nan_value, nan_value);
TEST_f_f (expm1, 1, M_El - 1.0);
- TEST_f_f (expm1, 0.7L, 1.0137527074704765216L);
+ TEST_f_f (expm1, 0.75L, 1.11700001661267466854536981983709561L);
END (expm1);
}
+
static void
fabs_test (void)
{
@@ -2503,6 +2588,7 @@ fabs_test (void)
END (fabs);
}
+
#if 0
static void
fdim_test (void)
@@ -2535,10 +2621,13 @@ fdim_test (void)
TEST_ff_f (fdim, nan_value, minus_infty, nan_value);
TEST_ff_f (fdim, nan_value, nan_value, nan_value);
+ TEST_ff_f (fdim, plus_infty, plus_infty, 0);
+
END (fdim);
}
#endif
+
static void
floor_test (void)
{
@@ -2553,9 +2642,59 @@ floor_test (void)
TEST_f_f (floor, M_PIl, 3.0);
TEST_f_f (floor, -M_PIl, -4.0);
+ TEST_f_f (floor, 0.25, 0.0);
+ TEST_f_f (floor, -0.25, -1.0);
+
+
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (floor, 4503599627370495.5L, 4503599627370495.0L);
+ TEST_f_f (floor, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (floor, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (floor, 4503599627370496.75L, 4503599627370496.0L);
+ TEST_f_f (floor, 4503599627370497.5L, 4503599627370497.0L);
+
+ TEST_f_f (floor, -4503599627370495.5L, -4503599627370496.0L);
+ TEST_f_f (floor, -4503599627370496.25L, -4503599627370497.0L);
+ TEST_f_f (floor, -4503599627370496.5L, -4503599627370497.0L);
+ TEST_f_f (floor, -4503599627370496.75L, -4503599627370497.0L);
+ TEST_f_f (floor, -4503599627370497.5L, -4503599627370498.0L);
+
+ TEST_f_f (floor, 9007199254740991.5L, 9007199254740991.0L);
+ TEST_f_f (floor, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (floor, 9007199254740992.5L, 9007199254740992.0L);
+ TEST_f_f (floor, 9007199254740992.75L, 9007199254740992.0L);
+ TEST_f_f (floor, 9007199254740993.5L, 9007199254740993.0L);
+
+ TEST_f_f (floor, -9007199254740991.5L, -9007199254740992.0L);
+ TEST_f_f (floor, -9007199254740992.25L, -9007199254740993.0L);
+ TEST_f_f (floor, -9007199254740992.5L, -9007199254740993.0L);
+ TEST_f_f (floor, -9007199254740992.75L, -9007199254740993.0L);
+ TEST_f_f (floor, -9007199254740993.5L, -9007199254740994.0L);
+
+ TEST_f_f (floor, 72057594037927935.5L, 72057594037927935.0L);
+ TEST_f_f (floor, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (floor, 72057594037927936.5L, 72057594037927936.0L);
+ TEST_f_f (floor, 72057594037927936.75L, 72057594037927936.0L);
+ TEST_f_f (floor, 72057594037927937.5L, 72057594037927937.0L);
+
+ TEST_f_f (floor, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (floor, -72057594037927936.25L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927936.5L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (floor, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (floor, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
+ TEST_f_f (floor, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
+#endif
+
END (floor);
}
+
#if 0
static void
fma_test (void)
@@ -2580,6 +2719,8 @@ fma_test (void)
TEST_fff_f (fma, plus_infty, minus_infty, plus_infty, nan_value, INVALID_EXCEPTION);
TEST_fff_f (fma, minus_infty, minus_infty, minus_infty, nan_value, INVALID_EXCEPTION);
+ TEST_fff_f (fma, 1.25L, 0.75L, 0.0625L, 1.0L);
+
END (fma);
}
@@ -2659,6 +2800,7 @@ fmin_test (void)
}
#endif
+
static void
fmod_test (void)
{
@@ -2692,14 +2834,15 @@ fmod_test (void)
TEST_ff_f (fmod, nan_value, nan_value, nan_value);
- TEST_ff_f (fmod, 6.5, 2.3L, 1.9L);
- TEST_ff_f (fmod, -6.5, 2.3L, -1.9L);
- TEST_ff_f (fmod, 6.5, -2.3L, 1.9L);
- TEST_ff_f (fmod, -6.5, -2.3L, -1.9L);
+ TEST_ff_f (fmod, 6.5, 2.25L, 2.0L);
+ TEST_ff_f (fmod, -6.5, 2.25L, -2.0L);
+ TEST_ff_f (fmod, 6.5, -2.25L, 2.0L);
+ TEST_ff_f (fmod, -6.5, -2.25L, -2.0L);
END (fmod);
}
+
static void
fpclassify_test (void)
{
@@ -2799,11 +2942,11 @@ hypot_test (void)
TEST_ff_f (hypot, -12.4L, -0.7L, 12.419742348374220601176836866763271L);
/* hypot (x,0) == fabs (x) */
- TEST_ff_f (hypot, 0.7L, 0, 0.7L);
- TEST_ff_f (hypot, -0.7L, 0, 0.7L);
+ TEST_ff_f (hypot, 0.75L, 0, 0.75L);
+ TEST_ff_f (hypot, -0.75L, 0, 0.75L);
TEST_ff_f (hypot, -5.7e7, 0, 5.7e7L);
- TEST_ff_f (hypot, 0.7L, 1.2L, 1.3892443989449804508432547041028554L);
+ TEST_ff_f (hypot, 0.75L, 1.25L, 1.45773797371132511771853821938639577L);
END (hypot);
}
@@ -2881,15 +3024,15 @@ j0_test (void)
/* j0 is the Bessel function of the first kind of order 0 */
TEST_f_f (j0, nan_value, nan_value);
TEST_f_f (j0, plus_infty, 0);
- TEST_f_f (j0, -1.0, 0.76519768655796655145L);
+ TEST_f_f (j0, -1.0, 0.765197686557966551449717526102663221L);
TEST_f_f (j0, 0.0, 1.0);
- TEST_f_f (j0, 0.1L, 0.99750156206604003228L);
- TEST_f_f (j0, 0.7L, 0.88120088860740528084L);
- TEST_f_f (j0, 1.0, 0.76519768655796655145L);
- TEST_f_f (j0, 1.5, 0.51182767173591812875L);
- TEST_f_f (j0, 2.0, 0.22389077914123566805L);
- TEST_f_f (j0, 8.0, 0.17165080713755390609L);
- TEST_f_f (j0, 10.0, -0.24593576445134833520L);
+ TEST_f_f (j0, 0.125L, 0.996097563041985204620768999453174712L);
+ TEST_f_f (j0, 0.75L, 0.864242275166648623555731103820923211L);
+ TEST_f_f (j0, 1.0, 0.765197686557966551449717526102663221L);
+ TEST_f_f (j0, 1.5, 0.511827671735918128749051744283411720L);
+ TEST_f_f (j0, 2.0, 0.223890779141235668051827454649948626L);
+ TEST_f_f (j0, 8.0, 0.171650807137553906090869407851972001L);
+ TEST_f_f (j0, 10.0, -0.245935764451348335197760862485328754L);
TEST_f_f (j0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
TEST_f_f (j0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
@@ -2920,15 +3063,15 @@ j1_test (void)
TEST_f_f (j1, nan_value, nan_value);
TEST_f_f (j1, plus_infty, 0);
- TEST_f_f (j1, -1.0, -0.44005058574493351596L);
+ TEST_f_f (j1, -1.0, -0.440050585744933515959682203718914913L);
TEST_f_f (j1, 0.0, 0.0);
- TEST_f_f (j1, 0.1L, 0.049937526036241997556L);
- TEST_f_f (j1, 0.7L, 0.32899574154005894785L);
- TEST_f_f (j1, 1.0, 0.44005058574493351596L);
- TEST_f_f (j1, 1.5, 0.55793650791009964199L);
- TEST_f_f (j1, 2.0, 0.57672480775687338720L);
- TEST_f_f (j1, 8.0, 0.23463634685391462438L);
- TEST_f_f (j1, 10.0, 0.043472746168861436670L);
+ TEST_f_f (j1, 0.125L, 0.0623780091344946810942311355879361177L);
+ TEST_f_f (j1, 0.75L, 0.349243602174862192523281016426251335L);
+ TEST_f_f (j1, 1.0, 0.440050585744933515959682203718914913L);
+ TEST_f_f (j1, 1.5, 0.557936507910099641990121213156089400L);
+ TEST_f_f (j1, 2.0, 0.576724807756873387202448242269137087L);
+ TEST_f_f (j1, 8.0, 0.234636346853914624381276651590454612L);
+ TEST_f_f (j1, 10.0, 0.0434727461688614366697487680258592883L);
END (j1);
}
@@ -2955,53 +3098,54 @@ jn_test (void)
/* jn (0, x) == j0 (x) */
TEST_ff_f (jn, 0, nan_value, nan_value);
TEST_ff_f (jn, 0, plus_infty, 0);
- TEST_ff_f (jn, 0, -1.0, 0.76519768655796655145L);
+ TEST_ff_f (jn, 0, -1.0, 0.765197686557966551449717526102663221L);
TEST_ff_f (jn, 0, 0.0, 1.0);
- TEST_ff_f (jn, 0, 0.1L, 0.99750156206604003228L);
- TEST_ff_f (jn, 0, 0.7L, 0.88120088860740528084L);
- TEST_ff_f (jn, 0, 1.0, 0.76519768655796655145L);
- TEST_ff_f (jn, 0, 1.5, 0.51182767173591812875L);
- TEST_ff_f (jn, 0, 2.0, 0.22389077914123566805L);
- TEST_ff_f (jn, 0, 8.0, 0.17165080713755390609L);
- TEST_ff_f (jn, 0, 10.0, -0.24593576445134833520L);
+ TEST_ff_f (jn, 0, 0.125L, 0.996097563041985204620768999453174712L);
+ TEST_ff_f (jn, 0, 0.75L, 0.864242275166648623555731103820923211L);
+ TEST_ff_f (jn, 0, 1.0, 0.765197686557966551449717526102663221L);
+ TEST_ff_f (jn, 0, 1.5, 0.511827671735918128749051744283411720L);
+ TEST_ff_f (jn, 0, 2.0, 0.223890779141235668051827454649948626L);
+ TEST_ff_f (jn, 0, 8.0, 0.171650807137553906090869407851972001L);
+ TEST_ff_f (jn, 0, 10.0, -0.245935764451348335197760862485328754L);
+ TEST_ff_f (jn, 0, 4.0, -3.9714980986384737228659076845169804197562E-1L);
+ TEST_ff_f (jn, 0, -4.0, -3.9714980986384737228659076845169804197562E-1L);
/* jn (1, x) == j1 (x) */
TEST_ff_f (jn, 1, nan_value, nan_value);
TEST_ff_f (jn, 1, plus_infty, 0);
-
- TEST_ff_f (jn, 1, -1.0, -0.44005058574493351596L);
+ TEST_ff_f (jn, 1, -1.0, -0.440050585744933515959682203718914913L);
TEST_ff_f (jn, 1, 0.0, 0.0);
- TEST_ff_f (jn, 1, 0.1L, 0.049937526036241997556L);
- TEST_ff_f (jn, 1, 0.7L, 0.32899574154005894785L);
- TEST_ff_f (jn, 1, 1.0, 0.44005058574493351596L);
- TEST_ff_f (jn, 1, 1.5, 0.55793650791009964199L);
- TEST_ff_f (jn, 1, 2.0, 0.57672480775687338720L);
- TEST_ff_f (jn, 1, 8.0, 0.23463634685391462438L);
- TEST_ff_f (jn, 1, 10.0, 0.043472746168861436670L);
+ TEST_ff_f (jn, 1, 0.125L, 0.0623780091344946810942311355879361177L);
+ TEST_ff_f (jn, 1, 0.75L, 0.349243602174862192523281016426251335L);
+ TEST_ff_f (jn, 1, 1.0, 0.440050585744933515959682203718914913L);
+ TEST_ff_f (jn, 1, 1.5, 0.557936507910099641990121213156089400L);
+ TEST_ff_f (jn, 1, 2.0, 0.576724807756873387202448242269137087L);
+ TEST_ff_f (jn, 1, 8.0, 0.234636346853914624381276651590454612L);
+ TEST_ff_f (jn, 1, 10.0, 0.0434727461688614366697487680258592883L);
/* jn (3, x) */
TEST_ff_f (jn, 3, nan_value, nan_value);
TEST_ff_f (jn, 3, plus_infty, 0);
- TEST_ff_f (jn, 3, -1.0, -0.019563353982668405919L);
+ TEST_ff_f (jn, 3, -1.0, -0.0195633539826684059189053216217515083L);
TEST_ff_f (jn, 3, 0.0, 0.0);
- TEST_ff_f (jn, 3, 0.1L, 0.000020820315754756261429L);
- TEST_ff_f (jn, 3, 0.7L, 0.0069296548267508408077L);
- TEST_ff_f (jn, 3, 1.0, 0.019563353982668405919L);
- TEST_ff_f (jn, 3, 2.0, 0.12894324947440205110L);
- TEST_ff_f (jn, 3, 10.0, 0.058379379305186812343L);
+ TEST_ff_f (jn, 3, 0.125L, 0.406503832554912875023029337653442868e-4L);
+ TEST_ff_f (jn, 3, 0.75L, 0.848438342327410884392755236884386804e-2L);
+ TEST_ff_f (jn, 3, 1.0, 0.0195633539826684059189053216217515083L);
+ TEST_ff_f (jn, 3, 2.0, 0.128943249474402051098793332969239835L);
+ TEST_ff_f (jn, 3, 10.0, 0.0583793793051868123429354784103409563L);
/* jn (10, x) */
TEST_ff_f (jn, 10, nan_value, nan_value);
TEST_ff_f (jn, 10, plus_infty, 0);
- TEST_ff_f (jn, 10, -1.0, 0.26306151236874532070e-9L);
+ TEST_ff_f (jn, 10, -1.0, 0.263061512368745320699785368779050294e-9L);
TEST_ff_f (jn, 10, 0.0, 0.0);
- TEST_ff_f (jn, 10, 0.1L, 0.26905328954342155795e-19L);
- TEST_ff_f (jn, 10, 0.7L, 0.75175911502153953928e-11L);
- TEST_ff_f (jn, 10, 1.0, 0.26306151236874532070e-9L);
- TEST_ff_f (jn, 10, 2.0, 0.25153862827167367096e-6L);
- TEST_ff_f (jn, 10, 10.0, 0.20748610663335885770L);
+ TEST_ff_f (jn, 10, 0.125L, 0.250543369809369890173993791865771547e-18L);
+ TEST_ff_f (jn, 10, 0.75L, 0.149621713117596814698712483621682835e-10L);
+ TEST_ff_f (jn, 10, 1.0, 0.263061512368745320699785368779050294e-9L);
+ TEST_ff_f (jn, 10, 2.0, 0.251538628271673670963516093751820639e-6L);
+ TEST_ff_f (jn, 10, 10.0, 0.207486106633358857697278723518753428L);
END (jn);
}
@@ -3024,6 +3168,7 @@ ldexp_test (void)
TEST_ff_f (ldexp, 1.0L, 0L, 1.0L);
}
+
static void
lgamma_test (void)
{
@@ -3050,12 +3195,13 @@ lgamma_test (void)
TEST_f_f1 (lgamma, 0.5, M_LOG_SQRT_PIl, 1);
TEST_f_f1 (lgamma, -0.5, M_LOG_2_SQRT_PIl, -1);
- TEST_f_f1 (lgamma, 0.7L, 0.26086724653166651439L, 1);
- TEST_f_f1 (lgamma, 1.2L, -0.853740900033158497197e-1L, 1);
+ TEST_f_f1 (lgamma, 0.7L, 0.260867246531666514385732417016759578L, 1);
+ TEST_f_f1 (lgamma, 1.2L, -0.853740900033158497197028392998854470e-1L, 1);
END (lgamma);
}
+
#if 0
static void
lrint_test (void)
@@ -3077,9 +3223,18 @@ lrint_test (void)
TEST_f_l (lrint, 8388600.3L, 8388600);
TEST_f_l (lrint, -8388600.3L, -8388600);
+ TEST_f_l (lrint, 1071930.0008, 1071930);
+#ifndef TEST_FLOAT
+ TEST_f_l (lrint, 1073741824.01, 1073741824);
+# if LONG_MAX > 281474976710656
+ TEST_f_l (lrint, 281474976710656.025, 281474976710656);
+# endif
+#endif
+
END (lrint);
}
+
static void
llrint_test (void)
{
@@ -3100,6 +3255,8 @@ llrint_test (void)
TEST_f_L (llrint, 8388600.3L, 8388600);
TEST_f_L (llrint, -8388600.3L, -8388600);
+ TEST_f_l (llrint, 1071930.0008, 1071930);
+
/* Test boundary conditions. */
/* 0x1FFFFF */
TEST_f_L (llrint, 2097151.0,2097151LL);
@@ -3111,6 +3268,8 @@ llrint_test (void)
TEST_f_L (llrint, 2199023255552.0, 2199023255552LL);
/* 0x40000000000 */
TEST_f_L (llrint, 4398046511104.0, 4398046511104LL);
+ /* 0x1000000000000 */
+ TEST_f_L (llrint, 281474976710656.0, 281474976710656LL);
/* 0x10000000000000 */
TEST_f_L (llrint, 4503599627370496.0, 4503599627370496LL);
/* 0x10000080000000 */
@@ -3121,11 +3280,50 @@ llrint_test (void)
TEST_f_L (llrint, 36028797018963968.0, 36028797018963968LL);
/* 0x100000000000000 */
TEST_f_L (llrint, 72057594037927936.0, 72057594037927936LL);
+#ifdef TEST_LDOUBLE
+ /* The input can only be represented in long double. */
+ TEST_f_L (llrint, 4503599627370495.5L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.25L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.5L, 4503599627370496LL);
+ TEST_f_L (llrint, 4503599627370496.75L, 4503599627370497LL);
+ TEST_f_L (llrint, 4503599627370497.5L, 4503599627370498LL);
+
+ TEST_f_L (llrint, -4503599627370495.5L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.25L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.5L, -4503599627370496LL);
+ TEST_f_L (llrint, -4503599627370496.75L, -4503599627370497LL);
+ TEST_f_L (llrint, -4503599627370497.5L, -4503599627370498LL);
+
+ TEST_f_L (llrint, 9007199254740991.5L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.25L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.5L, 9007199254740992LL);
+ TEST_f_L (llrint, 9007199254740992.75L, 9007199254740993LL);
+ TEST_f_L (llrint, 9007199254740993.5L, 9007199254740994LL);
+
+ TEST_f_L (llrint, -9007199254740991.5L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.25L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.5L, -9007199254740992LL);
+ TEST_f_L (llrint, -9007199254740992.75L, -9007199254740993LL);
+ TEST_f_L (llrint, -9007199254740993.5L, -9007199254740994LL);
+
+ TEST_f_L (llrint, 72057594037927935.5L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.25L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.5L, 72057594037927936LL);
+ TEST_f_L (llrint, 72057594037927936.75L, 72057594037927937LL);
+ TEST_f_L (llrint, 72057594037927937.5L, 72057594037927938LL);
+
+ TEST_f_L (llrint, -72057594037927935.5L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.25L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.5L, -72057594037927936LL);
+ TEST_f_L (llrint, -72057594037927936.75L, -72057594037927937LL);
+ TEST_f_L (llrint, -72057594037927937.5L, -72057594037927938LL);
+#endif
END (llrint);
}
#endif
+
static void
log_test (void)
{
@@ -3148,7 +3346,7 @@ log_test (void)
TEST_f_f (log, 1.0 / M_El, -1);
TEST_f_f (log, 2, M_LN2l);
TEST_f_f (log, 10, M_LN10l);
- TEST_f_f (log, 0.7L, -0.35667494393873237891263871124118447L);
+ TEST_f_f (log, 0.75L, -0.287682072451780927439219005993827432L);
END (log);
}
@@ -3181,7 +3379,7 @@ log10_test (void)
TEST_f_f (log10, 100.0, 2);
TEST_f_f (log10, 10000.0, 4);
TEST_f_f (log10, M_El, M_LOG10El);
- TEST_f_f (log10, 0.7L, -0.15490195998574316929L);
+ TEST_f_f (log10, 0.75L, -0.124938736608299953132449886193870744L);
END (log10);
}
@@ -3209,11 +3407,13 @@ log1p_test (void)
TEST_f_f (log1p, M_El - 1.0, 1);
- TEST_f_f (log1p, -0.3L, -0.35667494393873237891263871124118447L);
+ TEST_f_f (log1p, -0.25L, -0.287682072451780927439219005993827432L);
+ TEST_f_f (log1p, -0.875, -2.07944154167983592825169636437452970L);
END (log1p);
}
+
#if 0
static void
log2_test (void)
@@ -3240,7 +3440,7 @@ log2_test (void)
TEST_f_f (log2, 2.0, 1);
TEST_f_f (log2, 16.0, 4);
TEST_f_f (log2, 256.0, 8);
- TEST_f_f (log2, 0.7L, -0.51457317282975824043L);
+ TEST_f_f (log2, 0.75L, -.415037499278843818546261056052183492L);
END (log2);
}
@@ -3268,6 +3468,7 @@ logb_test (void)
END (logb);
}
+
#if 0
static void
lround_test (void)
@@ -3286,7 +3487,12 @@ lround_test (void)
TEST_f_l (lround, -1.5, -2);
TEST_f_l (lround, 22514.5, 22515);
TEST_f_l (lround, -22514.5, -22515);
+ TEST_f_l (lround, 1071930.0008, 1071930);
#ifndef TEST_FLOAT
+ TEST_f_l (lround, 1073741824.01, 1073741824);
+# if LONG_MAX > 281474976710656
+ TEST_f_l (lround, 281474976710656.025, 281474976710656);
+# endif
TEST_f_l (lround, 2097152.5, 2097153);
TEST_f_l (lround, -2097152.5, -2097153);
#endif
@@ -3311,6 +3517,7 @@ llround_test (void)
TEST_f_L (llround, -1.5, -2);
TEST_f_L (llround, 22514.5, 22515);
TEST_f_L (llround, -22514.5, -22515);
+ TEST_f_l (llround, 1071930.0008, 1071930);
#ifndef TEST_FLOAT
TEST_f_L (llround, 2097152.5, 2097153);
TEST_f_L (llround, -2097152.5, -2097153);
@@ -3329,10 +3536,12 @@ llround_test (void)
TEST_f_L (llround, 2199023255552.0, 2199023255552LL);
/* 0x40000000000 */
TEST_f_L (llround, 4398046511104.0, 4398046511104LL);
+ /* 0x1000000000000 */
+ TEST_f_L (llround, 281474976710656.0, 281474976710656LL);
/* 0x10000000000000 */
TEST_f_L (llround, 4503599627370496.0, 4503599627370496LL);
/* 0x10000080000000 */
- TEST_f_L (llrint, 4503601774854144.0, 4503601774854144LL);
+ TEST_f_L (llround, 4503601774854144.0, 4503601774854144LL);
/* 0x20000000000000 */
TEST_f_L (llround, 9007199254740992.0, 9007199254740992LL);
/* 0x80000000000000 */
@@ -3347,6 +3556,52 @@ llround_test (void)
TEST_f_L (llround, 8589934591.5, 8589934592LL);
#endif
+#ifdef TEST_LDOUBLE
+ /* The input can only be represented in long double. */
+ TEST_f_L (llround, 4503599627370495.5L, 4503599627370496LL);
+ TEST_f_L (llround, 4503599627370496.25L, 4503599627370496LL);
+ TEST_f_L (llround, 4503599627370496.5L, 4503599627370497LL);
+ TEST_f_L (llround, 4503599627370496.75L, 4503599627370497LL);
+ TEST_f_L (llround, 4503599627370497.5L, 4503599627370498LL);
+
+ TEST_f_L (llround, -4503599627370495.5L, -4503599627370496LL);
+ TEST_f_L (llround, -4503599627370496.25L, -4503599627370496LL);
+ TEST_f_L (llround, -4503599627370496.5L, -4503599627370497LL);
+ TEST_f_L (llround, -4503599627370496.75L, -4503599627370497LL);
+ TEST_f_L (llround, -4503599627370497.5L, -4503599627370498LL);
+
+ TEST_f_L (llround, 9007199254740991.5L, 9007199254740992LL);
+ TEST_f_L (llround, 9007199254740992.25L, 9007199254740992LL);
+ TEST_f_L (llround, 9007199254740992.5L, 9007199254740993LL);
+ TEST_f_L (llround, 9007199254740992.75L, 9007199254740993LL);
+ TEST_f_L (llround, 9007199254740993.5L, 9007199254740994LL);
+
+ TEST_f_L (llround, -9007199254740991.5L, -9007199254740992LL);
+ TEST_f_L (llround, -9007199254740992.25L, -9007199254740992LL);
+ TEST_f_L (llround, -9007199254740992.5L, -9007199254740993LL);
+ TEST_f_L (llround, -9007199254740992.75L, -9007199254740993LL);
+ TEST_f_L (llround, -9007199254740993.5L, -9007199254740994LL);
+
+ TEST_f_L (llround, 72057594037927935.5L, 72057594037927936LL);
+ TEST_f_L (llround, 72057594037927936.25L, 72057594037927936LL);
+ TEST_f_L (llround, 72057594037927936.5L, 72057594037927937LL);
+ TEST_f_L (llround, 72057594037927936.75L, 72057594037927937LL);
+ TEST_f_L (llround, 72057594037927937.5L, 72057594037927938LL);
+
+ TEST_f_L (llround, -72057594037927935.5L, -72057594037927936LL);
+ TEST_f_L (llround, -72057594037927936.25L, -72057594037927936LL);
+ TEST_f_L (llround, -72057594037927936.5L, -72057594037927937LL);
+ TEST_f_L (llround, -72057594037927936.75L, -72057594037927937LL);
+ TEST_f_L (llround, -72057594037927937.5L, -72057594037927938LL);
+
+ TEST_f_L (llround, 9223372036854775806.25L, 9223372036854775806LL);
+ TEST_f_L (llround, -9223372036854775806.25L, -9223372036854775806LL);
+ TEST_f_L (llround, 9223372036854775806.5L, 9223372036854775807LL);
+ TEST_f_L (llround, -9223372036854775806.5L, -9223372036854775807LL);
+ TEST_f_L (llround, 9223372036854775807.0L, 9223372036854775807LL);
+ TEST_f_L (llround, -9223372036854775807.0L, -9223372036854775807LL);
+#endif
+
END (llround);
}
#endif
@@ -3414,6 +3669,16 @@ nextafter_test (void)
TEST_ff_f (nextafter, 1.1L, nan_value, nan_value);
TEST_ff_f (nextafter, nan_value, nan_value, nan_value);
+ FLOAT fltmax = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
+ LDBL_MAX, DBL_MAX, FLT_MAX);
+ TEST_ff_f (nextafter, fltmax, plus_infty, plus_infty);
+ TEST_ff_f (nextafter, -fltmax, minus_infty, minus_infty);
+
+#ifdef TEST_LDOUBLE
+ // XXX Enable once gcc is fixed.
+ //TEST_ff_f (nextafter, 0x0.00000040000000000000p-16385L, -0.1L, 0x0.0000003ffffffff00000p-16385L);
+#endif
+
/* XXX We need the hexadecimal FP number representation here for further
tests. */
@@ -3446,6 +3711,7 @@ nexttoward_test (void)
}
#endif
+
static void
pow_test (void)
{
@@ -3540,6 +3806,28 @@ pow_test (void)
TEST_ff_f (pow, -1, plus_infty, 1);
TEST_ff_f (pow, 1, minus_infty, 1);
TEST_ff_f (pow, -1, minus_infty, 1);
+ TEST_ff_f (pow, 1, 1, 1);
+ TEST_ff_f (pow, 1, -1, 1);
+ TEST_ff_f (pow, 1, 1.25, 1);
+ TEST_ff_f (pow, 1, -1.25, 1);
+ TEST_ff_f (pow, 1, 0x1p62L, 1);
+ TEST_ff_f (pow, 1, 0x1p63L, 1);
+ TEST_ff_f (pow, 1, 0x1p64L, 1);
+ TEST_ff_f (pow, 1, 0x1p72L, 1);
+
+ /* pow (x, +-0) == 1. */
+ TEST_ff_f (pow, plus_infty, 0, 1);
+ TEST_ff_f (pow, plus_infty, minus_zero, 1);
+ TEST_ff_f (pow, minus_infty, 0, 1);
+ TEST_ff_f (pow, minus_infty, minus_zero, 1);
+ TEST_ff_f (pow, 32.75L, 0, 1);
+ TEST_ff_f (pow, 32.75L, minus_zero, 1);
+ TEST_ff_f (pow, -32.75L, 0, 1);
+ TEST_ff_f (pow, -32.75L, minus_zero, 1);
+ TEST_ff_f (pow, 0x1p72L, 0, 1);
+ TEST_ff_f (pow, 0x1p72L, minus_zero, 1);
+ TEST_ff_f (pow, 0x1p-72L, 0, 1);
+ TEST_ff_f (pow, 0x1p-72L, minus_zero, 1);
TEST_ff_f (pow, -0.1L, 1.1L, nan_value, INVALID_EXCEPTION);
TEST_ff_f (pow, -0.1L, -1.1L, nan_value, INVALID_EXCEPTION);
@@ -3556,6 +3844,10 @@ pow_test (void)
TEST_ff_f (pow, minus_zero, -2, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
TEST_ff_f (pow, minus_zero, -11.1L, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+ TEST_ff_f (pow, 0x1p72L, 0x1p72L, plus_infty);
+ TEST_ff_f (pow, 10, -0x1p72L, 0);
+ TEST_ff_f (pow, max_value, max_value, plus_infty);
+ TEST_ff_f (pow, 10, -max_value, 0);
TEST_ff_f (pow, 0, 1, 0);
TEST_ff_f (pow, 0, 11, 0);
@@ -3570,6 +3862,8 @@ pow_test (void)
TEST_ff_f (pow, minus_zero, 2, 0);
TEST_ff_f (pow, minus_zero, 11.1L, 0);
+ TEST_ff_f (pow, 0, plus_infty, 0);
+ TEST_ff_f (pow, minus_zero, plus_infty, 0);
#ifndef TEST_INLINE
/* pow (x, +inf) == +inf for |x| > 1. */
@@ -3614,7 +3908,12 @@ pow_test (void)
/* pow (-0, y) == +0 for y > 0 and not an odd integer. */
TEST_ff_f (pow, minus_zero, 4, 0.0);
- TEST_ff_f (pow, 0.7L, 1.2L, 0.65180494056638638188L);
+ TEST_ff_f (pow, 16, 0.25L, 2);
+ TEST_ff_f (pow, 0x1p64L, 0.125L, 256);
+ TEST_ff_f (pow, 2, 4, 16);
+ TEST_ff_f (pow, 256, 8, 0x1p64L);
+
+ TEST_ff_f (pow, 0.75L, 1.25L, 0.697953644326574699205914060237425566L);
#if defined TEST_DOUBLE || defined TEST_LDOUBLE
TEST_ff_f (pow, -7.49321e+133, -9.80818e+16, 0);
@@ -3704,12 +4003,164 @@ rint_test (void)
TEST_f_f (rint, -2.5, -2.0);
TEST_f_f (rint, -3.5, -4.0);
TEST_f_f (rint, -4.5, -4.0);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (rint, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (rint, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (rint, 4503599627370497.5L, 4503599627370498.0L);
+
+ TEST_f_f (rint, -4503599627370495.5L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (rint, -4503599627370496.75L, -4503599627370497.0L);
+ TEST_f_f (rint, -4503599627370497.5L, -4503599627370498.0L);
+
+ TEST_f_f (rint, 9007199254740991.5L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.5L, 9007199254740992.0L);
+ TEST_f_f (rint, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (rint, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (rint, -9007199254740991.5L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.5L, -9007199254740992.0L);
+ TEST_f_f (rint, -9007199254740992.75L, -9007199254740993.0L);
+ TEST_f_f (rint, -9007199254740993.5L, -9007199254740994.0L);
+
+ TEST_f_f (rint, 72057594037927935.5L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.5L, 72057594037927936.0L);
+ TEST_f_f (rint, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (rint, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (rint, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (rint, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (rint, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (rint, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (rint, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (rint, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
END (rint);
}
#if 0
static void
+rint_test_tonearest (void)
+{
+ int save_round_mode;
+ START (rint_tonearest);
+
+ save_round_mode = fegetround();
+
+ if (!fesetround (FE_TONEAREST))
+ {
+ TEST_f_f (rint, 2.0, 2.0);
+ TEST_f_f (rint, 1.5, 2.0);
+ TEST_f_f (rint, 1.0, 1.0);
+ TEST_f_f (rint, 0.5, 0.0);
+ TEST_f_f (rint, 0.0, 0.0);
+ TEST_f_f (rint, minus_zero, minus_zero);
+ TEST_f_f (rint, -0.5, -0.0);
+ TEST_f_f (rint, -1.0, -1.0);
+ TEST_f_f (rint, -1.5, -2.0);
+ TEST_f_f (rint, -2.0, -2.0);
+ }
+
+ fesetround(save_round_mode);
+
+ END (rint_tonearest);
+}
+
+static void
+rint_test_towardzero (void)
+{
+ int save_round_mode;
+ START (rint_towardzero);
+
+ save_round_mode = fegetround();
+
+ if (!fesetround (FE_TOWARDZERO))
+ {
+ TEST_f_f (rint, 2.0, 2.0);
+ TEST_f_f (rint, 1.5, 1.0);
+ TEST_f_f (rint, 1.0, 1.0);
+ TEST_f_f (rint, 0.5, 0.0);
+ TEST_f_f (rint, 0.0, 0.0);
+ TEST_f_f (rint, minus_zero, minus_zero);
+ TEST_f_f (rint, -0.5, -0.0);
+ TEST_f_f (rint, -1.0, -1.0);
+ TEST_f_f (rint, -1.5, -1.0);
+ TEST_f_f (rint, -2.0, -2.0);
+ }
+
+ fesetround(save_round_mode);
+
+ END (rint_towardzero);
+}
+
+static void
+rint_test_downward (void)
+{
+ int save_round_mode;
+ START (rint_downward);
+
+ save_round_mode = fegetround();
+
+ if (!fesetround (FE_DOWNWARD))
+ {
+ TEST_f_f (rint, 2.0, 2.0);
+ TEST_f_f (rint, 1.5, 1.0);
+ TEST_f_f (rint, 1.0, 1.0);
+ TEST_f_f (rint, 0.5, 0.0);
+ TEST_f_f (rint, 0.0, 0.0);
+ TEST_f_f (rint, minus_zero, minus_zero);
+ TEST_f_f (rint, -0.5, -1.0);
+ TEST_f_f (rint, -1.0, -1.0);
+ TEST_f_f (rint, -1.5, -2.0);
+ TEST_f_f (rint, -2.0, -2.0);
+ }
+
+ fesetround(save_round_mode);
+
+ END (rint_downward);
+}
+
+static void
+rint_test_upward (void)
+{
+ int save_round_mode;
+ START (rint_upward);
+
+ save_round_mode = fegetround();
+
+ if (!fesetround (FE_UPWARD))
+ {
+ TEST_f_f (rint, 2.0, 2.0);
+ TEST_f_f (rint, 1.5, 2.0);
+ TEST_f_f (rint, 1.0, 1.0);
+ TEST_f_f (rint, 0.5, 1.0);
+ TEST_f_f (rint, 0.0, 0.0);
+ TEST_f_f (rint, minus_zero, minus_zero);
+ TEST_f_f (rint, -0.5, -0.0);
+ TEST_f_f (rint, -1.0, -1.0);
+ TEST_f_f (rint, -1.5, -1.0);
+ TEST_f_f (rint, -2.0, -2.0);
+ }
+
+ fesetround(save_round_mode);
+
+ END (rint_upward);
+}
+
+static void
round_test (void)
{
START (round);
@@ -3727,6 +4178,51 @@ round_test (void)
TEST_f_f (round, 2097152.5, 2097153);
TEST_f_f (round, -2097152.5, -2097153);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (round, 4503599627370495.5L, 4503599627370496.0L);
+ TEST_f_f (round, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (round, 4503599627370496.5L, 4503599627370497.0L);
+ TEST_f_f (round, 4503599627370496.75L, 4503599627370497.0L);
+ TEST_f_f (round, 4503599627370497.5L, 4503599627370498.0L);
+
+ TEST_f_f (round, -4503599627370495.5L, -4503599627370496.0L);
+ TEST_f_f (round, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (round, -4503599627370496.5L, -4503599627370497.0L);
+ TEST_f_f (round, -4503599627370496.75L, -4503599627370497.0L);
+ TEST_f_f (round, -4503599627370497.5L, -4503599627370498.0L);
+
+ TEST_f_f (round, 9007199254740991.5L, 9007199254740992.0L);
+ TEST_f_f (round, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (round, 9007199254740992.5L, 9007199254740993.0L);
+ TEST_f_f (round, 9007199254740992.75L, 9007199254740993.0L);
+ TEST_f_f (round, 9007199254740993.5L, 9007199254740994.0L);
+
+ TEST_f_f (round, -9007199254740991.5L, -9007199254740992.0L);
+ TEST_f_f (round, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (round, -9007199254740992.5L, -9007199254740993.0L);
+ TEST_f_f (round, -9007199254740992.75L, -9007199254740993.0L);
+ TEST_f_f (round, -9007199254740993.5L, -9007199254740994.0L);
+
+ TEST_f_f (round, 72057594037927935.5L, 72057594037927936.0L);
+ TEST_f_f (round, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (round, 72057594037927936.5L, 72057594037927937.0L);
+ TEST_f_f (round, 72057594037927936.75L, 72057594037927937.0L);
+ TEST_f_f (round, 72057594037927937.5L, 72057594037927938.0L);
+
+ TEST_f_f (round, -72057594037927935.5L, -72057594037927936.0L);
+ TEST_f_f (round, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (round, -72057594037927936.5L, -72057594037927937.0L);
+ TEST_f_f (round, -72057594037927936.75L, -72057594037927937.0L);
+ TEST_f_f (round, -72057594037927937.5L, -72057594037927938.0L);
+
+ TEST_f_f (round, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L);
+ TEST_f_f (round, 10141204801825835211973625643008.75L, 10141204801825835211973625643009.0L);
+ TEST_f_f (round, 10141204801825835211973625643009.5L, 10141204801825835211973625643010.0L);
+#endif
+
END (round);
}
#endif
@@ -3813,6 +4309,7 @@ scalbn_test (void)
END (scalbn);
}
+
#if 0
static void
scalbln_test (void)
@@ -3836,6 +4333,7 @@ scalbln_test (void)
}
#endif
+
static void
signbit_test (void)
{
@@ -3855,6 +4353,7 @@ signbit_test (void)
END (signbit);
}
+
static void
sin_test (void)
{
@@ -3876,12 +4375,17 @@ sin_test (void)
TEST_f_f (sin, -M_PI_6l, -0.5);
TEST_f_f (sin, M_PI_2l, 1);
TEST_f_f (sin, -M_PI_2l, -1);
- TEST_f_f (sin, 0.7L, 0.64421768723769105367261435139872014L);
+ TEST_f_f (sin, 0.75L, 0.681638760023334166733241952779893935L);
+
+#ifdef TEST_DOUBLE
+ TEST_f_f (sin, 0.80190127184058835, 0.71867942238767868);
+#endif
END (sin);
}
+
#if 0
static void
sincos_test (void)
@@ -3907,7 +4411,11 @@ sincos_test (void)
TEST_extra (sincos, M_PI_2l, 1, 0);
TEST_extra (sincos, M_PI_6l, 0.5, 0.86602540378443864676372317075293616L);
TEST_extra (sincos, M_PI_6l*2.0, 0.86602540378443864676372317075293616L, 0.5);
- TEST_extra (sincos, 0.7L, 0.64421768723769105367261435139872014L, 0.76484218728448842625585999019186495L);
+ TEST_extra (sincos, 0.75L, 0.681638760023334166733241952779893935L, 0.731688868873820886311838753000084544L);
+
+#ifdef TEST_DOUBLE
+ TEST_extra (sincos, 0.80190127184058835, 0.71867942238767868, 0.69534156199418473);
+#endif
END (sincos);
}
@@ -3932,7 +4440,7 @@ sinh_test (void)
#endif
TEST_f_f (sinh, nan_value, nan_value);
- TEST_f_f (sinh, 0.7L, 0.75858370183953350346L);
+ TEST_f_f (sinh, 0.75L, 0.822316731935829980703661634446913849L);
TEST_f_f (sinh, 0x8p-32L, 1.86264514923095703232705808926175479e-9L);
END (sinh);
@@ -3965,12 +4473,13 @@ sqrt_test (void)
TEST_f_f (sqrt, 2, M_SQRT2l);
TEST_f_f (sqrt, 0.25, 0.5);
TEST_f_f (sqrt, 6642.25, 81.5);
- TEST_f_f (sqrt, 15239.9025L, 123.45L);
- TEST_f_f (sqrt, 0.7L, 0.83666002653407554797817202578518747L);
+ TEST_f_f (sqrt, 15190.5625L, 123.25L);
+ TEST_f_f (sqrt, 0.75L, 0.866025403784438646763723170752936183L);
END (sqrt);
}
+
static void
tan_test (void)
{
@@ -3989,7 +4498,7 @@ tan_test (void)
TEST_f_f (tan, nan_value, nan_value);
TEST_f_f (tan, M_PI_4l, 1);
- TEST_f_f (tan, 0.7L, 0.84228838046307944812813500221293775L);
+ TEST_f_f (tan, 0.75L, 0.931596459944072461165202756573936428L);
END (tan);
}
@@ -4014,14 +4523,14 @@ tanh_test (void)
#endif
TEST_f_f (tanh, nan_value, nan_value);
- TEST_f_f (tanh, 0.7L, 0.60436777711716349631L);
- TEST_f_f (tanh, -0.7L, -0.60436777711716349631L);
+ TEST_f_f (tanh, 0.75L, 0.635148952387287319214434357312496495L);
+ TEST_f_f (tanh, -0.75L, -0.635148952387287319214434357312496495L);
TEST_f_f (tanh, 1.0L, 0.7615941559557648881194582826047935904L);
TEST_f_f (tanh, -1.0L, -0.7615941559557648881194582826047935904L);
/* 2^-57 */
- TEST_f_f (tanh, 6.938893903907228377647697925567626953125e-18L,6.938893903907228377647697925567626953125e-18L);
+ TEST_f_f (tanh, 0x1p-57L, 6.938893903907228377647697925567626953125e-18L);
END (tanh);
}
@@ -4040,8 +4549,8 @@ tgamma_test (void)
START (tgamma);
TEST_f_f (tgamma, plus_infty, plus_infty);
- TEST_f_f (tgamma, 0, nan_value, INVALID_EXCEPTION);
- TEST_f_f (tgamma, minus_zero, nan_value, INVALID_EXCEPTION);
+ TEST_f_f (tgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
+ TEST_f_f (tgamma, minus_zero, minus_infty, DIVIDE_BY_ZERO_EXCEPTION);
/* tgamma (x) == NaN plus invalid exception for integer x <= 0. */
TEST_f_f (tgamma, -2, nan_value, INVALID_EXCEPTION);
TEST_f_f (tgamma, minus_infty, nan_value, INVALID_EXCEPTION);
@@ -4053,13 +4562,14 @@ tgamma_test (void)
TEST_f_f (tgamma, 1, 1);
TEST_f_f (tgamma, 4, 6);
- TEST_f_f (tgamma, 0.7L, 1.29805533264755778568L);
- TEST_f_f (tgamma, 1.2L, 0.91816874239976061064L);
+ TEST_f_f (tgamma, 0.7L, 1.29805533264755778568117117915281162L);
+ TEST_f_f (tgamma, 1.2L, 0.918168742399760610640951655185830401L);
END (tgamma);
}
#endif
+
#if 0
static void
trunc_test (void)
@@ -4088,6 +4598,50 @@ trunc_test (void)
TEST_f_f (trunc, 4294967296.625L, 4294967296.0L);
TEST_f_f (trunc, -4294967296.625L, -4294967296.0L);
+#ifdef TEST_LDOUBLE
+ /* The result can only be represented in long double. */
+ TEST_f_f (trunc, 4503599627370495.5L, 4503599627370495.0L);
+ TEST_f_f (trunc, 4503599627370496.25L, 4503599627370496.0L);
+ TEST_f_f (trunc, 4503599627370496.5L, 4503599627370496.0L);
+ TEST_f_f (trunc, 4503599627370496.75L, 4503599627370496.0L);
+ TEST_f_f (trunc, 4503599627370497.5L, 4503599627370497.0L);
+
+ TEST_f_f (trunc, -4503599627370495.5L, -4503599627370495.0L);
+ TEST_f_f (trunc, -4503599627370496.25L, -4503599627370496.0L);
+ TEST_f_f (trunc, -4503599627370496.5L, -4503599627370496.0L);
+ TEST_f_f (trunc, -4503599627370496.75L, -4503599627370496.0L);
+ TEST_f_f (trunc, -4503599627370497.5L, -4503599627370497.0L);
+
+ TEST_f_f (trunc, 9007199254740991.5L, 9007199254740991.0L);
+ TEST_f_f (trunc, 9007199254740992.25L, 9007199254740992.0L);
+ TEST_f_f (trunc, 9007199254740992.5L, 9007199254740992.0L);
+ TEST_f_f (trunc, 9007199254740992.75L, 9007199254740992.0L);
+ TEST_f_f (trunc, 9007199254740993.5L, 9007199254740993.0L);
+
+ TEST_f_f (trunc, -9007199254740991.5L, -9007199254740991.0L);
+ TEST_f_f (trunc, -9007199254740992.25L, -9007199254740992.0L);
+ TEST_f_f (trunc, -9007199254740992.5L, -9007199254740992.0L);
+ TEST_f_f (trunc, -9007199254740992.75L, -9007199254740992.0L);
+ TEST_f_f (trunc, -9007199254740993.5L, -9007199254740993.0L);
+
+ TEST_f_f (trunc, 72057594037927935.5L, 72057594037927935.0L);
+ TEST_f_f (trunc, 72057594037927936.25L, 72057594037927936.0L);
+ TEST_f_f (trunc, 72057594037927936.5L, 72057594037927936.0L);
+ TEST_f_f (trunc, 72057594037927936.75L, 72057594037927936.0L);
+ TEST_f_f (trunc, 72057594037927937.5L, 72057594037927937.0L);
+
+ TEST_f_f (trunc, -72057594037927935.5L, -72057594037927935.0L);
+ TEST_f_f (trunc, -72057594037927936.25L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927936.5L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927936.75L, -72057594037927936.0L);
+ TEST_f_f (trunc, -72057594037927937.5L, -72057594037927937.0L);
+
+ TEST_f_f (trunc, 10141204801825835211973625643007.5L, 10141204801825835211973625643007.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.5L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643008.75L, 10141204801825835211973625643008.0L);
+ TEST_f_f (trunc, 10141204801825835211973625643009.5L, 10141204801825835211973625643009.0L);
+#endif
END (trunc);
}
@@ -4112,18 +4666,18 @@ y0_test (void)
/* y0 is the Bessel function of the second kind of order 0 */
START (y0);
- TEST_f_f (y0, -1.0, minus_infty);
+ TEST_f_f (y0, -1.0, minus_infty, INVALID_EXCEPTION);
TEST_f_f (y0, 0.0, minus_infty);
TEST_f_f (y0, nan_value, nan_value);
TEST_f_f (y0, plus_infty, 0);
- TEST_f_f (y0, 0.1L, -1.5342386513503668441L);
- TEST_f_f (y0, 0.7L, -0.19066492933739506743L);
- TEST_f_f (y0, 1.0, 0.088256964215676957983L);
- TEST_f_f (y0, 1.5, 0.38244892379775884396L);
- TEST_f_f (y0, 2.0, 0.51037567264974511960L);
- TEST_f_f (y0, 8.0, 0.22352148938756622053L);
- TEST_f_f (y0, 10.0, 0.055671167283599391424L);
+ TEST_f_f (y0, 0.125L, -1.38968062514384052915582277745018693L);
+ TEST_f_f (y0, 0.75L, -0.137172769385772397522814379396581855L);
+ TEST_f_f (y0, 1.0, 0.0882569642156769579829267660235151628L);
+ TEST_f_f (y0, 1.5, 0.382448923797758843955068554978089862L);
+ TEST_f_f (y0, 2.0, 0.510375672649745119596606592727157873L);
+ TEST_f_f (y0, 8.0, 0.223521489387566220527323400498620359L);
+ TEST_f_f (y0, 10.0, 0.0556711672835993914244598774101900481L);
END (y0);
}
@@ -4148,22 +4702,23 @@ y1_test (void)
/* y1 is the Bessel function of the second kind of order 1 */
START (y1);
- TEST_f_f (y1, -1.0, minus_infty);
+ TEST_f_f (y1, -1.0, minus_infty, INVALID_EXCEPTION);
TEST_f_f (y1, 0.0, minus_infty);
TEST_f_f (y1, plus_infty, 0);
TEST_f_f (y1, nan_value, nan_value);
- TEST_f_f (y1, 0.1L, -6.4589510947020269877L);
- TEST_f_f (y1, 0.7L, -1.1032498719076333697L);
- TEST_f_f (y1, 1.0, -0.78121282130028871655L);
- TEST_f_f (y1, 1.5, -0.41230862697391129595L);
- TEST_f_f (y1, 2.0, -0.10703243154093754689L);
- TEST_f_f (y1, 8.0, -0.15806046173124749426L);
- TEST_f_f (y1, 10.0, 0.24901542420695388392L);
+ TEST_f_f (y1, 0.125L, -5.19993611253477499595928744876579921L);
+ TEST_f_f (y1, 0.75L, -1.03759455076928541973767132140642198L);
+ TEST_f_f (y1, 1.0, -0.781212821300288716547150000047964821L);
+ TEST_f_f (y1, 1.5, -0.412308626973911295952829820633445323L);
+ TEST_f_f (y1, 2.0, -0.107032431540937546888370772277476637L);
+ TEST_f_f (y1, 8.0, -0.158060461731247494255555266187483550L);
+ TEST_f_f (y1, 10.0, 0.249015424206953883923283474663222803L);
END (y1);
}
+
static void
yn_test (void)
{
@@ -4184,58 +4739,71 @@ yn_test (void)
START (yn);
/* yn (0, x) == y0 (x) */
- TEST_ff_f (yn, 0, -1.0, minus_infty);
+ TEST_ff_f (yn, 0, -1.0, minus_infty, INVALID_EXCEPTION);
TEST_ff_f (yn, 0, 0.0, minus_infty);
TEST_ff_f (yn, 0, nan_value, nan_value);
TEST_ff_f (yn, 0, plus_infty, 0);
- TEST_ff_f (yn, 0, 0.1L, -1.5342386513503668441L);
- TEST_ff_f (yn, 0, 0.7L, -0.19066492933739506743L);
- TEST_ff_f (yn, 0, 1.0, 0.088256964215676957983L);
- TEST_ff_f (yn, 0, 1.5, 0.38244892379775884396L);
- TEST_ff_f (yn, 0, 2.0, 0.51037567264974511960L);
- TEST_ff_f (yn, 0, 8.0, 0.22352148938756622053L);
- TEST_ff_f (yn, 0, 10.0, 0.055671167283599391424L);
+ TEST_ff_f (yn, 0, 0.125L, -1.38968062514384052915582277745018693L);
+ TEST_ff_f (yn, 0, 0.75L, -0.137172769385772397522814379396581855L);
+ TEST_ff_f (yn, 0, 1.0, 0.0882569642156769579829267660235151628L);
+ TEST_ff_f (yn, 0, 1.5, 0.382448923797758843955068554978089862L);
+ TEST_ff_f (yn, 0, 2.0, 0.510375672649745119596606592727157873L);
+ TEST_ff_f (yn, 0, 8.0, 0.223521489387566220527323400498620359L);
+ TEST_ff_f (yn, 0, 10.0, 0.0556711672835993914244598774101900481L);
/* yn (1, x) == y1 (x) */
- TEST_ff_f (yn, 1, -1.0, minus_infty);
+ TEST_ff_f (yn, 1, -1.0, minus_infty, INVALID_EXCEPTION);
TEST_ff_f (yn, 1, 0.0, minus_infty);
TEST_ff_f (yn, 1, plus_infty, 0);
TEST_ff_f (yn, 1, nan_value, nan_value);
- TEST_ff_f (yn, 1, 0.1L, -6.4589510947020269877L);
- TEST_ff_f (yn, 1, 0.7L, -1.1032498719076333697L);
- TEST_ff_f (yn, 1, 1.0, -0.78121282130028871655L);
- TEST_ff_f (yn, 1, 1.5, -0.41230862697391129595L);
- TEST_ff_f (yn, 1, 2.0, -0.10703243154093754689L);
- TEST_ff_f (yn, 1, 8.0, -0.15806046173124749426L);
- TEST_ff_f (yn, 1, 10.0, 0.24901542420695388392L);
+ TEST_ff_f (yn, 1, 0.125L, -5.19993611253477499595928744876579921L);
+ TEST_ff_f (yn, 1, 0.75L, -1.03759455076928541973767132140642198L);
+ TEST_ff_f (yn, 1, 1.0, -0.781212821300288716547150000047964821L);
+ TEST_ff_f (yn, 1, 1.5, -0.412308626973911295952829820633445323L);
+ TEST_ff_f (yn, 1, 2.0, -0.107032431540937546888370772277476637L);
+ TEST_ff_f (yn, 1, 8.0, -0.158060461731247494255555266187483550L);
+ TEST_ff_f (yn, 1, 10.0, 0.249015424206953883923283474663222803L);
/* yn (3, x) */
TEST_ff_f (yn, 3, plus_infty, 0);
TEST_ff_f (yn, 3, nan_value, nan_value);
- TEST_ff_f (yn, 3, 0.1L, -5099.3323786129048894L);
- TEST_ff_f (yn, 3, 0.7L, -15.819479052819633505L);
- TEST_ff_f (yn, 3, 1.0, -5.8215176059647288478L);
- TEST_ff_f (yn, 3, 2.0, -1.1277837768404277861L);
- TEST_ff_f (yn, 3, 10.0, -0.25136265718383732978L);
+ TEST_ff_f (yn, 3, 0.125L, -2612.69757350066712600220955744091741L);
+ TEST_ff_f (yn, 3, 0.75L, -12.9877176234475433186319774484809207L);
+ TEST_ff_f (yn, 3, 1.0, -5.82151760596472884776175706442981440L);
+ TEST_ff_f (yn, 3, 2.0, -1.12778377684042778608158395773179238L);
+ TEST_ff_f (yn, 3, 10.0, -0.251362657183837329779204747654240998L);
/* yn (10, x) */
TEST_ff_f (yn, 10, plus_infty, 0);
TEST_ff_f (yn, 10, nan_value, nan_value);
- TEST_ff_f (yn, 10, 0.1L, -0.11831335132045197885e19L);
- TEST_ff_f (yn, 10, 0.7L, -0.42447194260703866924e10L);
- TEST_ff_f (yn, 10, 1.0, -0.12161801427868918929e9L);
- TEST_ff_f (yn, 10, 2.0, -129184.54220803928264L);
- TEST_ff_f (yn, 10, 10.0, -0.35981415218340272205L);
+ TEST_ff_f (yn, 10, 0.125L, -127057845771019398.252538486899753195L);
+ TEST_ff_f (yn, 10, 0.75L, -2133501638.90573424452445412893839236L);
+ TEST_ff_f (yn, 10, 1.0, -121618014.278689189288130426667971145L);
+ TEST_ff_f (yn, 10, 2.0, -129184.542208039282635913145923304214L);
+ TEST_ff_f (yn, 10, 10.0, -0.359814152183402722051986577343560609L);
END (yn);
}
+static void
+significand_test (void)
+{
+ /* significand returns the mantissa of the exponential representation. */
+ START (significand);
+
+ TEST_f_f (significand, 4.0, 1.0);
+ TEST_f_f (significand, 6.0, 1.5);
+ TEST_f_f (significand, 8.0, 1.0);
+
+ END (significand);
+}
+
static void
initialize (void)
@@ -4249,12 +4817,18 @@ initialize (void)
HUGE_VALL, HUGE_VAL, HUGE_VALF);
minus_infty = CHOOSE (-HUGE_VALL, -HUGE_VAL, -HUGE_VALF,
-HUGE_VALL, -HUGE_VAL, -HUGE_VALF);
+ max_value = CHOOSE (LDBL_MAX, DBL_MAX, FLT_MAX,
+ LDBL_MAX, DBL_MAX, FLT_MAX);
+ min_value = CHOOSE (LDBL_MIN, DBL_MIN, FLT_MIN,
+ LDBL_MIN, DBL_MIN, FLT_MIN);
(void) &plus_zero;
(void) &nan_value;
(void) &minus_zero;
(void) &plus_infty;
(void) &minus_infty;
+ (void) &max_value;
+ (void) &min_value;
/* Clear all exceptions. From now on we must not get random exceptions. */
feclearexcept (FE_ALL_EXCEPT);
@@ -4404,6 +4978,7 @@ main (int argc, char **argv)
#if 0
scalbln_test ();
#endif
+ significand_test ();
/* Power and absolute value functions: */
cbrt_test ();
@@ -4429,6 +5004,10 @@ main (int argc, char **argv)
#endif
rint_test ();
#if 0
+ rint_test_tonearest ();
+ rint_test_towardzero ();
+ rint_test_downward ();
+ rint_test_upward ();
lrint_test ();
llrint_test ();
round_test ();
@@ -4473,7 +5052,9 @@ main (int argc, char **argv)
cimag_test ();
clog10_test ();
clog_test ();
+#if 0
conj_test ();
+#endif
cpow_test ();
cproj_test ();
creal_test ();
diff --git a/test/math/test-fpucw.c b/test/math/test-fpucw.c
new file mode 100644
index 000000000..6d638c66c
--- /dev/null
+++ b/test/math/test-fpucw.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 2000.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fpu_control.h>
+#include <stdio.h>
+
+int
+main (void)
+{
+#ifdef _FPU_GETCW
+/* Some architectures don't have _FPU_GETCW (e.g. Linux/Alpha). */
+ fpu_control_t cw;
+
+ _FPU_GETCW (cw);
+
+ cw &= ~_FPU_RESERVED;
+
+ if (cw != (_FPU_DEFAULT & ~_FPU_RESERVED))
+ printf ("control word is 0x%lx but should be 0x%lx.\n",
+ (long int) cw, (long int) (_FPU_DEFAULT & ~_FPU_RESERVED));
+
+ return cw != (_FPU_DEFAULT & ~_FPU_RESERVED);
+
+#else
+ return 0;
+#endif
+}
diff --git a/test/math/tst-definitions.c b/test/math/tst-definitions.c
new file mode 100644
index 000000000..7d352af40
--- /dev/null
+++ b/test/math/tst-definitions.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <limits.h>
+#include <math.h>
+#include <stdio.h>
+
+
+int
+main (void)
+{
+ int result = 0;
+
+ if (FP_ILOGB0 != INT_MIN && FP_ILOGB0 != -INT_MAX)
+ {
+ puts ("FP_ILOGB0 has no valid value");
+ result = 1;
+ }
+ else
+ puts ("FP_ILOGB0 value is OK");
+
+ if (FP_ILOGBNAN != INT_MIN && FP_ILOGBNAN != INT_MAX)
+ {
+ puts ("FP_ILOBNAN has no valid value");
+ result = 1;
+ }
+ else
+ puts ("FP_ILOGBNAN value is OK");
+
+ return result;
+}
diff --git a/test/misc/Makefile b/test/misc/Makefile
index ca9f51c42..48c549e73 100644
--- a/test/misc/Makefile
+++ b/test/misc/Makefile
@@ -1,14 +1,14 @@
# uClibc misc tests
-# Licensed under the GNU Library General Public License, see COPYING.LIB
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-TESTS_DISABLED := outb tst-fnmatch
+TESTS_DISABLED := outb tst-fnmatch bug-glob1 tst-gnuglob
include ../Test.mak
CFLAGS_dirent64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-CFLAGS_tst-regex2 := -std=c99
DODIFF_dirent := 1
DODIFF_dirent64 := 1
+OPTS_bug-glob1 := $(PWD)
OPTS_tst-fnmatch := < tst-fnmatch.input
diff --git a/test/misc/bug-glob1.c b/test/misc/bug-glob1.c
new file mode 100644
index 000000000..aec84ad44
--- /dev/null
+++ b/test/misc/bug-glob1.c
@@ -0,0 +1,94 @@
+/* Test case for globbing dangling symlink. By Ulrich Drepper. */
+#include <errno.h>
+#include <error.h>
+#include <glob.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static void prepare (int argc, char *argv[]);
+#define PREPARE prepare
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+#include "../test-skeleton.c"
+
+
+static char *fname;
+
+static void
+prepare (int argc, char *argv[])
+{
+ if (argc < 2)
+ error (EXIT_FAILURE, 0, "missing argument");
+
+ size_t len = strlen (argv[1]);
+ static const char ext[] = "globXXXXXX";
+ fname = malloc (len + sizeof (ext));
+ if (fname == NULL)
+ error (EXIT_FAILURE, errno, "cannot create temp file");
+ again:
+ strcpy (stpcpy (fname, argv[1]), ext);
+
+/*
+ fname = mktemp (fname);
+*/
+ close(mkstemp(fname));
+ unlink(fname);
+
+ if (fname == NULL || *fname == '\0')
+ error (EXIT_FAILURE, errno, "cannot create temp file name");
+ if (symlink ("bug-glob1-does-not-exist", fname) != 0)
+ {
+ if (errno == EEXIST)
+ goto again;
+
+ error (EXIT_FAILURE, errno, "cannot create symlink");
+ }
+ add_temp_file (fname);
+}
+
+
+static int
+do_test (void)
+{
+ glob_t gl;
+ int retval = 0;
+ int e;
+
+ e = glob (fname, 0, NULL, &gl);
+ if (e == 0)
+ {
+ printf ("glob(\"%s\") succeeded when it should not have\n", fname);
+ retval = 1;
+ }
+ globfree (&gl);
+
+ size_t fnamelen = strlen (fname);
+ char buf[fnamelen + 2];
+
+ strcpy (buf, fname);
+ buf[fnamelen - 1] = '?';
+ e = glob (buf, 0, NULL, &gl);
+ if (e == 0)
+ {
+ printf ("glob(\"%s\") succeeded when it should not have\n", buf);
+ retval = 1;
+ }
+ globfree (&gl);
+
+ strcpy (buf, fname);
+ buf[fnamelen] = '*';
+ buf[fnamelen + 1] = '\0';
+ e = glob (buf, 0, NULL, &gl);
+ if (e == 0)
+ {
+ printf ("glob(\"%s\") succeeded when it should not have\n", buf);
+ retval = 1;
+ }
+ globfree (&gl);
+
+ return retval;
+}
diff --git a/test/misc/bug-readdir1.c b/test/misc/bug-readdir1.c
new file mode 100644
index 000000000..4c3521dbb
--- /dev/null
+++ b/test/misc/bug-readdir1.c
@@ -0,0 +1,38 @@
+#include <dirent.h>
+#include <errno.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+
+int
+main (void)
+{
+ DIR *dirp;
+ struct dirent* ent;
+
+ /* open a dir stream */
+ dirp = opendir ("/tmp");
+ if (dirp == NULL)
+ {
+ if (errno == ENOENT)
+ exit (0);
+
+ perror ("opendir");
+ exit (1);
+ }
+
+ /* close the directory file descriptor, making it invalid */
+ if (close (dirfd (dirp)) != 0)
+ {
+ puts ("could not close directory file descriptor");
+ /* This is not an error. It is not guaranteed this is possible. */
+ return 0;
+ }
+
+ ent = readdir (dirp);
+
+ return ent != NULL || errno != EBADF;
+}
diff --git a/test/misc/dirent.c b/test/misc/dirent.c
index 885990bf2..491e3cf75 100644
--- a/test/misc/dirent.c
+++ b/test/misc/dirent.c
@@ -1,25 +1,39 @@
#include <stdio.h>
#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
-int main(int argc, char **argv)
+#define _DTIFY(DT) [DT] #DT
+const char * const types[] = {
+ _DTIFY(DT_UNKNOWN),
+ _DTIFY(DT_FIFO),
+ _DTIFY(DT_CHR),
+ _DTIFY(DT_DIR),
+ _DTIFY(DT_BLK),
+ _DTIFY(DT_REG),
+ _DTIFY(DT_LNK),
+ _DTIFY(DT_SOCK),
+ _DTIFY(DT_WHT)
+};
+
+int main(int argc, char *argv[])
{
+ DIR *dirh;
+ struct dirent *de;
+ const char *mydir = (argc == 1 ? "/" : argv[1]);
- DIR *dirh;
- struct dirent *dirp;
- static char mydir[20] = "/tmp";
+ if ((dirh = opendir(mydir)) == NULL) {
+ perror("opendir");
+ return 1;
+ }
- if ((dirh = opendir(mydir)) == NULL) {
- perror("opendir");
- return 1;
- }
+ printf("readdir() says:\n");
+ while ((de = readdir(dirh)) != NULL)
+ printf("\tdir entry %s: %s\n", types[de->d_type], de->d_name);
- for (dirp = readdir(dirh); dirp != NULL; dirp = readdir(dirh)) {
- printf("Got dir entry: %s\n",dirp->d_name);
- }
+ closedir(dirh);
- closedir(dirh);
- return 0;
+ return 0;
}
-
diff --git a/test/misc/dirent64.c b/test/misc/dirent64.c
new file mode 100644
index 000000000..26455ab68
--- /dev/null
+++ b/test/misc/dirent64.c
@@ -0,0 +1 @@
+#include "dirent.c"
diff --git a/test/misc/fdopen.c b/test/misc/fdopen.c
index 598a85a05..f64cfb6b9 100644
--- a/test/misc/fdopen.c
+++ b/test/misc/fdopen.c
@@ -1,6 +1,7 @@
/* Test for fdopen bugs. */
#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
@@ -12,21 +13,24 @@
goto the_end; \
}
-char buffer[256];
-
int
main (int argc, char *argv[])
{
- char *name;
+ char name[256];
FILE *fp = NULL;
int retval = 0;
int fd;
- name = tmpnam (NULL);
+ /* hack to get a tempfile name w/out using tmpname()
+ * as that func causes a link time warning */
+ sprintf(name, "%s-uClibc-test.XXXXXX", __FILE__);
+ fd = mkstemp(name);
+ close(fd);
+
fp = fopen (name, "w");
assert (fp != NULL)
- fputs ("foobar and baz", fp);
- fclose (fp);
+ assert (fputs ("foobar and baz", fp) > 0);
+ assert (fclose (fp) == 0);
fp = NULL;
fd = open (name, O_RDWR|O_CREAT);
@@ -35,11 +39,13 @@ main (int argc, char *argv[])
fp = fdopen (fd, "a");
assert (fp != NULL);
- assert (ftell (fp) == 14);
+ /* SuSv3 says that doing a fdopen() does not reset the file position,
+ * thus the '5' here is correct, not '14'. */
+ assert (ftell (fp) == 5);
the_end:
if (fp != NULL)
- fclose (fp);
+ assert (fclose (fp) == 0);
unlink (name);
return retval;
diff --git a/test/misc/opendir-tst1.c b/test/misc/opendir-tst1.c
new file mode 100644
index 000000000..983d4b482
--- /dev/null
+++ b/test/misc/opendir-tst1.c
@@ -0,0 +1,95 @@
+/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/* Name of the FIFO. */
+char tmpname[] = "fifoXXXXXX";
+
+
+/* Do the real work. */
+static int
+real_test (void)
+{
+ DIR *dirp;
+
+ /* This should not block for an FIFO. */
+ dirp = opendir (tmpname);
+
+ /* Successful. */
+ if (dirp != NULL)
+ {
+ /* Oh, oh, how can this work? */
+ fputs ("`opendir' succeeded on a FIFO???\n", stdout);
+ closedir (dirp);
+ return 1;
+ }
+
+ if (errno != ENOTDIR)
+ {
+ fprintf (stdout, "`opendir' return error `%s' instead of `%s'\n",
+ strerror (errno), strerror (ENOTDIR));
+ return 1;
+ }
+
+ return 0;
+}
+
+
+static int
+do_test (int argc, char *argv[])
+{
+ int retval;
+
+ retval = mkstemp(tmpname);
+ close(retval);
+ unlink(tmpname);
+
+ /* Try to generate a FIFO. */
+ if (mknod (tmpname, 0600 | S_IFIFO, 0) < 0)
+ {
+ perror ("mknod");
+ /* We cannot make this an error. */
+ return 0;
+ }
+
+ retval = real_test ();
+
+ remove (tmpname);
+
+ return retval;
+}
+
+
+static void
+do_cleanup (void)
+{
+ remove (tmpname);
+}
+#define CLEANUP_HANDLER do_cleanup ()
+
+
+/* Include the test skeleton. */
+#include <test-skeleton.c>
diff --git a/test/misc/popen.c b/test/misc/popen.c
new file mode 100644
index 000000000..868b70eed
--- /dev/null
+++ b/test/misc/popen.c
@@ -0,0 +1,47 @@
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <signal.h>
+
+#define TEST(r, f, x, m) ( \
+((r) = (f)) == (x) || \
+(printf(__FILE__ ":%d: %s failed (" m ")\n", __LINE__, #f, r, x), err++, 0) )
+
+#define TEST_E(f) ( (errno = 0), (f) || \
+(printf(__FILE__ ":%d: %s failed (errno = %d)\n", __LINE__, #f, errno), err++, 0) )
+
+#define TEST_S(s, x, m) ( \
+!strcmp((s),(x)) || \
+(printf(__FILE__ ":%d: [%s] != [%s] (%s)\n", __LINE__, s, x, m), err++, 0) )
+
+static sig_atomic_t got_sig;
+
+static void handler(int sig)
+{
+ got_sig = 1;
+}
+
+int main(void)
+{
+ int i;
+ char foo[6];
+ char cmd[64];
+ int err = 0;
+ FILE *f;
+
+ TEST_E(f = popen("echo hello", "r"));
+ TEST_E(fgets(foo, sizeof foo, f));
+ TEST_S(foo, "hello", "child process did not say hello");
+ TEST(i, pclose(f), 0, "exit status %04x != %04x");
+
+ signal(SIGUSR1, handler);
+ snprintf(cmd, sizeof cmd, "read a ; test \"x$a\" = xhello && kill -USR1 %d", getpid());
+ TEST_E(f = popen(cmd, "w"));
+ TEST_E(fputs("hello", f) >= 0);
+ TEST(i, pclose(f), 0, "exit status %04x != %04x");
+ signal(SIGUSR1, SIG_DFL);
+ TEST(i, got_sig, 1, "child process did not send signal (%i!=%i)");
+
+ return err;
+}
diff --git a/test/misc/seek.c b/test/misc/seek.c
new file mode 100644
index 000000000..f3f5d20df
--- /dev/null
+++ b/test/misc/seek.c
@@ -0,0 +1,79 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <assert.h>
+
+#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(*arr))
+
+int main(void)
+{
+ struct {
+ off_t offset;
+ int whence;
+ } tests[] = {
+ { 0x00, SEEK_SET },
+ { 0x01, SEEK_SET },
+ { 0xFF, SEEK_SET }
+ };
+ char buf[2000];
+ off_t ret;
+ int i, fd;
+ FILE *fp;
+
+ fd = open("lseek.out", O_RDWR|O_CREAT, 0600);
+ if (fd == -1) {
+ perror("open(lseek.out) failed");
+ return 1;
+ }
+ unlink("lseek.out");
+ fp = fdopen(fd, "rw");
+ if (fp == NULL) {
+ perror("fopen(lseek.out) failed");
+ return 1;
+ }
+
+ memset(buf, 0xAB, sizeof(buf));
+ ret = write(fd, buf, sizeof(buf));
+ if (ret != sizeof(buf)) {
+ fprintf(stderr, "write() failed to write %zi bytes (wrote %li): ", sizeof(buf), (long)ret);
+ perror("");
+ return 1;
+ }
+
+ assert(fseeko(fp, 1024, SEEK_SET) == 0);
+ assert(fseeko(fp, (off_t)-16, SEEK_CUR) == 0);
+ ret = ftell(fp);
+ if (ret != (1024-16)) {
+ fprintf(stderr, "ftell() failed, we wanted pos %i but got %li: ", (1024-16), (long)ret);
+ perror("");
+ return 1;
+ }
+
+ for (i = 0; i < ARRAY_SIZE(tests); ++i) {
+ ret = lseek(fd, tests[i].offset, tests[i].whence);
+ if (ret != tests[i].offset) {
+ fprintf(stderr, "lseek(%li,%i) failed (wanted %li, got %li): ", (long)tests[i].offset,
+ tests[i].whence, (long)tests[i].offset, (long)ret);
+ perror("");
+ return 1;
+ }
+ ret = fseek(fp, tests[i].offset, tests[i].whence);
+ if (ret != 0) {
+ fprintf(stderr, "fseek(%li,%i) failed (wanted 0, got %li): ", (long)tests[i].offset,
+ tests[i].whence, (long)ret);
+ perror("");
+ return 1;
+ }
+ }
+
+ fclose(fp);
+ close(fd);
+
+ printf("Success!\n");
+
+ return 0;
+}
diff --git a/test/misc/sem.c b/test/misc/sem.c
index 7606fd180..62a59b1e9 100644
--- a/test/misc/sem.c
+++ b/test/misc/sem.c
@@ -1,43 +1,45 @@
#include <stdio.h>
+#include <string.h>
+#include <errno.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
int main(void)
{
- int k, r;
- union semun {
- int val;
- struct semid_ds *buf;
- unsigned short int *array;
- struct seminfo *__buf;
- } sd;
- struct semid_ds sd_buf;
-
- k = semget(IPC_PRIVATE, 10, IPC_CREAT | 0666 );
- printf("%d\n", k);
-
- if (k < 0) {
- printf("semget failed: %m\n");
- return 1;
- }
-
- sd.buf = &sd_buf;
- r = semctl(k, 0, IPC_STAT, sd);
- printf("%d\n", r);
-
- if (r < 0) {
- printf("semctl IPC_STAT failed: %m\n");
- return 1;
- }
-
- printf("sem_nsems = %lu\n", sd_buf.sem_nsems);
- if (sd_buf.sem_nsems != 10) {
- printf("failed: incorrect sem_nsems!\n");
- return 1;
- }
-
- printf("succeeded\n");
-
- return 0;
+ int k, r;
+ union semun {
+ int val;
+ struct semid_ds *buf;
+ unsigned short int *array;
+ struct seminfo *__buf;
+ } sd;
+ struct semid_ds sd_buf;
+
+ k = semget(IPC_PRIVATE, 10, IPC_CREAT | 0666 );
+ printf("semget(IPC_CREAT) = %d\n", k);
+
+ if (k < 0) {
+ fprintf(stderr, "semget failed: %s\n", strerror(errno));
+ return 1;
+ }
+
+ sd.buf = &sd_buf;
+ r = semctl(k, 0, IPC_STAT, sd);
+ printf("semctl(k) = %d\n", r);
+
+ if (r < 0) {
+ perror("semctl IPC_STAT failed");
+ return 1;
+ }
+
+ printf("sem_nsems = %lu\n", sd_buf.sem_nsems);
+ if (sd_buf.sem_nsems != 10) {
+ fprintf(stderr, "failed: incorrect sem_nsems!\n");
+ return 1;
+ }
+
+ printf("succeeded\n");
+
+ return 0;
}
diff --git a/test/misc/stdarg.c b/test/misc/stdarg.c
new file mode 100644
index 000000000..561fd2c3b
--- /dev/null
+++ b/test/misc/stdarg.c
@@ -0,0 +1,23 @@
+/* copied from rsync */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <stdarg.h>
+int foo(const char *format, ...)
+{
+ va_list ap;
+ size_t len;
+ char buf[5];
+
+ va_start(ap, format);
+ len = vsnprintf(0, 0, format, ap);
+ va_end(ap);
+ if (len != 5) return(1);
+
+ if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) return(1);
+
+ return(0);
+}
+int main(void) { return foo("hello"); }
diff --git a/test/misc/tst-fnmatch.c b/test/misc/tst-fnmatch.c
new file mode 100644
index 000000000..bb102c5bb
--- /dev/null
+++ b/test/misc/tst-fnmatch.c
@@ -0,0 +1,444 @@
+/* Tests for fnmatch function.
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <error.h>
+#include <fnmatch.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/types.h>
+
+
+static char *next_input (char **line, int first, int last);
+static int convert_flags (const char *str);
+static char *flag_output (int flags);
+static char *escape (const char *str, size_t *reslenp, char **resbuf);
+
+
+int str_isalpha(const char *str)
+{
+ size_t i = strlen(str);
+ while (i--)
+ if (isascii(str[i]) == 0)
+ return 0;
+ return 1;
+}
+int str_has_funk(const char *str, const char x)
+{
+ size_t i, max = strlen(str);
+ for (i=0; i+1<max; ++i)
+ if (str[i] == '[' && str[i+1] == x)
+ return 1;
+ return 0;
+}
+
+
+int
+main (void)
+{
+ char *linebuf = NULL;
+ size_t linebuflen = 0;
+ int ntests = 0;
+ int nfailed = 0;
+ int nskipped = 0;
+ char *escinput = NULL;
+ size_t escinputlen = 0;
+ char *escpattern = NULL;
+ size_t escpatternlen = 0;
+ int nr = 0;
+
+ /* Read lines from stdin with the following format:
+
+ locale input-string match-string flags result
+
+ where `result' is either 0 or 1. If the first character of a
+ string is '"' we read until the next '"' and handled escaped '"'. */
+ while (! feof (stdin))
+ {
+ ssize_t n = getline (&linebuf, &linebuflen, stdin);
+ char *cp;
+ const char *locale;
+ const char *input;
+ const char *pattern;
+ const char *result_str;
+ int result;
+ const char *flags;
+ int flags_val;
+ int fnmres;
+ char numbuf[24];
+
+ if (n == -1)
+ break;
+
+ if (n == 0)
+ /* Maybe an empty line. */
+ continue;
+
+ /* Skip over all leading white spaces. */
+ cp = linebuf;
+
+ locale = next_input (&cp, 1, 0);
+ if (locale == NULL)
+ continue;
+
+ input = next_input (&cp, 0, 0);
+ if (input == NULL)
+ continue;
+
+ pattern = next_input (&cp, 0, 0);
+ if (pattern == NULL)
+ continue;
+
+ result_str = next_input (&cp, 0, 0);
+ if (result_str == NULL)
+ continue;
+
+ if (strcmp (result_str, "0") == 0)
+ result = 0;
+ else if (strcasecmp (result_str, "NOMATCH") == 0)
+ result = FNM_NOMATCH;
+ else
+ {
+ char *endp;
+ result = strtol (result_str, &endp, 0);
+ if (*endp != '\0')
+ continue;
+ }
+
+ flags = next_input (&cp, 0, 1);
+ if (flags == NULL)
+ /* We allow the flags missing. */
+ flags = "";
+
+ /* Convert the text describing the flags in a numeric value. */
+ flags_val = convert_flags (flags);
+ if (flags_val == -1)
+ /* Something went wrong. */
+ continue;
+
+ /* Now run the actual test. */
+ ++ntests;
+
+#ifdef __UCLIBC_HAS_XLOCALE__
+ if (setlocale (LC_COLLATE, locale) == NULL
+ || setlocale (LC_CTYPE, locale) == NULL)
+ {
+ puts ("*** Cannot set locale");
+ ++nfailed;
+ continue;
+ }
+#else
+ /* skip non-ascii strings */
+ if (!str_isalpha(pattern) || !str_isalpha(input))
+ {
+ ++nskipped;
+ printf("%3d: fnmatch (\"%s\", \"%s\"): SKIP multibyte test (requires locale support)\n", ++nr, pattern, input);
+ continue;
+ }
+ /* skip collating symbols */
+ if (str_has_funk(pattern, '.') || str_has_funk(input, '.'))
+ {
+ ++nskipped;
+ printf("%3d: fnmatch (\"%s\", \"%s\"): SKIP collating symbol test (requires locale support)\n", ++nr, pattern, input);
+ continue;
+ }
+ /* skip equivalence class expressions */
+ if (str_has_funk(pattern, '=') || str_has_funk(input, '='))
+ {
+ ++nskipped;
+ printf("%3d: fnmatch (\"%s\", \"%s\"): SKIP equivalence class test (requires locale support)\n", ++nr, pattern, input);
+ continue;
+ }
+#endif
+
+ fnmres = fnmatch (pattern, input, flags_val);
+
+ printf ("%3d: fnmatch (\"%s\", \"%s\", %s) = %s%c",
+ ++nr,
+ escape (pattern, &escpatternlen, &escpattern),
+ escape (input, &escinputlen, &escinput),
+ flag_output (flags_val),
+ (fnmres == 0
+ ? "0" : (fnmres == FNM_NOMATCH
+ ? "FNM_NOMATCH"
+ : (sprintf (numbuf, "%d", fnmres), numbuf))),
+ (fnmres != 0) != (result != 0) ? ' ' : '\n');
+
+ if ((fnmres != 0) != (result != 0))
+ {
+ printf ("(FAIL, expected %s) ***\n",
+ result == 0
+ ? "0" : (result == FNM_NOMATCH
+ ? "FNM_NOMATCH"
+ : (sprintf (numbuf, "%d", result), numbuf)));
+ ++nfailed;
+ }
+ }
+
+ printf ("=====================\n%3d tests, %3d failed, %3d skipped\n", ntests, nfailed, nskipped);
+
+ free (escpattern);
+ free (escinput);
+ free (linebuf);
+
+ return nfailed != 0;
+}
+
+
+static char *
+next_input (char **line, int first, int last)
+{
+ char *cp = *line;
+ char *result;
+
+ while (*cp == ' ' || *cp == '\t')
+ ++cp;
+
+ /* We allow comment lines starting with '#'. */
+ if (first && *cp == '#')
+ return NULL;
+
+ if (*cp == '"')
+ {
+ char *wp;
+
+ result = ++cp;
+ wp = cp;
+
+ while (*cp != '"' && *cp != '\0' && *cp != '\n')
+ if (*cp == '\\')
+ {
+ if (cp[1] == '\n' || cp[1] == '\0')
+ return NULL;
+
+ ++cp;
+ if (*cp == 't')
+ *wp++ = '\t';
+ else if (*cp == 'n')
+ *wp++ = '\n';
+ else
+ *wp++ = *cp;
+
+ ++cp;
+ }
+ else
+ *wp++ = *cp++;
+
+ if (*cp != '"')
+ return NULL;
+
+ if (wp != cp)
+ *wp = '\0';
+ }
+ else
+ {
+ result = cp;
+ while (*cp != '\0' && *cp != '\n' && *cp != ' ' && *cp != '\t')
+ ++cp;
+
+ if (cp == result && ! last)
+ /* Premature end of line. */
+ return NULL;
+ }
+
+ /* Terminate and skip over the next white spaces. */
+ *cp++ = '\0';
+
+ *line = cp;
+ return result;
+}
+
+
+static int
+convert_flags (const char *str)
+{
+ int result = 0;
+
+ while (*str != '\0')
+ {
+ int len;
+
+ if (strncasecmp (str, "PATHNAME", 8) == 0
+ && (str[8] == '|' || str[8] == '\0'))
+ {
+ result |= FNM_PATHNAME;
+ len = 8;
+ }
+ else if (strncasecmp (str, "NOESCAPE", 8) == 0
+ && (str[8] == '|' || str[8] == '\0'))
+ {
+ result |= FNM_NOESCAPE;
+ len = 8;
+ }
+ else if (strncasecmp (str, "PERIOD", 6) == 0
+ && (str[6] == '|' || str[6] == '\0'))
+ {
+ result |= FNM_PERIOD;
+ len = 6;
+ }
+#ifdef FNM_LEADING_DIR
+ else if (strncasecmp (str, "LEADING_DIR", 11) == 0
+ && (str[11] == '|' || str[11] == '\0'))
+ {
+ result |= FNM_LEADING_DIR;
+ len = 11;
+ }
+#endif
+#ifdef FNM_CASEFOLD
+ else if (strncasecmp (str, "CASEFOLD", 8) == 0
+ && (str[8] == '|' || str[8] == '\0'))
+ {
+ result |= FNM_CASEFOLD;
+ len = 8;
+ }
+#endif
+#ifdef FNM_EXTMATCH
+ else if (strncasecmp (str, "EXTMATCH", 8) == 0
+ && (str[8] == '|' || str[8] == '\0'))
+ {
+ result |= FNM_EXTMATCH;
+ len = 8;
+ }
+#endif
+ else
+ return -1;
+
+ str += len;
+ if (*str != '\0')
+ ++str;
+ }
+
+ return result;
+}
+
+
+static char *
+flag_output (int flags)
+{
+ static char buf[100];
+ int first = 1;
+ char *cp = buf;
+
+ if (flags & FNM_PATHNAME)
+ {
+ cp = stpcpy (cp, "FNM_PATHNAME");
+ first = 0;
+ }
+ if (flags & FNM_NOESCAPE)
+ {
+ if (! first)
+ *cp++ = '|';
+ cp = stpcpy (cp, "FNM_NOESCAPE");
+ first = 0;
+ }
+ if (flags & FNM_PERIOD)
+ {
+ if (! first)
+ *cp++ = '|';
+ cp = stpcpy (cp, "FNM_PERIOD");
+ first = 0;
+ }
+#ifdef FNM_LEADING_DIR
+ if (flags & FNM_LEADING_DIR)
+ {
+ if (! first)
+ *cp++ = '|';
+ cp = stpcpy (cp, "FNM_LEADING_DIR");
+ first = 0;
+ }
+#endif
+#ifdef FNM_CASEFOLD
+ if (flags & FNM_CASEFOLD)
+ {
+ if (! first)
+ *cp++ = '|';
+ cp = stpcpy (cp, "FNM_CASEFOLD");
+ first = 0;
+ }
+#endif
+#ifdef FNM_EXTMATCH
+ if (flags & FNM_EXTMATCH)
+ {
+ if (! first)
+ *cp++ = '|';
+ cp = stpcpy (cp, "FNM_EXTMATCH");
+ first = 0;
+ }
+#endif
+ if (cp == buf)
+ *cp++ = '0';
+ *cp = '\0';
+
+ return buf;
+}
+
+
+static char *
+escape (const char *str, size_t *reslenp, char **resbufp)
+{
+ size_t reslen = *reslenp;
+ char *resbuf = *resbufp;
+ size_t len = strlen (str);
+ char *wp;
+
+ if (2 * len + 1 > reslen)
+ {
+ resbuf = (char *) realloc (resbuf, 2 * len + 1);
+ if (resbuf == NULL)
+ error (EXIT_FAILURE, errno, "while allocating buffer for printing");
+ *reslenp = 2 * len + 1;
+ *resbufp = resbuf;
+ }
+
+ wp = resbuf;
+ while (*str != '\0')
+ if (*str == '\t')
+ {
+ *wp++ = '\\';
+ *wp++ = 't';
+ ++str;
+ }
+ else if (*str == '\n')
+ {
+ *wp++ = '\\';
+ *wp++ = 'n';
+ ++str;
+ }
+ else if (*str == '"')
+ {
+ *wp++ = '\\';
+ *wp++ = '"';
+ ++str;
+ }
+ else if (*str == '\\')
+ {
+ *wp++ = '\\';
+ *wp++ = '\\';
+ ++str;
+ }
+ else
+ *wp++ = *str++;
+
+ *wp = '\0';
+
+ return resbuf;
+}
diff --git a/test/misc/tst-fnmatch.input b/test/misc/tst-fnmatch.input
new file mode 100644
index 000000000..9061d1994
--- /dev/null
+++ b/test/misc/tst-fnmatch.input
@@ -0,0 +1,755 @@
+# Tests for fnmatch.
+# Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+# Contributes by Ulrich Drepper <drepper@redhat.com>.
+#
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library 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
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA.
+
+
+# Derived from the IEEE 2003.2 text. The standard only contains some
+# wording describing the situations to be tested. It does not specify
+# any specific tests. I.e., the tests below are in no case sufficient.
+# They are hopefully necessary, though.
+
+# B.6 004(C)
+C "!#%+,-./01234567889" "!#%+,-./01234567889" 0
+C ":;=@ABCDEFGHIJKLMNO" ":;=@ABCDEFGHIJKLMNO" 0
+C "PQRSTUVWXYZ]abcdefg" "PQRSTUVWXYZ]abcdefg" 0
+C "hijklmnopqrstuvwxyz" "hijklmnopqrstuvwxyz" 0
+C "^_{}~" "^_{}~" 0
+
+# B.6 005(C)
+C "\"$&'()" "\\\"\\$\\&\\'\\(\\)" 0
+C "*?[\\`|" "\\*\\?\\[\\\\\\`\\|" 0
+C "<>" "\\<\\>" 0
+
+# B.6 006(C)
+C "?*[" "[?*[][?*[][?*[]" 0
+C "a/b" "?/b" 0
+
+# B.6 007(C)
+C "a/b" "a?b" 0
+C "a/b" "a/?" 0
+C "aa/b" "?/b" NOMATCH
+C "aa/b" "a?b" NOMATCH
+C "a/bb" "a/?" NOMATCH
+
+# B.6 009(C)
+C "abc" "[abc]" NOMATCH
+C "x" "[abc]" NOMATCH
+C "a" "[abc]" 0
+C "[" "[[abc]" 0
+C "a" "[][abc]" 0
+C "a]" "[]a]]" 0
+
+# B.6 010(C)
+C "xyz" "[!abc]" NOMATCH
+C "x" "[!abc]" 0
+C "a" "[!abc]" NOMATCH
+
+# B.6 011(C)
+C "]" "[][abc]" 0
+C "abc]" "[][abc]" NOMATCH
+C "[]abc" "[][]abc" NOMATCH
+C "]" "[!]]" NOMATCH
+C "aa]" "[!]a]" NOMATCH
+C "]" "[!a]" 0
+C "]]" "[!a]]" 0
+
+# B.6 012(C)
+C "a" "[[.a.]]" 0
+C "-" "[[.-.]]" 0
+C "-" "[[.-.][.].]]" 0
+C "-" "[[.].][.-.]]" 0
+C "-" "[[.-.][=u=]]" 0
+C "-" "[[.-.][:alpha:]]" 0
+C "a" "[![.a.]]" NOMATCH
+
+# B.6 013(C)
+C "a" "[[.b.]]" NOMATCH
+C "a" "[[.b.][.c.]]" NOMATCH
+C "a" "[[.b.][=b=]]" NOMATCH
+
+
+# B.6 015(C)
+C "a" "[[=a=]]" 0
+C "b" "[[=a=]b]" 0
+C "b" "[[=a=][=b=]]" 0
+C "a" "[[=a=][=b=]]" 0
+C "a" "[[=a=][.b.]]" 0
+C "a" "[[=a=][:digit:]]" 0
+
+# B.6 016(C)
+C "=" "[[=a=]b]" NOMATCH
+C "]" "[[=a=]b]" NOMATCH
+C "a" "[[=b=][=c=]]" NOMATCH
+C "a" "[[=b=][.].]]" NOMATCH
+C "a" "[[=b=][:digit:]]" NOMATCH
+
+# B.6 017(C)
+C "a" "[[:alnum:]]" 0
+C "a" "[![:alnum:]]" NOMATCH
+C "-" "[[:alnum:]]" NOMATCH
+C "a]a" "[[:alnum:]]a" NOMATCH
+C "-" "[[:alnum:]-]" 0
+C "aa" "[[:alnum:]]a" 0
+C "-" "[![:alnum:]]" 0
+C "]" "[!][:alnum:]]" NOMATCH
+C "[" "[![:alnum:][]" NOMATCH
+C "a" "[[:alnum:]]" 0
+C "b" "[[:alnum:]]" 0
+C "c" "[[:alnum:]]" 0
+C "d" "[[:alnum:]]" 0
+C "e" "[[:alnum:]]" 0
+C "f" "[[:alnum:]]" 0
+C "g" "[[:alnum:]]" 0
+C "h" "[[:alnum:]]" 0
+C "i" "[[:alnum:]]" 0
+C "j" "[[:alnum:]]" 0
+C "k" "[[:alnum:]]" 0
+C "l" "[[:alnum:]]" 0
+C "m" "[[:alnum:]]" 0
+C "n" "[[:alnum:]]" 0
+C "o" "[[:alnum:]]" 0
+C "p" "[[:alnum:]]" 0
+C "q" "[[:alnum:]]" 0
+C "r" "[[:alnum:]]" 0
+C "s" "[[:alnum:]]" 0
+C "t" "[[:alnum:]]" 0
+C "u" "[[:alnum:]]" 0
+C "v" "[[:alnum:]]" 0
+C "w" "[[:alnum:]]" 0
+C "x" "[[:alnum:]]" 0
+C "y" "[[:alnum:]]" 0
+C "z" "[[:alnum:]]" 0
+C "A" "[[:alnum:]]" 0
+C "B" "[[:alnum:]]" 0
+C "C" "[[:alnum:]]" 0
+C "D" "[[:alnum:]]" 0
+C "E" "[[:alnum:]]" 0
+C "F" "[[:alnum:]]" 0
+C "G" "[[:alnum:]]" 0
+C "H" "[[:alnum:]]" 0
+C "I" "[[:alnum:]]" 0
+C "J" "[[:alnum:]]" 0
+C "K" "[[:alnum:]]" 0
+C "L" "[[:alnum:]]" 0
+C "M" "[[:alnum:]]" 0
+C "N" "[[:alnum:]]" 0
+C "O" "[[:alnum:]]" 0
+C "P" "[[:alnum:]]" 0
+C "Q" "[[:alnum:]]" 0
+C "R" "[[:alnum:]]" 0
+C "S" "[[:alnum:]]" 0
+C "T" "[[:alnum:]]" 0
+C "U" "[[:alnum:]]" 0
+C "V" "[[:alnum:]]" 0
+C "W" "[[:alnum:]]" 0
+C "X" "[[:alnum:]]" 0
+C "Y" "[[:alnum:]]" 0
+C "Z" "[[:alnum:]]" 0
+C "0" "[[:alnum:]]" 0
+C "1" "[[:alnum:]]" 0
+C "2" "[[:alnum:]]" 0
+C "3" "[[:alnum:]]" 0
+C "4" "[[:alnum:]]" 0
+C "5" "[[:alnum:]]" 0
+C "6" "[[:alnum:]]" 0
+C "7" "[[:alnum:]]" 0
+C "8" "[[:alnum:]]" 0
+C "9" "[[:alnum:]]" 0
+C "!" "[[:alnum:]]" NOMATCH
+C "#" "[[:alnum:]]" NOMATCH
+C "%" "[[:alnum:]]" NOMATCH
+C "+" "[[:alnum:]]" NOMATCH
+C "," "[[:alnum:]]" NOMATCH
+C "-" "[[:alnum:]]" NOMATCH
+C "." "[[:alnum:]]" NOMATCH
+C "/" "[[:alnum:]]" NOMATCH
+C ":" "[[:alnum:]]" NOMATCH
+C ";" "[[:alnum:]]" NOMATCH
+C "=" "[[:alnum:]]" NOMATCH
+C "@" "[[:alnum:]]" NOMATCH
+C "[" "[[:alnum:]]" NOMATCH
+C "\\" "[[:alnum:]]" NOMATCH
+C "]" "[[:alnum:]]" NOMATCH
+C "^" "[[:alnum:]]" NOMATCH
+C "_" "[[:alnum:]]" NOMATCH
+C "{" "[[:alnum:]]" NOMATCH
+C "}" "[[:alnum:]]" NOMATCH
+C "~" "[[:alnum:]]" NOMATCH
+C "\"" "[[:alnum:]]" NOMATCH
+C "$" "[[:alnum:]]" NOMATCH
+C "&" "[[:alnum:]]" NOMATCH
+C "'" "[[:alnum:]]" NOMATCH
+C "(" "[[:alnum:]]" NOMATCH
+C ")" "[[:alnum:]]" NOMATCH
+C "*" "[[:alnum:]]" NOMATCH
+C "?" "[[:alnum:]]" NOMATCH
+C "`" "[[:alnum:]]" NOMATCH
+C "|" "[[:alnum:]]" NOMATCH
+C "<" "[[:alnum:]]" NOMATCH
+C ">" "[[:alnum:]]" NOMATCH
+C "\t" "[[:cntrl:]]" 0
+C "t" "[[:cntrl:]]" NOMATCH
+C "t" "[[:lower:]]" 0
+C "\t" "[[:lower:]]" NOMATCH
+C "T" "[[:lower:]]" NOMATCH
+C "\t" "[[:space:]]" 0
+C "t" "[[:space:]]" NOMATCH
+C "t" "[[:alpha:]]" 0
+C "\t" "[[:alpha:]]" NOMATCH
+C "0" "[[:digit:]]" 0
+C "\t" "[[:digit:]]" NOMATCH
+C "t" "[[:digit:]]" NOMATCH
+C "\t" "[[:print:]]" NOMATCH
+C "t" "[[:print:]]" 0
+C "T" "[[:upper:]]" 0
+C "\t" "[[:upper:]]" NOMATCH
+C "t" "[[:upper:]]" NOMATCH
+C "\t" "[[:blank:]]" 0
+C "t" "[[:blank:]]" NOMATCH
+C "\t" "[[:graph:]]" NOMATCH
+C "t" "[[:graph:]]" 0
+C "." "[[:punct:]]" 0
+C "t" "[[:punct:]]" NOMATCH
+C "\t" "[[:punct:]]" NOMATCH
+C "0" "[[:xdigit:]]" 0
+C "\t" "[[:xdigit:]]" NOMATCH
+C "a" "[[:xdigit:]]" 0
+C "A" "[[:xdigit:]]" 0
+C "t" "[[:xdigit:]]" NOMATCH
+C "a" "[[alpha]]" NOMATCH
+C "a" "[[alpha:]]" NOMATCH
+C "a]" "[[alpha]]" 0
+C "a]" "[[alpha:]]" 0
+C "a" "[[:alpha:][.b.]]" 0
+C "a" "[[:alpha:][=b=]]" 0
+C "a" "[[:alpha:][:digit:]]" 0
+C "a" "[[:digit:][:alpha:]]" 0
+
+# B.6 018(C)
+C "a" "[a-c]" 0
+C "b" "[a-c]" 0
+C "c" "[a-c]" 0
+C "a" "[b-c]" NOMATCH
+C "d" "[b-c]" NOMATCH
+C "B" "[a-c]" NOMATCH
+C "b" "[A-C]" NOMATCH
+C "" "[a-c]" NOMATCH
+C "as" "[a-ca-z]" NOMATCH
+C "a" "[[.a.]-c]" 0
+C "a" "[a-[.c.]]" 0
+C "a" "[[.a.]-[.c.]]" 0
+C "b" "[[.a.]-c]" 0
+C "b" "[a-[.c.]]" 0
+C "b" "[[.a.]-[.c.]]" 0
+C "c" "[[.a.]-c]" 0
+C "c" "[a-[.c.]]" 0
+C "c" "[[.a.]-[.c.]]" 0
+C "d" "[[.a.]-c]" NOMATCH
+C "d" "[a-[.c.]]" NOMATCH
+C "d" "[[.a.]-[.c.]]" NOMATCH
+
+# B.6 019(C)
+C "a" "[c-a]" NOMATCH
+C "a" "[[.c.]-a]" NOMATCH
+C "a" "[c-[.a.]]" NOMATCH
+C "a" "[[.c.]-[.a.]]" NOMATCH
+C "c" "[c-a]" NOMATCH
+C "c" "[[.c.]-a]" NOMATCH
+C "c" "[c-[.a.]]" NOMATCH
+C "c" "[[.c.]-[.a.]]" NOMATCH
+
+# B.6 020(C)
+C "a" "[a-c0-9]" 0
+C "d" "[a-c0-9]" NOMATCH
+C "B" "[a-c0-9]" NOMATCH
+
+# B.6 021(C)
+C "-" "[-a]" 0
+C "a" "[-b]" NOMATCH
+C "-" "[!-a]" NOMATCH
+C "a" "[!-b]" 0
+C "-" "[a-c-0-9]" 0
+C "b" "[a-c-0-9]" 0
+C "a:" "a[0-9-a]" NOMATCH
+C "a:" "a[09-a]" 0
+
+# B.6 024(C)
+C "" "*" 0
+C "asd/sdf" "*" 0
+
+# B.6 025(C)
+C "as" "[a-c][a-z]" 0
+C "as" "??" 0
+
+# B.6 026(C)
+C "asd/sdf" "as*df" 0
+C "asd/sdf" "as*" 0
+C "asd/sdf" "*df" 0
+C "asd/sdf" "as*dg" NOMATCH
+C "asdf" "as*df" 0
+C "asdf" "as*df?" NOMATCH
+C "asdf" "as*??" 0
+C "asdf" "a*???" 0
+C "asdf" "*????" 0
+C "asdf" "????*" 0
+C "asdf" "??*?" 0
+
+# B.6 027(C)
+C "/" "/" 0
+C "/" "/*" 0
+C "/" "*/" 0
+C "/" "/?" NOMATCH
+C "/" "?/" NOMATCH
+C "/" "?" 0
+C "." "?" 0
+C "/." "??" 0
+C "/" "[!a-c]" 0
+C "." "[!a-c]" 0
+
+# B.6 029(C)
+C "/" "/" 0 PATHNAME
+C "//" "//" 0 PATHNAME
+C "/.a" "/*" 0 PATHNAME
+C "/.a" "/?a" 0 PATHNAME
+C "/.a" "/[!a-z]a" 0 PATHNAME
+C "/.a/.b" "/*/?b" 0 PATHNAME
+
+# B.6 030(C)
+C "/" "?" NOMATCH PATHNAME
+C "/" "*" NOMATCH PATHNAME
+C "a/b" "a?b" NOMATCH PATHNAME
+C "/.a/.b" "/*b" NOMATCH PATHNAME
+
+# B.6 031(C)
+C "/$" "\\/\\$" 0
+C "/[" "\\/\\[" 0
+C "/[" "\\/[" NOMATCH
+
+# B.6 032(C)
+C "/$" "\\/\\$" NOMATCH NOESCAPE
+C "/\\$" "\\/\\$" NOMATCH NOESCAPE
+C "\\/\\$" "\\/\\$" 0 NOESCAPE
+
+# B.6 033(C)
+C ".asd" ".*" 0 PERIOD
+C "/.asd" "*" 0 PERIOD
+C "/as/.df" "*/?*f" 0 PERIOD
+C "..asd" ".[!a-z]*" 0 PERIOD
+
+# B.6 034(C)
+C ".asd" "*" NOMATCH PERIOD
+C ".asd" "?asd" NOMATCH PERIOD
+C ".asd" "[!a-z]*" NOMATCH PERIOD
+
+# B.6 035(C)
+C "/." "/." 0 PATHNAME|PERIOD
+C "/.a./.b." "/.*/.*" 0 PATHNAME|PERIOD
+C "/.a./.b." "/.??/.??" 0 PATHNAME|PERIOD
+
+# B.6 036(C)
+C "/." "*" NOMATCH PATHNAME|PERIOD
+C "/." "/*" NOMATCH PATHNAME|PERIOD
+C "/." "/?" NOMATCH PATHNAME|PERIOD
+C "/." "/[!a-z]" NOMATCH PATHNAME|PERIOD
+C "/a./.b." "/*/*" NOMATCH PATHNAME|PERIOD
+C "/a./.b." "/??/???" NOMATCH PATHNAME|PERIOD
+
+# Some home-grown tests.
+C "foobar" "foo*[abc]z" NOMATCH
+C "foobaz" "foo*[abc][xyz]" 0
+C "foobaz" "foo?*[abc][xyz]" 0
+C "foobaz" "foo?*[abc][x/yz]" 0
+C "foobaz" "foo?*[abc]/[xyz]" NOMATCH PATHNAME
+C "a" "a/" NOMATCH PATHNAME
+C "a/" "a" NOMATCH PATHNAME
+C "//a" "/a" NOMATCH PATHNAME
+C "/a" "//a" NOMATCH PATHNAME
+C "az" "[a-]z" 0
+C "bz" "[ab-]z" 0
+C "cz" "[ab-]z" NOMATCH
+C "-z" "[ab-]z" 0
+C "az" "[-a]z" 0
+C "bz" "[-ab]z" 0
+C "cz" "[-ab]z" NOMATCH
+C "-z" "[-ab]z" 0
+C "\\" "[\\\\-a]" 0
+C "_" "[\\\\-a]" 0
+C "a" "[\\\\-a]" 0
+C "-" "[\\\\-a]" NOMATCH
+C "\\" "[\\]-a]" NOMATCH
+C "_" "[\\]-a]" 0
+C "a" "[\\]-a]" 0
+C "]" "[\\]-a]" 0
+C "-" "[\\]-a]" NOMATCH
+C "\\" "[!\\\\-a]" NOMATCH
+C "_" "[!\\\\-a]" NOMATCH
+C "a" "[!\\\\-a]" NOMATCH
+C "-" "[!\\\\-a]" 0
+C "!" "[\\!-]" 0
+C "-" "[\\!-]" 0
+C "\\" "[\\!-]" NOMATCH
+C "Z" "[Z-\\\\]" 0
+C "[" "[Z-\\\\]" 0
+C "\\" "[Z-\\\\]" 0
+C "-" "[Z-\\\\]" NOMATCH
+C "Z" "[Z-\\]]" 0
+C "[" "[Z-\\]]" 0
+C "\\" "[Z-\\]]" 0
+C "]" "[Z-\\]]" 0
+C "-" "[Z-\\]]" NOMATCH
+
+# Following are tests outside the scope of IEEE 2003.2 since they are using
+# locales other than the C locale. The main focus of the tests is on the
+# handling of ranges and the recognition of character (vs bytes).
+de_DE.ISO-8859-1 "a" "[a-z]" 0
+de_DE.ISO-8859-1 "z" "[a-z]" 0
+de_DE.ISO-8859-1 "ä" "[a-z]" 0
+de_DE.ISO-8859-1 "ö" "[a-z]" 0
+de_DE.ISO-8859-1 "ü" "[a-z]" 0
+de_DE.ISO-8859-1 "A" "[a-z]" NOMATCH
+de_DE.ISO-8859-1 "Z" "[a-z]" NOMATCH
+de_DE.ISO-8859-1 "Ä" "[a-z]" NOMATCH
+de_DE.ISO-8859-1 "Ö" "[a-z]" NOMATCH
+de_DE.ISO-8859-1 "Ü" "[a-z]" NOMATCH
+de_DE.ISO-8859-1 "a" "[A-Z]" NOMATCH
+de_DE.ISO-8859-1 "z" "[A-Z]" NOMATCH
+de_DE.ISO-8859-1 "ä" "[A-Z]" NOMATCH
+de_DE.ISO-8859-1 "ö" "[A-Z]" NOMATCH
+de_DE.ISO-8859-1 "ü" "[A-Z]" NOMATCH
+de_DE.ISO-8859-1 "A" "[A-Z]" 0
+de_DE.ISO-8859-1 "Z" "[A-Z]" 0
+de_DE.ISO-8859-1 "Ä" "[A-Z]" 0
+de_DE.ISO-8859-1 "Ö" "[A-Z]" 0
+de_DE.ISO-8859-1 "Ü" "[A-Z]" 0
+de_DE.ISO-8859-1 "a" "[[:lower:]]" 0
+de_DE.ISO-8859-1 "z" "[[:lower:]]" 0
+de_DE.ISO-8859-1 "ä" "[[:lower:]]" 0
+de_DE.ISO-8859-1 "ö" "[[:lower:]]" 0
+de_DE.ISO-8859-1 "ü" "[[:lower:]]" 0
+de_DE.ISO-8859-1 "A" "[[:lower:]]" NOMATCH
+de_DE.ISO-8859-1 "Z" "[[:lower:]]" NOMATCH
+de_DE.ISO-8859-1 "Ä" "[[:lower:]]" NOMATCH
+de_DE.ISO-8859-1 "Ö" "[[:lower:]]" NOMATCH
+de_DE.ISO-8859-1 "Ü" "[[:lower:]]" NOMATCH
+de_DE.ISO-8859-1 "a" "[[:upper:]]" NOMATCH
+de_DE.ISO-8859-1 "z" "[[:upper:]]" NOMATCH
+de_DE.ISO-8859-1 "ä" "[[:upper:]]" NOMATCH
+de_DE.ISO-8859-1 "ö" "[[:upper:]]" NOMATCH
+de_DE.ISO-8859-1 "ü" "[[:upper:]]" NOMATCH
+de_DE.ISO-8859-1 "A" "[[:upper:]]" 0
+de_DE.ISO-8859-1 "Z" "[[:upper:]]" 0
+de_DE.ISO-8859-1 "Ä" "[[:upper:]]" 0
+de_DE.ISO-8859-1 "Ö" "[[:upper:]]" 0
+de_DE.ISO-8859-1 "Ü" "[[:upper:]]" 0
+de_DE.ISO-8859-1 "a" "[[:alpha:]]" 0
+de_DE.ISO-8859-1 "z" "[[:alpha:]]" 0
+de_DE.ISO-8859-1 "ä" "[[:alpha:]]" 0
+de_DE.ISO-8859-1 "ö" "[[:alpha:]]" 0
+de_DE.ISO-8859-1 "ü" "[[:alpha:]]" 0
+de_DE.ISO-8859-1 "A" "[[:alpha:]]" 0
+de_DE.ISO-8859-1 "Z" "[[:alpha:]]" 0
+de_DE.ISO-8859-1 "Ä" "[[:alpha:]]" 0
+de_DE.ISO-8859-1 "Ö" "[[:alpha:]]" 0
+de_DE.ISO-8859-1 "Ü" "[[:alpha:]]" 0
+
+de_DE.ISO-8859-1 "a" "[[=a=]b]" 0
+de_DE.ISO-8859-1 "â" "[[=a=]b]" 0
+de_DE.ISO-8859-1 "à" "[[=a=]b]" 0
+de_DE.ISO-8859-1 "á" "[[=a=]b]" 0
+de_DE.ISO-8859-1 "ä" "[[=a=]b]" 0
+de_DE.ISO-8859-1 "b" "[[=a=]b]" 0
+de_DE.ISO-8859-1 "c" "[[=a=]b]" NOMATCH
+de_DE.ISO-8859-1 "a" "[[=â=]b]" 0
+de_DE.ISO-8859-1 "â" "[[=â=]b]" 0
+de_DE.ISO-8859-1 "à" "[[=â=]b]" 0
+de_DE.ISO-8859-1 "á" "[[=â=]b]" 0
+de_DE.ISO-8859-1 "ä" "[[=â=]b]" 0
+de_DE.ISO-8859-1 "b" "[[=â=]b]" 0
+de_DE.ISO-8859-1 "c" "[[=â=]b]" NOMATCH
+de_DE.ISO-8859-1 "a" "[[=à=]b]" 0
+de_DE.ISO-8859-1 "â" "[[=à=]b]" 0
+de_DE.ISO-8859-1 "à" "[[=à=]b]" 0
+de_DE.ISO-8859-1 "á" "[[=à=]b]" 0
+de_DE.ISO-8859-1 "ä" "[[=à=]b]" 0
+de_DE.ISO-8859-1 "b" "[[=à=]b]" 0
+de_DE.ISO-8859-1 "c" "[[=à=]b]" NOMATCH
+de_DE.ISO-8859-1 "a" "[[=á=]b]" 0
+de_DE.ISO-8859-1 "â" "[[=á=]b]" 0
+de_DE.ISO-8859-1 "à" "[[=á=]b]" 0
+de_DE.ISO-8859-1 "á" "[[=á=]b]" 0
+de_DE.ISO-8859-1 "ä" "[[=á=]b]" 0
+de_DE.ISO-8859-1 "b" "[[=á=]b]" 0
+de_DE.ISO-8859-1 "c" "[[=á=]b]" NOMATCH
+de_DE.ISO-8859-1 "a" "[[=ä=]b]" 0
+de_DE.ISO-8859-1 "â" "[[=ä=]b]" 0
+de_DE.ISO-8859-1 "à" "[[=ä=]b]" 0
+de_DE.ISO-8859-1 "á" "[[=ä=]b]" 0
+de_DE.ISO-8859-1 "ä" "[[=ä=]b]" 0
+de_DE.ISO-8859-1 "b" "[[=ä=]b]" 0
+de_DE.ISO-8859-1 "c" "[[=ä=]b]" NOMATCH
+
+de_DE.ISO-8859-1 "aa" "[[.a.]]a" 0
+de_DE.ISO-8859-1 "ba" "[[.a.]]a" NOMATCH
+
+
+# And with a multibyte character set.
+de_DE.UTF-8 "a" "[a-z]" 0
+de_DE.UTF-8 "z" "[a-z]" 0
+de_DE.UTF-8 "ä" "[a-z]" 0
+de_DE.UTF-8 "ö" "[a-z]" 0
+de_DE.UTF-8 "ü" "[a-z]" 0
+de_DE.UTF-8 "A" "[a-z]" NOMATCH
+de_DE.UTF-8 "Z" "[a-z]" NOMATCH
+de_DE.UTF-8 "Ä" "[a-z]" NOMATCH
+de_DE.UTF-8 "Ö" "[a-z]" NOMATCH
+de_DE.UTF-8 "Ü" "[a-z]" NOMATCH
+de_DE.UTF-8 "a" "[A-Z]" NOMATCH
+de_DE.UTF-8 "z" "[A-Z]" NOMATCH
+de_DE.UTF-8 "ä" "[A-Z]" NOMATCH
+de_DE.UTF-8 "ö" "[A-Z]" NOMATCH
+de_DE.UTF-8 "ü" "[A-Z]" NOMATCH
+de_DE.UTF-8 "A" "[A-Z]" 0
+de_DE.UTF-8 "Z" "[A-Z]" 0
+de_DE.UTF-8 "Ä" "[A-Z]" 0
+de_DE.UTF-8 "Ö" "[A-Z]" 0
+de_DE.UTF-8 "Ü" "[A-Z]" 0
+de_DE.UTF-8 "a" "[[:lower:]]" 0
+de_DE.UTF-8 "z" "[[:lower:]]" 0
+de_DE.UTF-8 "ä" "[[:lower:]]" 0
+de_DE.UTF-8 "ö" "[[:lower:]]" 0
+de_DE.UTF-8 "ü" "[[:lower:]]" 0
+de_DE.UTF-8 "A" "[[:lower:]]" NOMATCH
+de_DE.UTF-8 "Z" "[[:lower:]]" NOMATCH
+de_DE.UTF-8 "Ä" "[[:lower:]]" NOMATCH
+de_DE.UTF-8 "Ö" "[[:lower:]]" NOMATCH
+de_DE.UTF-8 "Ü" "[[:lower:]]" NOMATCH
+de_DE.UTF-8 "a" "[[:upper:]]" NOMATCH
+de_DE.UTF-8 "z" "[[:upper:]]" NOMATCH
+de_DE.UTF-8 "ä" "[[:upper:]]" NOMATCH
+de_DE.UTF-8 "ö" "[[:upper:]]" NOMATCH
+de_DE.UTF-8 "ü" "[[:upper:]]" NOMATCH
+de_DE.UTF-8 "A" "[[:upper:]]" 0
+de_DE.UTF-8 "Z" "[[:upper:]]" 0
+de_DE.UTF-8 "Ä" "[[:upper:]]" 0
+de_DE.UTF-8 "Ö" "[[:upper:]]" 0
+de_DE.UTF-8 "Ü" "[[:upper:]]" 0
+de_DE.UTF-8 "a" "[[:alpha:]]" 0
+de_DE.UTF-8 "z" "[[:alpha:]]" 0
+de_DE.UTF-8 "ä" "[[:alpha:]]" 0
+de_DE.UTF-8 "ö" "[[:alpha:]]" 0
+de_DE.UTF-8 "ü" "[[:alpha:]]" 0
+de_DE.UTF-8 "A" "[[:alpha:]]" 0
+de_DE.UTF-8 "Z" "[[:alpha:]]" 0
+de_DE.UTF-8 "Ä" "[[:alpha:]]" 0
+de_DE.UTF-8 "Ö" "[[:alpha:]]" 0
+de_DE.UTF-8 "Ü" "[[:alpha:]]" 0
+
+de_DE.UTF-8 "a" "[[=a=]b]" 0
+de_DE.UTF-8 "â" "[[=a=]b]" 0
+de_DE.UTF-8 "à" "[[=a=]b]" 0
+de_DE.UTF-8 "á" "[[=a=]b]" 0
+de_DE.UTF-8 "ä" "[[=a=]b]" 0
+de_DE.UTF-8 "b" "[[=a=]b]" 0
+de_DE.UTF-8 "c" "[[=a=]b]" NOMATCH
+de_DE.UTF-8 "a" "[[=â=]b]" 0
+de_DE.UTF-8 "â" "[[=â=]b]" 0
+de_DE.UTF-8 "à" "[[=â=]b]" 0
+de_DE.UTF-8 "á" "[[=â=]b]" 0
+de_DE.UTF-8 "ä" "[[=â=]b]" 0
+de_DE.UTF-8 "b" "[[=â=]b]" 0
+de_DE.UTF-8 "c" "[[=â=]b]" NOMATCH
+de_DE.UTF-8 "a" "[[=à=]b]" 0
+de_DE.UTF-8 "â" "[[=à=]b]" 0
+de_DE.UTF-8 "à" "[[=à=]b]" 0
+de_DE.UTF-8 "á" "[[=à=]b]" 0
+de_DE.UTF-8 "ä" "[[=à=]b]" 0
+de_DE.UTF-8 "b" "[[=à=]b]" 0
+de_DE.UTF-8 "c" "[[=à=]b]" NOMATCH
+de_DE.UTF-8 "a" "[[=á=]b]" 0
+de_DE.UTF-8 "â" "[[=á=]b]" 0
+de_DE.UTF-8 "à" "[[=á=]b]" 0
+de_DE.UTF-8 "á" "[[=á=]b]" 0
+de_DE.UTF-8 "ä" "[[=á=]b]" 0
+de_DE.UTF-8 "b" "[[=á=]b]" 0
+de_DE.UTF-8 "c" "[[=á=]b]" NOMATCH
+de_DE.UTF-8 "a" "[[=ä=]b]" 0
+de_DE.UTF-8 "â" "[[=ä=]b]" 0
+de_DE.UTF-8 "à" "[[=ä=]b]" 0
+de_DE.UTF-8 "á" "[[=ä=]b]" 0
+de_DE.UTF-8 "ä" "[[=ä=]b]" 0
+de_DE.UTF-8 "b" "[[=ä=]b]" 0
+de_DE.UTF-8 "c" "[[=ä=]b]" NOMATCH
+
+de_DE.UTF-8 "aa" "[[.a.]]a" 0
+de_DE.UTF-8 "ba" "[[.a.]]a" NOMATCH
+
+
+# Test of GNU extensions.
+C "x" "x" 0 PATHNAME|LEADING_DIR
+C "x/y" "x" 0 PATHNAME|LEADING_DIR
+C "x/y/z" "x" 0 PATHNAME|LEADING_DIR
+C "x" "*" 0 PATHNAME|LEADING_DIR
+C "x/y" "*" 0 PATHNAME|LEADING_DIR
+C "x/y/z" "*" 0 PATHNAME|LEADING_DIR
+C "x" "*x" 0 PATHNAME|LEADING_DIR
+C "x/y" "*x" 0 PATHNAME|LEADING_DIR
+C "x/y/z" "*x" 0 PATHNAME|LEADING_DIR
+C "x" "x*" 0 PATHNAME|LEADING_DIR
+C "x/y" "x*" 0 PATHNAME|LEADING_DIR
+C "x/y/z" "x*" 0 PATHNAME|LEADING_DIR
+C "x" "a" NOMATCH PATHNAME|LEADING_DIR
+C "x/y" "a" NOMATCH PATHNAME|LEADING_DIR
+C "x/y/z" "a" NOMATCH PATHNAME|LEADING_DIR
+C "x" "x/y" NOMATCH PATHNAME|LEADING_DIR
+C "x/y" "x/y" 0 PATHNAME|LEADING_DIR
+C "x/y/z" "x/y" 0 PATHNAME|LEADING_DIR
+C "x" "x?y" NOMATCH PATHNAME|LEADING_DIR
+C "x/y" "x?y" NOMATCH PATHNAME|LEADING_DIR
+C "x/y/z" "x?y" NOMATCH PATHNAME|LEADING_DIR
+
+# ksh style matching.
+C "abcd" "?@(a|b)*@(c)d" 0 EXTMATCH
+C "/dev/udp/129.22.8.102/45" "/dev/@(tcp|udp)/*/*" 0 PATHNAME|EXTMATCH
+C "12" "[1-9]*([0-9])" 0 EXTMATCH
+C "12abc" "[1-9]*([0-9])" NOMATCH EXTMATCH
+C "1" "[1-9]*([0-9])" 0 EXTMATCH
+C "07" "+([0-7])" 0 EXTMATCH
+C "0377" "+([0-7])" 0 EXTMATCH
+C "09" "+([0-7])" NOMATCH EXTMATCH
+C "paragraph" "para@(chute|graph)" 0 EXTMATCH
+C "paramour" "para@(chute|graph)" NOMATCH EXTMATCH
+C "para991" "para?([345]|99)1" 0 EXTMATCH
+C "para381" "para?([345]|99)1" NOMATCH EXTMATCH
+C "paragraph" "para*([0-9])" NOMATCH EXTMATCH
+C "para" "para*([0-9])" 0 EXTMATCH
+C "para13829383746592" "para*([0-9])" 0 EXTMATCH
+C "paragraph" "para+([0-9])" NOMATCH EXTMATCH
+C "para" "para+([0-9])" NOMATCH EXTMATCH
+C "para987346523" "para+([0-9])" 0 EXTMATCH
+C "paragraph" "para!(*.[0-9])" 0 EXTMATCH
+C "para.38" "para!(*.[0-9])" 0 EXTMATCH
+C "para.graph" "para!(*.[0-9])" 0 EXTMATCH
+C "para39" "para!(*.[0-9])" 0 EXTMATCH
+C "" "*(0|1|3|5|7|9)" 0 EXTMATCH
+C "137577991" "*(0|1|3|5|7|9)" 0 EXTMATCH
+C "2468" "*(0|1|3|5|7|9)" NOMATCH EXTMATCH
+C "1358" "*(0|1|3|5|7|9)" NOMATCH EXTMATCH
+C "file.c" "*.c?(c)" 0 EXTMATCH
+C "file.C" "*.c?(c)" NOMATCH EXTMATCH
+C "file.cc" "*.c?(c)" 0 EXTMATCH
+C "file.ccc" "*.c?(c)" NOMATCH EXTMATCH
+C "parse.y" "!(*.c|*.h|Makefile.in|config*|README)" 0 EXTMATCH
+C "shell.c" "!(*.c|*.h|Makefile.in|config*|README)" NOMATCH EXTMATCH
+C "Makefile" "!(*.c|*.h|Makefile.in|config*|README)" 0 EXTMATCH
+C "VMS.FILE;1" "*\;[1-9]*([0-9])" 0 EXTMATCH
+C "VMS.FILE;0" "*\;[1-9]*([0-9])" NOMATCH EXTMATCH
+C "VMS.FILE;" "*\;[1-9]*([0-9])" NOMATCH EXTMATCH
+C "VMS.FILE;139" "*\;[1-9]*([0-9])" 0 EXTMATCH
+C "VMS.FILE;1N" "*\;[1-9]*([0-9])" NOMATCH EXTMATCH
+C "abcfefg" "ab**(e|f)" 0 EXTMATCH
+C "abcfefg" "ab**(e|f)g" 0 EXTMATCH
+C "ab" "ab*+(e|f)" NOMATCH EXTMATCH
+C "abef" "ab***ef" 0 EXTMATCH
+C "abef" "ab**" 0 EXTMATCH
+C "fofo" "*(f*(o))" 0 EXTMATCH
+C "ffo" "*(f*(o))" 0 EXTMATCH
+C "foooofo" "*(f*(o))" 0 EXTMATCH
+C "foooofof" "*(f*(o))" 0 EXTMATCH
+C "fooofoofofooo" "*(f*(o))" 0 EXTMATCH
+C "foooofof" "*(f+(o))" NOMATCH EXTMATCH
+C "xfoooofof" "*(f*(o))" NOMATCH EXTMATCH
+C "foooofofx" "*(f*(o))" NOMATCH EXTMATCH
+C "ofxoofxo" "*(*(of*(o)x)o)" 0 EXTMATCH
+C "ofooofoofofooo" "*(f*(o))" NOMATCH EXTMATCH
+C "foooxfooxfoxfooox" "*(f*(o)x)" 0 EXTMATCH
+C "foooxfooxofoxfooox" "*(f*(o)x)" NOMATCH EXTMATCH
+C "foooxfooxfxfooox" "*(f*(o)x)" 0 EXTMATCH
+C "ofxoofxo" "*(*(of*(o)x)o)" 0 EXTMATCH
+C "ofoooxoofxo" "*(*(of*(o)x)o)" 0 EXTMATCH
+C "ofoooxoofxoofoooxoofxo" "*(*(of*(o)x)o)" 0 EXTMATCH
+C "ofoooxoofxoofoooxoofxoo" "*(*(of*(o)x)o)" 0 EXTMATCH
+C "ofoooxoofxoofoooxoofxofo" "*(*(of*(o)x)o)" NOMATCH EXTMATCH
+C "ofoooxoofxoofoooxoofxooofxofxo" "*(*(of*(o)x)o)" 0 EXTMATCH
+C "aac" "*(@(a))a@(c)" 0 EXTMATCH
+C "ac" "*(@(a))a@(c)" 0 EXTMATCH
+C "c" "*(@(a))a@(c)" NOMATCH EXTMATCH
+C "aaac" "*(@(a))a@(c)" 0 EXTMATCH
+C "baaac" "*(@(a))a@(c)" NOMATCH EXTMATCH
+C "abcd" "?@(a|b)*@(c)d" 0 EXTMATCH
+C "abcd" "@(ab|a*@(b))*(c)d" 0 EXTMATCH
+C "acd" "@(ab|a*(b))*(c)d" 0 EXTMATCH
+C "abbcd" "@(ab|a*(b))*(c)d" 0 EXTMATCH
+C "effgz" "@(b+(c)d|e*(f)g?|?(h)i@(j|k))" 0 EXTMATCH
+C "efgz" "@(b+(c)d|e*(f)g?|?(h)i@(j|k))" 0 EXTMATCH
+C "egz" "@(b+(c)d|e*(f)g?|?(h)i@(j|k))" 0 EXTMATCH
+C "egzefffgzbcdij" "*(b+(c)d|e*(f)g?|?(h)i@(j|k))" 0 EXTMATCH
+C "egz" "@(b+(c)d|e+(f)g?|?(h)i@(j|k))" NOMATCH EXTMATCH
+C "ofoofo" "*(of+(o))" 0 EXTMATCH
+C "oxfoxoxfox" "*(oxf+(ox))" 0 EXTMATCH
+C "oxfoxfox" "*(oxf+(ox))" NOMATCH EXTMATCH
+C "ofoofo" "*(of+(o)|f)" 0 EXTMATCH
+C "foofoofo" "@(foo|f|fo)*(f|of+(o))" 0 EXTMATCH
+C "oofooofo" "*(of|oof+(o))" 0 EXTMATCH
+C "fffooofoooooffoofffooofff" "*(*(f)*(o))" 0 EXTMATCH
+C "fofoofoofofoo" "*(fo|foo)" 0 EXTMATCH
+C "foo" "!(x)" 0 EXTMATCH
+C "foo" "!(x)*" 0 EXTMATCH
+C "foo" "!(foo)" NOMATCH EXTMATCH
+C "foo" "!(foo)*" 0 EXTMATCH
+C "foobar" "!(foo)" 0 EXTMATCH
+C "foobar" "!(foo)*" 0 EXTMATCH
+C "moo.cow" "!(*.*).!(*.*)" 0 EXTMATCH
+C "mad.moo.cow" "!(*.*).!(*.*)" NOMATCH EXTMATCH
+C "mucca.pazza" "mu!(*(c))?.pa!(*(z))?" NOMATCH EXTMATCH
+C "fff" "!(f)" 0 EXTMATCH
+C "fff" "*(!(f))" 0 EXTMATCH
+C "fff" "+(!(f))" 0 EXTMATCH
+C "ooo" "!(f)" 0 EXTMATCH
+C "ooo" "*(!(f))" 0 EXTMATCH
+C "ooo" "+(!(f))" 0 EXTMATCH
+C "foo" "!(f)" 0 EXTMATCH
+C "foo" "*(!(f))" 0 EXTMATCH
+C "foo" "+(!(f))" 0 EXTMATCH
+C "f" "!(f)" NOMATCH EXTMATCH
+C "f" "*(!(f))" NOMATCH EXTMATCH
+C "f" "+(!(f))" NOMATCH EXTMATCH
+C "foot" "@(!(z*)|*x)" 0 EXTMATCH
+C "zoot" "@(!(z*)|*x)" NOMATCH EXTMATCH
+C "foox" "@(!(z*)|*x)" 0 EXTMATCH
+C "zoox" "@(!(z*)|*x)" 0 EXTMATCH
+C "foo" "*(!(foo)) 0 EXTMATCH
+C "foob" "!(foo)b*" NOMATCH EXTMATCH
+C "foobb" "!(foo)b*" 0 EXTMATCH
+C "[" "*([a[])" 0 EXTMATCH
+C "]" "*([]a[])" 0 EXTMATCH
+C "a" "*([]a[])" 0 EXTMATCH
+C "b" "*([!]a[])" 0 EXTMATCH
+C "[" "*([!]a[]|[[])" 0 EXTMATCH
+C "]" "*([!]a[]|[]])" 0 EXTMATCH
+C "[" "!([!]a[])" 0 EXTMATCH
+C "]" "!([!]a[])" 0 EXTMATCH
+C ")" "*([)])" 0 EXTMATCH
+C "*" "*([*(])" 0 EXTMATCH
+C "abcd" "*!(|a)cd" 0 EXTMATCH
+C "ab/.a" "+([abc])/*" NOMATCH EXTMATCH|PATHNAME|PERIOD
+C "" "" 0
+C "" "" 0 EXTMATCH
+C "" "*([abc])" 0 EXTMATCH
+C "" "?([abc])" 0 EXTMATCH
diff --git a/test/misc/tst-gnuglob.c b/test/misc/tst-gnuglob.c
new file mode 100644
index 000000000..04c6743e9
--- /dev/null
+++ b/test/misc/tst-gnuglob.c
@@ -0,0 +1,447 @@
+/* Test the GNU extensions in glob which allow the user to provide callbacks
+ for the filesystem access functions.
+ Copyright (C) 2001-2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <dirent.h>
+#include <errno.h>
+#include <error.h>
+#include <glob.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+
+// #define DEBUG
+#ifdef DEBUG
+# define PRINTF(fmt, args...) printf (fmt, ##args)
+#else
+# define PRINTF(fmt, args...)
+#endif
+
+
+#ifdef GLOB_ALTDIRFUNC
+static struct
+{
+ const char *name;
+ int level;
+ int type;
+} filesystem[] =
+{
+ { ".", 1, DT_DIR },
+ { "..", 1, DT_DIR },
+ { "file1lev1", 1, DT_REG },
+ { "file2lev1", 1, DT_UNKNOWN },
+ { "dir1lev1", 1, DT_UNKNOWN },
+ { ".", 2, DT_DIR },
+ { "..", 2, DT_DIR },
+ { "file1lev2", 2, DT_REG },
+ { "dir1lev2", 2, DT_DIR },
+ { ".", 3, DT_DIR },
+ { "..", 3, DT_DIR },
+ { "dir2lev2", 2, DT_DIR },
+ { ".", 3, DT_DIR },
+ { "..", 3, DT_DIR },
+ { ".foo", 3, DT_REG },
+ { "dir1lev3", 3, DT_DIR },
+ { ".", 4, DT_DIR },
+ { "..", 4, DT_DIR },
+ { "file1lev4", 4, DT_REG },
+ { "file1lev3", 3, DT_REG },
+ { "file2lev3", 3, DT_REG },
+ { "file2lev2", 2, DT_REG },
+ { "file3lev2", 2, DT_REG },
+ { "dir3lev2", 2, DT_DIR },
+ { ".", 3, DT_DIR },
+ { "..", 3, DT_DIR },
+ { "file3lev3", 3, DT_REG },
+ { "file4lev3", 3, DT_REG },
+ { "dir2lev1", 1, DT_DIR },
+ { ".", 2, DT_DIR },
+ { "..", 2, DT_DIR },
+ { "dir1lev2", 2, DT_UNKNOWN },
+ { ".", 3, DT_DIR },
+ { "..", 3, DT_DIR },
+ { ".foo", 3, DT_REG },
+ { ".dir", 3, DT_DIR },
+ { ".", 4, DT_DIR },
+ { "..", 4, DT_DIR },
+ { "hidden", 4, DT_REG }
+};
+#define nfiles (sizeof (filesystem) / sizeof (filesystem[0]))
+
+
+typedef struct
+{
+ int level;
+ int idx;
+ struct dirent d;
+ char room_for_dirent[NAME_MAX];
+} my_DIR;
+
+
+static long int
+find_file (const char *s)
+{
+ int level = 1;
+ long int idx = 0;
+
+ if (strcmp (s, ".") == 0)
+ return 0;
+
+ if (s[0] == '.' && s[1] == '/')
+ s += 2;
+
+ while (*s != '\0')
+ {
+ char *endp = strchrnul (s, '/');
+
+ PRINTF ("looking for %.*s, level %d\n", (int) (endp - s), s, level);
+
+ while (idx < nfiles && filesystem[idx].level >= level)
+ {
+ if (filesystem[idx].level == level
+ && memcmp (s, filesystem[idx].name, endp - s) == 0
+ && filesystem[idx].name[endp - s] == '\0')
+ break;
+ ++idx;
+ }
+
+ if (idx == nfiles || filesystem[idx].level < level)
+ {
+ errno = ENOENT;
+ return -1;
+ }
+
+ if (*endp == '\0')
+ return idx + 1;
+
+ if (filesystem[idx].type != DT_DIR
+ && (idx + 1 >= nfiles
+ || filesystem[idx].level >= filesystem[idx + 1].level))
+ {
+ errno = ENOTDIR;
+ return -1;
+ }
+
+ ++idx;
+
+ s = endp + 1;
+ ++level;
+ }
+
+ errno = ENOENT;
+ return -1;
+}
+
+
+static void *
+my_opendir (const char *s)
+{
+ long int idx = find_file (s);
+ my_DIR *dir;
+
+
+ if (idx == -1)
+ {
+ PRINTF ("my_opendir(\"%s\") == NULL\n", s);
+ return NULL;
+ }
+
+ dir = (my_DIR *) malloc (sizeof (my_DIR));
+ if (dir == NULL)
+ error (EXIT_FAILURE, errno, "cannot allocate directory handle");
+
+ dir->level = filesystem[idx].level;
+ dir->idx = idx;
+
+ PRINTF ("my_opendir(\"%s\") == { level: %d, idx: %ld }\n",
+ s, filesystem[idx].level, idx);
+
+ return dir;
+}
+
+
+static struct dirent *
+my_readdir (void *gdir)
+{
+ my_DIR *dir = gdir;
+
+ if (dir->idx == -1)
+ {
+ PRINTF ("my_readdir ({ level: %d, idx: %ld }) = NULL\n",
+ dir->level, (long int) dir->idx);
+ return NULL;
+ }
+
+ while (dir->idx < nfiles && filesystem[dir->idx].level > dir->level)
+ ++dir->idx;
+
+ if (dir->idx == nfiles || filesystem[dir->idx].level < dir->level)
+ {
+ dir->idx = -1;
+ PRINTF ("my_readdir ({ level: %d, idx: %ld }) = NULL\n",
+ dir->level, (long int) dir->idx);
+ return NULL;
+ }
+
+ dir->d.d_ino = dir->idx;
+
+#ifdef _DIRENT_HAVE_D_TYPE
+ dir->d.d_type = filesystem[dir->idx].type;
+#endif
+
+ strcpy (dir->d.d_name, filesystem[dir->idx].name);
+
+#ifdef _DIRENT_HAVE_D_TYPE
+ PRINTF ("my_readdir ({ level: %d, idx: %ld }) = { d_ino: %ld, d_type: %d, d_name: \"%s\" }\n",
+ dir->level, (long int) dir->idx, dir->d.d_ino, dir->d.d_type,
+ dir->d.d_name);
+#else
+ PRINTF ("my_readdir ({ level: %d, idx: %ld }) = { d_ino: %ld, d_name: \"%s\" }\n",
+ dir->level, (long int) dir->idx, dir->d.d_ino,
+ dir->d.d_name);
+#endif
+
+ ++dir->idx;
+
+ return &dir->d;
+}
+
+
+static void
+my_closedir (void *dir)
+{
+ PRINTF ("my_closedir ()\n");
+ free (dir);
+}
+
+
+/* We use this function for lstat as well since we don't have any. */
+static int
+my_stat (const char *name, struct stat *st)
+{
+ long int idx = find_file (name);
+
+ if (idx == -1)
+ {
+ PRINTF ("my_stat (\"%s\", ...) = -1 (%s)\n", name, strerror (errno));
+ return -1;
+ }
+
+ memset (st, '\0', sizeof (*st));
+
+ if (filesystem[idx].type == DT_UNKNOWN)
+ st->st_mode = DTTOIF (idx + 1 < nfiles
+ && filesystem[idx].level < filesystem[idx + 1].level
+ ? DT_DIR : DT_REG) | 0777;
+ else
+ st->st_mode = DTTOIF (filesystem[idx].type) | 0777;
+
+ PRINTF ("my_stat (\"%s\", { st_mode: %o }) = 0\n", name, st->st_mode);
+
+ return 0;
+}
+
+
+static const char *glob_errstring[] =
+{
+ [GLOB_NOSPACE] = "out of memory",
+ [GLOB_ABORTED] = "read error",
+ [GLOB_NOMATCH] = "no matches found"
+};
+#define nglob_errstring (sizeof (glob_errstring) / sizeof (glob_errstring[0]))
+
+
+static const char *
+flagstr (int flags)
+{
+ const char *strs[] =
+ {
+ "GLOB_ERR", "GLOB_MARK", "GLOB_NOSORT", "GLOB_DOOFSS", "GLOB_NOCHECK",
+ "GLOB_APPEND", "GLOB_NOESCAPE", "GLOB_PERIOD", "GLOB_MAGCHAR",
+ "GLOB_ALTDIRFUNC", "GLOB_BRACE", "GLOB_NOMAGIC", "GLOB_TILDE",
+ "GLOB_ONLYDIR", "GLOB_TILDECHECK"
+ };
+#define nstrs (sizeof (strs) / sizeof (strs[0]))
+ static char buf[100];
+ char *cp = buf;
+ int cnt;
+
+ for (cnt = 0; cnt < nstrs; ++cnt)
+ if (flags & (1 << cnt))
+ {
+ flags &= ~(1 << cnt);
+ if (cp != buf)
+ *cp++ = '|';
+ cp = stpcpy (cp, strs[cnt]);
+ }
+
+ if (flags != 0)
+ {
+ if (cp != buf)
+ *cp++ = '|';
+ sprintf (cp, "%#x", flags);
+ }
+
+ return buf;
+}
+
+
+static int
+test_result (const char *fmt, int flags, glob_t *gl, const char *str[])
+{
+ size_t cnt;
+ int result = 0;
+
+ printf ("results for glob (\"%s\", %s)\n", fmt, flagstr (flags));
+ for (cnt = 0; cnt < gl->gl_pathc && str[cnt] != NULL; ++cnt)
+ {
+ int ok = strcmp (gl->gl_pathv[cnt], str[cnt]) == 0;
+ const char *errstr = "";
+
+ if (! ok)
+ {
+ size_t inner;
+
+ for (inner = 0; str[inner] != NULL; ++inner)
+ if (strcmp (gl->gl_pathv[cnt], str[inner]) == 0)
+ break;
+
+ if (str[inner] == NULL)
+ errstr = ok ? "" : " *** WRONG";
+ else
+ errstr = ok ? "" : " * wrong position";
+
+ result = 1;
+ }
+
+ printf (" %s%s\n", gl->gl_pathv[cnt], errstr);
+ }
+ puts ("");
+
+ if (str[cnt] != NULL || cnt < gl->gl_pathc)
+ {
+ puts (" *** incorrect number of entries");
+ result = 1;
+ }
+
+ return result;
+}
+
+
+int
+main (void)
+{
+ glob_t gl;
+ int errval;
+ int result = 0;
+ const char *fmt;
+ int flags;
+
+ memset (&gl, '\0', sizeof (gl));
+
+ gl.gl_closedir = my_closedir;
+ gl.gl_readdir = my_readdir;
+ gl.gl_opendir = my_opendir;
+ gl.gl_lstat = my_stat;
+ gl.gl_stat = my_stat;
+
+#define test(a, b, c...) \
+ fmt = a; \
+ flags = b; \
+ errval = glob (fmt, flags, NULL, &gl); \
+ if (errval != 0) \
+ { \
+ printf ("glob (\"%s\", %s) failed: %s\n", fmt, flagstr (flags), \
+ errval >= 0 && errval < nglob_errstring \
+ ? glob_errstring[errval] : "???"); \
+ result = 1; \
+ } \
+ else \
+ result |= test_result (fmt, flags, &gl, (const char *[]) { c, NULL })
+
+ test ("*/*/*", GLOB_ALTDIRFUNC,
+ "dir1lev1/dir2lev2/dir1lev3",
+ "dir1lev1/dir2lev2/file1lev3",
+ "dir1lev1/dir2lev2/file2lev3",
+ "dir1lev1/dir3lev2/file3lev3",
+ "dir1lev1/dir3lev2/file4lev3");
+
+ test ("*/*/*", GLOB_ALTDIRFUNC | GLOB_PERIOD,
+ "dir1lev1/dir1lev2/.",
+ "dir1lev1/dir1lev2/..",
+ "dir1lev1/dir2lev2/.",
+ "dir1lev1/dir2lev2/..",
+ "dir1lev1/dir2lev2/.foo",
+ "dir1lev1/dir2lev2/dir1lev3",
+ "dir1lev1/dir2lev2/file1lev3",
+ "dir1lev1/dir2lev2/file2lev3",
+ "dir1lev1/dir3lev2/.",
+ "dir1lev1/dir3lev2/..",
+ "dir1lev1/dir3lev2/file3lev3",
+ "dir1lev1/dir3lev2/file4lev3",
+ "dir2lev1/dir1lev2/.",
+ "dir2lev1/dir1lev2/..",
+ "dir2lev1/dir1lev2/.dir",
+ "dir2lev1/dir1lev2/.foo");
+
+ test ("*/*/.*", GLOB_ALTDIRFUNC,
+ "dir1lev1/dir1lev2/.",
+ "dir1lev1/dir1lev2/..",
+ "dir1lev1/dir2lev2/.",
+ "dir1lev1/dir2lev2/..",
+ "dir1lev1/dir2lev2/.foo",
+ "dir1lev1/dir3lev2/.",
+ "dir1lev1/dir3lev2/..",
+ "dir2lev1/dir1lev2/.",
+ "dir2lev1/dir1lev2/..",
+ "dir2lev1/dir1lev2/.dir",
+ "dir2lev1/dir1lev2/.foo");
+
+ test ("*1*/*2*/.*", GLOB_ALTDIRFUNC,
+ "dir1lev1/dir1lev2/.",
+ "dir1lev1/dir1lev2/..",
+ "dir1lev1/dir2lev2/.",
+ "dir1lev1/dir2lev2/..",
+ "dir1lev1/dir2lev2/.foo",
+ "dir1lev1/dir3lev2/.",
+ "dir1lev1/dir3lev2/..",
+ "dir2lev1/dir1lev2/.",
+ "dir2lev1/dir1lev2/..",
+ "dir2lev1/dir1lev2/.dir",
+ "dir2lev1/dir1lev2/.foo");
+
+ test ("*1*/*1*/.*", GLOB_ALTDIRFUNC,
+ "dir1lev1/dir1lev2/.",
+ "dir1lev1/dir1lev2/..",
+ "dir2lev1/dir1lev2/.",
+ "dir2lev1/dir1lev2/..",
+ "dir2lev1/dir1lev2/.dir",
+ "dir2lev1/dir1lev2/.foo");
+
+ globfree (&gl);
+
+ return result;
+}
+
+#else
+int main(void) { return 0; }
+#endif
diff --git a/test/misc/tst-seekdir.c b/test/misc/tst-seekdir.c
new file mode 100644
index 000000000..5a2810abd
--- /dev/null
+++ b/test/misc/tst-seekdir.c
@@ -0,0 +1,80 @@
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <dirent.h>
+#include <stdlib.h>
+
+int
+main (int argc, char *argv[])
+{
+ DIR * dirp;
+ long int save3 = 0;
+ long int cur;
+ int i = 0;
+ int result = 0;
+ struct dirent *dp;
+ long int save0;
+ long int rewind;
+
+ dirp = opendir (".");
+ if (dirp == NULL)
+ {
+ printf ("opendir failed: %s\n", strerror(errno));
+ return 1;
+ }
+
+ save0 = telldir (dirp);
+ if (save0 == -1)
+ {
+ printf ("telldir failed: %s\n", strerror(errno));
+ result = 1;
+ }
+
+ for (dp = readdir (dirp); dp != NULL; dp = readdir (dirp))
+ {
+ /* save position 3 (after fourth entry) */
+ if (i++ == 3)
+ save3 = telldir (dirp);
+
+ printf ("%s\n", dp->d_name);
+
+ /* stop at 400 (just to make sure dirp->__offset and dirp->__size are
+ scrambled */
+ if (i == 400)
+ break;
+ }
+
+ printf ("going back past 4-th entry...\n");
+
+ /* go back to saved entry */
+ seekdir (dirp, save3);
+
+ /* Check whether telldir equals to save3 now. */
+ cur = telldir (dirp);
+ if (cur != save3)
+ {
+ printf ("seekdir (d, %ld); telldir (d) == %ld\n", save3, cur);
+ result = 1;
+ }
+
+ /* print remaining files (3-last) */
+ for (dp = readdir (dirp); dp != NULL; dp = readdir (dirp))
+ printf ("%s\n", dp->d_name);
+
+ /* Check rewinddir */
+ rewinddir (dirp);
+ rewind = telldir (dirp);
+ if (rewind == -1)
+ {
+ printf ("telldir failed: %s\n", strerror(errno));
+ result = 1;
+ }
+ else if (save0 != rewind)
+ {
+ printf ("rewinddir didn't reset directory stream\n");
+ result = 1;
+ }
+
+ closedir (dirp);
+ return result;
+}
diff --git a/test/misc/tst-utmp.c b/test/misc/tst-utmp.c
new file mode 100644
index 000000000..12a208855
--- /dev/null
+++ b/test/misc/tst-utmp.c
@@ -0,0 +1,404 @@
+/* Tests for UTMP functions.
+ Copyright (C) 1998, 2001-2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <error.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <time.h>
+
+#ifdef UTMPX
+# include <utmpx.h>
+# define utmp utmpx
+# define utmpname utmpxname
+# define setutent setutxent
+# define getutent getutxent
+# define endutent endutxent
+# define getutline getutxline
+# define getutid getutxid
+# define pututline pututxline
+#else
+# include <utmp.h>
+#endif
+
+
+#if _HAVE_UT_TYPE || defined UTMPX
+
+/* Prototype for our test function. */
+static int do_test (int argc, char *argv[]);
+
+/* We have a preparation function. */
+static void do_prepare (int argc, char *argv[]);
+#define PREPARE do_prepare
+
+/* This defines the `main' function and some more. */
+#include <test-skeleton.c>
+
+
+/* These are for the temporary file we generate. */
+char *name;
+int fd;
+
+static void
+do_prepare (int argc, char *argv[])
+{
+ size_t name_len;
+
+ name_len = strlen (test_dir);
+ name = malloc (name_len + sizeof ("/utmpXXXXXX"));
+ mempcpy (mempcpy (name, test_dir, name_len),
+ "/utmpXXXXXX", sizeof ("/utmpXXXXXX"));
+ add_temp_file (name);
+
+ /* Open our test file. */
+ fd = mkstemp (name);
+ if (fd == -1)
+ error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
+}
+
+struct utmp entry[] =
+{
+#if _HAVE_UT_TV || defined UTMPX
+#define UT(a) .ut_tv = { .tv_sec = (a)}
+#else
+#define UT(a) .ut_time = (a)
+#endif
+
+ { .ut_type = BOOT_TIME, .ut_pid = 1, UT(1000) },
+ { .ut_type = RUN_LVL, .ut_pid = 1, UT(2000) },
+ { .ut_type = INIT_PROCESS, .ut_pid = 5, .ut_id = "si", UT(3000) },
+ { .ut_type = LOGIN_PROCESS, .ut_pid = 23, .ut_line = "tty1", .ut_id = "1",
+ .ut_user = "LOGIN", UT(4000) },
+ { .ut_type = USER_PROCESS, .ut_pid = 24, .ut_line = "tty2", .ut_id = "2",
+ .ut_user = "albert", UT(8000) },
+ { .ut_type = USER_PROCESS, .ut_pid = 196, .ut_line = "ttyp0", .ut_id = "p0",
+ .ut_user = "niels", UT(10000) },
+ { .ut_type = DEAD_PROCESS, .ut_line = "ttyp1", .ut_id = "p1", UT(16000) },
+ { .ut_type = EMPTY },
+ { .ut_type = EMPTY }
+};
+int num_entries = sizeof entry / sizeof (struct utmp);
+
+time_t entry_time = 20000;
+pid_t entry_pid = 234;
+
+static int
+do_init (void)
+{
+ int n;
+
+ setutent ();
+
+ for (n = 0; n < num_entries; n++)
+ {
+ if (pututline (&entry[n]) == NULL)
+ {
+ error (0, errno, "cannot write UTMP entry");
+ return 1;
+ }
+ }
+
+ endutent ();
+
+ return 0;
+}
+
+
+static int
+do_check (void)
+{
+ struct utmp *ut;
+ int n;
+
+ setutent ();
+
+ n = 0;
+ while ((ut = getutent ()))
+ {
+ if (n < num_entries &&
+ memcmp (ut, &entry[n], sizeof (struct utmp)))
+ {
+ error (0, 0, "UTMP entry does not match");
+ return 1;
+ }
+
+ n++;
+ }
+
+ if (n != num_entries)
+ {
+ error (0, 0, "number of UTMP entries is incorrect");
+ return 1;
+ }
+
+ endutent ();
+
+ return 0;
+}
+
+static int
+simulate_login (const char *line, const char *user)
+{
+ int n;
+
+ for (n = 0; n < num_entries; n++)
+ {
+ if (strcmp (line, entry[n].ut_line) == 0 ||
+ entry[n].ut_type == DEAD_PROCESS)
+ {
+ if (entry[n].ut_pid == DEAD_PROCESS)
+ entry[n].ut_pid = (entry_pid += 27);
+ entry[n].ut_type = USER_PROCESS;
+ strncpy (entry[n].ut_user, user, sizeof (entry[n].ut_user));
+#if _HAVE_UT_TV - 0 || defined UTMPX
+ entry[n].ut_tv.tv_sec = (entry_time += 1000);
+#else
+ entry[n].ut_time = (entry_time += 1000);
+#endif
+ setutent ();
+
+ if (pututline (&entry[n]) == NULL)
+ {
+ error (0, errno, "cannot write UTMP entry");
+ return 1;
+ }
+
+ endutent ();
+
+ return 0;
+ }
+ }
+
+ error (0, 0, "no entries available");
+ return 1;
+}
+
+static int
+simulate_logout (const char *line)
+{
+ int n;
+
+ for (n = 0; n < num_entries; n++)
+ {
+ if (strcmp (line, entry[n].ut_line) == 0)
+ {
+ entry[n].ut_type = DEAD_PROCESS;
+ strncpy (entry[n].ut_user, "", sizeof (entry[n].ut_user));
+#if _HAVE_UT_TV - 0 || defined UTMPX
+ entry[n].ut_tv.tv_sec = (entry_time += 1000);
+#else
+ entry[n].ut_time = (entry_time += 1000);
+#endif
+ setutent ();
+
+ if (pututline (&entry[n]) == NULL)
+ {
+ error (0, errno, "cannot write UTMP entry");
+ return 1;
+ }
+
+ endutent ();
+
+ return 0;
+ }
+ }
+
+ error (0, 0, "no entry found for `%s'", line);
+ return 1;
+}
+
+static int
+check_login (const char *line)
+{
+ struct utmp *up;
+ struct utmp ut;
+ int n;
+
+ setutent ();
+
+ strcpy (ut.ut_line, line);
+ up = getutline (&ut);
+ if (up == NULL)
+ {
+ error (0, errno, "cannot get entry for line `%s'", line);
+ return 1;
+ }
+
+ endutent ();
+
+ for (n = 0; n < num_entries; n++)
+ {
+ if (strcmp (line, entry[n].ut_line) == 0)
+ {
+ if (memcmp (up, &entry[n], sizeof (struct utmp)))
+ {
+ error (0, 0, "UTMP entry does not match");
+ return 1;
+ }
+
+ return 0;
+ }
+ }
+
+ error (0, 0, "bogus entry for line `%s'", line);
+ return 1;
+}
+
+static int
+check_logout (const char *line)
+{
+ struct utmp ut;
+
+ setutent ();
+
+ strcpy (ut.ut_line, line);
+ if (getutline (&ut) != NULL)
+ {
+ error (0, 0, "bogus login entry for `%s'", line);
+ return 1;
+ }
+
+ endutent ();
+
+ return 0;
+}
+
+static int
+check_id (const char *id)
+{
+ struct utmp *up;
+ struct utmp ut;
+ int n;
+
+ setutent ();
+
+ ut.ut_type = USER_PROCESS;
+ strcpy (ut.ut_id, id);
+ up = getutid (&ut);
+ if (up == NULL)
+ {
+ error (0, errno, "cannot get entry for ID `%s'", id);
+ return 1;
+ }
+
+ endutent ();
+
+ for (n = 0; n < num_entries; n++)
+ {
+ if (strcmp (id, entry[n].ut_id) == 0)
+ {
+ if (memcmp (up, &entry[n], sizeof (struct utmp)))
+ {
+ error (0, 0, "UTMP entry does not match");
+ return 1;
+ }
+
+ return 0;
+ }
+ }
+
+ error (0, 0, "bogus entry for ID `%s'", id);
+ return 1;
+}
+
+static int
+check_type (int type)
+{
+ struct utmp *up;
+ struct utmp ut;
+ int n;
+
+ setutent ();
+
+ ut.ut_type = type;
+ up = getutid (&ut);
+ if (up == NULL)
+ {
+ error (0, errno, "cannot get entry for type `%d'", type);
+ return 1;
+ }
+
+ endutent ();
+
+ for (n = 0; n < num_entries; n++)
+ {
+ if (type == entry[n].ut_type)
+ {
+ if (memcmp (up, &entry[n], sizeof (struct utmp)))
+ {
+ error (0, 0, "UTMP entry does not match");
+ return 1;
+ }
+
+ return 0;
+ }
+ }
+
+ error (0, 0, "bogus entry for type `%d'", type);
+ return 1;
+}
+
+static int
+do_test (int argc, char *argv[])
+{
+ int result = 0;
+
+ utmpname (name);
+
+ result |= do_init ();
+ result |= do_check ();
+
+ result |= simulate_login ("tty1", "erwin");
+ result |= do_check ();
+
+ result |= simulate_login ("ttyp1", "paul");
+ result |= do_check ();
+
+ result |= simulate_logout ("tty2");
+ result |= do_check ();
+
+ result |= simulate_logout ("ttyp0");
+ result |= do_check ();
+
+ result |= simulate_login ("ttyp2", "richard");
+ result |= do_check ();
+
+ result |= check_login ("tty1");
+ result |= check_logout ("ttyp0");
+ result |= check_id ("p1");
+ result |= check_id ("2");
+ result |= check_id ("si");
+ result |= check_type (BOOT_TIME);
+ result |= check_type (RUN_LVL);
+
+ return result;
+}
+
+#else
+
+/* No field 'ut_type' in struct utmp. */
+int
+main ()
+{
+ return 0;
+}
+
+#endif
diff --git a/test/mmap/Makefile b/test/mmap/Makefile
index 4addff95a..b4c301014 100644
--- a/test/mmap/Makefile
+++ b/test/mmap/Makefile
@@ -1,6 +1,4 @@
# uClibc mmap tests
-# Licensed under the GNU Library General Public License, see COPYING.LIB
-
-TESTS = mmap mmap64
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
include ../Test.mak
diff --git a/test/mmap/mmap64.c b/test/mmap/mmap64.c
index 7886ccd29..87165fe20 100644
--- a/test/mmap/mmap64.c
+++ b/test/mmap/mmap64.c
@@ -7,10 +7,11 @@
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
+#include <features.h>
int main(int argc, char **argv)
{
-#ifdef __NR_mmap64
+#ifdef __UCLIBC_HAS_LFS__
void *ptr;
ptr = mmap64(NULL, 4096, PROT_READ|PROT_WRITE,
diff --git a/test/nptl/Makefile b/test/nptl/Makefile
index 89260d51e..1513b6ad0 100644
--- a/test/nptl/Makefile
+++ b/test/nptl/Makefile
@@ -31,7 +31,8 @@ INCLUDES := -I$(TOPDIR)include -I. \
-I$(PTDIR)/sysdeps/pthread/bits \
-I$(PTDIR)/sysdeps/generic \
-I$(TOPDIR)ldso/include \
- -I$(TOPDIR)ldso/ldso/$(TARGET_ARCH)
+ -I$(TOPDIR)ldso/ldso/$(TARGET_ARCH) \
+ -include $(TOPDIR)include/libc-symbols.h
#
# CFLAGS for global use as well as individual tests
@@ -62,6 +63,26 @@ LDFLAGS-tst-rwlock14 = -lrt
LDFLAGS-tst-tls3 = -ldl -rdynamic
LDFLAGS-tst-tls4 = -ldl
LDFLAGS-tst-tls5 = tst-tls5mod.so
+LDFLAGS-tst-clock = -lrt
+LDFLAGS-tst-clock_nanosleep = -lrt
+LDFLAGS-tst-cpuclock1 = -lrt
+LDFLAGS-tst-cpuclock2 = -lrt
+LDFLAGS-tst-cputimer1 = -lrt
+LDFLAGS-tst-cputimer2 = -lrt
+LDFLAGS-tst-cputimer3 = -lrt
+LDFLAGS-tst-mqueue1 = -lrt
+LDFLAGS-tst-mqueue2 = -lrt
+LDFLAGS-tst-mqueue3 = -lrt
+LDFLAGS-tst-mqueue4 = -lrt
+LDFLAGS-tst-mqueue5 = -lrt
+LDFLAGS-tst-mqueue6 = -lrt
+LDFLAGS-tst-mqueue7 = -lrt
+LDFLAGS-tst-mqueue8 = -lrt
+LDFLAGS-tst-mqueue9 = -lrt
+LDFLAGS-tst-timer2 = -lrt
+LDFLAGS-tst-timer3 = -lrt
+LDFLAGS-tst-timer4 = -lrt
+LDFLAGS-tst-timer5 = -lrt
#
# Flags to build and link DSO modules
@@ -81,54 +102,63 @@ SO_OBJS := $(patsubst %.c, %.so, $(wildcard tst-*mod*.c))
#
OBJS := tst-cleanup4aux.o
-TARGETS = tst-align tst-align2 \
- tst-atfork1 \
- tst-attr1 tst-attr2 tst-attr3 \
- tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \
- tst-basic1 tst-basic2 tst-basic3 \
- tst-basic4 tst-basic5 tst-basic6 \
- tst-cancel1 tst-cancel2 tst-cancel3 tst-cancel6 tst-cancel7 \
- tst-cancel8 tst-cancel9 tst-cancel10 tst-cancel11 \
- tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
- tst-cancel16 tst-cancel19 tst-cancel20 tst-cancel21 \
- tst-cancel22 \
- tst-cleanup0 tst-cleanup1 tst-cleanup2 \
- tst-cleanup3 tst-cleanup4 \
- tst-clock1 tst-clock2 \
- tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 \
- tst-cond7 tst-cond8 tst-cond9 tst-cond10 tst-cond11 \
- tst-cond12 tst-cond13 tst-cond14 tst-cond15 tst-cond16 \
- tst-cond17 tst-cond18 tst-cond19 tst-cond20 tst-cond21 \
- tst-detach1 \
- tst-eintr1 tst-eintr2 tst-eintr3 tst-eintr4 tst-eintr5 \
- tst-exec2 tst-exec3 tst-exec4 \
- tst-exit1 tst-exit2 tst-exit3 \
- tst-flock1 tst-flock2 \
- tst-fork1 tst-fork2 tst-fork3 tst-fork4 \
- tst-initializers1 \
- tst-join1 tst-join2 tst-join3 tst-join4 tst-join5 \
- tst-key1 tst-key2 tst-key3 tst-key4 \
- tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
- tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 \
- tst-mutex6 tst-mutex7 tst-mutex8 tst-mutex9 tst-mutex5a \
- tst-mutex7a \
- tst-once1 tst-once2 tst-once3 tst-once4 \
- tst-popen1 \
- tst-raise1 \
- tst-rwlock1 tst-rwlock2 tst-rwlock3 tst-rwlock4 tst-rwlock5 \
- tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 tst-rwlock10 \
- tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \
- tst-sched1 \
- tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 \
- tst-sem7 tst-sem8 tst-sem9 \
- tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
- tst-signal6 \
- tst-spin1 tst-spin2 tst-spin3 \
- tst-stack1 tst-stack2 \
- tst-stdio1 tst-stdio2 tst-sysconf \
- tst-tls1 tst-tls2 tst-tls3 tst-tls4 tst-tls5 \
- tst-tsd1 tst-tsd2 tst-tsd3 tst-tsd4 tst-tsd5 \
- tst-umask1
+TARGETS := tst-align tst-align2 \
+ tst-atfork1 \
+ tst-attr1 tst-attr2 tst-attr3 \
+ tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \
+ tst-basic1 tst-basic2 tst-basic3 \
+ tst-basic4 tst-basic5 tst-basic6 \
+ tst-cancel1 tst-cancel2 tst-cancel3 tst-cancel6 tst-cancel7 \
+ tst-cancel8 tst-cancel9 tst-cancel10 tst-cancel11 \
+ tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
+ tst-cancel16 tst-cancel19 tst-cancel20 tst-cancel21 \
+ tst-cancel22 \
+ tst-cleanup0 tst-cleanup1 tst-cleanup2 \
+ tst-cleanup3 tst-cleanup4 \
+ tst-clock1 tst-clock2 \
+ tst-cond1 tst-cond2 tst-cond3 tst-cond4 tst-cond5 tst-cond6 \
+ tst-cond7 tst-cond8 tst-cond9 tst-cond10 tst-cond11 \
+ tst-cond12 tst-cond13 tst-cond14 tst-cond15 tst-cond16 \
+ tst-cond17 tst-cond18 tst-cond19 tst-cond20 tst-cond21 \
+ tst-detach1 \
+ tst-eintr1 tst-eintr2 tst-eintr3 tst-eintr4 tst-eintr5 \
+ tst-exec2 tst-exec3 tst-exec4 \
+ tst-exit1 tst-exit2 tst-exit3 \
+ tst-flock1 tst-flock2 \
+ tst-fork1 tst-fork2 tst-fork3 tst-fork4 \
+ tst-initializers1 \
+ tst-join1 tst-join2 tst-join3 tst-join4 tst-join5 \
+ tst-key1 tst-key2 tst-key3 tst-key4 \
+ tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
+ tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 \
+ tst-mutex6 tst-mutex7 tst-mutex8 tst-mutex9 tst-mutex5a \
+ tst-mutex7a \
+ tst-once1 tst-once2 tst-once3 tst-once4 \
+ tst-popen1 \
+ tst-raise1 \
+ tst-rwlock1 tst-rwlock2 tst-rwlock3 tst-rwlock4 tst-rwlock5 \
+ tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 tst-rwlock10 \
+ tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \
+ tst-sched1 \
+ tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 \
+ tst-sem7 tst-sem8 tst-sem9 \
+ tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
+ tst-signal6 \
+ tst-spin1 tst-spin2 tst-spin3 \
+ tst-stack1 tst-stack2 \
+ tst-stdio1 tst-stdio2 tst-sysconf \
+ tst-tls1 tst-tls2 tst-tls3 tst-tls4 tst-tls5 \
+ tst-tsd1 tst-tsd2 tst-tsd3 tst-tsd4 tst-tsd5 \
+ tst-umask1
+
+#
+# These are actually for the RT library and POSIX timers.
+#
+TARGETS += tst-clock tst-clock_nanosleep tst-cpuclock1 tst-cpuclock2 \
+ tst-cputimer1 tst-cputimer2 tst-cputimer3 tst-mqueue1 \
+ tst-mqueue2 tst-mqueue3 tst-mqueue4 tst-mqueue5 tst-mqueue6 \
+ tst-mqueue7 tst-mqueue8 tst-mqueue9 tst-timer2 tst-timer3 \
+ tst-timer4 tst-timer5
#
# Arguments used when running tests
diff --git a/test/pthread/Makefile b/test/pthread/Makefile
index 43e8c535e..560a424cb 100644
--- a/test/pthread/Makefile
+++ b/test/pthread/Makefile
@@ -1,106 +1,6 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 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 Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# uClibc pthread tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-include ../Rules.mak
+include ../Test.mak
-LDFLAGS +=
-#EXTRA_LIBS += -lc -lgcc -lpthread
-EXTRA_LIBS += -lpthread
-
-TARGETS=ex1 ex2 ex3 ex4 ex5 ex6 ex7
-all: $(TARGETS)
-
-ex1: ex1.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-ex2: ex2.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-ex3: ex3.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-ex4: ex4.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-ex5: ex5.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-ex6: ex6.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-ex7: ex7.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-clean:
- $(RM) *.[oa] *~ core $(TARGETS)
+EXTRA_LDFLAGS := -lpthread
diff --git a/test/pthread/ex3.c b/test/pthread/ex3.c
index 8005200ef..8ef779789 100644
--- a/test/pthread/ex3.c
+++ b/test/pthread/ex3.c
@@ -23,12 +23,12 @@ volatile int started;
int main(int argc, char ** argv)
{
- int i;
- int pid;
+ unsigned long i;
+ unsigned long pid;
/* create a number to search for */
pid = getpid();
- printf("Searching for the number = %d...\n", pid);
+ printf("Searching for the number = %ld...\n", pid);
/* Initialize the mutex lock */
pthread_mutex_init(&lock, NULL);
@@ -66,8 +66,8 @@ void print_it(void *arg)
void *search(void *arg)
{
- int num = (int) arg;
- int i, j, ntries;
+ unsigned long num = (unsigned long) arg;
+ unsigned long i, j, ntries;
pthread_t tid;
/* get the calling thread ID */
diff --git a/test/pthread/ex7.c b/test/pthread/ex7.c
index fadaccaa1..bda2ca9eb 100644
--- a/test/pthread/ex7.c
+++ b/test/pthread/ex7.c
@@ -25,7 +25,7 @@ event_t main_event;
void *
test_thread (void *ms_param)
{
- int status = 0;
+ unsigned long status = 0;
event_t foo;
struct timespec time;
struct timeval now;
diff --git a/test/pwd_grp/Makefile b/test/pwd_grp/Makefile
index 4ddb60bd7..e6362d352 100644
--- a/test/pwd_grp/Makefile
+++ b/test/pwd_grp/Makefile
@@ -1,181 +1,10 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 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 Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# uClibc pwd_grp tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-include ../Rules.mak
+include ../Test.mak
-TARGETS=test_pwd test_pwd_glibc
-TARGETS+=test_grp test_grp_glibc
-TARGETS+=pwcat pwcat_glibc
-TARGETS+=grcat grcat_glibc
-TARGETS+=getgroups getgroups_glibc
-TARGETS+=test_pwd_diff test_grp_diff pwcat_diff grcat_diff getgroups_diff
-
-all: $(TARGETS)
-
-test_pwd: test_pwd.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ 2>&1 >test_pwd.out
- -@ echo " "
-
-test_pwd_glibc: test_pwd.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ 2>&1 >test_pwd_glibc.out
- -@ echo " "
-
-test_grp: test_grp.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ 2>&1 >test_grp.out
- -@ echo " "
-
-test_grp_glibc: test_grp.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ 2>&1 >test_grp_glibc.out
- -@ echo " "
-
-pwcat: pwcat.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ 2>&1 >pwcat.out
- -@ echo " "
-
-pwcat_glibc: pwcat.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ 2>&1 >pwcat_glibc.out
- -@ echo " "
-
-grcat: grcat.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ 2>&1 >grcat.out
- -@ echo " "
-
-grcat_glibc: grcat.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ 2>&1 >grcat_glibc.out
- -@ echo " "
-
-getgroups: getgroups.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ 2>&1 >getgroups.out
- -@ echo " "
-
-getgroups_glibc: getgroups.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ 2>&1 >getgroups_glibc.out
- -@ echo " "
-
-test_pwd_diff: test_pwd_glibc test_pwd
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing output: "
- -@ echo " "
- -diff -u test_pwd_glibc.out test_pwd.out
- -@ echo " "
-
-test_grp_diff: test_grp_glibc test_grp
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing output: "
- -@ echo " "
- -diff -u test_grp_glibc.out test_grp.out
- -@ echo " "
-
-pwcat_diff: pwcat_glibc pwcat
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing output: "
- -@ echo " "
- -diff -u pwcat_glibc.out pwcat.out
- -@ echo " "
-
-grcat_diff: grcat_glibc grcat
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing output: "
- -@ echo " "
- -diff -u grcat_glibc.out grcat.out
- -@ echo " "
-
-getgroups_diff: getgroups_glibc getgroups
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing output: "
- -@ echo " "
- -diff -u getgroups_glibc.out getgroups.out
- -@ echo " "
-
-clean:
- $(RM) *.[oa] *~ core $(TARGETS) *.out
+DODIFF_test_pwd := 1
+DODIFF_test_grp := 1
+DODIFF_pwcat := 1
+DODIFF_grcat := 1
+DODIFF_getgroups := 1
diff --git a/test/pwd_grp/test_grp.c b/test/pwd_grp/test_grp.c
index 0e9c4a013..573806cd6 100644
--- a/test/pwd_grp/test_grp.c
+++ b/test/pwd_grp/test_grp.c
@@ -1,21 +1,8 @@
/*
* test_grp.c - This file is part of the libc-8086/grp package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#include <unistd.h>
diff --git a/test/pwd_grp/test_pwd.c b/test/pwd_grp/test_pwd.c
index 9d2186695..065864e2e 100644
--- a/test/pwd_grp/test_pwd.c
+++ b/test/pwd_grp/test_pwd.c
@@ -1,21 +1,8 @@
/*
* test_pwd.c - This file is part of the libc-8086/pwd package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#include <unistd.h>
diff --git a/test/regex/Makefile b/test/regex/Makefile
index 62a3a6e91..7c55c3c0e 100644
--- a/test/regex/Makefile
+++ b/test/regex/Makefile
@@ -1,5 +1,5 @@
# uClibc regex tests
-# Licensed under the GNU Library General Public License, see COPYING.LIB
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#TESTS_DISABLED := testregexi testregexn
diff --git a/test/rpc/Makefile b/test/rpc/Makefile
index 58f04f634..fa5c5240b 100644
--- a/test/rpc/Makefile
+++ b/test/rpc/Makefile
@@ -1,38 +1,8 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2005 Erik Andersen <andersen@uclibc.org>
+# uClibc rpc tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-include ../Rules.mak
+TESTS := getrpcent
-# getrpcent_r_diff
-TARGETS = getrpcent getrpcent_glibc getrpcent_diff
+include ../Test.mak
-all: $(TARGETS)
-
-getrpcent: getrpcent.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ > getrpcent.out
- -@ echo " "
-
-getrpcent_glibc: getrpcent.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ > getrpcent_glibc.out
- -@ echo " "
-
-getrpcent_diff: getrpcent getrpcent_glibc
- diff -u getrpcent_glibc.out getrpcent.out
-
-clean:
- $(RM) *.[oa] *~ core $(TARGETS) *.out
+DODIFF_getrpcent := 1
diff --git a/test/setjmp/Makefile b/test/setjmp/Makefile
index 40f5fd853..581ab3213 100644
--- a/test/setjmp/Makefile
+++ b/test/setjmp/Makefile
@@ -1,6 +1,4 @@
# uClibc setjmp tests
-# Licensed under the GNU Library General Public License, see COPYING.LIB
-
-TESTS = setjmp_test
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
include ../Test.mak
diff --git a/test/setjmp/bug269-setjmp.c b/test/setjmp/bug269-setjmp.c
new file mode 100644
index 000000000..f50a5b1a5
--- /dev/null
+++ b/test/setjmp/bug269-setjmp.c
@@ -0,0 +1,107 @@
+/* Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */ ;
+
+/* Test case for Bugzilla # 269 */
+
+#include <stdio.h>
+#include <setjmp.h>
+#include <stdlib.h>
+
+jmp_buf buf1;
+jmp_buf buf2;
+int *p;
+int n_x = 6;
+
+static int g_counter = 0;
+
+int
+f (void)
+{
+ static int counter = 0;
+ static int way_point1 = 3;
+ static int way_point2 = 2;
+ int lose = 0;
+
+ if (setjmp (buf1) != 101)
+ {
+ int a[n_x]; /* reallocate stack space */
+ g_counter++;
+ p = &a[0];
+ if (g_counter < 5)
+ longjmp (buf1, 2);
+ else if (g_counter == 5)
+ longjmp (buf1, 101);
+ else
+ {
+ _setjmp (buf2);
+ _longjmp (buf1, 101);
+ }
+ }
+
+ way_point1--;
+
+ if (counter == 0)
+ {
+ counter++;
+ {
+ int a[n_x]; /* reallocate stack space */
+ g_counter++;
+ p = &a[0];
+ if (g_counter < 5)
+ longjmp (buf1, 2);
+ else if (g_counter == 5)
+ longjmp (buf1, 101);
+ else
+ {
+ _setjmp (buf2);
+ _longjmp (buf1, 101);
+ }
+ }
+ }
+
+ way_point2--;
+
+ if (counter == 1)
+ {
+ counter++;
+ longjmp (buf2, 2);
+ }
+
+ lose = !(way_point1 == 0 && way_point2 == 0
+ && g_counter == 6 && counter == 2);
+
+ return lose;
+}
+
+static int
+do_test (void)
+{
+ int lose;
+
+ lose = f ();
+
+ if (lose)
+ puts ("Test FAILED!");
+ else
+ puts ("Test succeeded!");
+
+ return lose ? EXIT_FAILURE : EXIT_SUCCESS;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/test/setjmp/jmpbug.c b/test/setjmp/jmpbug.c
new file mode 100644
index 000000000..125977b2f
--- /dev/null
+++ b/test/setjmp/jmpbug.c
@@ -0,0 +1,40 @@
+/* setjmp vs alloca test case. Exercised bug on sparc. */
+
+#include <stdio.h>
+#include <setjmp.h>
+#include <alloca.h>
+
+static void
+sub5 (jmp_buf buf)
+{
+ longjmp (buf, 1);
+}
+
+static void
+test (int x)
+{
+ jmp_buf buf;
+ char *foo;
+ int arr[100];
+
+ arr[77] = x;
+ if (setjmp (buf))
+ {
+ printf ("made it ok; %d\n", arr[77]);
+ return;
+ }
+
+ foo = (char *) alloca (128);
+ sub5 (buf);
+}
+
+int
+main (void)
+{
+ int i;
+
+ for (i = 123; i < 345; ++i)
+ test (i);
+
+ return 0;
+}
diff --git a/test/setjmp/setjmp_test.c b/test/setjmp/tst-setjmp.c
index 35d9638ad..35d9638ad 100644
--- a/test/setjmp/setjmp_test.c
+++ b/test/setjmp/tst-setjmp.c
diff --git a/test/signal/Makefile b/test/signal/Makefile
index 55fb6554d..a0b14a6c9 100644
--- a/test/signal/Makefile
+++ b/test/signal/Makefile
@@ -1,72 +1,4 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 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 Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# uClibc signal tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-include ../Rules.mak
-
-CFLAGS += -D_GNU_SOURCE
-GLIBC_CFLAGS += -D_GNU_SOURCE
-
-TARGETS=signal signal_glibc sigchld sigchld_glibc
-all: $(TARGETS)
-
-signal: signal.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-signal_glibc: signal.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-sigchld: sigchld.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-sigchld_glibc: sigchld.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-clean:
- $(RM) *.[oa] *~ core $(TARGETS)
+include ../Test.mak
diff --git a/test/signal/sigchld.c b/test/signal/sigchld.c
index ad2970624..60ddf4b3c 100644
--- a/test/signal/sigchld.c
+++ b/test/signal/sigchld.c
@@ -14,6 +14,8 @@ void test_handler(int signo)
}
+#ifdef __ARCH_USE_MMU__
+
int main(void)
{
pid_t mypid;
@@ -57,3 +59,12 @@ int main(void)
return 0;
}
+#else
+
+int main(void)
+{
+ printf("Skipping test on non-mmu host!\n");
+ return 0;
+}
+
+#endif
diff --git a/test/signal/signal.c b/test/signal/signal.c
index 97963ebda..6e6f04a7a 100644
--- a/test/signal/signal.c
+++ b/test/signal/signal.c
@@ -1,28 +1,14 @@
/* vi: set sw=4 ts=4: */
/*
* signal testing function for uClibc
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
*
- * Copyright (C) 2000 by Lineo, inc. and Erik Andersen
- * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
- * Written by Erik Andersen <andersen@uclibc.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 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 Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/test/signal/tst-raise.c b/test/signal/tst-raise.c
new file mode 100644
index 000000000..9e8e472be
--- /dev/null
+++ b/test/signal/tst-raise.c
@@ -0,0 +1,63 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <string.h>
+#include <error.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+volatile int count;
+
+void
+sh (int sig)
+{
+ ++count;
+}
+
+int
+main (void)
+{
+ struct sigaction sa;
+ sa.sa_handler = sh;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = 0;
+ if (sigaction (SIGUSR1, &sa, NULL) < 0)
+ {
+ printf ("sigaction failed: %s\n", strerror(errno));
+ exit (1);
+ }
+ if (raise (SIGUSR1) < 0)
+ {
+ printf ("first raise failed: %s\n", strerror(errno));
+ exit (1);
+ }
+ if (raise (SIGUSR1) < 0)
+ {
+ printf ("second raise failed: %s\n", strerror(errno));
+ exit (1);
+ }
+ if (count != 2)
+ {
+ printf ("signal handler not called 2 times\n");
+ exit (1);
+ }
+ exit (0);
+}
diff --git a/test/signal/tst-signal.c b/test/signal/tst-signal.c
new file mode 100644
index 000000000..6d3178792
--- /dev/null
+++ b/test/signal/tst-signal.c
@@ -0,0 +1,44 @@
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int win = 0;
+
+static void
+handler (int sig)
+{
+ printf ("Received signal %d (%s).\n", sig, strsignal(sig));
+ win = 1;
+}
+
+int
+main (void)
+{
+ if (signal (SIGTERM, handler) == SIG_ERR)
+ {
+ perror ("signal: SIGTERM");
+ exit (EXIT_FAILURE);
+ }
+
+ puts ("Set handler.");
+
+ printf ("Sending myself signal %d.\n", SIGTERM);
+ fflush (stdout);
+
+ if (raise (SIGTERM) < 0)
+ {
+ perror ("raise: SIGTERM");
+ exit (EXIT_FAILURE);
+ }
+
+ if (!win)
+ {
+ puts ("Didn't get any signal. Test FAILED!");
+ exit (EXIT_FAILURE);
+ }
+
+ puts ("Got a signal. Test succeeded.");
+
+ return EXIT_SUCCESS;
+}
diff --git a/test/signal/tst-sigset.c b/test/signal/tst-sigset.c
new file mode 100644
index 000000000..bc1b05764
--- /dev/null
+++ b/test/signal/tst-sigset.c
@@ -0,0 +1,45 @@
+/* Test sig*set functions. */
+
+#include <signal.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+#define TEST_FUNCTION do_test ()
+static int
+do_test (void)
+{
+ int result = 0;
+ int sig = -1;
+
+#define TRY(call) \
+ if (call) \
+ { \
+ printf ("%s (sig = %d): %s\n", #call, sig, strerror(errno)); \
+ result = 1; \
+ } \
+ else
+
+
+ sigset_t set;
+ TRY (sigemptyset (&set) != 0);
+
+#ifdef SIGRTMAX
+ int max_sig = SIGRTMAX;
+#else
+ int max_sig = NSIG - 1;
+#endif
+
+ for (sig = 1; sig <= max_sig; ++sig)
+ {
+ TRY (sigismember (&set, sig) != 0);
+ TRY (sigaddset (&set, sig) != 0);
+ TRY (sigismember (&set, sig) == 0);
+ TRY (sigdelset (&set, sig) != 0);
+ TRY (sigismember (&set, sig) != 0);
+ }
+
+ return result;
+}
+
+#include "../test-skeleton.c"
diff --git a/test/signal/tst-sigsimple.c b/test/signal/tst-sigsimple.c
new file mode 100644
index 000000000..22bb85cba
--- /dev/null
+++ b/test/signal/tst-sigsimple.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+
+
+static int
+do_test (void)
+{
+ int result = 0;
+ int e;
+
+#define RUN(test) \
+ errno = 0; \
+ e = test; \
+ if (e != -1) \
+ { \
+ printf ("%s returned %d\n", #test, e); \
+ result = 1; \
+ } \
+ else if (errno != EINVAL) \
+ { \
+ printf ("%s didn't set errno to EINVAL (%s instead)\n", \
+ #test, strerror (errno)); \
+ result = 1; \
+ }
+
+ RUN (sighold (-1));
+ RUN (sighold (_NSIG + 100));
+
+ RUN (sigrelse (-1));
+ RUN (sigrelse (_NSIG + 100));
+
+ return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/test/silly/Makefile b/test/silly/Makefile
index 57739a447..ccd701852 100644
--- a/test/silly/Makefile
+++ b/test/silly/Makefile
@@ -1,9 +1,7 @@
# uClibc silly tests
-# Licensed under the GNU Library General Public License, see COPYING.LIB
-
-TESTS = hello tiny
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
include ../Test.mak
-export RET_hello = 42
-export RET_tiny = 42
+RET_hello := 42
+RET_tiny := 42
diff --git a/test/stat/Makefile b/test/stat/Makefile
index 558b67510..008a81248 100644
--- a/test/stat/Makefile
+++ b/test/stat/Makefile
@@ -1,98 +1,12 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 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 Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# uClibc stat tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-include ../Rules.mak
+include ../Test.mak
-CFLAGS64=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+CFLAGS_stat64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+DODIFF_stat := 1
+DODIFF_stat64 := 1
-TARGETS=stat_diff stat64_diff
-
-all: $(TARGETS)
-
-stat_source:
- -@ $(RM) $(TARGETS)
- -@ echo "-------"
- -@ echo "stat.c source: "
- -@ echo " "
- -@ cat stat.c
- -@ echo " "
-
-stat: stat.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ stat.c > $@.out
- -@ echo " "
-
-stat_glibc: stat.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ stat.c > $@.out
- -@ echo " "
-
-stat_diff: stat stat_glibc
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing stat output: "
- -@ echo " "
- -diff -u stat_glibc.out stat.out
- -@ echo " "
-
-stat64: stat.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) $(CFLAGS64) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ stat.c > $@.out
- -@ echo " "
-
-stat64_glibc: stat.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) $(CFLAGS64) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ stat.c > $@.out
- -@ echo " "
-
-stat64_diff: stat64 stat64_glibc
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing stat64 output: "
- -@ echo " "
- -diff -u stat64_glibc.out stat64.out
- -@ echo " "
-
-clean:
- $(RM) *.[oa] *~ core stat stat_glibc stat_glibc.out stat.out \
- stat64 stat64_glibc stat64_glibc.out stat64.out
+OPTS_stat := Makefile
+OPTS_stat64 := Makefile
diff --git a/test/stat/stat64.c b/test/stat/stat64.c
new file mode 100644
index 000000000..a07425192
--- /dev/null
+++ b/test/stat/stat64.c
@@ -0,0 +1 @@
+#include "stat.c"
diff --git a/test/stdlib/Makefile b/test/stdlib/Makefile
index f7b03be1a..efec56d70 100644
--- a/test/stdlib/Makefile
+++ b/test/stdlib/Makefile
@@ -1,178 +1,9 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 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 Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# uClibc stdlib tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-include ../Rules.mak
+include ../Test.mak
-TARGETS+=teststrtol teststrtol_glibc teststrtol_diff
-TARGETS+=qsort qsort_glibc qsort_diff
-TARGETS+=teston_exit teston_exit_glibc teston_exit_diff
-TARGETS+=testatexit testatexit_glibc testatexit_diff
-TARGETS+=ptytest
-
-all: $(TARGETS)
-
-teststrtol_source:
- -@ echo "-------"
- -@ echo "teststrtol.c source: "
- -@ echo " "
- -@ cat teststrtol.c
- -@ echo " "
-
-teststrtol: teststrtol.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ./$@ > $@.out
- -@ echo " "
-
-teststrtol_glibc: teststrtol.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ./$@ > $@.out
- -@ echo " "
-
-teststrtol_diff: teststrtol_glibc teststrtol
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing output: "
- -@ echo " "
- diff -u teststrtol_glibc.out teststrtol.out
- -@ echo " "
-
-qsort: qsort.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ./$@ > $@.out
- -@ echo " "
-
-qsort_glibc: qsort.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ./$@ > $@.out
- -@ echo " "
-
-qsort_diff: qsort_glibc qsort
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing output: "
- -@ echo " "
- diff -u qsort_glibc.out qsort.out
- -@ echo " "
-
-teston_exit: teston_exit.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ./$@ > $@.out
- -@ echo " "
-
-teston_exit_glibc: teston_exit.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ./$@ > $@.out
- -@ echo " "
-
-teston_exit_diff: teston_exit_glibc teston_exit
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing output: "
- -@ echo " "
- diff -u teston_exit_glibc.out teston_exit.out
- -@ echo " "
-
-testatexit: testatexit.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ./$@ > $@.out
- -@ echo " "
-
-testatexit_glibc: testatexit.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ./$@ > $@.out
- -@ echo " "
-
-testatexit_diff: testatexit_glibc testatexit
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing output: "
- -@ echo " "
- diff -u testatexit_glibc.out testatexit.out
- -@ echo " "
-
-ptytest: ptytest.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ./$@
- -@ echo " "
-
-
-clean:
- $(RM) *.[oa] *~ core $(TARGETS) *.out
+DODIFF_qsort := 1
+DODIFF_testatexit := 1
+DODIFF_teston_exit := 1
+DODIFF_teststrtol := 1
diff --git a/test/string/Makefile b/test/string/Makefile
index 9bd7d90cf..a18d52e93 100644
--- a/test/string/Makefile
+++ b/test/string/Makefile
@@ -1,103 +1,6 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 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 Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# uClibc string tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-include ../Rules.mak
+include ../Test.mak
-TARGETS=string string_glibc
-TARGETS+=testcopy testcopy_glibc
-TARGETS+=#strerror #strsignal
-
-all: $(TARGETS)
-
-string: string.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-string_glibc: string.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-testcopy: testcopy.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ > testcopy.out
- -@ echo " "
-
-testcopy_glibc: testcopy.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ > testcopy.gnu.out
- -@ echo " "
-
-testcopy_diff: testcopy testcopy_glibc
- -@ echo "-------"
- -@ echo " "
- -@ echo "Diffing output: "
- -@ echo " "
- -diff -u testcopy.gnu.out testcopy.out
- -@ echo " "
-
-
-strerror: ../../libc/string/strerror.c $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -DCHECK_BUF -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-strsignal: ../../libc/string/strsignal.c
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -DCHECK_BUF -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- ./$@
- -@ echo " "
-
-clean:
- $(RM) *.[oa] *~ core $(TARGETS) testcopy.gnu.out testcopy.out
+EXTRA_CFLAGS := -fno-builtin
diff --git a/test/string/bug-strcoll1.c b/test/string/bug-strcoll1.c
new file mode 100644
index 000000000..b6510d926
--- /dev/null
+++ b/test/string/bug-strcoll1.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <string.h>
+#include <locale.h>
+
+int
+main (void)
+{
+ const char t1[] = "0-0-0-0-0-0-0-0-0-0.COM";
+ const char t2[] = "00000-00000.COM";
+ int res1;
+ int res2;
+
+ setlocale (LC_ALL, "en_US.ISO-8859-1");
+
+ res1 = strcoll (t1, t2);
+ printf ("strcoll (\"%s\", \"%s\") = %d\n", t1, t2, res1);
+ res2 = strcoll (t2, t1);
+ printf ("strcoll (\"%s\", \"%s\") = %d\n", t2, t1, res2);
+
+ return ((res1 == 0 && res2 != 0)
+ || (res1 != 0 && res2 == 0)
+ || (res1 < 0 && res2 < 0)
+ || (res1 > 0 && res2 > 0));
+}
diff --git a/test/string/bug-strncat1.c b/test/string/bug-strncat1.c
new file mode 100644
index 000000000..f1b5c37c5
--- /dev/null
+++ b/test/string/bug-strncat1.c
@@ -0,0 +1,31 @@
+/* Test case by Joseph S. Myers <jsm28@cam.ac.uk>. */
+#undef __USE_STRING_INLINES
+#define __USE_STRING_INLINES
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+char d[3] = "\0\1\2";
+
+int
+main (void)
+{
+ strncat (d, "\5\6", 1);
+ if (d[0] != '\5')
+ {
+ puts ("d[0] != '\\5'");
+ exit (1);
+ }
+ if (d[1] != '\0')
+ {
+ puts ("d[1] != '\\0'");
+ exit (1);
+ }
+ if (d[2] != '\2')
+ {
+ puts ("d[2] != '\\2'");
+ exit (1);
+ }
+
+ return 0;
+}
diff --git a/test/string/bug-strpbrk1.c b/test/string/bug-strpbrk1.c
new file mode 100644
index 000000000..28238b0f5
--- /dev/null
+++ b/test/string/bug-strpbrk1.c
@@ -0,0 +1,19 @@
+/* Test case by Joseph S. Myers <jsm28@cam.ac.uk>. */
+#undef __USE_STRING_INLINES
+#define __USE_STRING_INLINES
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+int
+main (void)
+{
+ const char *a = "abc";
+ const char *b = a;
+
+ strpbrk (b++, "");
+ if (b != a + 1)
+ return 1;
+
+ return 0;
+}
diff --git a/test/string/bug-strspn1.c b/test/string/bug-strspn1.c
new file mode 100644
index 000000000..a657bafc4
--- /dev/null
+++ b/test/string/bug-strspn1.c
@@ -0,0 +1,19 @@
+/* Test case by Joseph S. Myers <jsm28@cam.ac.uk>. */
+#undef __USE_STRING_INLINES
+#define __USE_STRING_INLINES
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+int
+main (void)
+{
+ const char *a = "abc";
+ const char *b = a;
+
+ strspn (b++, "");
+ if (b != a + 1)
+ return 1;
+
+ return 0;
+}
diff --git a/test/string/stratcliff.c b/test/string/stratcliff.c
new file mode 100644
index 000000000..41e774681
--- /dev/null
+++ b/test/string/stratcliff.c
@@ -0,0 +1,349 @@
+/* Test for string function add boundaries of usable memory.
+ Copyright (C) 1996,1997,1999-2002,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define _GNU_SOURCE 1
+
+/* Make sure we don't test the optimized inline functions if we want to
+ test the real implementation. */
+#undef __USE_STRING_INLINES
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/param.h>
+
+#ifndef MAX
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+#endif
+
+int
+main (int argc, char *argv[])
+{
+ int size = sysconf (_SC_PAGESIZE);
+ char *adr, *dest;
+ int result = 0;
+
+ adr = (char *) mmap (NULL, 3 * size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON, -1, 0);
+ dest = (char *) mmap (NULL, 3 * size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON, -1, 0);
+ if (adr == MAP_FAILED || dest == MAP_FAILED)
+ {
+ if (errno == ENOSYS)
+ puts ("No test, mmap not available.");
+ else
+ {
+ printf ("mmap failed: %s", strerror(errno));
+ result = 1;
+ }
+ }
+ else
+ {
+ int inner, middle, outer;
+
+ mprotect(adr, size, PROT_NONE);
+ mprotect(adr + 2 * size, size, PROT_NONE);
+ adr += size;
+
+ mprotect(dest, size, PROT_NONE);
+ mprotect(dest + 2 * size, size, PROT_NONE);
+ dest += size;
+
+ memset (adr, 'T', size);
+
+ /* strlen test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (inner = MAX (outer, size - 64); inner < size; ++inner)
+ {
+ adr[inner] = '\0';
+
+ if (strlen (&adr[outer]) != (size_t) (inner - outer))
+ {
+ printf ("strlen flunked for outer = %d, inner = %d\n",
+ outer, inner);
+ result = 1;
+ }
+
+ adr[inner] = 'T';
+ }
+ }
+
+ /* strchr test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (middle = MAX (outer, size - 64); middle < size; ++middle)
+ {
+ for (inner = middle; inner < size; ++inner)
+ {
+ char *cp;
+ adr[middle] = 'V';
+ adr[inner] = '\0';
+
+ cp = strchr (&adr[outer], 'V');
+
+ if ((inner == middle && cp != NULL)
+ || (inner != middle
+ && (cp - &adr[outer]) != middle - outer))
+ {
+ printf ("strchr flunked for outer = %d, middle = %d, "
+ "inner = %d\n", outer, middle, inner);
+ result = 1;
+ }
+
+ adr[inner] = 'T';
+ adr[middle] = 'T';
+ }
+ }
+ }
+
+ /* Special test. */
+ adr[size - 1] = '\0';
+ if (strchr (&adr[size - 1], '\n') != NULL)
+ {
+ puts ("strchr flunked for test of empty string at end of page");
+ result = 1;
+ }
+
+ /* strrchr test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (middle = MAX (outer, size - 64); middle < size; ++middle)
+ {
+ for (inner = middle; inner < size; ++inner)
+ {
+ char *cp;
+ adr[middle] = 'V';
+ adr[inner] = '\0';
+
+ cp = strrchr (&adr[outer], 'V');
+
+ if ((inner == middle && cp != NULL)
+ || (inner != middle
+ && (cp - &adr[outer]) != middle - outer))
+ {
+ printf ("strrchr flunked for outer = %d, middle = %d, "
+ "inner = %d\n", outer, middle, inner);
+ result = 1;
+ }
+
+ adr[inner] = 'T';
+ adr[middle] = 'T';
+ }
+ }
+ }
+
+ /* rawmemchr test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (middle = MAX (outer, size - 64); middle < size; ++middle)
+ {
+ char *cp;
+ adr[middle] = 'V';
+
+ cp = rawmemchr (&adr[outer], 'V');
+
+ if (cp - &adr[outer] != middle - outer)
+ {
+ printf ("rawmemchr flunked for outer = %d, middle = %d\n",
+ outer, middle);
+ result = 1;
+ }
+
+ adr[middle] = 'T';
+ }
+ }
+
+ /* strcpy test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (inner = MAX (outer, size - 64); inner < size; ++inner)
+ {
+ adr[inner] = '\0';
+
+ if (strcpy (dest, &adr[outer]) != dest
+ || strlen (dest) != (size_t) (inner - outer))
+ {
+ printf ("strcpy flunked for outer = %d, inner = %d\n",
+ outer, inner);
+ result = 1;
+ }
+
+ adr[inner] = 'T';
+ }
+ }
+
+ /* strncpy tests */
+ adr[size-1] = 'T';
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ size_t len;
+
+ for (len = 0; len < size - outer; ++len)
+ {
+ if (strncpy (dest, &adr[outer], len) != dest
+ || memcmp (dest, &adr[outer], len) != 0)
+ {
+ printf ("outer strncpy flunked for outer = %d, len = %Zd\n",
+ outer, len);
+ result = 1;
+ }
+ }
+ }
+ adr[size-1] = '\0';
+
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (inner = MAX (outer, size - 64); inner < size; ++inner)
+ {
+ size_t len;
+
+ adr[inner] = '\0';
+
+ for (len = 0; len < size - outer + 64; ++len)
+ {
+ if (strncpy (dest, &adr[outer], len) != dest
+ || memcmp (dest, &adr[outer],
+ MIN (inner - outer, len)) != 0
+ || (inner - outer < len
+ && strlen (dest) != (inner - outer)))
+ {
+ printf ("strncpy flunked for outer = %d, inner = %d, len = %Zd\n",
+ outer, inner, len);
+ result = 1;
+ }
+ if (strncpy (dest + 1, &adr[outer], len) != dest + 1
+ || memcmp (dest + 1, &adr[outer],
+ MIN (inner - outer, len)) != 0
+ || (inner - outer < len
+ && strlen (dest + 1) != (inner - outer)))
+ {
+ printf ("strncpy+1 flunked for outer = %d, inner = %d, len = %Zd\n",
+ outer, inner, len);
+ result = 1;
+ }
+ }
+
+ adr[inner] = 'T';
+ }
+ }
+
+ /* stpcpy test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (inner = MAX (outer, size - 64); inner < size; ++inner)
+ {
+ adr[inner] = '\0';
+
+ if ((stpcpy (dest, &adr[outer]) - dest) != inner - outer)
+ {
+ printf ("stpcpy flunked for outer = %d, inner = %d\n",
+ outer, inner);
+ result = 1;
+ }
+
+ adr[inner] = 'T';
+ }
+ }
+
+ /* stpncpy test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ {
+ for (middle = MAX (outer, size - 64); middle < size; ++middle)
+ {
+ adr[middle] = '\0';
+
+ for (inner = 0; inner < size - outer; ++ inner)
+ {
+ if ((stpncpy (dest, &adr[outer], inner) - dest)
+ != MIN (inner, middle - outer))
+ {
+ printf ("stpncpy flunked for outer = %d, middle = %d, "
+ "inner = %d\n", outer, middle, inner);
+ result = 1;
+ }
+ }
+
+ adr[middle] = 'T';
+ }
+ }
+
+ /* memcpy test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ for (inner = 0; inner < size - outer; ++inner)
+ if (memcpy (dest, &adr[outer], inner) != dest)
+ {
+ printf ("memcpy flunked for outer = %d, inner = %d\n",
+ outer, inner);
+ result = 1;
+ }
+
+ /* mempcpy test */
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ for (inner = 0; inner < size - outer; ++inner)
+ if (mempcpy (dest, &adr[outer], inner) != dest + inner)
+ {
+ printf ("mempcpy flunked for outer = %d, inner = %d\n",
+ outer, inner);
+ result = 1;
+ }
+
+ /* memccpy test */
+ memset (adr, '\0', size);
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ for (inner = 0; inner < size - outer; ++inner)
+ if (memccpy (dest, &adr[outer], '\1', inner) != NULL)
+ {
+ printf ("memccpy flunked full copy for outer = %d, inner = %d\n",
+ outer, inner);
+ result = 1;
+ }
+ for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
+ for (middle = 0; middle < size - outer; ++middle)
+ {
+ memset (dest, '\2', middle + 1);
+ for (inner = 0; inner < middle; ++inner)
+ {
+ adr[outer + inner] = '\1';
+
+ if (memccpy (dest, &adr[outer], '\1', middle + 128)
+ != dest + inner + 1)
+ {
+ printf ("\
+memccpy flunked partial copy for outer = %d, middle = %d, inner = %d\n",
+ outer, middle, inner);
+ result = 1;
+ }
+ else if (dest[inner + 1] != '\2')
+ {
+ printf ("\
+memccpy copied too much for outer = %d, middle = %d, inner = %d\n",
+ outer, middle, inner);
+ result = 1;
+ }
+ adr[outer + inner] = '\0';
+ }
+ }
+ }
+
+ return result;
+}
diff --git a/test/string/test-ffs.c b/test/string/test-ffs.c
new file mode 100644
index 000000000..86e11758d
--- /dev/null
+++ b/test/string/test-ffs.c
@@ -0,0 +1,66 @@
+/* Copyright (C) 1994, 1997, 2000, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Joel Sherrill (jsherril@redstone-emh2.army.mil),
+ On-Line Applications Research Corporation.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+int
+main (void)
+{
+ int failures = 0;
+ int i;
+
+ auto void try (const char *name, long long int param, int value,
+ int expected);
+
+ void try (const char *name, long long int param, int value, int expected)
+ {
+ if (value != expected)
+ {
+ printf ("%s(%#llx) expected %d got %d\n",
+ name, param, expected, value);
+ ++failures;
+ }
+ else
+ printf ("%s(%#llx) as expected %d\n", name, param, value);
+ }
+
+#define TEST(fct, type) \
+ try (#fct, 0, fct ((type) 0), 0); \
+ for (i=0 ; i < 8 * sizeof (type); i++) \
+ try (#fct, 1ll << i, fct (((type) 1) << i), i + 1); \
+ for (i=0 ; i < 8 * sizeof (type) ; i++) \
+ try (#fct, (~((type) 0) >> i) << i, fct ((~((type) 0) >> i) << i), i + 1);\
+ try (#fct, 0x80008000, fct ((type) 0x80008000), 16)
+
+ TEST (ffs, int);
+/* Not implemented in uClibc (yet?)
+ TEST (ffsl, long int);
+ TEST (ffsll, long long int);
+*/
+
+ if (failures)
+ printf ("Test FAILED! %d failure%s.\n", failures, &"s"[failures == 1]);
+ else
+ puts ("Test succeeded.");
+
+ return failures;
+}
diff --git a/test/string/testcopy.c b/test/string/testcopy.c
index 02d193779..60039f790 100644
--- a/test/string/testcopy.c
+++ b/test/string/testcopy.c
@@ -1,29 +1,29 @@
-/* Copyright (C) 1990, 1991, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1990, 1991, 1992, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
Contributed by Torbjorn Granlund (tege@sics.se).
-This file is part of the GNU C Library.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+ The GNU C Library 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
+ Lesser General Public License for more details.
-The GNU C Library 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <malloc.h>
-int main(int argc, char **argv)
+int
+main (void)
{
char *mem, *memp;
char *rand_mem;
@@ -46,7 +46,7 @@ int main(int argc, char **argv)
{
int x;
do
- x = rand ();
+ x = random ();
while (x == 0);
rand_mem[i] = x;
}
diff --git a/test/string/string.c b/test/string/tester.c
index 60caddf99..f89cf01fa 100644
--- a/test/string/string.c
+++ b/test/string/tester.c
@@ -1,5 +1,5 @@
/* Tester for string functions.
- Copyright (C) 1995-2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1995-2001, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -34,6 +34,12 @@
#include <strings.h>
#include <fcntl.h>
+#ifdef __UCLIBC__
+# define __TEST_BSD_FUNCS__
+#else
+# undef __TEST_BSD_FUNCS__
+#endif
+
#define STREQ(a, b) (strcmp((a), (b)) == 0)
const char *it = "<UNSET>"; /* Routine name for message routines. */
@@ -84,8 +90,8 @@ test_strcmp (void)
int k;
for (k = 0; k < 0x3f; k++)
{
- buf1[j] = '0' ^ (k & 4);
- buf2[j] = '4' ^ (k & 4);
+ buf1[k] = '0' ^ (k & 4);
+ buf2[k] = '4' ^ (k & 4);
}
buf1[i] = buf1[0x3f] = 0;
buf2[j] = buf2[0x3f] = 0;
@@ -168,6 +174,12 @@ test_strcpy (void)
SIMPLE_COPY(strcpy, 14, "44444444444444", 55);
SIMPLE_COPY(strcpy, 15, "555555555555555", 56);
SIMPLE_COPY(strcpy, 16, "6666666666666666", 57);
+
+ /* Simple test using implicitly coerced `void *' arguments. */
+ const void *src = "frobozz";
+ void *dst = one;
+ check (strcpy (dst, src) == dst, 1);
+ equal (dst, "frobozz", 2);
}
static void
@@ -343,6 +355,53 @@ test_strncat (void)
}
static void
+test_strlcat (void)
+{
+#ifdef __TEST_BSD_FUNCS__
+ /* First test it as strcat, with big counts, then test the count
+ mechanism. */
+ it = "strlcat";
+ (void) strcpy (one, "ijk");
+ check (strlcat (one, "lmn", 99) == 6, 1); /* Returned value. */
+ equal (one, "ijklmn", 2); /* Basic test. */
+
+ (void) strcpy (one, "x");
+ (void) strlcat (one, "yz", 99);
+ equal (one, "xyz", 3); /* Writeover. */
+ equal (one+4, "mn", 4); /* Wrote too much? */
+
+ (void) strcpy (one, "gh");
+ (void) strcpy (two, "ef");
+ (void) strlcat (one, two, 99);
+ equal (one, "ghef", 5); /* Basic test encore. */
+ equal (two, "ef", 6); /* Stomped on source? */
+
+ (void) strcpy (one, "");
+ (void) strlcat (one, "", 99);
+ equal (one, "", 7); /* Boundary conditions. */
+ (void) strcpy (one, "ab");
+ (void) strlcat (one, "", 99);
+ equal (one, "ab", 8);
+ (void) strcpy (one, "");
+ (void) strlcat (one, "cd", 99);
+ equal (one, "cd", 9);
+
+ (void) strcpy (one, "ab");
+ (void) strlcat (one, "cdef", 2);
+ equal (one, "ab", 10); /* Count-limited. */
+
+ (void) strlcat (one, "gh", 0);
+ equal (one, "ab", 11); /* Zero count. */
+
+ (void) strlcat (one, "gh", 4);
+ equal (one, "abg", 12); /* Count and length equal. */
+
+ (void) strlcat (one, "ij", (size_t)-1); /* set sign bit in count */
+ equal (one, "abgij", 13);
+#endif
+}
+
+static void
test_strncmp (void)
{
/* First test as strcmp with big counts, then test count code. */
@@ -360,7 +419,7 @@ test_strncmp (void)
check (strncmp ("abce", "abc", 3) == 0, 11); /* Count == length. */
check (strncmp ("abcd", "abce", 4) < 0, 12); /* Nudging limit. */
check (strncmp ("abc", "def", 0) == 0, 13); /* Zero count. */
- check (strncmp ("abc", "", (size_t)-1) > 0, 14); /* set sign bit in count */
+ check (strncmp ("abc", "", (size_t)-1) > 0, 14); /* set sign bit in count */
check (strncmp ("abc", "abc", (size_t)-2) == 0, 15);
}
@@ -407,6 +466,50 @@ test_strncpy (void)
}
static void
+test_strlcpy (void)
+{
+#ifdef __TEST_BSD_FUNCS__
+ /* Testing is a bit different because of odd semantics. */
+ it = "strlcpy";
+ check (strlcpy (one, "abc", sizeof(one)) == 3, 1); /* Returned value. */
+ equal (one, "abc", 2); /* Did the copy go right? */
+
+ (void) strcpy (one, "abcdefgh");
+ (void) strlcpy (one, "xyz", 2);
+ equal (one, "x\0cdefgh", 3); /* Copy cut by count. */
+
+ (void) strcpy (one, "abcdefgh");
+ (void) strlcpy (one, "xyz", 3); /* Copy cut just before NUL. */
+ equal (one, "xy\0defgh", 4);
+
+ (void) strcpy (one, "abcdefgh");
+ (void) strlcpy (one, "xyz", 4); /* Copy just includes NUL. */
+ equal (one, "xyz", 5);
+ equal (one+4, "efgh", 6); /* Wrote too much? */
+
+ (void) strcpy (one, "abcdefgh");
+ (void) strlcpy (one, "xyz", 5); /* Copy includes padding. */
+ equal (one, "xyz", 7);
+ equal (one+3, "", 8);
+ equal (one+4, "efgh", 9);
+
+ (void) strcpy (one, "abc");
+ (void) strlcpy (one, "xyz", 0); /* Zero-length copy. */
+ equal (one, "abc", 10);
+
+ (void) strlcpy (one, "", 2); /* Zero-length source. */
+ equal (one, "", 11);
+ equal (one+1, "bc", 12);
+ equal (one+2, "c", 13);
+
+ (void) strcpy (one, "hi there");
+ (void) strlcpy (two, one, 9);
+ equal (two, "hi there", 14); /* Just paranoia. */
+ equal (one, "hi there", 15); /* Stomped on source? */
+#endif
+}
+
+static void
test_strlen (void)
{
it = "strlen";
@@ -433,7 +536,7 @@ test_strnlen (void)
it = "strnlen";
check (strnlen ("", 10) == 0, 1); /* Empty. */
check (strnlen ("a", 10) == 1, 2); /* Single char. */
- check (strnlen ("abcd", 10) == 4, 3); /* Multiple chars. */
+ check (strnlen ("abcd", 10) == 4, 3); /* Multiple chars. */
check (strnlen ("foo", (size_t)-1) == 3, 4); /* limits of n. */
{
@@ -1325,6 +1428,52 @@ test_strerror (void)
check(strerror(ENOENT) != 0, 3);
}
+static void
+test_strcasecmp (void)
+{
+ it = "strcasecmp";
+ /* Note that the locale is "C". */
+ check(strcasecmp("a", "a") == 0, 1);
+ check(strcasecmp("a", "A") == 0, 2);
+ check(strcasecmp("A", "a") == 0, 3);
+ check(strcasecmp("a", "b") < 0, 4);
+ check(strcasecmp("c", "b") > 0, 5);
+ check(strcasecmp("abc", "AbC") == 0, 6);
+ check(strcasecmp("0123456789", "0123456789") == 0, 7);
+ check(strcasecmp("", "0123456789") < 0, 8);
+ check(strcasecmp("AbC", "") > 0, 9);
+ check(strcasecmp("AbC", "A") > 0, 10);
+ check(strcasecmp("AbC", "Ab") > 0, 11);
+ check(strcasecmp("AbC", "ab") > 0, 12);
+}
+
+static void
+test_strncasecmp (void)
+{
+ it = "strncasecmp";
+ /* Note that the locale is "C". */
+ check(strncasecmp("a", "a", 5) == 0, 1);
+ check(strncasecmp("a", "A", 5) == 0, 2);
+ check(strncasecmp("A", "a", 5) == 0, 3);
+ check(strncasecmp("a", "b", 5) < 0, 4);
+ check(strncasecmp("c", "b", 5) > 0, 5);
+ check(strncasecmp("abc", "AbC", 5) == 0, 6);
+ check(strncasecmp("0123456789", "0123456789", 10) == 0, 7);
+ check(strncasecmp("", "0123456789", 10) < 0, 8);
+ check(strncasecmp("AbC", "", 5) > 0, 9);
+ check(strncasecmp("AbC", "A", 5) > 0, 10);
+ check(strncasecmp("AbC", "Ab", 5) > 0, 11);
+ check(strncasecmp("AbC", "ab", 5) > 0, 12);
+ check(strncasecmp("0123456789", "AbC", 0) == 0, 13);
+ check(strncasecmp("AbC", "abc", 1) == 0, 14);
+ check(strncasecmp("AbC", "abc", 2) == 0, 15);
+ check(strncasecmp("AbC", "abc", 3) == 0, 16);
+ check(strncasecmp("AbC", "abcd", 3) == 0, 17);
+ check(strncasecmp("AbC", "abcd", 4) < 0, 18);
+ check(strncasecmp("ADC", "abcd", 1) == 0, 19);
+ check(strncasecmp("ADC", "abcd", 2) > 0, 20);
+}
+
int
main (void)
{
@@ -1348,12 +1497,18 @@ main (void)
/* strncat. */
test_strncat ();
+ /* strlcat. */
+ test_strlcat ();
+
/* strncmp. */
test_strncmp ();
/* strncpy. */
test_strncpy ();
+ /* strlcpy. */
+ test_strlcpy ();
+
/* strlen. */
test_strlen ();
@@ -1438,6 +1593,11 @@ main (void)
/* strerror - VERY system-dependent. */
test_strerror ();
+ /* strcasecmp. Without locale dependencies. */
+ test_strcasecmp ();
+
+ /* strncasecmp. Without locale dependencies. */
+ test_strncasecmp ();
if (errors == 0)
{
@@ -1447,7 +1607,7 @@ main (void)
else
{
status = EXIT_FAILURE;
- printf("%lu errors.\n", (unsigned long)errors);
+ printf("%Zd errors.\n", errors);
}
return status;
diff --git a/test/string/tst-bswap.c b/test/string/tst-bswap.c
new file mode 100644
index 000000000..b2b4ef08d
--- /dev/null
+++ b/test/string/tst-bswap.c
@@ -0,0 +1,74 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <byteswap.h>
+#include <stdio.h>
+
+extern unsigned long long int wash (unsigned long long int a);
+
+int
+main (void)
+{
+ int result = 0;
+
+ /* Test the functions with constant arguments. */
+ if (bswap_16 (0x1234) != 0x3412)
+ {
+ puts ("bswap_16 (constant) flunked");
+ result = 1;
+ }
+ if (bswap_32 (0x12345678) != 0x78563412)
+ {
+ puts ("bswap_32 (constant) flunked");
+ result = 1;
+ }
+ if (bswap_64 (0x1234567890abcdefULL) != 0xefcdab9078563412ULL)
+ {
+ puts ("bswap_64 (constant) flunked");
+ result = 1;
+ }
+
+ /* Test the functions with non-constant arguments. */
+ if (bswap_16 (wash (0x1234)) != 0x3412)
+ {
+ puts ("bswap_16 (non-constant) flunked");
+ result = 1;
+ }
+ if (bswap_32 (wash (0x12345678)) != 0x78563412)
+ {
+ puts ("bswap_32 (non-constant) flunked");
+ result = 1;
+ }
+ if (bswap_64 (wash (0x1234567890abcdefULL)) != 0xefcdab9078563412ULL)
+ {
+ puts ("bswap_64 (non-constant) flunked");
+ result = 1;
+ }
+
+ return result;
+}
+
+
+unsigned long long int
+wash (unsigned long long int a)
+{
+ /* Do nothing. This function simply exists to avoid that the compiler
+ regards the argument to the bswap_*() functions as constant. */
+ return a + 0;
+}
diff --git a/test/string/tst-inlcall.c b/test/string/tst-inlcall.c
new file mode 100644
index 000000000..2a4124ea5
--- /dev/null
+++ b/test/string/tst-inlcall.c
@@ -0,0 +1,83 @@
+/* Tester for calling inline string functions.
+ Copyright (C) 1998, 2000, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+/* Make sure we test the optimized inline functions. */
+#define __USE_STRING_INLINES 1
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <fcntl.h>
+
+
+int
+main (void)
+{
+ int status;
+ int errors = 0;
+ char buf1[1000];
+ char *cp;
+ char ch;
+
+ cp = strcpy (buf1, "hello world");
+ if (strcmp ("hello world", cp++) != 0)
+ {
+ puts ("strcmp test 1 failed");
+ ++errors;
+ }
+
+ cp = buf1;
+ if (strcmp (cp++, "hello world") != 0)
+ {
+ puts ("strcmp test 2 failed");
+ ++errors;
+ }
+
+ ch = 'h';
+ if (strchr ("hello world", ch++) == NULL)
+ {
+ puts ("strchr test 1 failed");
+ ++errors;
+ }
+
+ const char * const hw = "hello world";
+ if (strpbrk (hw, "o") - hw != 4)
+ {
+ puts ("strpbrk test 1 failed");
+ ++errors;
+ }
+
+ if (errors == 0)
+ {
+ status = EXIT_SUCCESS;
+ puts ("No errors.");
+ }
+ else
+ {
+ status = EXIT_FAILURE;
+ printf ("%d errors.\n", errors);
+ }
+ return status;
+}
diff --git a/test/string/tst-strlen.c b/test/string/tst-strlen.c
new file mode 100644
index 000000000..a1e115927
--- /dev/null
+++ b/test/string/tst-strlen.c
@@ -0,0 +1,45 @@
+/* Make sure we don't test the optimized inline functions if we want to
+ test the real implementation. */
+#undef __USE_STRING_INLINES
+
+#include <stdio.h>
+#include <string.h>
+
+int
+main(int argc, char *argv[])
+{
+ static const size_t lens[] = { 0, 1, 0, 2, 0, 1, 0, 3,
+ 0, 1, 0, 2, 0, 1, 0, 4 };
+ char basebuf[24 + 32];
+ size_t base;
+
+ for (base = 0; base < 32; ++base)
+ {
+ char *buf = basebuf + base;
+ size_t words;
+
+ for (words = 0; words < 4; ++words)
+ {
+ size_t last;
+ memset (buf, 'a', words * 4);
+
+ for (last = 0; last < 16; ++last)
+ {
+ buf[words * 4 + 0] = (last & 1) != 0 ? 'b' : '\0';
+ buf[words * 4 + 1] = (last & 2) != 0 ? 'c' : '\0';
+ buf[words * 4 + 2] = (last & 4) != 0 ? 'd' : '\0';
+ buf[words * 4 + 3] = (last & 8) != 0 ? 'e' : '\0';
+ buf[words * 4 + 4] = '\0';
+
+ if (strlen (buf) != words * 4 + lens[last]
+ || strnlen (buf, -1) != words * 4 + lens[last])
+ {
+ printf ("failed for base=%Zu, words=%Zu, and last=%Zu\n",
+ base, words, last);
+ return 1;
+ }
+ }
+ }
+ }
+ return 0;
+}
diff --git a/test/string/tst-strtok.c b/test/string/tst-strtok.c
new file mode 100644
index 000000000..7e34aeefa
--- /dev/null
+++ b/test/string/tst-strtok.c
@@ -0,0 +1,23 @@
+/* Testcase for strtok reported by Andrew Church <achurch@achurch.org>. */
+#include <stdio.h>
+#include <string.h>
+
+int
+main (void)
+{
+ char buf[1] = { 0 };
+ int result = 0;
+
+ if (strtok (buf, " ") != NULL)
+ {
+ puts ("first strtok call did not return NULL");
+ result = 1;
+ }
+ else if (strtok (NULL, " ") != NULL)
+ {
+ puts ("second strtok call did not return NULL");
+ result = 1;
+ }
+
+ return result;
+}
diff --git a/test/string/tst-strxfrm.c b/test/string/tst-strxfrm.c
new file mode 100644
index 000000000..ff1b396be
--- /dev/null
+++ b/test/string/tst-strxfrm.c
@@ -0,0 +1,80 @@
+/* Based on a test case by Paul Eggert. */
+#include <features.h>
+#ifdef __UCLIBC_HAS_XLOCALE__
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+char const string[] = "";
+
+
+static int
+test (const char *locale)
+{
+ size_t bufsize;
+ size_t r;
+ size_t l;
+ char *buf;
+ locale_t loc;
+ int result = 0;
+
+ if (setlocale (LC_COLLATE, locale) == NULL)
+ {
+ printf ("cannot set locale \"%s\"\n", locale);
+ return 1;
+ }
+ bufsize = strxfrm (NULL, string, 0) + 1;
+ buf = malloc (bufsize);
+ if (buf == NULL)
+ {
+ printf ("cannot allocate %zd bytes\n", bufsize);
+ return 1;
+ }
+ r = strxfrm (buf, string, bufsize);
+ l = strlen (buf);
+ if (r != l)
+ {
+ printf ("locale \"%s\": strxfrm returned %zu, strlen returned %zu\n",
+ locale, r, l);
+ result = 1;
+ }
+
+ loc = newlocale (1 << LC_ALL, locale, NULL);
+
+ r = strxfrm_l (buf, string, bufsize, loc);
+ l = strlen (buf);
+ if (r != l)
+ {
+ printf ("locale \"%s\": strxfrm_l returned %zu, strlen returned %zu\n",
+ locale, r, l);
+ result = 1;
+ }
+
+ freelocale (loc);
+
+ free (buf);
+
+ return result;
+}
+
+
+int
+main (void)
+{
+ int result = 0;
+
+ result |= test ("C");
+ result |= test ("en_US.ISO-8859-1");
+ result |= test ("de_DE.UTF-8");
+
+ return result;
+}
+
+#else
+int main(void)
+{
+ return 0;
+}
+#endif
diff --git a/test/termios/Makefile b/test/termios/Makefile
index a65022826..2aa6ccd90 100644
--- a/test/termios/Makefile
+++ b/test/termios/Makefile
@@ -1,52 +1,4 @@
-# Makefile for uClibc
-#
-# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Library General Public License as published by the Free
-# Software Foundation; either version 2 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 Library General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# uClibc termios tests
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
-include ../Rules.mak
-
-TARGETS=termios termios_glibc
-
-all: $(TARGETS)
-
-termios: termios.c Makefile $(TESTDIR)/Rules.mak
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs uClibc: "
- -@ echo " "
- $(CC) $(CFLAGS) -c $< -o $@.o
- $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ls -l $@
- ./$@
- -@ echo " "
-
-termios_glibc: termios.c Makefile
- -@ echo "-------"
- -@ echo " "
- -@ echo "Compiling $@ vs glibc: "
- -@ echo " "
- $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o
- $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@
- $(STRIPTOOL) -x -R .note -R .comment $@
- -$(LDD) $@
- ls -l $@
- ./$@
- -@ echo " "
-
-clean:
- $(RM) *.[oa] *~ core $(TARGETS)
+include ../Test.mak
diff --git a/test/termios/termios.c b/test/termios/termios.c
index 8b3aabc55..5fbc344c0 100644
--- a/test/termios/termios.c
+++ b/test/termios/termios.c
@@ -11,7 +11,7 @@ int main(int argc,char *argv[])
int ret;
printf("TCGETS = 0x%08x\n",TCGETS);
- printf("sizeof(struct termios) = %d\n",sizeof(struct termios));
+ printf("sizeof(struct termios) = %ld\n",(long)sizeof(struct termios));
ret = ioctl(fileno(stdout),TCGETS,&t);
diff --git a/test/test-skeleton.c b/test/test-skeleton.c
index dd5d8041d..22fdd8f98 100644
--- a/test/test-skeleton.c
+++ b/test/test-skeleton.c
@@ -31,6 +31,7 @@
#include <sys/wait.h>
#include <sys/param.h>
#include <time.h>
+#include <features.h>
/* The test function is normally called `do_test' and it is called
with argc and argv as the arguments. We nevertheless provide the
@@ -117,7 +118,7 @@ create_temp_file (const char *base, char **filename)
fd = mkstemp (fname);
if (fd == -1)
{
- printf ("cannot open temporary file '%s': %m\n", fname);
+ printf ("cannot open temporary file '%s': %s\n", fname, strerror(errno));
free (fname);
return -1;
}
@@ -152,7 +153,9 @@ timeout_handler (int sig __attribute__ ((unused)))
nanosleep() call return prematurely, all the better. We
won't restart it since this probably means the child process
finally died. */
- struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 };
+ struct timespec ts;
+ ts.tv_sec = 0;
+ ts.tv_nsec = 100000000;
nanosleep (&ts, NULL);
}
if (killed != 0 && killed != pid)
@@ -191,14 +194,23 @@ timeout_handler (int sig __attribute__ ((unused)))
int
main (int argc, char *argv[])
{
+#ifdef __ARCH_USE_MMU__
int direct = 0; /* Directly call the test function? */
+#else
+ int direct = 1;
+#endif
int status;
int opt;
unsigned int timeoutfactor = 1;
pid_t termpid;
/* Make uses of freed and uninitialized memory known. */
+#ifdef __MALLOC_STANDARD__
+#ifndef M_PERTURB
+# define M_PERTURB -6
+#endif
mallopt (M_PERTURB, 42);
+#endif
#ifdef STDOUT_UNBUFFERED
setbuf (stdout, NULL);
@@ -276,6 +288,7 @@ main (int argc, char *argv[])
- set up the timer
- fork and execute the function. */
+#if defined __ARCH_USE_MMU__ || ! defined __UCLIBC__
pid = fork ();
if (pid == 0)
{
@@ -313,6 +326,7 @@ main (int argc, char *argv[])
exit (TEST_FUNCTION);
}
else if (pid < 0)
+#endif
{
perror ("Cannot fork test program");
exit (1);
@@ -330,7 +344,7 @@ main (int argc, char *argv[])
termpid = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0));
if (termpid == -1)
{
- printf ("Waiting for test program failed: %m\n");
+ printf ("Waiting for test program failed: %s\n", strerror(errno));
exit (1);
}
if (termpid != pid)
diff --git a/test/testsuite.h b/test/testsuite.h
index 3465d328e..c45876831 100644
--- a/test/testsuite.h
+++ b/test/testsuite.h
@@ -1,25 +1,9 @@
/* vi: set sw=4 ts=4: */
/*
* Some simple macros for use in test applications.
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
*
- * Copyright (C) 2000 by Lineo, inc. and Erik Andersen
- * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
- * Written by Erik Andersen <andersen@uclibc.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 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 Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#ifndef TESTSUITE_H
@@ -45,13 +29,13 @@ void error_msg(int result, int line, const char* file, const char* command)
printf("\nFAILED TEST %lu: \n\t%s\n", (unsigned long)test_number, command);
printf("AT LINE: %d, FILE: %s\n\n", line, file);
-}
+}
void success_msg(int result, const char* command)
{
#if 0
printf("passed test: %s == 0\n", command);
-#endif
+#endif
}
void done_testing(void)
@@ -70,7 +54,9 @@ void init_testsuite(const char* testname)
printf("%s", testname);
test_number = 0;
failures = 0;
+#if !defined(__UCLIBC__) || defined(__UCLIBC_DYNAMIC_ATEXIT__)
atexit(done_testing);
+#endif
}
#endif /* __NO_TESTCODE__ */
@@ -110,5 +96,5 @@ void init_testsuite(const char* testname)
} while (0)
#define STR_CMD(cmd) cmd
-
+
#endif /* TESTSUITE_H */
diff --git a/test/time/Makefile b/test/time/Makefile
index bb2a2b5bb..237082d3c 100644
--- a/test/time/Makefile
+++ b/test/time/Makefile
@@ -1,5 +1,5 @@
# uClibc time tests
-# Licensed under the GNU Library General Public License, see COPYING.LIB
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
TESTS_DISABLED := bug-asctime bug-asctime_r time tst-mktime2 tst-posixtz \
tst-strftime tst-strptime tst-timezone
diff --git a/test/unistd/Makefile b/test/unistd/Makefile
index 3640d7c6a..c5007cdcc 100644
--- a/test/unistd/Makefile
+++ b/test/unistd/Makefile
@@ -1,10 +1,13 @@
# uClibc unistd tests
-# Licensed under the GNU Library General Public License, see COPYING.LIB
-
-TESTS = clone errno fork getcwd getopt getopt_long preadwrite tstgetopt vfork
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
include ../Test.mak
-export OPTS_getopt = -abcXXX -9
-export OPTS_getopt_long = --add XXX --delete YYY --verbose
-export OPTS_tstgetopt = -a -b -cfoobar --required foobar --optional=bazbug --none random --col --color --colour
+OPTS_getopt := -abcXXX -9
+OPTS_getopt_long := --add XXX --delete YYY --verbose
+ifeq ($(UCLIBC_HAS_GNU_GETOPT),y)
+OPTS_tstgetopt := -a -b -cfoobar --required foobar --optional=bazbug --none random --col --color --colour
+else
+# reordering is not supported, behaves as if POSIXLY_CORRECT would be set
+OPTS_tstgetopt := -a -b -cfoobar --required foobar --optional=bazbug --none --colou --color --colour random
+endif
diff --git a/test/unistd/clone.c b/test/unistd/clone.c
index 6d9aa6873..bc08c94bf 100644
--- a/test/unistd/clone.c
+++ b/test/unistd/clone.c
@@ -1,25 +1,9 @@
/* vi: set sw=4 ts=4: */
/*
* clone test for uClibc
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
*
- * Copyright (C) 2000 by Lineo, inc. and Erik Andersen
- * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
- * Written by Erik Andersen <andersen@uclibc.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 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 Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#include <stdio.h>
@@ -28,6 +12,7 @@
#include <signal.h>
#include <sched.h>
#include <sys/wait.h>
+#include "clone_cruft.h"
#define GOT1 (1 << 1)
#define GOT2 (1 << 2)
@@ -48,7 +33,7 @@ int clone_main(void *arg)
return input + 20;
}
-int main(void)
+int main(void)
{
int clone1, clone2, clone3;
char clone1_stack[8192], clone2_stack[8192], clone3_stack[8192];
@@ -56,15 +41,15 @@ int main(void)
signal(SIGCHLD, child_handler);
- if ((clone1 = clone(clone_main, clone1_stack, 0, (void*)11)) == -1) {
+ if ((clone1 = do_clone(clone_main, clone1_stack, 0, (void*)11)) == -1) {
perror("Clone 1 failed");
exit(-1);
}
- if ((clone2 = clone(clone_main, clone2_stack, 0, (void*)22)) == -1) {
+ if ((clone2 = do_clone(clone_main, clone2_stack, 0, (void*)22)) == -1) {
perror("Clone 2 failed");
exit(-2);
}
- if ((clone3 = clone(clone_main, clone3_stack, 0, (void*)33)) == -1) {
+ if ((clone3 = do_clone(clone_main, clone3_stack, 0, (void*)33)) == -1) {
perror("Clone 3 failed");
exit(-3);
}
diff --git a/test/unistd/clone_cruft.h b/test/unistd/clone_cruft.h
new file mode 100644
index 000000000..b6a395d06
--- /dev/null
+++ b/test/unistd/clone_cruft.h
@@ -0,0 +1,24 @@
+/* because people like to make things difficult */
+
+#undef do_clone
+
+#define crappy_sizeof(s) (s == NULL ? 0 : sizeof(s))
+
+#if defined __ia64__
+
+extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
+ size_t __child_stack_size, int __flags, void *__arg, ...);
+# define do_clone(fn, stack, flags, arg) \
+ __clone2(fn, stack, crappy_sizeof(stack), flags, arg, NULL, NULL, NULL)
+
+#elif defined __hppa__
+
+# define do_clone(fn, stack, flags, arg) \
+ clone(fn, stack, flags, arg)
+
+#else
+
+# define do_clone(fn, stack, flags, arg) \
+ clone(fn, stack+crappy_sizeof(stack), flags, arg)
+
+#endif
diff --git a/test/unistd/errno.c b/test/unistd/errno.c
index cb082b890..c77f58aa2 100644
--- a/test/unistd/errno.c
+++ b/test/unistd/errno.c
@@ -4,6 +4,7 @@
#include <stdlib.h>
#include <errno.h>
#include <sched.h>
+#include "clone_cruft.h"
int child_fn(void *arg)
{
@@ -15,7 +16,7 @@ int main(void)
{
int r_clone, ret_errno;
- r_clone = clone(child_fn, NULL, (int) NULL, NULL);
+ r_clone = do_clone(child_fn, NULL, (int) NULL, NULL);
ret_errno = errno;
if (ret_errno != EINVAL || r_clone != -1) {
fprintf(stderr, "clone: res=%d (wanted -1) errno=%d (wanted %d)\n",
diff --git a/test/unistd/fork.c b/test/unistd/fork.c
index da4f2688d..b163c0ef9 100644
--- a/test/unistd/fork.c
+++ b/test/unistd/fork.c
@@ -1,25 +1,9 @@
/* vi: set sw=4 ts=4: */
/*
* fork test for uClibc
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
*
- * Copyright (C) 2000 by Lineo, inc. and Erik Andersen
- * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
- * Written by Erik Andersen <andersen@uclibc.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 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 Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#include <stdio.h>
@@ -32,12 +16,14 @@
#define GOT2 (1 << 2)
#define GOT3 (1 << 3)
+#ifdef __ARCH_USE_MMU__
+
void child_handler(int sig)
{
fprintf(stderr, "I got a SIGCHLD\n");
}
-int main(void)
+int main(void)
{
pid_t pid1, pid2, pid3;
int status, result, wpid;
@@ -86,6 +72,16 @@ int main(void)
return EXIT_SUCCESS;
}
+#else
+
+int main(void)
+{
+ printf("Skipping test on non-mmu host!\n");
+ return EXIT_SUCCESS;
+}
+
+#endif
+
/*
Local Variables:
c-file-style: "linux"
diff --git a/test/unistd/getcwd.c b/test/unistd/getcwd.c
index 455a9da69..bcecec7be 100644
--- a/test/unistd/getcwd.c
+++ b/test/unistd/getcwd.c
@@ -1,32 +1,16 @@
/* vi: set sw=4 ts=4: */
/*
* fork test for uClibc
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
*
- * Copyright (C) 2000 by Lineo, inc. and Erik Andersen
- * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
- * Written by Erik Andersen <andersen@uclibc.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 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 Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-int main(void)
+int main(void)
{
char *foo;
char junk[12];
diff --git a/test/unistd/preadwrite.c b/test/unistd/preadwrite.c
deleted file mode 100644
index cfc8635b9..000000000
--- a/test/unistd/preadwrite.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/* Tests for pread and pwrite.
- Copyright (C) 1998, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#define _GNU_SOURCE
-#include <stdlib.h>
-#include <stdio.h>
-#include <search.h>
-#include <errno.h>
-#include <error.h>
-#include <string.h>
-#include <unistd.h>
-
-#define TESTFILE_NAME "CRAP.XXXXXX"
-#define STRINGIFY(s) STRINGIFY2 (s)
-#define STRINGIFY2(s) #s
-
-/* These are for the temporary file we generate. */
-char *name;
-int fd;
-
-
-/* Test the 32-bit versions first. */
-#define PREAD pread
-#define PWRITE pwrite
-
-int test(int argc, char *argv[])
-{
- char buf[1000];
- char res[1000];
- int i;
-
- memset (buf, '\0', sizeof (buf));
- memset (res, '\xff', sizeof (res));
-
- if (write (fd, buf, sizeof (buf)) != sizeof (buf))
- error (EXIT_FAILURE, errno, "during write");
-
- for (i = 100; i < 200; ++i)
- buf[i] = i;
- if (PWRITE (fd, buf + 100, 100, 100) != 100)
- error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PWRITE));
-
- for (i = 450; i < 600; ++i)
- buf[i] = i;
- if (PWRITE (fd, buf + 450, 150, 450) != 150)
- error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PWRITE));
-
- if (PREAD (fd, res, sizeof (buf) - 50, 50) != sizeof (buf) - 50)
- error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PREAD));
-
- close (fd);
- unlink (name);
- return memcmp (buf + 50, res, sizeof (buf) - 50);
-}
-
-/* Test the 64-bit versions as well. */
-#if defined __UCLIBC_HAS_LFS__
-
-#undef PREAD
-#undef PWRITE
-#define PREAD pread64
-#define PWRITE pwrite64
-
-
-int test64(int argc, char *argv[])
-{
- char buf[1000];
- char res[1000];
- int i;
-
- memset (buf, '\0', sizeof (buf));
- memset (res, '\xff', sizeof (res));
-
- if (write (fd, buf, sizeof (buf)) != sizeof (buf))
- error (EXIT_FAILURE, errno, "during write");
-
- for (i = 100; i < 200; ++i)
- buf[i] = i;
- if (PWRITE (fd, buf + 100, 100, 100) != 100)
- error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PWRITE));
-
- for (i = 450; i < 600; ++i)
- buf[i] = i;
- if (PWRITE (fd, buf + 450, 150, 450) != 150)
- error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PWRITE));
-
- if (PREAD (fd, res, sizeof (buf) - 50, 50) != sizeof (buf) - 50)
- error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PREAD));
-
- close (fd);
- unlink (name);
- return memcmp (buf + 50, res, sizeof (buf) - 50);
-}
-#endif
-
-void prepare(void)
-{
- if (!name) {
- name = malloc (BUFSIZ);
- if (name == NULL)
- error (EXIT_FAILURE, errno, "cannot allocate file name");
- }
- strncpy(name, TESTFILE_NAME, BUFSIZ);
-
- /* Open our test file. */
- fd = mkstemp (name);
- if (fd == -1)
- error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
-}
-
-int main (int argc, char **argv)
-{
- int result = 0;
-
- prepare();
- result+=test(argc, argv);
- if (result) {
- fprintf(stderr, "pread/pwrite test failed.\n");
- return(EXIT_FAILURE);
- }
- fprintf(stderr, "pread/pwrite test successful.\n");
-
-#if defined __UCLIBC_HAS_LFS__
- prepare();
- result+=test64(argc, argv);
- if (result) {
- fprintf(stderr, "pread64/pwrite64 test failed.\n");
- return(EXIT_FAILURE);
- }
- fprintf(stderr, "pread64/pwrite64 test successful.\n");
-#endif
- return(EXIT_SUCCESS);
-}
diff --git a/test/unistd/tst-preadwrite.c b/test/unistd/tst-preadwrite.c
new file mode 100644
index 000000000..281044858
--- /dev/null
+++ b/test/unistd/tst-preadwrite.c
@@ -0,0 +1,105 @@
+/* Tests for pread and pwrite.
+ Copyright (C) 1998, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <errno.h>
+#include <error.h>
+#include <string.h>
+#include <unistd.h>
+
+
+/* Allow testing of the 64-bit versions as well. */
+#ifndef PREAD
+# define PREAD pread
+# define PWRITE pwrite
+#endif
+
+#define STRINGIFY(s) STRINGIFY2 (s)
+#define STRINGIFY2(s) #s
+
+/* Prototype for our test function. */
+extern void do_prepare (int argc, char *argv[]);
+extern int do_test (int argc, char *argv[]);
+
+/* We have a preparation function. */
+#define PREPARE do_prepare
+
+/* We might need a bit longer timeout. */
+#define TIMEOUT 20 /* sec */
+
+/* This defines the `main' function and some more. */
+#include <test-skeleton.c>
+
+/* These are for the temporary file we generate. */
+char *name;
+int fd;
+
+void
+do_prepare (int argc, char *argv[])
+{
+ char name_len;
+
+#define FNAME FNAME2(TRUNCATE)
+#define FNAME2(s) "/" STRINGIFY(s) "XXXXXX"
+
+ name_len = strlen (test_dir);
+ name = malloc (name_len + sizeof (FNAME));
+ if (name == NULL)
+ error (EXIT_FAILURE, errno, "cannot allocate file name");
+ mempcpy (mempcpy (name, test_dir, name_len), FNAME, sizeof (FNAME));
+ add_temp_file (name);
+
+ /* Open our test file. */
+ fd = mkstemp (name);
+ if (fd == -1)
+ error (EXIT_FAILURE, errno, "cannot open test file `%s'", name);
+}
+
+
+int
+do_test (int argc, char *argv[])
+{
+ char buf[1000];
+ char res[1000];
+ int i;
+
+ memset (buf, '\0', sizeof (buf));
+ memset (res, '\xff', sizeof (res));
+
+ if (write (fd, buf, sizeof (buf)) != sizeof (buf))
+ error (EXIT_FAILURE, errno, "during write");
+
+ for (i = 100; i < 200; ++i)
+ buf[i] = i;
+ if (PWRITE (fd, buf + 100, 100, 100) != 100)
+ error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PWRITE));
+
+ for (i = 450; i < 600; ++i)
+ buf[i] = i;
+ if (PWRITE (fd, buf + 450, 150, 450) != 150)
+ error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PWRITE));
+
+ if (PREAD (fd, res, sizeof (buf) - 50, 50) != sizeof (buf) - 50)
+ error (EXIT_FAILURE, errno, "during %s", STRINGIFY (PREAD));
+
+ close (fd);
+ unlink (name);
+
+ return memcmp (buf + 50, res, sizeof (buf) - 50);
+}
diff --git a/test/unistd/tst-preadwrite64.c b/test/unistd/tst-preadwrite64.c
new file mode 100644
index 000000000..57098e864
--- /dev/null
+++ b/test/unistd/tst-preadwrite64.c
@@ -0,0 +1,24 @@
+/* Tests for pread64 and pwrite64.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#define PREAD pread64
+#define PWRITE pwrite64
+
+#include "tst-preadwrite.c"
diff --git a/test/unistd/vfork.c b/test/unistd/vfork.c
index 6239e3f02..295583945 100644
--- a/test/unistd/vfork.c
+++ b/test/unistd/vfork.c
@@ -1,24 +1,9 @@
/* vi: set sw=4 ts=4: */
/*
* vfork test for uClibc
+ * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org>
*
- * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
- * Written by Erik Andersen <andersen@uclibc.org>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 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 Library General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#include <stdio.h>
@@ -28,7 +13,7 @@
#include <sys/types.h>
-int main(void)
+int main(void)
{
pid_t pid;
int status, wpid;