diff options
Diffstat (limited to 'test')
546 files changed, 70523 insertions, 968 deletions
diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 000000000..0d19285e9 --- /dev/null +++ b/test/.gitignore @@ -0,0 +1,334 @@ +# +# Never ignore these +# +!.gitignore +# +# Generated files +# +*.out +# +# Executable test +# +*_glibc +argp/argp-ex[1-4] +argp/argp-test +argp/bug-argp1 +argp/tst-argp[12] +args/arg_test +assert/assert +crypt/crypt +crypt/md5c-test +crypt/sha256c-test +crypt/sha512c-test +ctype/ctype +dlopen/dladdr +dlopen/dlafk +dlopen/dlstatic +dlopen/dltest +dlopen/dltest2 +dlopen/dlundef +dlopen/libafk.so +dlopen/libafk-temp.so +dlopen/libA.so +dlopen/libB.so +dlopen/libC.so +dlopen/libstatic.so +dlopen/libtest[123].so +dlopen/libtest.so +dlopen/libundef.so +dlopen/test[1-3] +dlopen/testscope +inet/bug-if1 +inet/gethost_r-align +inet/gethostid +inet/getnetent +inet/if_nameindex +inet/tst-aton +inet/tst-ether_aton +inet/tst-ethers +inet/tst-ethers-line +inet/tst-network +inet/tst-ntoa +inet/tst-res +inet/tst-sock-nonblock +librt/shmtest +locale/bug-iconv-trans +locale/bug-usesetlocale +locale/C +locale/collate-test +locale/dump-ctype +locale/gen-unicode-ctype +locale/show-ucs-data +locale/tst-digits +locale/tst-langinfo +locale/tst-mbswcs[1-6] +locale/tst_nl_langinfo +locale/tst-numeric +locale/tst-setlocale +locale/tst-sscanf +locale/tst-trans +locale/tst-wctype +locale/tst-xlocale1 +locale/tst-xlocale2 +locale/xfrm-test +locale-mbwc/tst_iswalnum +locale-mbwc/tst_iswalpha +locale-mbwc/tst_iswcntrl +locale-mbwc/tst_iswctype +locale-mbwc/tst_iswdigit +locale-mbwc/tst_iswgraph +locale-mbwc/tst_iswlower +locale-mbwc/tst_iswprint +locale-mbwc/tst_iswpunct +locale-mbwc/tst_iswspace +locale-mbwc/tst_iswupper +locale-mbwc/tst_iswxdigit +locale-mbwc/tst_mblen +locale-mbwc/tst_mbrlen +locale-mbwc/tst_mbrtowc +locale-mbwc/tst_mbsrtowcs +locale-mbwc/tst_mbstowcs +locale-mbwc/tst_mbtowc +locale-mbwc/tst_strcoll +locale-mbwc/tst_strxfrm +locale-mbwc/tst_swscanf +locale-mbwc/tst_towctrans +locale-mbwc/tst_towlower +locale-mbwc/tst_towupper +locale-mbwc/tst_wcrtomb +locale-mbwc/tst_wcscat +locale-mbwc/tst_wcschr +locale-mbwc/tst_wcscmp +locale-mbwc/tst_wcscoll +locale-mbwc/tst_wcscpy +locale-mbwc/tst_wcscspn +locale-mbwc/tst_wcslen +locale-mbwc/tst_wcsncat +locale-mbwc/tst_wcsncmp +locale-mbwc/tst_wcsncpy +locale-mbwc/tst_wcspbrk +locale-mbwc/tst_wcsrtombs +locale-mbwc/tst_wcsspn +locale-mbwc/tst_wcsstr +locale-mbwc/tst_wcstod +locale-mbwc/tst_wcstok +locale-mbwc/tst_wcstombs +locale-mbwc/tst_wcswidth +locale-mbwc/tst_wcsxfrm +locale-mbwc/tst_wctob +locale-mbwc/tst_wctomb +locale-mbwc/tst_wctrans +locale-mbwc/tst_wctype +locale-mbwc/tst_wcwidth +locale-mbwc/tst2_mbrtowc +malloc/malloc +malloc/mallocbug +malloc/malloc-standard-alignment +malloc/realloc0 +malloc/realloc-can-shrink +malloc/testmalloc +malloc/tst-[cmv]alloc +malloc/tst-mallocfork +malloc/tst-mcheck +malloc/tst-obstack +math/basic-test +math/compile_test +math/c99_test +math/ilogb +math/libm-test-ulps.h +math/libm-test.c +math/rint +math/signgam +math/test-double +math/test-ildoubl +math/test-ldouble +math/test-float +math/test-fpucw +math/test-idouble +math/test-ifloat +math/tst-definitions +misc/bug-glob2 +misc/bug-readdir1 +misc/dirent +misc/dirent64 +misc/fdopen +misc/opendir-tst1 +misc/popen +misc/seek +misc/sem +misc/stdarg +misc/tst-inotify +misc/tst-scandir +misc/tst-seekdir +misc/tst-statfs +misc/tst-statvfs +misc/tst-utmp +misc/tst-utmpx +mmap/mmap +mmap/mmap2 +mmap/mmap64 +nptl/tst-align +nptl/tst-align2 +nptl/tst-align3 +nptl/tst-atfork1 +nptl/tst-attr[1-3] +nptl/tst-barrier[1-4] +nptl/tst-basic[1-7] +nptl/tst-cancel[1-9] +nptl/tst-cancelx[2-4] +nptl/tst-cancelx[6-9] +nptl/tst-cancelx1[0-8] +nptl/tst-cancelx2[0-1] +nptl/tst-cancel[1-3][0-9] +nptl/tst-cleanup[0-4] +nptl/tst-cleanupx[0-4] +nptl/tst-clock +nptl/tst-clock[12] +nptl/tst-clock_nanosleep +nptl/tst-cond[1-9] +nptl/tst-cond[1-2][0-9] +nptl/tst-cpuclock[12] +nptl/tst-cputimer[1-3] +nptl/tst-detach1 +nptl/tst-dlsym1 +nptl/tst-eintr[1-5] +nptl/tst-exec[2-4] +nptl/tst-exit[1-3] +nptl/tst-fini1 +nptl/tst-fini1mod.so +nptl/tst-flock[1-2] +nptl/tst-fork[1-4] +nptl/tst-getpid[1-3] +nptl/tst-initializers1 +nptl/tst-initializers1-c[89]9 +nptl/tst-initializers1-gnu[89]9 +nptl/tst-join[1-6] +nptl/tst-key[1-4] +nptl/tst-kill[1-6] +nptl/tst-mqueue[1-9] +nptl/tst-mutex[1-9] +nptl/tst-mutex[57]a +nptl/tst-once[1-4] +nptl/tst-oncex[3-4] +nptl/tst-popen1 +nptl/tst-oddstacklimit +nptl/tst-raise1 +nptl/tst-rwlock[1-9] +nptl/tst-rwlock1[0-4] +nptl/tst-rwlock2a +nptl/tst-sched1 +nptl/tst-sem[1-9] +nptl/tst-sem1[0-2] +nptl/tst-signal[1-7] +nptl/tst-spin[1-3] +nptl/tst-stack[12] +nptl/tst-stdio[12] +nptl/tst-sysconf +nptl/tst-timer[2-5] +nptl/tst-tls[1-5] +nptl/tst-tls4mod.so +nptl/tst-tls?mod[a-f].so +nptl/tst-tls4modb.so +nptl/tst-tls[35]mod.so +nptl/tst-tls6.sh +nptl/tst-tsd[1-6] +nptl/tst-typesizes +nptl/tst-umask1 +nptl/tst-unload +nptl/tst-vfork[12]x +pthread/cancellation-points +pthread/ex[1-7] +pthread/tst-too-many-cleanups +pwd_grp/getgroups +pwd_grp/grcat +pwd_grp/pwcat +pwd_grp/test_grp +pwd_grp/test_pwd +regex/testregex +regex/tst-regex2 +regex/tst-regexloc +rpc/getrpcent +rpc/getrpcent_r +setjmp/bug269-setjmp +setjmp/jmpbug +setjmp/sigjmpbug +setjmp/tst-setjmp +setjmp/tst-vfork-longjmp +signal/sigchld +signal/signal +signal/tst-raise +signal/tst-signal +signal/tst-signalfd +signal/tst-sigset +signal/tst-sigsimple +silly/hello +silly/tiny +silly/tst-atomic +silly/tst-atomic-long +stat/memcmp-stat +stat/stat +stat/stat64 +stat/stat-loop256 +stdio/64bit +stdio/fclose-loop +stdlib/ptytest +stdlib/qsort +stdlib/testarc4random +stdlib/testatexit +stdlib/test-canon +stdlib/test-canon2 +stdlib/test-mkostemp-O_CLOEXEC +stdlib/test-mkostemp-child +stdlib/teston_exit +stdlib/teststrtol +stdlib/teststrtoq +string/bug-strcoll1 +string/bug-strncat1 +string/bug-strpbrk1 +string/bug-strspn1 +string/stratcliff +string/testcopy +string/tester +string/test-ffs +string/tst-bswap +string/tst-inlcall +string/tst-strlen +string/tst-strtok +string/tst-strxfrm +termios/termios +time/clocktest +time/test_time +time/tst-ctime +time/tst-ftime_l +time/tst-futimens1 +time/tst-mktime +time/tst-mktime3 +time/tst-strptime2 +time/tst-timerfd +time/tst_wcsftime +tls/tst-tls[1-9] +tls/tst-tls1[0-8] +tls/tst-tls-at-ctor +tls/tst-tlsmod[1-9].so +tls/tst-tlsmod1[0-9].so +tls/tst-tlsmod1[0-9][ab].so +tls/tst-tlsmod1[78]a[0-9].so +tls/tst-tlsmod1[78]a1[0-9].so +tls/tst-tlsmod-at-ctor.so +unistd/clone +unistd/errno +unistd/exec-null +unistd/fork +unistd/getconf +unistd/getconf.c +unistd/getcwd +unistd/getopt +unistd/getopt_long +unistd/tstgetopt +unistd/tst-fallocate +unistd/tst-fallocate64 +unistd/tst-posix_fallocate +unistd/tst-posix_fallocate64 +unistd/tst-preadwrite +unistd/tst-preadwrite64 +unistd/vfork diff --git a/test/Makefile b/test/Makefile index f38427e41..138308e73 100644 --- a/test/Makefile +++ b/test/Makefile @@ -5,6 +5,7 @@ # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # +top_srcdir=../ top_builddir=../ include Rules.mak @@ -17,34 +18,49 @@ endif ifneq ($(findstring -static,$(LDFLAGS)),) DIRS := $(filter-out dlopen,$(DIRS)) endif -ifneq ($(UCLIBC_HAS_THREADS),y) +ifneq ($(UCLIBC_HAS_THREADS)$(ARCH_USE_MMU),yy) DIRS := $(filter-out pthread,$(DIRS)) endif +ifneq ($(UCLIBC_HAS_FLOATS),y) + DIRS := $(filter-out math,$(DIRS)) +endif ifneq ($(UCLIBC_HAS_FULL_RPC),y) DIRS := $(filter-out rpc,$(DIRS)) endif ifneq ($(UCLIBC_HAS_REGEX),y) DIRS := $(filter-out regex,$(DIRS)) endif +ifneq ($(UCLIBC_HAS_THREADS_NATIVE),y) + DIRS := $(filter-out tls nptl,$(DIRS)) +endif ifneq ($(UCLIBC_HAS_WCHAR),y) DIRS := $(filter-out locale-mbwc,$(DIRS)) endif ifneq ($(UCLIBC_HAS_LOCALE),y) DIRS := $(filter-out locale,$(DIRS)) endif -ifeq ($(UCLIBC_HAS_CRYPT_STUB),y) +ifneq ($(UCLIBC_HAS_CRYPT_IMPL),y) DIRS := $(filter-out crypt,$(DIRS)) endif ifeq ($(HAS_NO_THREADS),y) DIRS := $(filter-out pthread,$(DIRS)) endif -DIRS := $(filter-out math,$(DIRS)) +ifneq ($(UCLIBC_HAS_ARGP),y) + DIRS := $(filter-out argp,$(DIRS)) +endif test check all: run run: subdirs_run -compile: subdirs_compile +gen: + -rm -f $(top_builddir)/test/uclibcng-testrunner.in + $(MAKE) run UCLIBCNG_GENERATE_TESTRUNNER=1 + +compile: $(top_builddir)$(LOCAL_INSTALL_PATH) subdirs_compile + +$(top_builddir)$(LOCAL_INSTALL_PATH): + $(Q)$(MAKE) -C $(top_builddir) $(LOCAL_INSTALL_PATH) tags: ctags -R @@ -57,13 +73,17 @@ subdirs_run: $(patsubst %, _dirrun_%, $(DIRS)) subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) $(patsubst %, _dir_%, $(DIRS)) : dummy - $(Q)$(MAKE) -C $(patsubst _dir_%, %, $@) + $(Q)$(MAKE) -C $(patsubst _dir_%, %, $@) \ + KCONFIG_CONFIG=$(KCONFIG_CONFIG) $(patsubst %, _dirrun_%, $(DIRS)) : dummy - $(Q)$(MAKE) -C $(patsubst _dirrun_%, %, $@) run + $(Q)$(MAKE) -C $(patsubst _dirrun_%, %, $@) run \ + UCLIBCNG_TEST_SUBDIR=$(strip $(patsubst _dirrun_%, %, $@)) \ + KCONFIG_CONFIG=$(KCONFIG_CONFIG) $(patsubst %, _dircompile_%, $(DIRS)) : dummy - $(Q)$(MAKE) -C $(patsubst _dircompile_%, %, $@) compile + $(Q)$(MAKE) -C $(patsubst _dircompile_%, %, $@) compile \ + KCONFIG_CONFIG=$(KCONFIG_CONFIG) $(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy $(Q)$(MAKE) -C $(patsubst _dirclean_%, %, $@) clean diff --git a/test/README b/test/README index b59945c54..723ce6e43 100644 --- a/test/README +++ b/test/README @@ -5,13 +5,11 @@ Following make targets are avaialable make compile -This will compile and link the tests +This will compile and link the tests. make run -This will check for binaries if they are not there it -will call 'compile' target then it will execute all the -tests. +This will execute all the tests. make check make all @@ -19,32 +17,53 @@ make all This will build and run tests. The following make variables may help you in testing: + - UCLIBC_ONLY - only run tests against uClibc - GLIBC_ONLY - only run tests against glibc - V / VERBOSE - run tests with a lot of output - - TEST_INSTALLED_UCLIBC - Test installed libraries + - TEST_INSTALLED_UCLIBC - Test installed libraries under /lib and /usr/lib. + - TIMEOUTFACTOR=nn - increase test timeout nn times. + At least REGEX_OLD + regex/tst-regex2 needs it increased. + So, to just run the uClibc tests, try this: make check UCLIBC_ONLY=1 +You can pass the following 2 environment variables to "make run": + - make run SIMULATOR_uclibc=qemu-sh4 SIMULATOR_glibc=qemu-x86_64 + +If you need to test just a subset of all test, delete subdirectories +you do not need. + +As of 2009-07, build machinery does not track dependencies on uclibc. +If you edit a header and re-run "make compile", it does not re-install it +into ../install_dir. If you delete ../install_dir, "make compile" +rebuilds uclibc as needed and re-installs ../install_dir, +but still does not rebuild testcases. +(You can work around it by "touch */*.c" for now). + ---------------- For: Developer ---------------- The structure of this test system is: - test/ toplevel dir containing common test code - test/Rules.mak Common build code - test/Test.mak Runtime test make code - test/subdir/ code specific to a subsystem is stored in a subdir - test/subdir/Makefile describe the tests to run - test/subdir/*.c the tests - -Each subdir Makefile must include the toplevel Test.mak file. Before doing so, -you may define the TESTS and TESTS_DISABLED variables. If you do not, TESTS -is built automatically based upon all the .c files in the subdir. + test/ toplevel dir containing common test code + test/Rules.mak Common build code + test/Test.mak Runtime test make code + test/subdir/ code specific to a subsystem is stored in a subdir + test/subdir/Makefile.in describe the tests to run + test/subdir/Makefile test entry point, includes needed upper-level + makefiles plus Makefile.in + test/subdir/*.c the tests + +Each subdir has a Makefile (same for any subdir) that must include in strict order: + - the upper-level Rules.mak file + - the Makefile.in + - the upper-level Test.mak file +Makefile.in may be used to define the TESTS and TESTS_DISABLED variables. +If you do not, TESTS is built automatically based upon all the .c files in the subdir. TESTS := foo TESTS_DISABLED := bar -include ../Test.mak Each test must use a similar .c name; so the "foo" test needs a "foo.c". Additionally, the following options further control specific test behavior: @@ -57,10 +76,11 @@ WRAPPER_foo := execute stuff just before test Or to control all tests in a subdir: EXTRA_CLEAN := extra files to remove in the clean target +EXTRA_DIRS := extra directories to remove in the clean target EXTRA_CFLAGS := -DFOO EXTRA_LDFLAGS := -lpthread -OPTS := -WRAPPER := +OPTS := +WRAPPER := If you want to compare the output of a test with known good output, then just create a local file named "foo.out.good" and the output generated by the test diff --git a/test/Rules.mak b/test/Rules.mak index b74d941b6..9416a0cb4 100644 --- a/test/Rules.mak +++ b/test/Rules.mak @@ -5,23 +5,37 @@ # 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 -# +.SUFFIXES: top_builddir ?= ../ +abs_top_builddir ?= $(shell cd $(top_builddir); pwd)/ TESTDIR=$(top_builddir)test/ -include $(top_builddir)/Rules.mak -ifndef TEST_INSTALLED_UCLIBC +include $(top_srcdir)Rules.mak +ifeq ($(filter $(clean_targets) CLEAN_%,$(MAKECMDGOALS)),) +ifeq ($(HAVE_DOT_CONFIG),) +$(error no HAVE_DOT_CONFIG, failed to read .config) +endif +endif + ifdef UCLIBC_LDSO ifeq (,$(findstring /,$(UCLIBC_LDSO))) -UCLIBC_LDSO := $(top_builddir)lib/$(UCLIBC_LDSO) +UCLIBC_LDSO := $(UCLIBC_LDSO) +else +UCLIBC_LDSO := $(notdir $(UCLIBC_LDSO)) +endif +else +UCLIBC_LDSO := $(notdir $(firstword $(wildcard $(top_builddir)lib/ld*))) endif +ifndef TEST_INSTALLED_UCLIBC +ifeq ($(LDSO_SAFE_RUNPATH),y) +UCLIBC_PATH := $(abs_top_builddir)lib else -UCLIBC_LDSO := $(firstword $(wildcard $(top_builddir)lib/ld*)) +UCLIBC_PATH := $(top_builddir)lib endif +else +UCLIBC_PATH := $(RUNTIME_PREFIX)$(MULTILIB_DIR) endif #-------------------------------------------------------- # Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc. @@ -31,11 +45,11 @@ export LC_ALL ifeq ($(strip $(TARGET_ARCH)),) TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \ -e 's/i.86/i386/' \ - -e 's/sparc.*/sparc/' \ - -e 's/arm.*/arm/g' \ + -e 's/sun.*/sparc/' -e 's/sparc.*/sparc/' \ + -e 's/sa110/arm/' -e 's/arm.*/arm/g' \ -e 's/m68k.*/m68k/' \ + -e 's/parisc.*/hppa/' \ -e 's/ppc/powerpc/g' \ - -e 's/v850.*/v850/g' \ -e 's/sh[234]/sh/' \ -e 's/mips.*/mips/' \ -e 's/cris.*/cris/' \ @@ -44,84 +58,72 @@ TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \ endif export TARGET_ARCH +RM_R = $(Q)$(RM) -r +LN_S = $(Q)$(LN) -fs -#-------------------------------------------------------- -# If you are running a cross compiler, you will want to set 'CROSS' -# to something more interesting... Target architecture is determined -# by asking the CC compiler what arch it compiles things for, so unless -# your compiler is broken, you should not need to specify TARGET_ARCH -# -# Most people will set this stuff on the command line, i.e. -# make CROSS=mipsel-linux- -# will build uClibc for 'mipsel'. - -CROSS = $(subst ",, $(strip $(CROSS_COMPILER_PREFIX))) -CC = $(CROSS)gcc -RM = rm -f - -# Select the compiler needed to build binaries for your development system -HOSTCC = gcc - - -#-------------------------------------------------------- -# 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) - -# use '-Os' optimization if available, else use -O2, allow Config to override -# Override optimization settings when debugging -ifeq ($(DODEBUG),y) -OPTIMIZATION = -O0 +ifneq ($(KERNEL_HEADERS),) +ifeq ($(patsubst /%,/,$(KERNEL_HEADERS)),/) +# Absolute path in KERNEL_HEADERS +KERNEL_INCLUDES += -I$(KERNEL_HEADERS) else -OPTIMIZATION += $(call check_gcc,-Os,-O2) +# Relative path in KERNEL_HEADERS +KERNEL_INCLUDES += -I$(top_builddir)$(KERNEL_HEADERS) +endif endif -XWARNINGS := $(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes -XARCH_CFLAGS := $(subst ",, $(strip $(ARCH_CFLAGS))) $(CPU_CFLAGS) -XCOMMON_CFLAGS := -D_GNU_SOURCE -I$(top_builddir)test -CFLAGS := $(XWARNINGS) $(OPTIMIZATION) $(XCOMMON_CFLAGS) $(XARCH_CFLAGS) -nostdinc -I$(top_builddir)$(LOCAL_INSTALL_PATH)/usr/include +XCOMMON_CFLAGS := -I$(top_builddir)test -D_GNU_SOURCE +XWARNINGS += $(CFLAG_-Wstrict-prototypes) +CFLAGS := -nostdinc -I$(top_builddir)$(LOCAL_INSTALL_PATH)/usr/include +CFLAGS += $(XCOMMON_CFLAGS) $(KERNEL_INCLUDES) $(CC_INC) +CFLAGS += $(OPTIMIZATION) $(CPU_CFLAGS) $(XWARNINGS) -CC_IPREFIX:=$(shell $(CC) --print-file-name=include) -CFLAGS += -I$(dir $(CC_IPREFIX))/include-fixed -I$(CC_IPREFIX) +$(eval $(call check-gcc-var,-Wno-missing-field-initializers)) +CFLAGS += $(CFLAG_-Wno-missing-field-initializers) -HOST_CFLAGS += $(XWARNINGS) $(OPTIMIZATION) $(XCOMMON_CFLAGS) +# Can't add $(OPTIMIZATION) here, it may be target-specific. +# Just adding -Os for now. +HOST_CFLAGS += $(XCOMMON_CFLAGS) -Os $(XWARNINGS) -std=gnu99 -LDFLAGS := $(CPU_LDFLAGS) +LDFLAGS := $(CPU_LDFLAGS-y) -Wl,-z,now ifeq ($(DODEBUG),y) CFLAGS += -g HOST_CFLAGS += -g - LDFLAGS += -g - HOST_LDFLAGS += -g -else - LDFLAGS += -s - HOST_LDFLAGS += -s + LDFLAGS += -Wl,-g + HOST_LDFLAGS += -Wl,-g endif -ifneq ($(strip $(HAVE_SHARED)),y) - LDFLAGS += -static - HOST_LDFLAGS += -static +ifeq ($(DOSTRIP),y) + LDFLAGS += -Wl,-s + HOST_LDFLAGS += -Wl,-s endif -LDFLAGS += -B$(top_builddir)lib -Wl,-rpath,$(top_builddir)lib -Wl,-rpath-link,$(top_builddir)lib -UCLIBC_LDSO_ABSPATH=$(shell pwd) -ifdef TEST_INSTALLED_UCLIBC -LDFLAGS += -Wl,-rpath,./ -UCLIBC_LDSO_ABSPATH=$(SHARED_LIB_LOADER_PREFIX) +ifneq ($(HAVE_SHARED),y) + LDFLAGS += -Wl,-static -static-libgcc +endif + +ifndef TEST_INSTALLED_UCLIBC +LDFLAGS += -B$(UCLIBC_PATH) -Wl,-rpath,$(UCLIBC_PATH):$(shell pwd) -Wl,-rpath-link,$(UCLIBC_PATH):$(shell pwd) +else +LDFLAGS += -Wl,-rpath,$(shell pwd) endif ifeq ($(findstring -static,$(LDFLAGS)),) - LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_LDSO_ABSPATH)/$(UCLIBC_LDSO) +LDFLAGS += -Wl,--dynamic-linker,$(UCLIBC_PATH)/$(UCLIBC_LDSO) endif ifeq ($(LDSO_GNU_HASH_SUPPORT),y) # Check for binutils support is done on root Rules.mak -LDFLAGS += -Wl,${LDFLAGS_GNUHASH} +LDFLAGS += $(CFLAG_-Wl--hash-style=gnu) endif +ifneq ($(strip $(UCLIBC_EXTRA_CFLAGS)),"") +CFLAGS += $(call qstrip,$(UCLIBC_EXTRA_CFLAGS)) +endif +ifneq ($(strip $(UCLIBC_EXTRA_LDFLAGS)),"") +LDFLAGS += $(call qstrip,$(UCLIBC_EXTRA_LDFLAGS)) +endif -# Filter output -MAKEFLAGS += --no-print-directory -ifneq ($(findstring s,$(MAKEFLAGS)),) +ifneq ($(findstring -s,$(MAKEFLAGS)),) DISP := sil Q := @ SCAT := -@true @@ -136,12 +138,15 @@ Q := @ SCAT := -@true endif endif +ifneq ($(Q),) +MAKEFLAGS += --no-print-directory +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))/ $(patsubst %.exe,%,$@) +pur_showtest = echo " "TEST_EXEC $(notdir $(CURDIR))/ $(@:.exe=) sil_showclean = sil_showdiff = true sil_showlink = true @@ -149,7 +154,7 @@ sil_showtest = true ver_showclean = ver_showdiff = true echo ver_showlink = true echo -ver_showtest = printf "\n$(banner)\nTEST $(notdir $(PWD))/ $(patsubst %.exe,%,$@)\n$(banner)\n" +ver_showtest = printf "\n$(banner)\nTEST $(notdir $(CURDIR))/ $(@:.exe=)\n$(banner)\n" do_showclean = $($(DISP)_showclean) do_showdiff = $($(DISP)_showdiff) do_showlink = $($(DISP)_showlink) diff --git a/test/Test.mak b/test/Test.mak index af415aa9e..c1b34a7f9 100644 --- a/test/Test.mak +++ b/test/Test.mak @@ -4,6 +4,8 @@ # # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +shellescape='$(subst ','\'',$(1))' + ifeq ($(TESTS),) TESTS := $(patsubst %.c,%,$(wildcard *.c)) endif @@ -14,15 +16,16 @@ ifeq ($(SHELL_TESTS),) SHELL_TESTS := $(patsubst %.sh,shell_%,$(wildcard *.sh)) endif -ifneq ($(filter-out test,$(TESTS)),$(TESTS)) +ifneq ($(filter-out test,$(strip $(TESTS))),$(strip $(TESTS))) $(error Sanity check: cannot have a test named "test.c") endif -top_builddir = ../../ -include ../Rules.mak - U_TARGETS := $(TESTS) -G_TARGETS := $(patsubst %,%_glibc,$(U_TARGETS)) +G_TARGETS := $(addsuffix _glibc,$(U_TARGETS)) + +ifneq ($(GLIBC_TESTS_DISABLED),) +G_TARGETS := $(filter-out $(GLIBC_TESTS_DISABLED),$(G_TARGETS)) +endif ifeq ($(GLIBC_ONLY),) TARGETS += $(U_TARGETS) @@ -32,85 +35,121 @@ TARGETS += $(G_TARGETS) endif CLEAN_TARGETS := $(U_TARGETS) $(G_TARGETS) +CLEAN_TARGETS += $(TESTS_DISABLED) $(addsuffix _glibc,$(TESTS_DISABLED)) $(GLIBC_TESTS_DISABLED) COMPILE_TARGETS := $(TARGETS) -RUN_TARGETS := $(patsubst %,%.exe,$(TARGETS)) +# We sort the targets so uClibc and host-libc tests are run adjacent +RUN_TARGETS := $(sort $(addsuffix .exe,$(TARGETS))) +COMPILE_TARGETS := $(sort $(COMPILE_TARGETS)) +# provide build rules even for disabled tests: +U_TARGETS += $(TESTS_DISABLED) +G_TARGETS += $(addsuffix _glibc,$(TESTS_DISABLED)) $(GLIBC_TESTS_DISABLED) TARGETS += $(SHELL_TESTS) +CFLAGS += $(CFLAGS_$(notdir $(CURDIR))) +ifeq (1,$(UCLIBCNG_GENERATE_TESTRUNNER)) +UCLIBCNG_TEST_SUBDIR ?= $(patsubst $(realpath $(TESTDIR))/%,%,$(CURDIR)) +endif define binary_name $(patsubst %.exe,%,$@) endef +define tst_src_name +$(patsubst %_glibc,%,$(binary_name)) +endef define diff_test $(Q)\ - for x in "$(binary_name).out" "$(patsubst %_glibc,%,$(binary_name)).out" ; do \ + for x in "$(binary_name).out" "$(tst_src_name).out" ; do \ test -e "$$x.good" && $(do_showdiff) "$(binary_name).out" "$$x.good" && exec diff -u "$(binary_name).out" "$$x.good" ; \ done ; \ true endef define uclibc_glibc_diff_test $(Q)\ - test -z "$(DODIFF_$(patsubst %_glibc,%,$(binary_name)))" && exec true ; \ + test -z "$(DODIFF_$(tst_src_name))" && exec true ; \ uclibc_out="$(binary_name).out" ; \ - glibc_out="$(patsubst %_glibc,%,$(binary_name)).out" ; \ + glibc_out="$(tst_src_name).out" ; \ $(do_showdiff) $$uclibc_out $$glibc_out ; \ exec diff -u "$$uclibc_out" "$$glibc_out" endef define exec_test $(showtest) $(Q)\ - $(WRAPPER) $(WRAPPER_$(patsubst %_glibc,%,$(binary_name))) \ - ./$(binary_name) $(OPTS) $(OPTS_$(patsubst %_glibc,%,$(binary_name))) &> "$(binary_name).out" ; \ + $(SIMULATOR) $(WRAPPER) $(WRAPPER_$(tst_src_name)) \ + ./$(binary_name) $(OPTS) $(OPTS_$(tst_src_name)) > "$(binary_name).out" 2>&1 ; \ ret=$$? ; \ - expected_ret="$(RET_$(patsubst %_glibc,%,$(binary_name)))" ; \ + expected_ret="$(RET_$(tst_src_name))" ; \ test -z "$$expected_ret" && export expected_ret=0 ; \ if ! test $$ret -eq $$expected_ret ; then \ echo "ret == $$ret ; expected_ret == $$expected_ret" ; \ + echo "The output of the failed test is:"; \ + cat "$(binary_name).out"; \ exit 1 ; \ fi $(SCAT) "$(binary_name).out" endef test check all: run -run: $(RUN_TARGETS) compile +run: $(RUN_TARGETS) -$(RUN_TARGETS): $(TARGETS) +$(addsuffix .exe,$(U_TARGETS)): SIMULATOR:=$(SIMULATOR_uclibc) +$(addsuffix .exe,$(G_TARGETS)): SIMULATOR:=$(SIMULATOR_glibc) +$(RUN_TARGETS): +ifeq (1,$(UCLIBCNG_GENERATE_TESTRUNNER)) + $(Q)\ + expected_ret="$(RET_$(tst_src_name))"; echo \ + "$${expected_ret:-0}" \ + $(call shellescape,$(tst_src_name)) \ + $(call shellescape,$(binary_name)) \ + $(call shellescape,$(UCLIBCNG_TEST_SUBDIR)) \ + $(call shellescape,$(WRAPPER) $(WRAPPER_$(tst_src_name)) ./$(binary_name) $(OPTS) $(OPTS_$(tst_src_name))) \ + >>$(top_builddir)/test/uclibcng-testrunner.in +else $(exec_test) $(diff_test) ifeq ($(UCLIBC_ONLY),) $(uclibc_glibc_diff_test) endif +endif compile: $(COMPILE_TARGETS) -G_TARGET_SRCS := $(patsubst %,%.c,$(G_TARGETS)) -U_TARGET_SRCS := $(patsubst %,%.c,$(U_TARGETS)) +G_TARGET_SRCS := $(addsuffix .c,$(G_TARGETS)) +U_TARGET_SRCS := $(addsuffix .c,$(U_TARGETS)) -$(MAKE_SRCS): Makefile $(TESTDIR)Makefile $(TESTDIR)Rules.mak $(TESTDIR)Test.mak +MAKE_SRCS := Makefile $(TESTDIR)Makefile $(TESTDIR)Rules.mak $(TESTDIR)Test.mak $(U_TARGETS): $(U_TARGET_SRCS) $(MAKE_SRCS) $(showlink) - $(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -c $@.c -o $@.o - $(Q)$(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$@) + $(Q)$(CC) $(filter-out $(CFLAGS-OMIT-$@),$(CFLAGS)) $(EXTRA_CFLAGS) $(CFLAGS_$(notdir $(CURDIR))) $(CFLAGS_$@) -c $@.c -o $@.o + $(Q)$(CC) $(filter-out $(LDFLAGS-OMIT-$@),$(LDFLAGS)) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$@) $(G_TARGETS): $(U_TARGET_SRCS) $(MAKE_SRCS) $(showlink) - $(Q)$(HOSTCC) $(HOST_CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(patsubst %_glibc,%,$@)) -c $(patsubst %_glibc,%,$@).c -o $@.o - $(Q)$(HOSTCC) $(HOST_LDFLAGS) $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$(patsubst %_glibc,%,$@)) + $(Q)$(HOSTCC) $(filter-out $(HOST_CFLAGS-OMIT-$(patsubst %_glibc,%,$@)),$(HOST_CFLAGS)) \ + $(CFLAGS_$(notdir $(CURDIR))) $(CFLAGS_$(patsubst %_glibc,%,$@)) \ + -c $(patsubst %_glibc,%,$@).c -o $@.o + $(Q)$(HOSTCC) $(filter-out $(LDFLAGS-OMIT-$(patsubst %_glibc,%,$@)),$(HOST_LDFLAGS)) \ + $@.o -o $@ $(EXTRA_LDFLAGS) $(LDFLAGS_$(patsubst %_glibc,%,$@)) $(LDFLAGS_$@) shell_%: $(showtest) + $(Q)$(if $(PRE_RUN_$(@)),$(PRE_RUN_$(@))) $(Q)$(SHELL) $(patsubst shell_%,%.sh,$(binary_name)) + $(Q)$(if $(POST_RUN_$(@)),$(POST_RUN_$(@))) %.so: %.c $(showlink) $(Q)$(CC) \ - $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(patsubst %_glibc,%,$@)) \ + $(filter-out $(CFLAGS-OMIT-$<),$(CFLAGS)) $(EXTRA_CFLAGS) \ + $(CFLAGS_$(patsubst %_glibc,%,$@)) \ -fPIC -shared $< -o $@ -Wl,-soname,$@ \ - $(LDFLAGS) $(EXTRA_LIBS) $(LDFLAGS_$(patsubst %_glibc,%,$@)) + $(filter-out $(LDFLAGS-OMIT-$<),$(LDFLAGS)) $(EXTRA_LIBS) \ + $(LDFLAGS_$(patsubst %_glibc,%,$@)) clean: $(showclean) $(Q)$(RM) *.a *.o *.so *~ core *.out *.gdb $(CLEAN_TARGETS) $(EXTRA_CLEAN) + $(Q)$(RM_R) $(EXTRA_DIRS) .PHONY: all check clean test run compile diff --git a/test/argp/Makefile b/test/argp/Makefile new file mode 100644 index 000000000..fcb5a8328 --- /dev/null +++ b/test/argp/Makefile @@ -0,0 +1,8 @@ +# uClibc argp tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in +include ../Test.mak diff --git a/test/argp/Makefile.in b/test/argp/Makefile.in new file mode 100644 index 000000000..d81b3595b --- /dev/null +++ b/test/argp/Makefile.in @@ -0,0 +1,12 @@ +# uClibc argp tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +TESTS := $(addprefix argp-, ex1 ex2 ex3 ex4 test) \ + bug-argp1 tst-argp1 tst-argp2 + +EXTRA_LDFLAGS = -luargp + +OPTS_argp-ex3 = ARG1 ARG2 +OPTS_argp-ex4 = ARG1 string1 string2 string3 +OPTS_bug-argp1 = -- --help + diff --git a/test/argp/argp-ex1.c b/test/argp/argp-ex1.c new file mode 100644 index 000000000..7bb5f2241 --- /dev/null +++ b/test/argp/argp-ex1.c @@ -0,0 +1,15 @@ +/* Argp example #1 -- a minimal program using argp */ + +/* This is (probably) the smallest possible program that + uses argp. It won't do much except give an error + messages and exit when there are any arguments, and print + a (rather pointless) messages for --help. */ + +#include <stdlib.h> +#include <argp.h> + +int main (int argc, char **argv) +{ + argp_parse (0, argc, argv, 0, 0, 0); + exit (0); +} diff --git a/test/argp/argp-ex2.c b/test/argp/argp-ex2.c new file mode 100644 index 000000000..c49fbaca9 --- /dev/null +++ b/test/argp/argp-ex2.c @@ -0,0 +1,45 @@ +/* Argp example #2 -- a pretty minimal program using argp */ + +/* This program doesn't use any options or arguments, but uses + argp to be compliant with the GNU standard command line + format. + + In addition to making sure no arguments are given, and + implementing a --help option, this example will have a + --version option, and will put the given documentation string + and bug address in the --help output, as per GNU standards. + + The variable ARGP contains the argument parser specification; + adding fields to this structure is the way most parameters are + passed to argp_parse (the first three fields are usually used, + but not in this small program). There are also two global + variables that argp knows about defined here, + ARGP_PROGRAM_VERSION and ARGP_PROGRAM_BUG_ADDRESS (they are + global variables because they will almost always be constant + for a given program, even if it uses different argument + parsers for various tasks). */ + +#include <stdlib.h> +#include <argp.h> + +const char *argp_program_version = + "argp-ex2 1.0"; +const char *argp_program_bug_address = + "<bug-gnu-utils@@gnu.org>"; + +/* Program documentation. */ +static char doc[] = + "Argp example #2 -- a pretty minimal program using argp"; + +/* Our argument parser. The @code{options}, @code{parser}, and + @code{args_doc} fields are zero because we have neither options or + arguments; @code{doc} and @code{argp_program_bug_address} will be + used in the output for @samp{--help}, and the @samp{--version} + option will print out @code{argp_program_version}. */ +static struct argp argp = { 0, 0, 0, doc }; + +int main (int argc, char **argv) +{ + argp_parse (&argp, argc, argv, 0, 0, 0); + exit (0); +} diff --git a/test/argp/argp-ex3.c b/test/argp/argp-ex3.c new file mode 100644 index 000000000..24d5c501a --- /dev/null +++ b/test/argp/argp-ex3.c @@ -0,0 +1,153 @@ +/* Argp example #3 -- a program with options and arguments using argp */ + +/* This program uses the same features as example 2, and uses options and + arguments. + + We now use the first four fields in ARGP, so here's a description of them: + OPTIONS -- A pointer to a vector of struct argp_option (see below) + PARSER -- A function to parse a single option, called by argp + ARGS_DOC -- A string describing how the non-option arguments should look + DOC -- A descriptive string about this program; if it contains a + vertical tab character (\v), the part after it will be + printed *following* the options + + The function PARSER takes the following arguments: + KEY -- An integer specifying which option this is (taken + from the KEY field in each struct argp_option), or + a special key specifying something else; the only + special keys we use here are ARGP_KEY_ARG, meaning + a non-option argument, and ARGP_KEY_END, meaning + that all arguments have been parsed + ARG -- For an option KEY, the string value of its + argument, or NULL if it has none + STATE-- A pointer to a struct argp_state, containing + various useful information about the parsing state; used here + are the INPUT field, which reflects the INPUT argument to + argp_parse, and the ARG_NUM field, which is the number of the + current non-option argument being parsed + It should return either 0, meaning success, ARGP_ERR_UNKNOWN, meaning the + given KEY wasn't recognized, or an errno value indicating some other + error. + + Note that in this example, main uses a structure to communicate with the + parse_opt function, a pointer to which it passes in the INPUT argument to + argp_parse. Of course, it's also possible to use global variables + instead, but this is somewhat more flexible. + + The OPTIONS field contains a pointer to a vector of struct argp_option's; + that structure has the following fields (if you assign your option + structures using array initialization like this example, unspecified + fields will be defaulted to 0, and need not be specified): + NAME -- The name of this option's long option (may be zero) + KEY -- The KEY to pass to the PARSER function when parsing this option, + *and* the name of this option's short option, if it is a + printable ascii character + ARG -- The name of this option's argument, if any + FLAGS -- Flags describing this option; some of them are: + OPTION_ARG_OPTIONAL -- The argument to this option is optional + OPTION_ALIAS -- This option is an alias for the + previous option + OPTION_HIDDEN -- Don't show this option in --help output + DOC -- A documentation string for this option, shown in --help output + + An options vector should be terminated by an option with all fields zero. */ + +#include <stdlib.h> +#include <argp.h> + +const char *argp_program_version = + "argp-ex3 1.0"; +const char *argp_program_bug_address = + "<bug-gnu-utils@@gnu.org>"; + +/* Program documentation. */ +static char doc[] = + "Argp example #3 -- a program with options and arguments using argp"; + +/* A description of the arguments we accept. */ +static char args_doc[] = "ARG1 ARG2"; + +/* The options we understand. */ +static struct argp_option options[] = { + {"verbose", 'v', 0, 0, "Produce verbose output" }, + {"quiet", 'q', 0, 0, "Don't produce any output" }, + {"silent", 's', 0, OPTION_ALIAS }, + {"output", 'o', "FILE", 0, + "Output to FILE instead of standard output" }, + { 0 } +}; + +/* Used by @code{main} to communicate with @code{parse_opt}. */ +struct arguments +{ + char *args[2]; /* @var{arg1} & @var{arg2} */ + int silent, verbose; + char *output_file; +}; + +/* Parse a single option. */ +static error_t +parse_opt (int key, char *arg, struct argp_state *state) +{ + /* Get the @var{input} argument from @code{argp_parse}, which we + know is a pointer to our arguments structure. */ + struct arguments *arguments = state->input; + + switch (key) + { + case 'q': case 's': + arguments->silent = 1; + break; + case 'v': + arguments->verbose = 1; + break; + case 'o': + arguments->output_file = arg; + break; + + case ARGP_KEY_ARG: + if (state->arg_num >= 2) + /* Too many arguments. */ + argp_usage (state); + + arguments->args[state->arg_num] = arg; + + break; + + case ARGP_KEY_END: + if (state->arg_num < 2) + /* Not enough arguments. */ + argp_usage (state); + break; + + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + +/* Our argp parser. */ +static struct argp argp = { options, parse_opt, args_doc, doc }; + +int main (int argc, char **argv) +{ + struct arguments arguments; + + /* Default values. */ + arguments.silent = 0; + arguments.verbose = 0; + arguments.output_file = "-"; + + /* Parse our arguments; every option seen by @code{parse_opt} will + be reflected in @code{arguments}. */ + argp_parse (&argp, argc, argv, 0, 0, &arguments); + + printf ("ARG1 = %s\nARG2 = %s\nOUTPUT_FILE = %s\n" + "VERBOSE = %s\nSILENT = %s\n", + arguments.args[0], arguments.args[1], + arguments.output_file, + arguments.verbose ? "yes" : "no", + arguments.silent ? "yes" : "no"); + + exit (0); +} diff --git a/test/argp/argp-ex4.c b/test/argp/argp-ex4.c new file mode 100644 index 000000000..c77c7ef02 --- /dev/null +++ b/test/argp/argp-ex4.c @@ -0,0 +1,167 @@ +/* Argp example #4 -- a program with somewhat more complicated options */ + +/* This program uses the same features as example 3, but has more + options, and somewhat more structure in the -help output. It + also shows how you can `steal' the remainder of the input + arguments past a certain point, for programs that accept a + list of items. It also shows the special argp KEY value + ARGP_KEY_NO_ARGS, which is only given if no non-option + arguments were supplied to the program. + + For structuring the help output, two features are used, + *headers* which are entries in the options vector with the + first four fields being zero, and a two part documentation + string (in the variable DOC), which allows documentation both + before and after the options; the two parts of DOC are + separated by a vertical-tab character ('\v', or '\013'). By + convention, the documentation before the options is just a + short string saying what the program does, and that afterwards + is longer, describing the behavior in more detail. All + documentation strings are automatically filled for output, + although newlines may be included to force a line break at a + particular point. All documentation strings are also passed to + the `gettext' function, for possible translation into the + current locale. */ + +#include <stdlib.h> +#include <error.h> +#include <argp.h> + +const char *argp_program_version = + "argp-ex4 1.0"; +const char *argp_program_bug_address = + "<bug-gnu-utils@@prep.ai.mit.edu>"; + +/* Program documentation. */ +static char doc[] = + "Argp example #4 -- a program with somewhat more complicated\ +options\ +\vThis part of the documentation comes *after* the options;\ + note that the text is automatically filled, but it's possible\ + to force a line-break, e.g.\n<-- here."; + +/* A description of the arguments we accept. */ +static char args_doc[] = "ARG1 [STRING...]"; + +/* Keys for options without short-options. */ +#define OPT_ABORT 1 /* --abort */ + +/* The options we understand. */ +static struct argp_option options[] = { + {"verbose", 'v', 0, 0, "Produce verbose output" }, + {"quiet", 'q', 0, 0, "Don't produce any output" }, + {"silent", 's', 0, OPTION_ALIAS }, + {"output", 'o', "FILE", 0, + "Output to FILE instead of standard output" }, + + {0,0,0,0, "The following options should be grouped together:" }, + {"repeat", 'r', "COUNT", OPTION_ARG_OPTIONAL, + "Repeat the output COUNT (default 10) times"}, + {"abort", OPT_ABORT, 0, 0, "Abort before showing any output"}, + + { 0 } +}; + +/* Used by @code{main} to communicate with @code{parse_opt}. */ +struct arguments +{ + char *arg1; /* @var{arg1} */ + char **strings; /* [@var{string}@dots{}] */ + int silent, verbose, abort; /* @samp{-s}, @samp{-v}, @samp{--abort} */ + char *output_file; /* @var{file} arg to @samp{--output} */ + int repeat_count; /* @var{count} arg to @samp{--repeat} */ +}; + +/* Parse a single option. */ +static error_t +parse_opt (int key, char *arg, struct argp_state *state) +{ + /* Get the @code{input} argument from @code{argp_parse}, which we + know is a pointer to our arguments structure. */ + struct arguments *arguments = state->input; + + switch (key) + { + case 'q': case 's': + arguments->silent = 1; + break; + case 'v': + arguments->verbose = 1; + break; + case 'o': + arguments->output_file = arg; + break; + case 'r': + arguments->repeat_count = arg ? atoi (arg) : 10; + break; + case OPT_ABORT: + arguments->abort = 1; + break; + + case ARGP_KEY_NO_ARGS: + argp_usage (state); + + case ARGP_KEY_ARG: + /* Here we know that @code{state->arg_num == 0}, since we + force argument parsing to end before any more arguments can + get here. */ + arguments->arg1 = arg; + + /* Now we consume all the rest of the arguments. + @code{state->next} is the index in @code{state->argv} of the + next argument to be parsed, which is the first @var{string} + we're interested in, so we can just use + @code{&state->argv[state->next]} as the value for + arguments->strings. + + @emph{In addition}, by setting @code{state->next} to the end + of the arguments, we can force argp to stop parsing here and + return. */ + arguments->strings = &state->argv[state->next]; + state->next = state->argc; + + break; + + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + +/* Our argp parser. */ +static struct argp argp = { options, parse_opt, args_doc, doc }; + +int main (int argc, char **argv) +{ + int i, j; + struct arguments arguments; + + /* Default values. */ + arguments.silent = 0; + arguments.verbose = 0; + arguments.output_file = "-"; + arguments.repeat_count = 1; + arguments.abort = 0; + + /* Parse our arguments; every option seen by @code{parse_opt} will be + reflected in @code{arguments}. */ + argp_parse (&argp, argc, argv, 0, 0, &arguments); + + if (arguments.abort) + error (10, 0, "ABORTED"); + + for (i = 0; i < arguments.repeat_count; i++) + { + printf ("ARG1 = %s\n", arguments.arg1); + printf ("STRINGS = "); + for (j = 0; arguments.strings[j]; j++) + printf (j == 0 ? "%s" : ", %s", arguments.strings[j]); + printf ("\n"); + printf ("OUTPUT_FILE = %s\nVERBOSE = %s\nSILENT = %s\n", + arguments.output_file, + arguments.verbose ? "yes" : "no", + arguments.silent ? "yes" : "no"); + } + + exit (0); +} diff --git a/test/argp/argp-test.c b/test/argp/argp-test.c new file mode 100644 index 000000000..b3d573bae --- /dev/null +++ b/test/argp/argp-test.c @@ -0,0 +1,209 @@ +/* Test program for argp argument parser + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Written by Miles Bader <miles at gnu.ai.mit.edu>. + + 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. */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <stdlib.h> +#include <time.h> +#include <string.h> +#include <argp.h> + +const char *argp_program_version = "argp-test 1.0"; + +struct argp_option sub_options[] = +{ + {"subopt1", 's', 0, 0, "Nested option 1"}, + {"subopt2", 'S', 0, 0, "Nested option 2"}, + + { 0, 0, 0, 0, "Some more nested options:", 10}, + {"subopt3", 'p', 0, 0, "Nested option 3"}, + + {"subopt4", 'q', 0, 0, "Nested option 4", 1}, + + {0} +}; + +static const char sub_args_doc[] = "STRING...\n-"; +static const char sub_doc[] = "\vThis is the doc string from the sub-arg-parser."; + +static error_t +sub_parse_opt (int key, char *arg, struct argp_state *state) +{ + switch (key) + { + case ARGP_KEY_NO_ARGS: + printf ("NO SUB ARGS\n"); + break; + case ARGP_KEY_ARG: + printf ("SUB ARG: %s\n", arg); + break; + + case 's' : case 'S': case 'p': case 'q': + printf ("SUB KEY %c\n", key); + break; + + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + +static char * +sub_help_filter (int key, const char *text, void *input) +{ + if (key == ARGP_KEY_HELP_EXTRA) + return strdup ("This is some extra text from the sub parser (note that it \ +is preceded by a blank line)."); + else + return (char *)text; +} + +static struct argp sub_argp = { + sub_options, sub_parse_opt, sub_args_doc, sub_doc, 0, sub_help_filter +}; + +/* Structure used to communicate with the parsing functions. */ +struct params +{ + unsigned foonly; /* Value parsed for foonly. */ + unsigned foonly_default; /* Default value for it. */ +}; + +#define OPT_PGRP 1 +#define OPT_SESS 2 + +struct argp_option options[] = +{ + {"pid", 'p', "PID", 0, "List the process PID"}, + {"pgrp", OPT_PGRP,"PGRP",0, "List processes in the process group PGRP"}, + {"no-parent", 'P', 0, 0, "Include processes without parents"}, + {0, 'x', 0, OPTION_ALIAS}, + {"all-fields",'Q', 0, 0, "Don't elide unusable fields (normally" + " if there's some reason ps can't" + " print a field for any process, it's" + " removed from the output entirely)" }, + {"reverse", 'r', 0, 0, "Reverse the order of any sort"}, + {"gratuitously-long-reverse-option", 0, 0, OPTION_ALIAS}, + {"session", OPT_SESS,"SID", OPTION_ARG_OPTIONAL, + "Add the processes from the session" + " SID (which defaults to the sid of" + " the current process)" }, + + {0,0,0,0, "Here are some more options:"}, + {"foonly", 'f', "ZOT", OPTION_ARG_OPTIONAL, "Glork a foonly"}, + {"zaza", 'z', 0, 0, "Snit a zar"}, + + {0} +}; + +static const char args_doc[] = "STRING"; +static const char doc[] = "Test program for argp." + "\vThis doc string comes after the options." + "\nHey! Some manual formatting!" + "\nThe current time is: %s"; + +static void +popt (int key, char *arg) +{ + char buf[10]; + if (isprint (key)) + sprintf (buf, "%c", key); + else + sprintf (buf, "%d", key); + if (arg) + printf ("KEY %s: %s\n", buf, arg); + else + printf ("KEY %s\n", buf); +} + +static error_t +parse_opt (int key, char *arg, struct argp_state *state) +{ + struct params *params = state->input; + + switch (key) + { + case ARGP_KEY_NO_ARGS: + printf ("NO ARGS\n"); + break; + + case ARGP_KEY_ARG: + if (state->arg_num > 0) + return ARGP_ERR_UNKNOWN; /* Leave it for the sub-arg parser. */ + printf ("ARG: %s\n", arg); + break; + + case 'f': + if (arg) + params->foonly = atoi (arg); + else + params->foonly = params->foonly_default; + popt (key, arg); + break; + + case 'p': case 'P': case OPT_PGRP: case 'x': case 'Q': + case 'r': case OPT_SESS: case 'z': + popt (key, arg); + break; + + default: + return ARGP_ERR_UNKNOWN; + } + return 0; +} + +static char * +help_filter (int key, const char *text, void *input) +{ + char *new_text; + struct params *params = input; + + if (key == ARGP_KEY_HELP_POST_DOC && text) + { + time_t now = time (0); + asprintf (&new_text, text, ctime (&now)); + } + else if (key == 'f') + /* Show the default for the --foonly option. */ + asprintf (&new_text, "%s (ZOT defaults to %x)", + text, params->foonly_default); + else + new_text = (char *)text; + + return new_text; +} + +static struct argp_child argp_children[] = { { &sub_argp }, { 0 } }; +static struct argp argp = { + options, parse_opt, args_doc, doc, argp_children, help_filter +}; + +int +main (int argc, char **argv) +{ + struct params params; + params.foonly = 0; + params.foonly_default = random (); + argp_parse (&argp, argc, argv, 0, 0, ¶ms); + printf ("After parsing: foonly = %x\n", params.foonly); + return 0; +} diff --git a/test/argp/bug-argp1.c b/test/argp/bug-argp1.c new file mode 100644 index 000000000..a28cf4b9c --- /dev/null +++ b/test/argp/bug-argp1.c @@ -0,0 +1,26 @@ +#include <argp.h> + + +static const struct argp_option test_options[] = +{ + { NULL, 'a', NULL, OPTION_DOC, NULL }, + { NULL, 'b', NULL, OPTION_DOC, NULL }, + { NULL, 0, NULL, 0, NULL } +}; + +static struct argp test_argp = +{ + test_options +}; + + +static int +do_test (int argc, char *argv[]) +{ + int i; + argp_parse (&test_argp, argc, argv, 0, &i, NULL); + return 0; +} + +#define TEST_FUNCTION do_test (argc, argv) +#include "../test-skeleton.c" diff --git a/test/argp/tst-argp1.c b/test/argp/tst-argp1.c new file mode 100644 index 000000000..827daca6f --- /dev/null +++ b/test/argp/tst-argp1.c @@ -0,0 +1,118 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper at redhat.com>, 2002. + + 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 <argp.h> + + + + +#define OPT_TO_THREAD 300 +#define OPT_TO_PROCESS 301 +#define OPT_SYNC_SIGNAL 302 +#define OPT_SYNC_JOIN 303 +#define OPT_TOPLEVEL 304 + + +static const struct argp_option test_options[] = + { + { NULL, 0, NULL, 0, "\ +This is a test for threads so we allow ther user to selection the number of \ +threads which are used at any one time. Independently the total number of \ +rounds can be selected. This is the total number of threads which will have \ +run when the process terminates:" }, + { "threads", 't', "NUMBER", 0, "Number of threads used at once" }, + { "starts", 's', "NUMBER", 0, "Total number of working threads" }, + { "toplevel", OPT_TOPLEVEL, "NUMBER", 0, + "Number of toplevel threads which start the other threads; this \ +implies --sync-join" }, + + { NULL, 0, NULL, 0, "\ +Each thread can do one of two things: sleep or do work. The latter is 100% \ +CPU bound. The work load is the probability a thread does work. All values \ +from zero to 100 (inclusive) are valid. How often each thread repeats this \ +can be determined by the number of rounds. The work cost determines how long \ +each work session (not sleeping) takes. If it is zero a thread would \ +effectively nothing. By setting the number of rounds to zero the thread \ +does no work at all and pure thread creation times can be measured." }, + { "workload", 'w', "PERCENT", 0, "Percentage of time spent working" }, + { "workcost", 'c', "NUMBER", 0, + "Factor in the cost of each round of working" }, + { "rounds", 'r', "NUMBER", 0, "Number of rounds each thread runs" }, + + { NULL, 0, NULL, 0, "\ +There are a number of different methods how thread creation can be \ +synchronized. Synchronization is necessary since the number of concurrently \ +running threads is limited." }, + { "sync-signal", OPT_SYNC_SIGNAL, NULL, 0, + "Synchronize using a signal (default)" }, + { "sync-join", OPT_SYNC_JOIN, NULL, 0, "Synchronize using pthread_join" }, + + { NULL, 0, NULL, 0, "\ +One parameter for each threads execution is the size of the stack. If this \ +parameter is not used the system's default stack size is used. If many \ +threads are used the stack size should be chosen quite small." }, + { "stacksize", 'S', "BYTES", 0, "Size of threads stack" }, + { "guardsize", 'g', "BYTES", 0, + "Size of stack guard area; must fit into the stack" }, + + { NULL, 0, NULL, 0, "Signal options:" }, + { "to-thread", OPT_TO_THREAD, NULL, 0, "Send signal to main thread" }, + { "to-process", OPT_TO_PROCESS, NULL, 0, + "Send signal to process (default)" }, + + { NULL, 0, NULL, 0, "Administrative options:" }, + { "progress", 'p', NULL, 0, "Show signs of progress" }, + { "timing", 'T', NULL, 0, + "Measure time from startup to the last thread finishing" }, + { NULL, 0, NULL, 0, NULL } + }; + +/* Prototype for option handler. */ +static error_t parse_opt (int key, char *arg, struct argp_state *state); + +/* Data structure to communicate with argp functions. */ +static struct argp argp = +{ + test_options, parse_opt +}; + + +static int +do_test (void) +{ + int argc = 2; + char *argv[3] = { (char *) "tst-argp1", (char *) "--help", NULL }; + int remaining; + + /* Parse and process arguments. */ + argp_parse (&argp, argc, argv, 0, &remaining, NULL); + + return 0; +} + + +/* Handle program arguments. */ +static error_t +parse_opt (int key, char *arg, struct argp_state *state) +{ + return ARGP_ERR_UNKNOWN; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/argp/tst-argp2.c b/test/argp/tst-argp2.c new file mode 100644 index 000000000..705cdcaa9 --- /dev/null +++ b/test/argp/tst-argp2.c @@ -0,0 +1,101 @@ +/* Copyright (C) 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub at redhat.com>, 2007. + + 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 <argp.h> + +static const struct argp_option opt1[] = + { + { "opt1", '1', "NUMBER", 0, "Option 1" }, + { NULL, 0, NULL, 0, NULL } + }; + +static const struct argp_option opt2[] = + { + { "opt2", '2', "NUMBER", 0, "Option 2" }, + { NULL, 0, NULL, 0, NULL } + }; + +static const struct argp_option opt3[] = + { + { "opt3", '3', "NUMBER", 0, "Option 3" }, + { NULL, 0, NULL, 0, NULL } + }; + +static const struct argp_option opt4[] = + { + { "opt4", '4', "NUMBER", 0, "Option 4" }, + { NULL, 0, NULL, 0, NULL } + }; + +static const struct argp_option opt5[] = + { + { "opt5", '5', "NUMBER", 0, "Option 5" }, + { NULL, 0, NULL, 0, NULL } + }; + +static struct argp argp5 = + { + opt5, NULL, "args doc5", "doc5", NULL, NULL, NULL + }; + +static struct argp argp4 = + { + opt4, NULL, "args doc4", "doc4", NULL, NULL, NULL + }; + +static struct argp argp3 = + { + opt3, NULL, "args doc3", "doc3", NULL, NULL, NULL + }; + +static struct argp_child children2[] = + { + { &argp4, 0, "child3", 3 }, + { &argp5, 0, "child4", 4 }, + { NULL, 0, NULL, 0 } + }; + +static struct argp argp2 = + { + opt2, NULL, "args doc2", "doc2", children2, NULL, NULL + }; + +static struct argp_child children1[] = + { + { &argp2, 0, "child1", 1 }, + { &argp3, 0, "child2", 2 }, + { NULL, 0, NULL, 0 } + }; + +static struct argp argp1 = + { + opt1, NULL, "args doc1", "doc1", children1, NULL, NULL + }; + + +static int +do_test (void) +{ + argp_help (&argp1, stdout, ARGP_HELP_LONG, (char *) "tst-argp2"); + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/args/Makefile b/test/args/Makefile index 7ba8a31b4..0ae3f010b 100644 --- a/test/args/Makefile +++ b/test/args/Makefile @@ -1,11 +1,8 @@ # uClibc args tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -OPTS_arg_test = a b c d e f g h -WRAPPER_arg_test = \ - env -i \ - ENVVAR=123 \ - SOMETHING=sldajfasdf \ - BLAHBLAH=" hi hi " diff --git a/test/args/Makefile.in b/test/args/Makefile.in new file mode 100644 index 000000000..f4edab454 --- /dev/null +++ b/test/args/Makefile.in @@ -0,0 +1,9 @@ +# uClibc args tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +OPTS_arg_test = a b c d e f g h +WRAPPER_arg_test = \ + env -i \ + ENVVAR=123 \ + SOMETHING=sldajfasdf \ + BLAHBLAH=" hi hi " diff --git a/test/assert/Makefile b/test/assert/Makefile index 1c557fc84..841a4dace 100644 --- a/test/assert/Makefile +++ b/test/assert/Makefile @@ -1,7 +1,8 @@ # uClibc assert tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -RET_assert := 134 -WRAPPER_assert := trap ":" ABRT ; diff --git a/test/assert/Makefile.in b/test/assert/Makefile.in new file mode 100644 index 000000000..3f4fb4dfe --- /dev/null +++ b/test/assert/Makefile.in @@ -0,0 +1,6 @@ +# uClibc assert tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +RET_assert := 134 +WRAPPER_assert := trap ":" ABRT ; +CFLAGS_assert := -fPIC diff --git a/test/build/Makefile b/test/build/Makefile index eb65c2ad3..ce74a8a7a 100644 --- a/test/build/Makefile +++ b/test/build/Makefile @@ -1,4 +1,8 @@ # uClibc build tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak diff --git a/test/build/check_config_options.sh b/test/build/check_config_options.sh index 086131f38..086131f38 100644..100755 --- a/test/build/check_config_options.sh +++ b/test/build/check_config_options.sh diff --git a/test/crypt/Makefile b/test/crypt/Makefile index 11d420d9e..25b0f3c86 100644 --- a/test/crypt/Makefile +++ b/test/crypt/Makefile @@ -1,8 +1,8 @@ # uClibc crypt tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -EXTRA_LDFLAGS := -lcrypt - -OPTS_crypt = < crypt.input diff --git a/test/crypt/Makefile.in b/test/crypt/Makefile.in new file mode 100644 index 000000000..f85221947 --- /dev/null +++ b/test/crypt/Makefile.in @@ -0,0 +1,15 @@ +# uClibc crypt tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +EXTRA_LDFLAGS := -lcrypt + +OPTS_crypt = < crypt.input + +ifneq ($(UCLIBC_HAS_SHA512_CRYPT_IMPL),y) +TESTS_DISABLED += sha512c-test +endif +ifneq ($(UCLIBC_HAS_SHA256_CRYPT_IMPL),y) +TESTS_DISABLED += sha256c-test +endif + +WRAPPER := env TIMEOUTFACTOR=50 diff --git a/test/crypt/crypt.c b/test/crypt/crypt.c index 34d7e4158..786464710 100644 --- a/test/crypt/crypt.c +++ b/test/crypt/crypt.c @@ -10,18 +10,10 @@ #include <stdlib.h> #include "crypt.h" -int totfails = 0; - -#if __STDC__ - 0 -int main (int argc, char *argv[]); -void get8 (char *cp); -void put8 (char *cp); -void good_bye (void) __attribute__ ((noreturn)); -#else -void get8(), put8(); -#endif - -void good_bye () +static int totfails = 0; + +static void good_bye (void) __attribute__ ((noreturn)); +static void good_bye (void) { if(totfails == 0) { printf("Passed DES validation suite\n"); @@ -32,10 +24,33 @@ void good_bye () } } -int -main(argc, argv) - int argc; - char *argv[]; +static void get8(char *cp) +{ + int i,j,t; + + for(i=0;i<8;i++){ + scanf("%2x",&t); + if(feof(stdin)) + good_bye(); + for(j=0; j<8 ; j++) { + *cp++ = (t & (0x01 << (7-j))) != 0; + } + } +} + +static void put8(char *cp) +{ + int i,j,t; + + for(i=0;i<8;i++){ + t = 0; + for(j = 0; j<8; j++) + t = (t<<1) | *cp++; + printf("%02x", t); + } +} + +int main(void) { char key[64],plain[64],cipher[64],answer[64]; int i; @@ -58,9 +73,10 @@ main(argc, argv) cipher[i] = plain[i]; encrypt(cipher, 0); - for(i=0;i<64;i++) + for(i=0;i<64;i++) { if(cipher[i] != answer[i]) break; + } fail = 0; if(i != 64){ printf(" Encrypt FAIL"); @@ -83,31 +99,5 @@ main(argc, argv) } good_bye(); } -void -get8(cp) -char *cp; -{ - int i,j,t; - for(i=0;i<8;i++){ - scanf("%2x",&t); - if(feof(stdin)) - good_bye(); - for(j=0; j<8 ; j++) { - *cp++ = (t & (0x01 << (7-j))) != 0; - } - } -} -void -put8(cp) -char *cp; -{ - int i,j,t; - for(i=0;i<8;i++){ - t = 0; - for(j = 0; j<8; j++) - t = (t<<1) | *cp++; - printf("%02x", t); - } -} diff --git a/test/crypt/sha256c-test.c b/test/crypt/sha256c-test.c new file mode 100644 index 000000000..357f0d8b7 --- /dev/null +++ b/test/crypt/sha256c-test.c @@ -0,0 +1,62 @@ +#include <crypt.h> +#include <stdio.h> +#include <string.h> + +static const struct +{ + const char *salt; + const char *input; + const char *expected; +} tests[] = +{ + { "$5$saltstring", "Hello world!", + "$5$saltstring$5B8vYYiY.CVt1RlTTf8KbXBH3hsxY/GNooZaBBGWEc5" }, + { "$5$rounds=10000$saltstringsaltstring", "Hello world!", + "$5$rounds=10000$saltstringsaltst$3xv.VbSHBb41AL9AvLeujZkZRBAwqFMz2." + "opqey6IcA" }, + { "$5$rounds=5000$toolongsaltstring", "This is just a test", + "$5$rounds=5000$toolongsaltstrin$Un/5jzAHMgOGZ5.mWJpuVolil07guHPvOW8" + "mGRcvxa5" }, + { "$5$rounds=1400$anotherlongsaltstring", + "a very much longer text to encrypt. This one even stretches over more" + "than one line.", + "$5$rounds=1400$anotherlongsalts$Rx.j8H.h8HjEDGomFU8bDkXm3XIUnzyxf12" + "oP84Bnq1" }, + { "$5$rounds=77777$short", + "we have a short salt string but not a short password", + "$5$rounds=77777$short$JiO1O3ZpDAxGJeaDIuqCoEFysAe1mZNJRs3pw0KQRd/" }, + { "$5$rounds=123456$asaltof16chars..", "a short string", + "$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/" + "cZKmF/wJvD" }, + { "$5$rounds=10$roundstoolow", "the minimum number is still observed", + "$5$rounds=1000$roundstoolow$yfvwcWrQ8l/K0DAWyuPMDNHpIVlTQebY9l/gL97" + "2bIC" }, +}; +#define ntests (sizeof (tests) / sizeof (tests[0])) + + + +static int +do_test (void) +{ + int result = 0; + int i; + + for (i = 0; i < ntests; ++i) + { + char *cp = crypt (tests[i].input, tests[i].salt); + + if (strcmp (cp, tests[i].expected) != 0) + { + printf ("test %d: expected \"%s\", got \"%s\"\n", + i, tests[i].expected, cp); + result = 1; + } + } + + return result; +} + +#define TIMEOUT 6 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/crypt/sha512c-test.c b/test/crypt/sha512c-test.c new file mode 100644 index 000000000..c829242e2 --- /dev/null +++ b/test/crypt/sha512c-test.c @@ -0,0 +1,63 @@ +#include <crypt.h> +#include <stdio.h> +#include <string.h> + +static const struct +{ + const char *salt; + const char *input; + const char *expected; +} tests[] = +{ + { "$6$saltstring", "Hello world!", + "$6$saltstring$svn8UoSVapNtMuq1ukKS4tPQd8iKwSMHWjl/O817G3uBnIFNjnQJu" + "esI68u4OTLiBFdcbYEdFCoEOfaS35inz1" }, + { "$6$rounds=10000$saltstringsaltstring", "Hello world!", + "$6$rounds=10000$saltstringsaltst$OW1/O6BYHV6BcXZu8QVeXbDWra3Oeqh0sb" + "HbbMCVNSnCM/UrjmM0Dp8vOuZeHBy/YTBmSK6H9qs/y3RnOaw5v." }, + { "$6$rounds=5000$toolongsaltstring", "This is just a test", + "$6$rounds=5000$toolongsaltstrin$lQ8jolhgVRVhY4b5pZKaysCLi0QBxGoNeKQ" + "zQ3glMhwllF7oGDZxUhx1yxdYcz/e1JSbq3y6JMxxl8audkUEm0" }, + { "$6$rounds=1400$anotherlongsaltstring", + "a very much longer text to encrypt. This one even stretches over more" + "than one line.", + "$6$rounds=1400$anotherlongsalts$POfYwTEok97VWcjxIiSOjiykti.o/pQs.wP" + "vMxQ6Fm7I6IoYN3CmLs66x9t0oSwbtEW7o7UmJEiDwGqd8p4ur1" }, + { "$6$rounds=77777$short", + "we have a short salt string but not a short password", + "$6$rounds=77777$short$WuQyW2YR.hBNpjjRhpYD/ifIw05xdfeEyQoMxIXbkvr0g" + "ge1a1x3yRULJ5CCaUeOxFmtlcGZelFl5CxtgfiAc0" }, + { "$6$rounds=123456$asaltof16chars..", "a short string", + "$6$rounds=123456$asaltof16chars..$BtCwjqMJGx5hrJhZywWvt0RLE8uZ4oPwc" + "elCjmw2kSYu.Ec6ycULevoBK25fs2xXgMNrCzIMVcgEJAstJeonj1" }, + { "$6$rounds=10$roundstoolow", "the minimum number is still observed", + "$6$rounds=1000$roundstoolow$kUMsbe306n21p9R.FRkW3IGn.S9NPN0x50YhH1x" + "hLsPuWGsUSklZt58jaTfF4ZEQpyUNGc0dqbpBYYBaHHrsX." }, +}; +#define ntests (sizeof (tests) / sizeof (tests[0])) + + +static int +do_test (void) +{ + int result = 0; + int i; + + for (i = 0; i < ntests; ++i) + { + char *cp = crypt (tests[i].input, tests[i].salt); + + if (strcmp (cp, tests[i].expected) != 0) + { + printf ("test %d: expected \"%s\", got \"%s\"\n", + i, tests[i].expected, cp); + result = 1; + } + } + + return result; +} + +#define TIMEOUT 6 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/ctype/Makefile b/test/ctype/Makefile index d2b7bc5de..99dbdbc9c 100644 --- a/test/ctype/Makefile +++ b/test/ctype/Makefile @@ -1,6 +1,8 @@ # uClibc ctype tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -TESTS := ctype - +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak diff --git a/test/ctype/Makefile.in b/test/ctype/Makefile.in new file mode 100644 index 000000000..041e85176 --- /dev/null +++ b/test/ctype/Makefile.in @@ -0,0 +1,5 @@ +# uClibc ctype tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +TESTS := ctype +CFLAGS_ctype = -fPIC diff --git a/test/ctype/ctype.c b/test/ctype/ctype.c index 352b2d2c8..f38f722b2 100644 --- a/test/ctype/ctype.c +++ b/test/ctype/ctype.c @@ -56,6 +56,7 @@ int main( int argc, char **argv) +#ifdef __UCLIBC_SUSV4_LEGACY__ /* isascii() */ { int buffer[]={ 'a', 'z', 'A', 'Z', '\n', -1}; @@ -71,6 +72,7 @@ int main( int argc, char **argv) TEST( isascii(c)==0); } } +#endif /* iscntrl() */ diff --git a/test/dlopen/Makefile b/test/dlopen/Makefile index b59c3e2d2..d5be53c6a 100644 --- a/test/dlopen/Makefile +++ b/test/dlopen/Makefile @@ -1,40 +1,8 @@ # uClibc dlopen tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -# rules need a little love to work with glibc ... -export UCLIBC_ONLY := 1 - -TESTS := dltest dltest2 dlstatic test1 test2 test3 dlundef dlafk dladdr - +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -CFLAGS_dltest := -DLIBNAME="\"./libtest.so\"" -CFLAGS_dltest2 := -DLIBNAME="\"./libtest3.so\"" - -LDFLAGS_dlstatic := -ldl -LDFLAGS_dltest := -ldl -lpthread -LDFLAGS_dltest2 := -ldl -lpthread -LDFLAGS_dlundef := -ldl -LDFLAGS_dlafk := -ldl ./libafk.so -Wl,-rpath,. -LDFLAGS_test1 := -ldl -LDFLAGS_test2 := -ldl -LDFLAGS_test3 := -ldl ./libtest1.so ./libtest2.so -Wl,-rpath,. -LDFLAGS_dladdr := -ldl - -DEBUG_LIBS := X -WRAPPER := env $(DEBUG_LIBS)=all LD_LIBRARY_PATH="$$PWD:.:$(LD_LIBRARY_PATH)" - -dltest: libtest.so -dltest2: libtest3.so -dlstatic: libstatic.so -dlundef: libundef.so -dlafk: libafk.so -libafk.so: libafk-temp.so -LDFLAGS_libafk.so := ./libafk-temp.so -Wl,-rpath,. -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/Makefile.in b/test/dlopen/Makefile.in new file mode 100644 index 000000000..0bed0f749 --- /dev/null +++ b/test/dlopen/Makefile.in @@ -0,0 +1,82 @@ +# uClibc dlopen tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +# rules need a little love to work with glibc ... +export UCLIBC_ONLY := 1 + +TESTS := dltest dltest2 dlstatic test1 test2 test3 dlundef dlafk dladdr \ + testscope nodelete tst-origin + +ifneq ($(HAVE_SHARED),y) +TESTS_DISABLED := test3 +LDFLAGS_libtest.so := -lpthread +endif + +CFLAGS_dltest := -DLIBNAME="\"./libtest.so\"" +CFLAGS_dltest2 := -DLIBNAME="\"./libtest3.so\"" + +LDFLAGS_dlstatic := -ldl +LDFLAGS_dltest := -ldl +LDFLAGS_dltest2 := -ldl +LDFLAGS_dlundef := -ldl +LDFLAGS_dlafk := -ldl ./libafk.so -Wl,-rpath,. +LDFLAGS_test1 := -ldl +LDFLAGS_test2 := -ldl +LDFLAGS_test3 := -ldl ./libtest1.so ./libtest2.so -Wl,-rpath,. +LDFLAGS_dladdr := -ldl +LDFLAGS_testscope:= -ldl +LDFLAGS_tst-origin:= -ldl -Wl,-rpath,\$$ORIGIN/testlib + +DEBUG_LIBS := X +WRAPPER := env $(DEBUG_LIBS)=all LD_LIBRARY_PATH="$$PWD:.:$(LD_LIBRARY_PATH)" + +testlib: + @mkdir $@ + +testlib/libtest31.so: libtest3.so | testlib + @cp $^ $@ + +EXTRA_DIRS := testlib + +# Build libC.so without -mprefergot compilation flag to force a +# R_SH_JMP_SLOT relocation instead of R_SH_GLOB_DAT for _libC_fini. This is +# needed to resolve the _libC_fini symbol when used (by libC.so destructor), +# whereas with GLOB_DAT relocation the resolution happens in the GOT entry +# when the libC is loaded, for the same reason remove also the "-z now" +# linker flag. +# These are needed to spot the issue test case want raise. + +ifeq ($(TARGET_ARCH),sh) +CFLAGS-OMIT-libC.c = -mprefergot +endif +LDFLAGS-OMIT-libC.c = -Wl,-z,now + +dltest: libtest.so +dltest2: libtest3.so +dlstatic: libstatic.so +dlundef: libundef.so +dlafk: libafk.so +testscope:libA.so +libafk.so: libafk-temp.so +LDFLAGS_libafk.so := ./libafk-temp.so -Wl,-rpath,. +test1: libtest1.so +test2: libtest1.so libtest2.so +test3: libtest1.so libtest2.so +tst-origin: testlib/libtest31.so +libtest1.so: libtest2.so +libB.so: libC.so +libA.so: libB.so +LDFLAGS_libtest.so := -lpthread +LDFLAGS_libtest1.so := ./libtest2.so -Wl,-rpath,. +LDFLAGS_libtest2.so := -Wl,-rpath,. +LDFLAGS_libtest3.so := -lpthread -Wl,-rpath,. +LDFLAGS_libC.so := -ldl +LDFLAGS_libB.so := ./libC.so -Wl,-rpath,. +LDFLAGS_libA.so := ./libB.so -Wl,-rpath,. + +nodelete: nodelmod1.so nodelmod2.so nodelmod3.so +nodelmod3.so: nodelmod4.so +LDFLAGS_nodelete := -rdynamic -ldl +LDFLAGS_nodelmod1.so := -Wl,-z,nodelete +LDFLAGS_nodelmod3.so := ./nodelmod4.so +LDFLAGS_nodelmod4.so := -Wl,-z,nodelete diff --git a/test/dlopen/dltest.c b/test/dlopen/dltest.c index 6bec6e00e..b5fa1cdd7 100644 --- a/test/dlopen/dltest.c +++ b/test/dlopen/dltest.c @@ -25,7 +25,7 @@ int main(int argc, char **argv) } mydltest(&value1, &value2); - printf("dltest: __pthread_once=%p\n", value1); + printf("dltest: pthread_once=%p\n", value1); printf("dltest: pthread_self=%p\n", value2); if (value1 == value2) { ret = EXIT_FAILURE; diff --git a/test/dlopen/libA.c b/test/dlopen/libA.c new file mode 100644 index 000000000..13b83dcec --- /dev/null +++ b/test/dlopen/libA.c @@ -0,0 +1,7 @@ +extern void libB_func(void); + +void libA_func(void); +void libA_func(void) +{ + libB_func(); +} diff --git a/test/dlopen/libB.c b/test/dlopen/libB.c new file mode 100644 index 000000000..9b9fff41c --- /dev/null +++ b/test/dlopen/libB.c @@ -0,0 +1,7 @@ +extern void libC_func(void); + +void libB_func(void); +void libB_func(void) +{ + libC_func(); +} diff --git a/test/dlopen/libC.c b/test/dlopen/libC.c new file mode 100644 index 000000000..84cbbef3d --- /dev/null +++ b/test/dlopen/libC.c @@ -0,0 +1,30 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +#define LIBNAME "libB.so" +void _libC_fini(void); +void _libC_fini(void) +{ + printf("libC_fini():finish - atexit()\n"); +} + +void libC_fini(void); +void libC_fini(void) +{ + _libC_fini(); +} + +void libC_func(void); +void libC_func(void) +{ + void *libB; + + libB = dlopen(LIBNAME, RTLD_LAZY); + if (!libB) { + fprintf(stderr, "Could not open ./%s: %s\n", LIBNAME, dlerror()); + exit(1); + } + + atexit(libC_fini); +} diff --git a/test/dlopen/libtest.c b/test/dlopen/libtest.c index a306e4bf7..3fd137f06 100644 --- a/test/dlopen/libtest.c +++ b/test/dlopen/libtest.c @@ -2,12 +2,10 @@ #include <pthread.h> #include <stdint.h> -extern int __pthread_once(void); - void dltest(uint32_t **value1, uint32_t **value2); void dltest(uint32_t **value1, uint32_t **value2) { - *value1 = (uint32_t *) __pthread_once; + *value1 = (uint32_t *) pthread_once; *value2 = (uint32_t *) pthread_self; } diff --git a/test/dlopen/nodelete.c b/test/dlopen/nodelete.c new file mode 100644 index 000000000..07ff96136 --- /dev/null +++ b/test/dlopen/nodelete.c @@ -0,0 +1,205 @@ +#include <dlfcn.h> +#include <setjmp.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> + + +static sigjmp_buf jmpbuf; + + +int fini_ran; + + +static void +__attribute__ ((noreturn)) +handler (int sig) +{ + siglongjmp (jmpbuf, 1); +} + + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ + /* We are testing the two possibilities to mark an object as not deletable: + - marked on the linker commandline with `-z nodelete' + - with the RTLD_NODELETE flag at dlopen()-time. + + The test we are performing should be safe. We are loading the objects, + get the address of variables in the respective object, unload the object + and then try to read the variable. If the object is unloaded this + should lead to an segmentation fault. */ + void *p; + struct sigaction sa; + + sa.sa_handler = handler; + sigfillset (&sa.sa_mask); + sa.sa_flags = SA_RESTART; + + if (sigaction (SIGSEGV, &sa, NULL) == -1) + puts ("cannot install signal handler: %m"); + + p = dlopen ("nodelmod1.so", RTLD_LAZY); + if (p == NULL) + { + printf ("failed to load \"nodelmod1.so\": %s\n", dlerror ()); + exit (1); + } + else + { + int *varp; + + varp = dlsym (p, "var1"); + if (varp == NULL) + { + puts ("failed to get address of \"var1\" in \"nodelmod1.so\""); + exit (1); + } + else + { + *varp = 20000720; + + /* Now close the object. */ + fini_ran = 0; + if (dlclose (p) != 0) + { + puts ("failed to close \"nodelmod1.so\""); + exit (1); + } + else if (! sigsetjmp (jmpbuf, 1)) + { + /* Access the variable again. */ + if (*varp != 20000720) + { + puts ("\"var1\" value not correct"); + exit (1); + } + else if (fini_ran != 0) + { + puts ("destructor of \"nodelmod1.so\" ran"); + exit (1); + } + else + puts ("-z nodelete test succeeded"); + } + else + { + /* We caught an segmentation fault. */ + puts ("\"nodelmod1.so\" got deleted!"); + exit (1); + } + } + } + + p = dlopen ("nodelmod2.so", RTLD_LAZY | RTLD_NODELETE); + if (p == NULL) + { + printf ("failed to load \"nodelmod2.so\": %s\n", dlerror ()); + exit (1); + } + else + { + int *varp; + + varp = dlsym (p, "var2"); + if (varp == NULL) + { + puts ("failed to get address of \"var2\" in \"nodelmod2.so\""); + exit (1); + } + else + { + *varp = 42; + + /* Now close the object. */ + fini_ran = 0; + if (dlclose (p) != 0) + { + puts ("failed to close \"nodelmod2.so\""); + exit (1); + } + else if (! sigsetjmp (jmpbuf, 1)) + { + /* Access the variable again. */ + if (*varp != 42) + { + puts ("\"var2\" value not correct"); + exit (1); + } + else if (fini_ran != 0) + { + puts ("destructor of \"nodelmod2.so\" ran"); + exit (1); + } + else + puts ("RTLD_NODELETE test succeeded"); + } + else + { + /* We caught an segmentation fault. */ + puts ("\"nodelmod2.so\" got deleted!"); + exit (1); + } + } + } + + p = dlopen ("nodelmod3.so", RTLD_LAZY); + if (p == NULL) + { + printf ("failed to load \"nodelmod3.so\": %s\n", dlerror ()); + exit (1); + } + else + { + int *(*fctp) (void); + + fctp = dlsym (p, "addr"); + if (fctp == NULL) + { + puts ("failed to get address of \"addr\" in \"nodelmod3.so\""); + exit (1); + } + else + { + int *varp = fctp (); + + *varp = -1; + + /* Now close the object. */ + fini_ran = 0; + if (dlclose (p) != 0) + { + puts ("failed to close \"nodelmod3.so\""); + exit (1); + } + else if (! sigsetjmp (jmpbuf, 1)) + { + /* Access the variable again. */ + if (*varp != -1) + { + puts ("\"var_in_mod4\" value not correct"); + exit (1); + } + else if (fini_ran != 0) + { + puts ("destructor of \"nodelmod4.so\" ran"); + exit (1); + } + else + puts ("-z nodelete in dependency succeeded"); + } + else + { + /* We caught an segmentation fault. */ + puts ("\"nodelmod4.so\" got deleted!"); + exit (1); + } + } + } + + return 0; +} + +#include "../test-skeleton.c" diff --git a/test/dlopen/nodelmod1.c b/test/dlopen/nodelmod1.c new file mode 100644 index 000000000..51be080af --- /dev/null +++ b/test/dlopen/nodelmod1.c @@ -0,0 +1,10 @@ +extern int fini_ran; + +int var1 = 42; + +static void +__attribute__ ((__destructor__)) +destr (void) +{ + fini_ran = 1; +} diff --git a/test/dlopen/nodelmod2.c b/test/dlopen/nodelmod2.c new file mode 100644 index 000000000..ff2ffc2fc --- /dev/null +++ b/test/dlopen/nodelmod2.c @@ -0,0 +1,10 @@ +extern int fini_ran; + +int var2 = 100; + +static void +__attribute__ ((__destructor__)) +destr (void) +{ + fini_ran = 1; +} diff --git a/test/dlopen/nodelmod3.c b/test/dlopen/nodelmod3.c new file mode 100644 index 000000000..817c94db6 --- /dev/null +++ b/test/dlopen/nodelmod3.c @@ -0,0 +1,8 @@ +extern int var_in_mod4; +extern int *addr (void); + +int * +addr (void) +{ + return &var_in_mod4; +} diff --git a/test/dlopen/nodelmod4.c b/test/dlopen/nodelmod4.c new file mode 100644 index 000000000..d7fa89396 --- /dev/null +++ b/test/dlopen/nodelmod4.c @@ -0,0 +1,10 @@ +extern int fini_ran; + +int var_in_mod4 = 99; + +static void +__attribute__ ((__destructor__)) +destr (void) +{ + fini_ran = 1; +} diff --git a/test/dlopen/testscope.c b/test/dlopen/testscope.c new file mode 100644 index 000000000..90e079885 --- /dev/null +++ b/test/dlopen/testscope.c @@ -0,0 +1,29 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +#define LIBNAME "libA.so" +int main(int argc, char **argv) +{ + void *libA; + void (*libAfn)(void); + char *error; + + libA = dlopen(LIBNAME, RTLD_LAZY); + if (!libA) { + fprintf(stderr, "Could not open ./%s: %s\n", LIBNAME, dlerror()); + exit(1); + } + + libAfn = dlsym(libA, "libA_func"); + if ((error = dlerror()) != NULL) { + fprintf(stderr, "Could not locate symbol 'libA_func': %s\n", error); + exit(1); + } + + libAfn(); + + dlclose(libA); + + return EXIT_SUCCESS; +} diff --git a/test/dlopen/tst-origin.c b/test/dlopen/tst-origin.c new file mode 100644 index 000000000..a12be415b --- /dev/null +++ b/test/dlopen/tst-origin.c @@ -0,0 +1,37 @@ +#include <fcntl.h> +#include <stdlib.h> +#include <stdio.h> +#include <dlfcn.h> + +#ifdef __UCLIBC__ +extern void _dlinfo(void); +#endif + +int main(int argc, char **argv) { + void *h1, *h2; + int (*mydltest)(const char *s); + char *error; + + h1 = dlopen ("libtest31.so", RTLD_LAZY); + if (!h1) { + fprintf(stderr, "Could not open libtest31.so: %s\n", dlerror()); + exit(1); + } + + h2 = dlopen ("libtest31.so", RTLD_NOLOAD); + if (!h2) { + fprintf(stderr, "Could not open libtest31.so(RTLD_NOLOAD): %s\n", dlerror()); + exit(1); + } + + mydltest = dlsym(h1, "dltest"); + if ((error = dlerror()) != NULL) { + fprintf(stderr, "Could not locate symbol 'dltest': %s\n", error); + exit(1); + } + + dlclose(h2); + dlclose(h1); + + return EXIT_SUCCESS; +} diff --git a/test/inet/Makefile b/test/inet/Makefile index 91927e42e..b294ea6b5 100644 --- a/test/inet/Makefile +++ b/test/inet/Makefile @@ -1,4 +1,8 @@ # uClibc inet tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak diff --git a/test/inet/Makefile.in b/test/inet/Makefile.in new file mode 100644 index 000000000..1cede4761 --- /dev/null +++ b/test/inet/Makefile.in @@ -0,0 +1,21 @@ +# uClibc inet tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# +ifeq ($(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),) +TESTS_DISABLED := bug-if1 gethost_r-align gethostid if_nameindex tst-aton \ + tst-network tst-ntoa test-ifaddrs +endif + +ifeq ($(UCLIBC_HAS_SOCKET)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6),) +TESTS_DISABLED += tst-ether_aton tst-ethers tst-ethers-line +endif + +ifeq ($(UCLIBC_HAS_RESOLVER_SUPPORT),) +TESTS_DISABLED += tst-res +else +LDFLAGS_tst-res_glibc := -lresolv # assume it's glibc or somebody with that lib +endif + +CFLAGS_bug-if1 = -fPIC +CFLAGS_tst-sock-nonblock = -fPIC +CFLAGS_tst-ifaddrs = -fPIC diff --git a/test/inet/bug-if1.c b/test/inet/bug-if1.c index 6bcd175eb..ea84a6850 100644 --- a/test/inet/bug-if1.c +++ b/test/inet/bug-if1.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <errno.h> #include <limits.h> diff --git a/test/inet/gethost.c b/test/inet/gethost.c new file mode 100644 index 000000000..77467e9e3 --- /dev/null +++ b/test/inet/gethost.c @@ -0,0 +1,40 @@ +#include <errno.h> +#include <netdb.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <arpa/inet.h> +#include <sys/socket.h> + +int main(void) +{ + in_addr_t addr = inet_addr("127.0.0.1"); + struct hostent *hent; + + hent = gethostent(); + if (hent == NULL) { + printf("gethostent(%d):%s\n", errno, hstrerror(h_errno)); + exit(1); + } + + hent = gethostbyname("localhost"); + if (hent == NULL) { + printf("gethostbyname(%d):%s\n", errno, hstrerror(h_errno)); + exit(1); + } + + hent = gethostbyname2("localhost", AF_INET); + if (hent == NULL) { + printf("gethostbyname2(%d):%s\n", errno, hstrerror(h_errno)); + exit(1); + } + + hent = gethostbyaddr(&addr, sizeof(addr), AF_INET); + if (hent == NULL) { + printf("gethostbyaddr(%d):%s\n", errno, hstrerror(h_errno)); + exit(1); + } + + return 0; +} + diff --git a/test/inet/gethostid.c b/test/inet/gethostid.c new file mode 100644 index 000000000..1b9af86b7 --- /dev/null +++ b/test/inet/gethostid.c @@ -0,0 +1,6 @@ +#include <unistd.h> +#include <stdio.h> +int main(void) { + printf("hostid=%ld\n", gethostid()); + return 0; +} diff --git a/test/inet/getnetent.c b/test/inet/getnetent.c new file mode 100644 index 000000000..1f55e4388 --- /dev/null +++ b/test/inet/getnetent.c @@ -0,0 +1,17 @@ +#include <stdio.h> +#include <netdb.h> +int main(void) +{ + struct netent *net; + setnetent(0); + while ((net = getnetent())) { + while (net->n_net && !((net->n_net >> 24) & 0xff)) { + net->n_net <<= 8; + } + printf("%u.%u.%u.%u\n", + (net->n_net >> 24) & 0xff, (net->n_net >> 16) & 0xff, + (net->n_net >> 8) & 0xff, net->n_net & 0xff); + } + endnetent(); + return 0; +} diff --git a/test/inet/tst-ether_aton.c b/test/inet/tst-ether_aton.c new file mode 100644 index 000000000..67cb43540 --- /dev/null +++ b/test/inet/tst-ether_aton.c @@ -0,0 +1,46 @@ +#include <stdio.h> +#include <stdint.h> +#include <string.h> +#include <netinet/ether.h> + +static struct tests +{ + const char *input; + int valid; + uint8_t result[6]; +} tests[] = +{ + { "", 0, {0, 0, 0, 0, 0, 0} }, + { "AB:CD:EF:01:23:45", 1, {171, 205, 239, 1, 35, 69} }, + { "\022B:BB:BB:BB:BB:BB", 0, {0, 0, 0, 0, 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 ether_addr *addr; + + if (!!(addr = ether_aton (tests[cnt].input)) != tests[cnt].valid) + { + if (tests[cnt].valid) + printf ("\"%s\" not seen as valid MAC address\n", tests[cnt].input); + else + printf ("\"%s\" seen as valid MAC address\n", tests[cnt].input); + result = 1; + } + else if (tests[cnt].valid + && memcmp(addr, &tests[cnt].result, sizeof(struct ether_addr))) + { + printf ("\"%s\" not converted correctly\n", tests[cnt].input); + result = 1; + } + } + + return result; +} diff --git a/test/inet/tst-ifaddrs.c b/test/inet/tst-ifaddrs.c new file mode 100644 index 000000000..6e6c01570 --- /dev/null +++ b/test/inet/tst-ifaddrs.c @@ -0,0 +1,99 @@ +/* Test listing of network interface addresses. + Copyright (C) 2002-2015 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ifaddrs.h> +#include <netinet/in.h> +#include <arpa/inet.h> + +static int failures; + +static const char * +addr_string (struct sockaddr *sa, char *buf, size_t size) +{ + if (sa == NULL) + return "<none>"; + + switch (sa->sa_family) + { + case AF_INET: + return inet_ntop (AF_INET, &((struct sockaddr_in *) sa)->sin_addr, + buf, size); + case AF_INET6: + return inet_ntop (AF_INET6, &((struct sockaddr_in6 *) sa)->sin6_addr, + buf, size); +#ifdef AF_LINK + case AF_LINK: + return "<link>"; +#endif + case AF_UNSPEC: + return "---"; + +#ifdef AF_PACKET + case AF_PACKET: + return "<packet>"; +#endif + + default: + ++failures; + printf ("sa_family=%d %08x\n", sa->sa_family, + *(int*)&((struct sockaddr_in *) sa)->sin_addr.s_addr); + return "<unexpected sockaddr family>"; + } +} + + +static int +do_test (void) +{ + struct ifaddrs *ifaces, *ifa; + + if (getifaddrs (&ifaces) < 0) + { + if (errno != ENOSYS) + { + printf ("Couldn't get any interfaces: %s.\n", strerror (errno)); + exit (1); + } + /* The function is simply not implemented. */ + exit (0); + } + + puts ("\ +Name Flags Address Netmask Broadcast/Destination"); + + for (ifa = ifaces; ifa != NULL; ifa = ifa->ifa_next) + { + char abuf[64], mbuf[64], dbuf[64]; + printf ("%-15s%#.4x %-15s %-15s %-15s\n", + ifa->ifa_name, ifa->ifa_flags, + addr_string (ifa->ifa_addr, abuf, sizeof (abuf)), + addr_string (ifa->ifa_netmask, mbuf, sizeof (mbuf)), + addr_string (ifa->ifa_broadaddr, dbuf, sizeof (dbuf))); + } + + freeifaddrs (ifaces); + + return failures ? 1 : 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/inet/tst-network.c b/test/inet/tst-network.c index 259863733..c6089aa6c 100644 --- a/test/inet/tst-network.c +++ b/test/inet/tst-network.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <sys/socket.h> diff --git a/test/inet/tst-res.c b/test/inet/tst-res.c new file mode 100644 index 000000000..b65f30fd6 --- /dev/null +++ b/test/inet/tst-res.c @@ -0,0 +1,44 @@ +#include <stdlib.h> +#include <assert.h> +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/nameser.h> +#include <resolv.h> +#include <netdb.h> + +int main(int argc, char **argv) +{ + int r; + struct __res_state state; + + r = res_ninit(&state); + if (r) { + herror("ninit"); + abort(); + } + r = res_init(); + if (r) { + herror("init"); + abort(); + } + +#ifdef __UCLIBC_HAS_BSD_RES_CLOSE__ + res_close(); +#endif +#ifdef __UCLIBC__ + /* assume there is at least one resolver configured */ + assert (state._u._ext.nscount > 0); +#else + assert (state._u._ext.nscount == 0); +#endif + assert (state.options & RES_INIT); + res_nclose(&state); +#ifdef __UCLIBC__ + /* We wipe the whole thing */ + assert ((state.options & RES_INIT) == 0); +#endif + assert (state._u._ext.nscount == 0); + + return 0; +} + diff --git a/test/inet/tst-sock-nonblock.c b/test/inet/tst-sock-nonblock.c new file mode 100644 index 000000000..54a7ee28a --- /dev/null +++ b/test/inet/tst-sock-nonblock.c @@ -0,0 +1,53 @@ +/* vi: set sw=4 ts=4 sts=4: */ +/* + * Nonblocking socket test for uClibc + * Copyright (C) 2012 by Kevin Cernekee <cernekee@gmail.com> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <error.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/un.h> +#include <sys/fcntl.h> + +static int +do_test(void) +{ + int fd, ret, result = 0; + struct sockaddr_un sa; + char buf; + + fd = socket(AF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0); + if (fd < 0) { + perror("socket()"); + result = 1; + } + + memset(&sa, 0, sizeof(sa)); + sa.sun_family = AF_UNIX; + strcpy(sa.sun_path, "socktest"); + unlink("socktest"); + if (bind(fd, (const struct sockaddr *)&sa, sizeof(sa)) < 0) { + perror("bind()"); + result = 1; + } + + ret = read(fd, &buf, sizeof(buf)); + if (ret != -1 || errno != EAGAIN) { + error(0, 0, "Nonblocking read returned %d", ret); + result = 1; + } + + return result; +} + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/librt/Makefile b/test/librt/Makefile new file mode 100644 index 000000000..1021afe9c --- /dev/null +++ b/test/librt/Makefile @@ -0,0 +1,8 @@ +# uClibc shm tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in +include ../Test.mak diff --git a/test/librt/Makefile.in b/test/librt/Makefile.in new file mode 100644 index 000000000..f25522cbe --- /dev/null +++ b/test/librt/Makefile.in @@ -0,0 +1,8 @@ +# uClibc shm tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +LDFLAGS_shmtest := -lrt + +ifeq ($(ARCH_USE_MMU),) +TESTS_DISABLED := shmtest +endif diff --git a/test/librt/shmtest.c b/test/librt/shmtest.c new file mode 100644 index 000000000..a14302d09 --- /dev/null +++ b/test/librt/shmtest.c @@ -0,0 +1,104 @@ +/* Copyright (C) 2009 Mikael Lund Jepsen <mlj@iccc.dk> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include <errno.h> +#include <fcntl.h> +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/mman.h> +#include <sys/stat.h> +#include <sys/wait.h> + +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) + +char shared_name[] = "/sharetest"; +int test_data[11] = {0,1,2,3,4,5,6,7,8,9,10}; + +int main(void) { + int pfds[2]; + pid_t pid; + int fd; + int test_data_fails = 0; + char *ptest_data; + unsigned int i; + char buf[30]; + int rv; + + pipe(pfds); + + switch(pid = fork()) { + case -1: + perror("fork"); + exit(1); /* parent exits */ + + case 0: + /* Child */ + + /* wait for parent */ + read(pfds[0], buf, 5); + + fd = shm_open(shared_name, O_RDWR, DEFFILEMODE); + if (fd == -1) { + perror("CHILD - shm_open(existing):"); + exit(1); + } else { + ptest_data = mmap(0, sizeof(test_data), PROT_READ + PROT_WRITE, MAP_SHARED, fd, 0); + if (ptest_data != MAP_FAILED) { + for (i=0; i < ARRAY_SIZE(test_data); i++) { + if (ptest_data[i] != test_data[i]) { + printf("%-40s: Offset %d, local %d, shm %d\n", "Compare memory error", i, test_data[i], ptest_data[i]); + test_data_fails++; + } + } + if (test_data_fails == 0) + printf("%-40s: %s\n", "Compare memory", "Success"); + + munmap(ptest_data, sizeof(test_data)); + } + } + exit(0); + + default: + /* Parent */ + fd = shm_open(shared_name, O_RDWR+O_CREAT+O_EXCL, DEFFILEMODE ); + if (fd == -1) { + perror("PARENT - shm_open(create):"); + } else { + if ((ftruncate(fd, sizeof(test_data))) == -1) + { + printf("%-40s: %s", "ftruncate", strerror(errno)); + shm_unlink(shared_name); + return 0; + } + + ptest_data = mmap(0, sizeof(test_data), PROT_READ + PROT_WRITE, MAP_SHARED, fd, 0); + if (ptest_data == MAP_FAILED) + { + perror("PARENT - mmap:"); + if (shm_unlink(shared_name) == -1) { + perror("PARENT - shm_unlink:"); + } + return 0; + } + for (i=0; i < ARRAY_SIZE(test_data); i++) + ptest_data[i] = test_data[i]; + + /* signal child */ + write(pfds[1], "rdy", 5); + /* wait for child */ + wait(&rv); + + /* Cleanup */ + munmap(ptest_data, sizeof(test_data)); + if (shm_unlink(shared_name) == -1) { + perror("PARENT - shm_unlink:"); + } + } + } + return 0; +} diff --git a/test/locale-mbwc/Makefile b/test/locale-mbwc/Makefile index 8f5a2dba8..263f325b9 100644 --- a/test/locale-mbwc/Makefile +++ b/test/locale-mbwc/Makefile @@ -1,29 +1,8 @@ # uClibc locale tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -# tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \ - -TESTS := tst_iswalnum tst_iswalpha tst_iswcntrl \ - tst_iswctype tst_iswdigit tst_iswgraph \ - tst_iswlower tst_iswprint tst_iswpunct \ - tst_iswspace tst_iswupper tst_iswxdigit \ - tst_mblen tst_mbrlen tst_mbrtowc tst_mbsrtowcs \ - tst_mbstowcs tst_mbtowc tst_strcoll tst_strxfrm \ - tst_swscanf tst_towctrans tst_towlower \ - tst_towupper tst_wcrtomb tst_wcscat tst_wcschr \ - tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn \ - tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy \ - tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \ - tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \ - tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \ - tst_wctype tst_wcwidth tst_strfmon - - -# NOTE: For now disabled tst_strfmon to avoid build failure. -TESTS_DISABLED := tst_strfmon +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -DODIFF_rint := 1 - -EXTRA_CFLAGS := -D__USE_GNU -fno-builtin - diff --git a/test/locale-mbwc/Makefile.in b/test/locale-mbwc/Makefile.in new file mode 100644 index 000000000..d6a84f234 --- /dev/null +++ b/test/locale-mbwc/Makefile.in @@ -0,0 +1,31 @@ +# uClibc locale tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \ + +TESTS := tst_iswalnum tst_iswalpha tst_iswcntrl \ + tst_iswctype tst_iswdigit tst_iswgraph \ + tst_iswlower tst_iswprint tst_iswpunct \ + tst_iswspace tst_iswupper tst_iswxdigit \ + tst_mblen tst_mbrlen tst_mbrtowc tst_mbsrtowcs \ + tst_mbstowcs tst_mbtowc tst_strcoll tst_strxfrm \ + tst_swscanf tst_towctrans tst_towlower \ + tst_towupper tst_wcrtomb tst_wcscat tst_wcschr \ + tst_wcscmp tst_wcscoll tst_wcscpy tst_wcscspn \ + tst_wcslen tst_wcsncat tst_wcsncmp tst_wcsncpy \ + tst_wcspbrk tst_wcsrtombs tst_wcsspn tst_wcsstr \ + tst_wcstod tst_wcstok tst_wcstombs tst_wcswidth \ + tst_wcsxfrm tst_wctob tst_wctomb tst_wctrans \ + tst_wctype tst_wcwidth tst_strfmon \ + tst2_mbrtowc + +# NOTE: For now disabled tst_strfmon to avoid build failure. +TESTS_DISABLED := tst_strfmon + +ifneq ($(UCLIBC_HAS_FLOATS),y) +TESTS_DISABLED += tst_swscanf tst_wcstod +endif + +DODIFF_rint := 1 + +EXTRA_CFLAGS := -D__USE_GNU -fno-builtin -fPIC + diff --git a/test/locale-mbwc/dat_iswctype.c b/test/locale-mbwc/dat_iswctype.c index 6448b328f..0dcf1824e 100644 --- a/test/locale-mbwc/dat_iswctype.c +++ b/test/locale-mbwc/dat_iswctype.c @@ -240,7 +240,7 @@ TST_ISWCTYPE tst_iswctype_loc [] = { { { 0x007B, "cntrl" }, { 0,1,0 } }, { { 0x007E, "cntrl" }, { 0,1,0 } }, { { 0x007F, "cntrl" }, { 0,0,0 } }, - { { 0x0080, "cntrl" }, { 0,0,0 } }, + { { 0x0080, "cntrl" }, { 0,1,0 } }, { { 0x0000, "digit" }, { 0,1,0 } }, { { 0x001F, "digit" }, { 0,1,0 } }, { { 0x0020, "digit" }, { 0,1,0 } }, diff --git a/test/locale-mbwc/tst2_mbrtowc.c b/test/locale-mbwc/tst2_mbrtowc.c new file mode 100644 index 000000000..92e12838c --- /dev/null +++ b/test/locale-mbwc/tst2_mbrtowc.c @@ -0,0 +1,21 @@ +#include <wchar.h> +#include <assert.h> +#include <stdlib.h> + +/* bugs.uclibc.org/1471 : make sure output is 0 */ +static int +do_test(void) +{ + wchar_t output; + int result; + + output = L'A'; /* anything other than 0 will do... */ + result = mbrtowc (&output, "", 1, 0); + + assert (result == 0); + assert (output == 0); + + return EXIT_SUCCESS; +} +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/locale-mbwc/tst_funcs.h b/test/locale-mbwc/tst_funcs.h index 552bed2f9..4bd0fb1ab 100644 --- a/test/locale-mbwc/tst_funcs.h +++ b/test/locale-mbwc/tst_funcs.h @@ -95,6 +95,7 @@ extern int result (FILE * fp, char res, const char *func, const char *loc, for (loc = 0; strcmp (TST_HEAD (o_func).locale, TST_LOC_end); ++loc) +#ifdef __UCLIBC_HAS_LOCALE__ #define TST_HEAD_LOCALE(ofunc, s_func) \ func_id = TST_HEAD (ofunc).func_id; \ locale = TST_HEAD (ofunc).locale; \ @@ -106,6 +107,29 @@ extern int result (FILE * fp, char res, const char *func, const char *loc, ++err_count; \ continue; \ } +#else +#define TST_HEAD_LOCALE(ofunc, s_func) \ + func_id = TST_HEAD (ofunc).func_id; \ + locale = TST_HEAD (ofunc).locale; \ + if (strcmp(locale, "C") == 0) \ + { \ + if (setlocale (LC_ALL, locale) == NULL) \ + { \ + fprintf (stderr, "Warning : can't set locale: %s\nskipping ...\n", \ + locale); \ + result (fp, C_LOCALES, s_func, locale, 0, 0, 0, "can't set locale"); \ + ++err_count; \ + continue; \ + } \ + } \ + else \ + { \ + fprintf (stderr, "Warning : locale %s unsupported\n\n", \ + locale); \ + result (fp, C_LOCALES, s_func, locale, 0, 0, 0, "unsupported"); \ + continue; \ + } +#endif #define TST_DO_REC(ofunc) \ for (rec=0; !TST_IS_LAST (ofunc); ++rec) diff --git a/test/locale/Makefile b/test/locale/Makefile index 0ab07f7aa..263f325b9 100644 --- a/test/locale/Makefile +++ b/test/locale/Makefile @@ -1,31 +1,8 @@ # uClibc locale tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -# tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \ - -TESTS := bug-iconv-trans bug-usesetlocale collate-test dump-ctype \ - gen-unicode-ctype show-ucs-data tst-ctype \ - tst-digits tst-fmon tst-langinfo tst-leaks tst-mbswcs1 \ - tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 tst-mbswcs6 \ - tst_nl_langinfo tst-numeric tst-rpmatch tst-setlocale \ - tst-sscanf tst-strfmon1 tst-trans tst-wctype tst-xlocale1 \ - tst-xlocale2 xfrm-test - - -# NOTE: For now disabled some tests that are known not build -TESTS_DISABLED := tst-ctype tst-fmon tst-leaks tst-rpmatch tst-strfmon1 - -ifneq ($(UCLIBC_HAS_XLOCALE),y) -TESTS_DISABLED += bug-usesetlocale tst-xlocale1 tst-xlocale2 xfrm-test tst-C-locale -endif +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -DODIFF_rint := 1 - -EXTRA_CFLAGS := -D__USE_GNU -fno-builtin - -OPTS_dump-ctype = C -OPTS_tst-ctype = < tst-ctype-de_DE.ISO-8859-1.in -OPTS_tst-langinfo = < tst-langinfo.input - -EXTRA_CLEAN := C diff --git a/test/locale/Makefile.in b/test/locale/Makefile.in new file mode 100644 index 000000000..806ea2866 --- /dev/null +++ b/test/locale/Makefile.in @@ -0,0 +1,31 @@ +# uClibc locale tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# tst_mbtowc tst_strcoll tst_strfmon tst_strxfrm \ + +TESTS := bug-iconv-trans bug-usesetlocale collate-test dump-ctype \ + gen-unicode-ctype show-ucs-data tst-ctype \ + tst-digits tst-fmon tst-langinfo tst-leaks tst-mbswcs1 \ + tst-mbswcs2 tst-mbswcs3 tst-mbswcs4 tst-mbswcs5 tst-mbswcs6 \ + tst_nl_langinfo tst-numeric tst-rpmatch tst-setlocale \ + tst-sscanf tst-strfmon1 tst-trans tst-wctype tst-xlocale1 \ + tst-xlocale2 xfrm-test + + +# NOTE: For now disabled some tests that are known not build +TESTS_DISABLED := tst-ctype tst-fmon tst-leaks tst-rpmatch tst-strfmon1 + +ifneq ($(UCLIBC_HAS_XLOCALE),y) +TESTS_DISABLED += bug-usesetlocale tst-xlocale1 tst-xlocale2 xfrm-test tst-C-locale +endif + +DODIFF_rint := 1 + +EXTRA_CFLAGS := -D__USE_GNU -fno-builtin + +OPTS_dump-ctype = C +OPTS_tst-ctype = < tst-ctype-de_DE.ISO-8859-1.in +OPTS_tst-langinfo = < tst-langinfo.input + +CFLAGS_tst-sscanf = -fPIC + +EXTRA_DIRS := C diff --git a/test/locale/collate-test.c b/test/locale/collate-test.c index e8f43218f..a84974cef 100644 --- a/test/locale/collate-test.c +++ b/test/locale/collate-test.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <ctype.h> #include <error.h> diff --git a/test/locale/dump-ctype.c b/test/locale/dump-ctype.c index a1f24c656..6cf96d81d 100644 --- a/test/locale/dump-ctype.c +++ b/test/locale/dump-ctype.c @@ -15,9 +15,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* Usage example: $ dump-ctype de_DE.UTF-8 diff --git a/test/locale/gen-unicode-ctype.c b/test/locale/gen-unicode-ctype.c index 849f272ed..0c74e6a7e 100644 --- a/test/locale/gen-unicode-ctype.c +++ b/test/locale/gen-unicode-ctype.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* Usage example: $ gen-unicode /usr/local/share/Unidata/UnicodeData.txt 3.1 diff --git a/test/locale/tst-C-locale.c b/test/locale/tst-C-locale.c index c568cf404..282d53aac 100644 --- a/test/locale/tst-C-locale.c +++ b/test/locale/tst-C-locale.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <ctype.h> #include <langinfo.h> diff --git a/test/locale/tst-ctype.c b/test/locale/tst-ctype.c index c03c2dab3..d61739851 100644 --- a/test/locale/tst-ctype.c +++ b/test/locale/tst-ctype.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <ctype.h> #include <locale.h> diff --git a/test/locale/tst-digits.c b/test/locale/tst-digits.c index 8414a4b51..16cf2114e 100644 --- a/test/locale/tst-digits.c +++ b/test/locale/tst-digits.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <ctype.h> #include <langinfo.h> diff --git a/test/locale/tst-fmon.c b/test/locale/tst-fmon.c index 11093ce6c..bcdd2d03e 100644 --- a/test/locale/tst-fmon.c +++ b/test/locale/tst-fmon.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <locale.h> diff --git a/test/locale/tst-langinfo.c b/test/locale/tst-langinfo.c index e95f0da53..aca8239bf 100644 --- a/test/locale/tst-langinfo.c +++ b/test/locale/tst-langinfo.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <langinfo.h> #include <locale.h> diff --git a/test/locale/tst-langinfo.input b/test/locale/tst-langinfo.input index 0a05ab862..8f1861b22 100644 --- a/test/locale/tst-langinfo.input +++ b/test/locale/tst-langinfo.input @@ -15,9 +15,8 @@ # 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. +# License along with the GNU C Library; see the file COPYING.LIB. If +# not, see <http://www.gnu.org/licenses/>. # Run the test program. diff --git a/test/locale/tst-mbswcs1.c b/test/locale/tst-mbswcs1.c index fb2ea84cd..6681ccc9e 100644 --- a/test/locale/tst-mbswcs1.c +++ b/test/locale/tst-mbswcs1.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <string.h> diff --git a/test/locale/tst-mbswcs2.c b/test/locale/tst-mbswcs2.c index 49f13cc87..042069f82 100644 --- a/test/locale/tst-mbswcs2.c +++ b/test/locale/tst-mbswcs2.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <string.h> diff --git a/test/locale/tst-mbswcs3.c b/test/locale/tst-mbswcs3.c index 0c4af4c14..73bb59af0 100644 --- a/test/locale/tst-mbswcs3.c +++ b/test/locale/tst-mbswcs3.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <string.h> diff --git a/test/locale/tst-mbswcs4.c b/test/locale/tst-mbswcs4.c index e02b67569..872040138 100644 --- a/test/locale/tst-mbswcs4.c +++ b/test/locale/tst-mbswcs4.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <string.h> diff --git a/test/locale/tst-mbswcs5.c b/test/locale/tst-mbswcs5.c index 7cab97e72..efb6dda89 100644 --- a/test/locale/tst-mbswcs5.c +++ b/test/locale/tst-mbswcs5.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <string.h> diff --git a/test/locale/tst-mbswcs6.c b/test/locale/tst-mbswcs6.c index eb383ac87..4bbb961d5 100644 --- a/test/locale/tst-mbswcs6.c +++ b/test/locale/tst-mbswcs6.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <errno.h> #include <locale.h> diff --git a/test/locale/tst-numeric.c b/test/locale/tst-numeric.c index 9d3c91d15..a7911f1b2 100644 --- a/test/locale/tst-numeric.c +++ b/test/locale/tst-numeric.c @@ -16,9 +16,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <locale.h> diff --git a/test/locale/tst-rpmatch.c b/test/locale/tst-rpmatch.c index d751a43bf..91e23650b 100644 --- a/test/locale/tst-rpmatch.c +++ b/test/locale/tst-rpmatch.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <locale.h> #include <stdio.h> diff --git a/test/locale/tst-trans.c b/test/locale/tst-trans.c index 034a36216..081a9aaaf 100644 --- a/test/locale/tst-trans.c +++ b/test/locale/tst-trans.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <locale.h> #include <stdio.h> diff --git a/test/locale/tst-wctype.c b/test/locale/tst-wctype.c index 8fd8ce518..21ebd9294 100644 --- a/test/locale/tst-wctype.c +++ b/test/locale/tst-wctype.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <error.h> #include <locale.h> diff --git a/test/locale/xfrm-test.c b/test/locale/xfrm-test.c index 199bb6b5a..1ab087440 100644 --- a/test/locale/xfrm-test.c +++ b/test/locale/xfrm-test.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <ctype.h> #include <error.h> diff --git a/test/malloc/Makefile b/test/malloc/Makefile index 3e92e6cdb..97c424be6 100644 --- a/test/malloc/Makefile +++ b/test/malloc/Makefile @@ -1,6 +1,8 @@ # uClibc malloc tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -TESTS_DISABLED := time_malloc - +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak diff --git a/test/malloc/Makefile.in b/test/malloc/Makefile.in new file mode 100644 index 000000000..9e7cac9f0 --- /dev/null +++ b/test/malloc/Makefile.in @@ -0,0 +1,18 @@ +# uClibc malloc tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +TESTS_DISABLED := time_malloc + +ifneq ($(UCLIBC_SUSV2_LEGACY),y) +TESTS_DISABLED += tst-valloc +endif + +ifneq ($(UCLIBC_HAS_OBSTACK),y) +TESTS_DISABLED += tst-obstack +endif + +ifneq ($(MALLOC_STANDARD),y) +TESTS_DISABLED += tst-asprintf +endif + +CFLAGS_tst-mallocfork = -fPIC diff --git a/test/malloc/tst-asprintf.c b/test/malloc/tst-asprintf.c new file mode 100644 index 000000000..d4c3f7676 --- /dev/null +++ b/test/malloc/tst-asprintf.c @@ -0,0 +1,27 @@ +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <malloc.h> + +static void my_stats(void) +{ + malloc_stats(); + fprintf(stderr, "\n"); +} + +int main(int argc, char *argv[]) +{ + char *a, *b; + + my_stats(); + asprintf(&b, "asdsadasd %ssdf\n", "AAAA"); + my_stats(); + asprintf(&a, "asdsadasd %ssdf\n", "AAAA"); + my_stats(); + free(a); + free(b); + my_stats(); + + return 0; +} diff --git a/test/malloc/tst-calloc.c b/test/malloc/tst-calloc.c index b3594c937..b7b6d2bd2 100644 --- a/test/malloc/tst-calloc.c +++ b/test/malloc/tst-calloc.c @@ -13,17 +13,16 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <errno.h> -#include <error.h> #include <limits.h> #include <malloc.h> #include <stdlib.h> #include <stdio.h> +static int errors = 0; /* Number of samples per size. */ #define N 50000 @@ -46,10 +45,11 @@ fixed_test (int size) for (j = 0; j < size; ++j) { - if (ptrs[i][j] != '\0') - error (EXIT_FAILURE, 0, - "byte not cleared (size %d, element %d, byte %d)", + if (ptrs[i][j] != '\0') { + ++errors; + printf("byte not cleared (size %d, element %d, byte %d)", size, i, j); + } ptrs[i][j] = '\xff'; } } @@ -79,10 +79,11 @@ random_test (void) for (j = 0; j < size; ++j) { - if (ptrs[i][j] != '\0') - error (EXIT_FAILURE, 0, - "byte not cleared (size %d, element %d, byte %d)", + if (ptrs[i][j] != '\0') { + ++errors; + printf("byte not cleared (size %d, element %d, byte %d)", size, i, j); + } ptrs[i][j] = '\xff'; } } @@ -122,5 +123,5 @@ main (void) null_test (); - return 0; + return errors != 0; } diff --git a/test/malloc/tst-malloc.c b/test/malloc/tst-malloc.c index 468e1d4ba..2d3bcce17 100644 --- a/test/malloc/tst-malloc.c +++ b/test/malloc/tst-malloc.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <errno.h> #include <malloc.h> diff --git a/test/malloc/tst-mcheck.c b/test/malloc/tst-mcheck.c index af72c042b..9297d7994 100644 --- a/test/malloc/tst-mcheck.c +++ b/test/malloc/tst-mcheck.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <errno.h> #include <stdio.h> diff --git a/test/malloc/tst-obstack.c b/test/malloc/tst-obstack.c index 769697f18..1841946c3 100644 --- a/test/malloc/tst-obstack.c +++ b/test/malloc/tst-obstack.c @@ -1,4 +1,8 @@ -/* Test case by Alexandre Duret-Lutz <duret_g@epita.fr>. */ +/* Test case by Alexandre Duret-Lutz <duret_g@epita.fr>. + * test_obstack_printf() added by Anthony G. Basile <blueness.gentoo.org>. + */ + +#include <features.h> #include <obstack.h> #include <stdint.h> #include <stdio.h> @@ -26,7 +30,7 @@ verbose_free (void *buf) } int -main (void) +test_obstack_alloc (void) { int result = 0; int align = 2; @@ -62,3 +66,39 @@ main (void) return result; } + +int +test_obstack_printf (void) +{ + int result = 0; + int n; + char *s; + struct obstack ob; + + obstack_init (&ob); + + n = obstack_printf (&ob, "%s%d%c", "testing 1 ... 2 ... ", 3, '\n'); + result |= (n != 22); + printf("obstack_printf => %d\n", n); + + n = obstack_printf (&ob, "%s%d%c", "testing 3 ... 2 ... ", 1, '\0'); + result |= (n != 22); + printf("obstack_printf => %d\n", n); + + s = obstack_finish (&ob); + printf("obstack_printf => %s\n", s); + obstack_free (&ob, NULL); + + return result; +} + +int +main (void) +{ + int result = 0; + + result |= test_obstack_alloc(); + result |= test_obstack_printf(); + + return result; +} diff --git a/test/math/Makefile b/test/math/Makefile index e65f1700e..6194efa07 100644 --- a/test/math/Makefile +++ b/test/math/Makefile @@ -1,26 +1,8 @@ # uClibc math tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -TESTS := basic-test rint tst-definitions test-fpucw -# test-double test-idouble -# test-float test-ifloat -# test-ldouble test-ildouble - +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -DODIFF_rint := 1 - -# NOTE: For basic-test we must disable the floating point optimization. -# Only for sh architecture because in the other architecture are disabled. -ifeq ($(TARGET_ARCH),sh) -CFLAGS_basic-test := -mieee -endif -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 - $(Q)$(PERL) ./gen-libm-test.pl -u $< ./libm-test.inc -o "." 2>&1 > /dev/null -EXTRA_CLEAN := libm-test.c libm-test-ulps.h -$(TARGETS): libm-test.c diff --git a/test/math/Makefile.in b/test/math/Makefile.in new file mode 100644 index 000000000..387400151 --- /dev/null +++ b/test/math/Makefile.in @@ -0,0 +1,46 @@ +# uClibc math tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +# libm-test.c is a generated file used by the tests internally so skip it +TESTS_DISABLED := libm-test + +# gamma (removed from TESTS, need to add "small errors are ok" machinery there) +TESTS_DISABLED += gamma +ifeq ($(UCLIBC_HAS_LONG_DOUBLE_MATH),) +TESTS_DISABLED += test-ldouble test-ildoubl compile_test c99_test +CFLAGS_basic-test := -DNO_LONG_DOUBLE +endif +ifeq ($(DO_C99_MATH),) +TESTS_DISABLED += test-float test-ifloat test-double test-idouble rint signgam ilogb +endif +ifeq ($(UCLIBC_HAS_FPU),) +TESTS_DISABLED += test-fpucw +endif + +DODIFF_rint := 1 +DODIFF_signgam := 1 + +# NOTE: For basic-test we must disable the floating point optimization. +# Only for sh architecture because in the other architecture are disabled. +ifeq ($(TARGET_ARCH),sh) +CFLAGS_basic-test += -mieee +endif +EXTRA_CFLAGS := -fno-builtin +EXTRA_LDFLAGS := -lm + +PERL := perl + +MDEPS := $(wildcard test-*.c) +$(MDEPS): libm-test.c + +ULP_SUFFIX := +ifeq ($(TARGET_ARCH),mips) +ULP_SUFFIX:=$(if $(CONFIG_MIPS_N64_ABI),64,32) +endif + +TARGET_ULP := $(if $(wildcard libm-test-ulps-$(TARGET_ARCH)$(ULP_SUFFIX)),$(TARGET_ARCH)$(ULP_SUFFIX),generic) + +libm-test.c: libm-test-ulps-$(TARGET_ULP) libm-test.inc gen-libm-test.pl + $(Q)$(PERL) ./gen-libm-test.pl -u libm-test-ulps-$(TARGET_ULP) ./libm-test.inc -o "." 2>&1 > /dev/null + +EXTRA_CLEAN := libm-test.c libm-test-ulps.h diff --git a/test/math/basic-test.c b/test/math/basic-test.c index e42c01457..d073abb0f 100644 --- a/test/math/basic-test.c +++ b/test/math/basic-test.c @@ -13,9 +13,10 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#define _ISOC99_SOURCE #include <math.h> #include <float.h> @@ -63,11 +64,6 @@ NAME (void) \ 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 \ @@ -76,7 +72,6 @@ NAME (void) \ 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. \ @@ -87,6 +82,48 @@ NAME (void) \ check (#FLOAT " !isinf (-NAN)", !(isinf (-NANFUNC ("")))); \ check (#FLOAT " NAN != NAN", NANFUNC ("") != NANFUNC ("")); \ \ + /* 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); \ +} +#ifndef DO_C99_MATH +# undef TEST_FUNC +# define TEST_FUNC(NAME, FLOAT, NANFUNC, EPSILON, HUGEVAL) \ +static void \ +NAME(void) \ +{ /* nothing */ } +#endif + +#define TEST_VAL(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 " 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); \ + \ + check (#FLOAT " NAN != NAN", NAN != NAN); \ + \ + \ /* test if EPSILON is ok */ \ x1 = 1.0; \ x2 = x1 + EPSILON; \ @@ -96,27 +133,28 @@ NAME (void) \ 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) +TEST_VAL (float_test_value, float, nanf, FLT_EPSILON, HUGE_VALF) +TEST_FUNC (float_test_call, float, nanf, FLT_EPSILON, HUGE_VALF) +TEST_VAL (double_test_value, double, nan, DBL_EPSILON, HUGE_VAL) +TEST_FUNC (double_test_call, double, nan, DBL_EPSILON, HUGE_VAL) #ifndef NO_LONG_DOUBLE -TEST_FUNC (ldouble_test, long double, nanl, LDBL_EPSILON, HUGE_VALL) +TEST_VAL (ldouble_test_value, long double, nanl, LDBL_EPSILON, HUGE_VALL) +TEST_FUNC (ldouble_test_call, long double, nanl, LDBL_EPSILON, HUGE_VALL) #endif int main (void) { - float_test (); - double_test (); + float_test_value (); + float_test_call (); + double_test_value (); + double_test_call (); #ifndef NO_LONG_DOUBLE - ldouble_test (); + ldouble_test_value (); + ldouble_test_call (); #endif return errors != 0; diff --git a/test/math/c99_test.c b/test/math/c99_test.c new file mode 100644 index 000000000..73382e41b --- /dev/null +++ b/test/math/c99_test.c @@ -0,0 +1,116 @@ +#include <math.h> +#include <float.h> +#include <stdlib.h> +#include <stdint.h> +#include <limits.h> +#include <stdio.h> + +#define check_d1(func, param, expected) \ +do { \ + int err; hex_union ur; hex_union up; \ + double result = func(param); up.f = param; ur.f = result; \ + errors += (err = (result != (expected))); \ + err \ + ? printf("FAIL: %s(%g/"HEXFMT")=%g/"HEXFMT" (expected %g)\n", \ + #func, (double)(param), (long long)up.hex, result, (long long)ur.hex, (double)(expected)) \ + : printf("PASS: %s(%g)=%g\n", #func, (double)(param), result); \ +} while (0) + +#define check_i1(func, param, expected) \ +do { \ + int err; hex_union up; \ + long long result = func(param); up.f = param; \ + errors += (err = (result != (expected))); \ + err \ + ? printf("FAIL: %s(%g/"HEXFMT")=%lld/%llu (expected %llu)\n", \ + #func, (double)(param), (long long)up.hex, result, result, (long long)(expected)) \ + : printf("PASS: %s(%g)=%lld/%llu\n", #func, (double)(param), result, result); \ +} while (0) + +#define HEXFMT "%08llx" +typedef union { + double f; + uint64_t hex; +} hex_union; + +double zero = 0.0; +double minus_zero = 0.0; +double nan_value = 0.0; +int errors = 0; + +int main(void) +{ + nan_value /= nan_value; + minus_zero = copysign(zero, -1.0); + + check_i1(isfinite, 1.0, 1); + check_i1(isfinite, 2.0, 1); + check_i1(isfinite, 3.0, 1); + check_i1(isfinite, DBL_MAX, 1); + check_i1(isfinite, FLT_MAX, 1); + check_i1(isfinite, HUGE_VAL, 0); + check_i1(isfinite, HUGE_VALF, 0); + check_i1(isfinite, HUGE_VALL, 0); + check_i1(isfinite, nan_value, 0); + check_i1(isfinite, nan_value, 0); + check_i1(isfinite, nan_value, 0); + + check_i1(isnan, 1.0, 0); + check_i1(isnan, 2.0, 0); + check_i1(isnan, 3.0, 0); + check_i1(isnan, DBL_MAX, 0); + check_i1(isnan, FLT_MAX, 0); + check_i1(isnan, HUGE_VAL, 0); + check_i1(isnan, HUGE_VALF, 0); + check_i1(isnan, HUGE_VALL, 0); + check_i1(isnan, (float)HUGE_VALL, 0); + check_i1(isnan, nan_value, 1); + check_i1(isnan, nan_value, 1); + check_i1(isnan, nan_value, 1); + + check_i1(isinf, 1.0, 0); + check_i1(isinf, 2.0, 0); + check_i1(isinf, 3.0, 0); + check_i1(isinf, DBL_MAX, 0); + check_i1(isinf, FLT_MAX, 0); + check_i1(isinf, (float)DBL_MAX, 1); + check_i1(isinf, HUGE_VAL, 1); + check_i1(isinf, HUGE_VALF, 1); + check_i1(isinf, HUGE_VALL, 1); + check_i1(isinf, (float)HUGE_VALL, 1); + check_i1(isinf, nan_value, 0); + check_i1(isinf, nan_value, 0); + check_i1(isinf, nan_value, 0); + + check_i1(fpclassify, minus_zero, FP_ZERO); + check_i1(fpclassify, 0.0, FP_ZERO); + check_i1(fpclassify, 1.0, FP_NORMAL); + check_i1(fpclassify, 2.0, FP_NORMAL); + check_i1(fpclassify, 3.0, FP_NORMAL); + check_i1(fpclassify, DBL_MIN/1.01, FP_SUBNORMAL); + check_i1(fpclassify, DBL_MIN, FP_NORMAL); + check_i1(fpclassify, DBL_MAX, FP_NORMAL); + check_i1(fpclassify, FLT_MAX, FP_NORMAL); + check_i1(fpclassify, DBL_MAX, FP_NORMAL); + check_i1(fpclassify, DBL_MAX*1.01, FP_INFINITE); + check_i1(fpclassify, HUGE_VAL, FP_INFINITE); + check_i1(fpclassify, HUGE_VALF, FP_INFINITE); + check_i1(fpclassify, HUGE_VALL, FP_INFINITE); + check_i1(fpclassify, (float)HUGE_VALL, FP_INFINITE); + check_i1(fpclassify, nan_value, FP_NAN); + check_i1(fpclassify, nan_value, FP_NAN); + check_i1(fpclassify, nan_value, FP_NAN); + + check_i1(!!signbit, -1.0, 1); + check_i1(!!signbit, minus_zero, 1); + check_i1(!!signbit, 0.0, 0); + check_i1(!!signbit, HUGE_VAL, 0); + check_i1(!!signbit, HUGE_VALF, 0); + check_i1(!!signbit, HUGE_VALL, 0); + check_i1(!!signbit, -HUGE_VAL, 1); + check_i1(!!signbit, -HUGE_VALF, 1); + check_i1(!!signbit, -HUGE_VALL, 1); + + printf("Errors: %d\n", errors); + return errors; +} diff --git a/test/math/compile_test.c b/test/math/compile_test.c new file mode 100644 index 000000000..aedfde601 --- /dev/null +++ b/test/math/compile_test.c @@ -0,0 +1,141 @@ +#include <math.h> + +static int testf(float float_x, long double long_double_x, /*float complex float_complex_x,*/ int int_x, long long_x) +{ +int r = 0; +r += acosf(float_x); +r += acoshf(float_x); +r += asinf(float_x); +r += asinhf(float_x); +r += atan2f(float_x, float_x); +r += atanf(float_x); +r += atanhf(float_x); +/*r += cargf(float_complex_x); - will fight with complex numbers later */ +r += cbrtf(float_x); +r += ceilf(float_x); +r += copysignf(float_x, float_x); +r += cosf(float_x); +r += coshf(float_x); +r += erfcf(float_x); +r += erff(float_x); +r += exp2f(float_x); +r += expf(float_x); +r += expm1f(float_x); +r += fabsf(float_x); +r += fdimf(float_x, float_x); +r += floorf(float_x); +r += fmaf(float_x, float_x, float_x); +r += fmaxf(float_x, float_x); +r += fminf(float_x, float_x); +r += fmodf(float_x, float_x); +r += frexpf(float_x, &int_x); +r += gammaf(float_x); +r += hypotf(float_x, float_x); +r += ilogbf(float_x); +r += ldexpf(float_x, int_x); +r += lgammaf(float_x); +r += llrintf(float_x); +r += llroundf(float_x); +r += log10f(float_x); +r += log1pf(float_x); +r += log2f(float_x); +r += logbf(float_x); +r += logf(float_x); +r += lrintf(float_x); +r += lroundf(float_x); +r += modff(float_x, &float_x); +r += nearbyintf(float_x); +r += nexttowardf(float_x, long_double_x); +r += powf(float_x, float_x); +r += remainderf(float_x, float_x); +r += remquof(float_x, float_x, &int_x); +r += rintf(float_x); +r += roundf(float_x); +#ifdef __UCLIBC_SUSV3_LEGACY__ +r += scalbf(float_x, float_x); +#endif +r += scalblnf(float_x, long_x); +r += scalbnf(float_x, int_x); +r += significandf(float_x); +r += sinf(float_x); +r += sinhf(float_x); +r += sqrtf(float_x); +r += tanf(float_x); +r += tanhf(float_x); +r += tgammaf(float_x); +r += truncf(float_x); +return r; +} + +static int testl(long double long_double_x, int int_x, long long_x) +{ +int r = 0; +r += __finitel(long_double_x); +r += __fpclassifyl(long_double_x); +r += __isinfl(long_double_x); +r += __isnanl(long_double_x); +r += __signbitl(long_double_x); +r += acoshl(long_double_x); +r += acosl(long_double_x); +r += asinhl(long_double_x); +r += asinl(long_double_x); +r += atan2l(long_double_x, long_double_x); +r += atanhl(long_double_x); +r += atanl(long_double_x); +r += cbrtl(long_double_x); +r += ceill(long_double_x); +r += copysignl(long_double_x, long_double_x); +r += coshl(long_double_x); +r += cosl(long_double_x); +r += erfcl(long_double_x); +r += erfl(long_double_x); +r += exp2l(long_double_x); +r += expl(long_double_x); +r += expm1l(long_double_x); +r += fabsl(long_double_x); +r += fdiml(long_double_x, long_double_x); +r += floorl(long_double_x); +r += fmal(long_double_x, long_double_x, long_double_x); +r += fmaxl(long_double_x, long_double_x); +r += fminl(long_double_x, long_double_x); +r += fmodl(long_double_x, long_double_x); +r += frexpl(long_double_x, &int_x); +r += hypotl(long_double_x, long_double_x); +r += ilogbl(long_double_x); +r += ldexpl(long_double_x, int_x); +r += lgammal(long_double_x); +r += llrintl(long_double_x); +r += llroundl(long_double_x); +r += log10l(long_double_x); +r += log1pl(long_double_x); +r += log2l(long_double_x); +r += logbl(long_double_x); +r += logl(long_double_x); +r += lrintl(long_double_x); +r += lroundl(long_double_x); +r += modfl(long_double_x, &long_double_x); +r += nearbyintl(long_double_x); +r += nextafterl(long_double_x, long_double_x); +r += nexttowardl(long_double_x, long_double_x); +r += powl(long_double_x, long_double_x); +r += remainderl(long_double_x, long_double_x); +r += remquol(long_double_x, long_double_x, &int_x); +r += rintl(long_double_x); +r += roundl(long_double_x); +r += scalblnl(long_double_x, long_x); +r += scalbnl(long_double_x, int_x); +r += sinhl(long_double_x); +r += sinl(long_double_x); +r += sqrtl(long_double_x); +r += tanhl(long_double_x); +r += tanl(long_double_x); +r += tgammal(long_double_x); +r += truncl(long_double_x); +return r; +} + +int main(int argc, char **argv) +{ + /* Always 0 but gcc hopefully won't be able to notice */ + return 5 & ((long)&testf) & ((long)&testl) & 2; +} diff --git a/test/math/gamma.c b/test/math/gamma.c new file mode 100644 index 000000000..69c10afa4 --- /dev/null +++ b/test/math/gamma.c @@ -0,0 +1,73 @@ +#include <math.h> +#include <float.h> +#include <stdlib.h> +#include <stdint.h> +#include <stdio.h> + +#define check_d1(func, param, expected) \ +do { \ + int err; hex_union ur; hex_union up; \ + double result = func(param); up.f = param; ur.f = result; \ + errors += (err = (result != (expected))); \ + err \ + ? printf("FAIL: %s(%g/"HEXFMT")=%g/"HEXFMT" (expected %g)\n", \ + #func, (double)(param), (long long)up.hex, result, (long long)ur.hex, (double)(expected)) \ + : printf("PASS: %s(%g)=%g\n", #func, (double)(param), result); \ +} while (0) + +#define HEXFMT "%08llx" +typedef union { + double f; + uint64_t hex; +} hex_union; +double result; + +#define M_2_SQRT_PIl 3.5449077018110320545963349666822903L /* 2 sqrt (M_PIl) */ +#define M_SQRT_PIl 1.7724538509055160272981674833411451L /* sqrt (M_PIl) */ + +double zero = 0.0; +double minus_zero = 0.0; +double nan_value = 0.0; +int errors = 0; + +int main(void) +{ + nan_value /= nan_value; + minus_zero = copysign(zero, -1.0); + + //check_d1(tgamma, HUGE_VAL, NAN); + //check_d1(tgamma, negative_integer, NAN); + check_d1(tgamma, 0.0, HUGE_VAL); /* pole */ + check_d1(tgamma, minus_zero, -HUGE_VAL); /* pole */ + check_d1(tgamma, DBL_MAX/2, HUGE_VAL); /* overflow to inf */ + check_d1(tgamma, DBL_MAX, HUGE_VAL); /* overflow to inf */ + check_d1(tgamma, HUGE_VAL, HUGE_VAL); /* overflow to inf */ + check_d1(tgamma, 7, 2*3*4*5*6); /* normal value */ + check_d1(tgamma, -0.5, -M_2_SQRT_PIl); /* normal value (testing negative points) */ + + check_d1(lgamma, -HUGE_VAL, HUGE_VAL); + //check_d1(lgamma, HUGE_VAL, NAN); + check_d1(lgamma, 0.0, HUGE_VAL); /* pole */ + check_d1(lgamma, minus_zero, HUGE_VAL); /* pole */ + check_d1(lgamma, 1.0, 0.0); + check_d1(lgamma, 2.0, 0.0); + check_d1(lgamma, DBL_MAX/2, HUGE_VAL); /* overflow to inf */ + check_d1(lgamma, DBL_MAX, HUGE_VAL); /* overflow to inf */ + check_d1(lgamma, HUGE_VAL, HUGE_VAL); /* overflow to inf */ + check_d1(lgamma, 7, log(2*3*4*5*6)); /* normal value */ + + /* In glibc, gamma == lgamma. (In BSD, it's == tgamma */ + check_d1(gamma, -HUGE_VAL, HUGE_VAL); + //check_d1(gamma, HUGE_VAL, NAN); + check_d1(gamma, 0.0, HUGE_VAL); /* pole */ + check_d1(gamma, minus_zero, HUGE_VAL); /* pole */ + check_d1(gamma, 1.0, 0.0); + check_d1(gamma, 2.0, 0.0); + check_d1(gamma, DBL_MAX/2, HUGE_VAL); /* overflow to inf */ + check_d1(gamma, DBL_MAX, HUGE_VAL); /* overflow to inf */ + check_d1(gamma, HUGE_VAL, HUGE_VAL); /* overflow to inf */ + check_d1(gamma, 7, log(2*3*4*5*6)); /* normal value */ + + printf("Errors: %d\n", errors); + return errors; +} diff --git a/test/math/gen-libm-test.pl b/test/math/gen-libm-test.pl index 26f819a88..118f352fa 100755 --- a/test/math/gen-libm-test.pl +++ b/test/math/gen-libm-test.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # Copyright (C) 1999 Free Software Foundation, Inc. # This file is part of the GNU C Library. # Contributed by Andreas Jaeger <aj@suse.de>, 1999. @@ -14,9 +14,8 @@ # 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. +# License along with the GNU C Library; see the file COPYING.LIB. If +# not, see <http://www.gnu.org/licenses/>. # This file needs to be tidied up # Note that functions and tests share the same namespace. diff --git a/test/math/ilogb.c b/test/math/ilogb.c new file mode 100644 index 000000000..041e66b0e --- /dev/null +++ b/test/math/ilogb.c @@ -0,0 +1,52 @@ +#include <math.h> +#include <float.h> +#include <stdlib.h> +#include <stdint.h> +#include <limits.h> +#include <stdio.h> + +#define check_d1(func, param, expected) \ +do { \ + int err; hex_union ur; hex_union up; \ + double result = func(param); up.f = param; ur.f = result; \ + errors += (err = (result != (expected))); \ + err \ + ? printf("FAIL: %s(%g/"HEXFMT")=%g/"HEXFMT" (expected %g)\n", \ + #func, (double)(param), (long long)up.hex, result, (long long)ur.hex, (double)(expected)) \ + : printf("PASS: %s(%g)=%g\n", #func, (double)(param), result); \ +} while (0) + +#define check_i1(func, param, expected) \ +do { \ + int err; hex_union up; \ + long long result = func(param); up.f = param; \ + errors += (err = (result != (expected))); \ + err \ + ? printf("FAIL: %s(%g/"HEXFMT")=%lld/%llu (expected %llu)\n", \ + #func, (double)(param), (long long)up.hex, result, result, (long long)(expected)) \ + : printf("PASS: %s(%g)=%lld/%llu\n", #func, (double)(param), result, result); \ +} while (0) + +#define HEXFMT "%08llx" +typedef union { + double f; + uint64_t hex; +} hex_union; + +double nan_value = 0.0; +int errors = 0; + +int main(void) +{ + nan_value /= nan_value; + + check_i1(ilogb, 0.0, FP_ILOGB0); + check_i1(ilogb, HUGE_VAL, INT_MAX); + check_i1(ilogb, nan_value, FP_ILOGBNAN); + check_i1(ilogbf, 0.0, FP_ILOGB0); + check_i1(ilogbf, HUGE_VALF, INT_MAX); + check_i1(ilogbf, nan_value, FP_ILOGBNAN); + + printf("Errors: %d\n", errors); + return errors; +} diff --git a/test/math/libm-test-ulps-arc b/test/math/libm-test-ulps-arc new file mode 100644 index 000000000..7139447dc --- /dev/null +++ b/test/math/libm-test-ulps-arc @@ -0,0 +1,144 @@ +# Begin of automatic generation + +# cos +Test "cos (M_PI_6l * 2.0) == 0.5": +idouble: 1 +Test "cos (M_PI_6l * 4.0) == -0.5": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# erf +Test "erf (0.75) == 0.711155633653515131598937834591410777": +double: 1 +idouble: 1 +Test "erf (1.25) == 0.922900128256458230136523481197281140": +double: 1 +idouble: 1 + +# erfc +Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8": +double: 1 +idouble: 1 + +# exp +Test "exp (1) == e": +double: 1 +idouble: 1 + +# expm1 +Test "expm1 (0.75) == 1.11700001661267466854536981983709561": +double: 1 +idouble: 1 + +# hypot +Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 + +# lgamma +Test "lgamma (0.7) == 0.260867246531666514385732417016759578": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# log10 +Test "log10 (0.75) == -0.124938736608299953132449886193870744": +double: 1 +idouble: 1 +Test "log10 (e) == log10(e)": +float: 1 +ifloat: 1 + +# tgamma +Test "tgamma (-0.5) == -2 sqrt (pi)": +double: 1 +idouble: 1 +Test "tgamma (0.7) == 1.29805533264755778568117117915281162": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# Maximal error of functions: +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "erf": +double: 1 +idouble: 1 + +Function: "erfc": +double: 1 +idouble: 1 + +Function: "exp": +double: 1 +idouble: 1 + +Function: "expm1": +double: 1 +idouble: 1 + +Function: "hypot": +float: 1 +ifloat: 1 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "log": +float: 1 +ifloat: 1 + +Function: "log10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "tan": +double: 1 +idouble: 1 + +Function: "tgamma": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# end of automatic generation diff --git a/test/math/libm-test-ulps-arm b/test/math/libm-test-ulps-arm new file mode 100644 index 000000000..8528e81b4 --- /dev/null +++ b/test/math/libm-test-ulps-arm @@ -0,0 +1,4989 @@ +# Begin of automatic generation + +# acos_downward +Test "acos_downward (-0)": +float: 1 +ifloat: 1 +Test "acos_downward (-0.5)": +double: 1 +idouble: 1 +Test "acos_downward (-1)": +float: 1 +ifloat: 1 +Test "acos_downward (0)": +float: 1 +ifloat: 1 +Test "acos_downward (0.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# acos_towardzero +Test "acos_towardzero (-0)": +float: 1 +ifloat: 1 +Test "acos_towardzero (-0.5)": +double: 1 +idouble: 1 +Test "acos_towardzero (-1)": +float: 1 +ifloat: 1 +Test "acos_towardzero (0)": +float: 1 +ifloat: 1 +Test "acos_towardzero (0.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# asin_downward +Test "asin_downward (-0.5)": +double: 1 +idouble: 1 +Test "asin_downward (0.5)": +double: 1 +idouble: 1 +Test "asin_downward (1.0)": +float: 1 +ifloat: 1 + +# asin_towardzero +Test "asin_towardzero (-0.5)": +double: 1 +idouble: 1 +Test "asin_towardzero (-1.0)": +float: 1 +ifloat: 1 +Test "asin_towardzero (0.5)": +double: 1 +idouble: 1 +Test "asin_towardzero (1.0)": +float: 1 +ifloat: 1 + +# asin_upward +Test "asin_upward (-1.0)": +float: 1 +ifloat: 1 + +# atan2 +Test "atan2 (-0.75, -1.0)": +float: 1 +ifloat: 1 +Test "atan2 (-max_value, -min_value)": +float: 1 +ifloat: 1 +Test "atan2 (0.75, -1.0)": +float: 1 +ifloat: 1 +Test "atan2 (1.390625, 0.9296875)": +float: 1 +ifloat: 1 + +# atanh +Test "atanh (0.75)": +float: 1 +ifloat: 1 + +# cacos +Test "Imaginary part of: cacos (+0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (+0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (+0 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (+0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (+0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (+0 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0.25 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0.25 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0.25 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0.25 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0.5 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0.5 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (-0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (-0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1.fp-100 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-100 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0x0.ffffffp0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 1.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0x0.ffffffp0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 1.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1.fp-30 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-30 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 + 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 - 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 + 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 - 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-23 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1p-23 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-23 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-23 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1p-23 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-23 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 + 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 - 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 + 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 - 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-1.0 + 0x1p50 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-1.0 - 0x1p50 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0.25 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0.25 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0.5 + +0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1p-63 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0.5 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1p-63 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0.5 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0x0.ffffffp0 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0x0.ffffffp0 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacos (0x0.ffffffp0 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0x0.ffffffp0 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacos (0x1.0000000000001p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0x1.0000000000001p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0x1.000002p0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0x1.000002p0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (1.0 + 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (1.0 + 0x1.fp-10 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (1.0 - 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (1.0 - 0x1.fp-10 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 + +# cacosh +Test "Real part of: cacosh (+0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 + 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (+0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 + 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.25 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0.25 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (-0.25 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0.25 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (-0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacosh (-0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacosh (-0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-100 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-100 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0x0.ffffffp0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 1.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0x0.ffffffp0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 1.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-30 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-30 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 + 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 - 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 + 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 - 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-23 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0x1p-23 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-23 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-23 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0x1p-23 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-23 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 + 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 - 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 + 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 - 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-1.0 + 0x1p50 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-1.0 - 0x1p50 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0.25 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0.25 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0.5 + +0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1p-63 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0.5 - 0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1p-63 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0x0.ffffffp0 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0x0.ffffffp0 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacosh (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacosh (0x0.ffffffp0 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0x0.ffffffp0 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacosh (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacosh (0x1.0000000000001p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0x1.0000000000001p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0x1.000002p0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacosh (0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0x1.000002p0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacosh (0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (1.0 + 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (1.0 + 0x1.fp-10 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacosh (1.0 - 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (1.0 - 0x1.fp-10 i)": +float: 2 +ifloat: 2 + +# casin +Test "Imaginary part of: casin (+0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (+0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (+0 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (+0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (+0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (+0 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.25 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0.25 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: casin (-0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: casin (-0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (-0x1.fp-10 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-0x1.fp-10 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (-0x1p-23 + 0.5 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-0x1p-23 + 0x1.000002p0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casin (-0x1p-23 - 0.5 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-0x1p-23 - 0x1.000002p0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (-1.0 + 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (-1.0 - 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0.25 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0.25 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: casin (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: casin (0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (0x1.fp-10 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (0x1.fp-10 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (0x1p-23 + 0.5 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (0x1p-23 + 0x1.000002p0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casin (0x1p-23 - 0.5 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (0x1p-23 - 0x1.000002p0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (1.0 + 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (1.0 - 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 + +# casinh +Test "Imaginary part of: casinh (-0.25 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (-0.25 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0.5 + +0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (-0.5 + 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (-0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (-0.5 - 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (-0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0x0.ffffffp0 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x0.ffffffp0 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (-0x1.000002p0 + 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casinh (-0x1.000002p0 - 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-0x1.fp-10 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0x1.fp-10 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0x1.fp-129 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1.fp-129 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-105 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-105 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-112 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-112 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-23 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-23 + 0x0.ffffffp0 i)": +float: 2 +ifloat: 2 +Test "Real part of: casinh (-0x1p-23 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0x1p-23 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-23 - 0x0.ffffffp0 i)": +float: 2 +ifloat: 2 +Test "Real part of: casinh (-0x1p-23 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0x1p-52 + 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-52 - 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.0 + +0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 + 0.25 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (-1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-100 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-129 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-30 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 - 0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 - 0.25 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (-1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-100 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-129 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-30 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.5 + +0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.5 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.5 - 0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.5 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (0.25 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (0.25 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0.5 + +0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.5 + 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.5 - 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (0x0.ffffffp0 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x0.ffffffp0 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (0x1.000002p0 + 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0x1.000002p0 - 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (0x1.fp-10 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0x1.fp-10 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0x1.fp-129 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1.fp-129 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-105 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-105 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-112 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-112 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-23 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-23 + 0x0.ffffffp0 i)": +float: 2 +ifloat: 2 +Test "Real part of: casinh (0x1p-23 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0x1p-23 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-23 - 0x0.ffffffp0 i)": +float: 2 +ifloat: 2 +Test "Real part of: casinh (0x1p-23 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0x1p-52 + 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-52 - 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.0 + +0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 + 0.25 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-100 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-129 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-30 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 - 0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 - 0.25 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-100 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-129 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-30 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.5 + +0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.5 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.5 - 0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.5 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 + +# catan +Test "Imaginary part of: catan (-0x0.fffffffffffff8p0 + 0x1p-27 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x0.ffffffp0 + 0x1p-13 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1.0000000000001p0 - 0x1p-27 i)": +double: 1 +idouble: 1 +Test "Real part of: catan (-0x1.000002p0 + 0x1p-126 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1.000002p0 - 0x1p-126 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1.000002p0 - 0x1p-13 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1.fp1023 - 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1.fp127 - 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1p-1020 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1p-1020 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: catan (-0x1p-13 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1p-13 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1p-13 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-54 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-54 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-57 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-57 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-1.0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-1.0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-2 - 3 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x0.fffffffffffff8p0 + 0x1p-27 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x0.ffffffp0 + 0x1p-13 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1.0000000000001p0 - 0x1p-27 i)": +double: 1 +idouble: 1 +Test "Real part of: catan (0x1.000002p0 + 0x1p-126 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1.000002p0 - 0x1p-126 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1.000002p0 - 0x1p-13 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1.fp1023 - 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1.fp127 - 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1p-1020 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1p-1020 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: catan (0x1p-13 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1p-13 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1p-13 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-54 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-54 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-57 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-57 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (1.0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (1.0 - 0x1p-13 i)": +float: 1 +ifloat: 1 + +# catanh +Test "Real part of: catanh (-0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (-0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (-0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-0x1.fp1023 - 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-0x1.fp127 - 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (-0x1p-126 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (-0x1p-126 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-0x1p-13 + 0x1.000002p0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (-0x1p-13 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (-0x1p-13 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-0x1p-13 - 0x1.000002p0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (-0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (-0x1p-13 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-0x1p-27 + 0x1.0000000000001p0 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-0x1p-27 - 0x1.0000000000001p0 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-1.0 + 0x1p-1020 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (-1.0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 + 0x1p-54 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 + 0x1p-57 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 - 0x1p-1020 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (-1.0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 - 0x1p-54 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 - 0x1p-57 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-2 - 3 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (0x1.fp1023 - 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (0x1.fp127 - 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (0x1p-126 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1p-126 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (0x1p-13 + 0x0.ffffffp0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1p-13 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1p-13 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (0x1p-13 - 0x0.ffffffp0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1p-13 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (0x1p-27 + 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (0x1p-27 - 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (1.0 + 0x1p-1020 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (1.0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 + 0x1p-54 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 + 0x1p-57 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 - 0x1p-1020 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (1.0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 - 0x1p-54 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 - 0x1p-57 i)": +float: 1 +ifloat: 1 + +# cbrt +Test "cbrt (-27.0)": +double: 1 +idouble: 1 +Test "cbrt (0.75)": +double: 1 +idouble: 1 +Test "cbrt (0.9921875)": +double: 1 +idouble: 1 + +# ccos +Test "Imaginary part of: ccos (-0.75 + 710.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccos (-0.75 + 89.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccos (-0.75 - 710.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccos (-0.75 - 89.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccos (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Real part of: ccos (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccos (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccos (0.75 + 710.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccos (0.75 + 89.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccos (0.75 - 710.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccos (0.75 - 89.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccos (0x1p-1074 + 1440 i)": +double: 1 +idouble: 1 + +# ccosh +Test "Real part of: ccosh (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (-710.5 + 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccosh (-710.5 - 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccosh (-89.5 + 0.75 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (-89.5 - 0.75 i)": +float: 1 +ifloat: 1 +Test "Real part of: ccosh (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (1440 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccosh (710.5 + 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccosh (710.5 - 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccosh (89.5 + 0.75 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (89.5 - 0.75 i)": +float: 1 +ifloat: 1 + +# cexp +Test "Imaginary part of: cexp (-2.0 - 3.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cexp (-95 + 0.75 i)": +double: 1 +idouble: 1 +Test "Real part of: cexp (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cexp (1440 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Real part of: cexp (50 + 0x1p127 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: cexp (50 + 0x1p127 i)": +double: 1 +idouble: 1 +Test "Real part of: cexp (500 + 0x1p1023 i)": +double: 1 +idouble: 1 +Test "Real part of: cexp (709.8125 + 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cexp (709.8125 + 0.75 i)": +double: 1 +idouble: 1 +Test "Real part of: cexp (88.75 + 0.75 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cexp (88.75 + 0.75 i)": +float: 2 +ifloat: 2 + +# clog +Test "Real part of: clog (-0x1.0000000123456p0 + 0x1.2345678p-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: clog (-0x1.0000000123456p0 + 0x1.2345678p-30 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog (-0x1.234566p-40 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1.fp+127 + 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1.fp+127 - 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1p-149 + 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog (-0x1p-149 + 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1p-149 - 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog (-0x1p-149 - 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x0.ffffffp0 + 0x0.ffffffp-100 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1.000566p0 + 0x1.234p-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1.fp+127 + 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1.fp+127 - 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1p-1074 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Real part of: clog (0x1p-147 + 0x1p-147 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1p-149 + 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1p-149 - 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog (0x2818p-15 + 0x798fp-15 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (1.0 + 0x1.234566p-10 i)": +float: 1 +ifloat: 1 + +# clog10 +Test "Imaginary part of: clog10 (-0 + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0 - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-1000 i)": +double: 2 +idouble: 2 +Test "Imaginary part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-30 i)": +double: 2 +idouble: 2 +Test "Imaginary part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-30 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+1023 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+1023 - 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+127 + 0x1p-149 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0x1.fp+127 - 0x1p-149 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0x1p-1074 + 0x1.fp+1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1p-1074 - 0x1.fp+1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1p-149 + 0x1.fp+127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1p-149 - 0x1.fp+127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-1.0 + 0x1.234566p-20 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-2 - 3 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-3 + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-3 - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 1 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + inf i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-inf - 0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf - 1 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0x0.fffffffffffff8p0 + 0x0.fffffffffffff8p-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x0.ffffffp0 + 0x0.ffffffp-100 i)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "Real part of: clog10 (0x1.000566p0 + 0x1.234p-10 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.000566p0 + 0x1.234p-10 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x1.000566p0 + 0x1.234p-100 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.234566p-30 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.234566p-50 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.234566p-60 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.fffffep+127 + 0x1.fffffep+127 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0x1.fffffep+127 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x10673dd0f2481p-51 + 0x7ef1d17cefbd2p-51 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x164c74eea876p-45 + 0x16f393482f77p-45 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1a6p-10 + 0x3a5p-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-1073 + 0x1p-1073 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-1074 + 0x1.fp+1023 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x1p-1074 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-1074 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-1074 - 0x1.fp+1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-147 + 0x1p-147 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-149 + 0x1.fp+127 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-149 + 0x1p-149 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-149 - 0x1.fp+127 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-509 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-510 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-511 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-61 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-62 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-63 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0x2818p-15 + 0x798fp-15 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x2818p-15 + 0x798fp-15 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog10 (0x2dd46725bp-35 + 0x7783a1284p-35 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x2ede88p-23 + 0x771c3fp-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x2ede88p-23 + 0x771c3fp-23 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x4447d7175p-35 + 0x6c445e00ap-35 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x5b06b680ea2ccp-52 + 0xef452b965da9fp-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x9b57bp-20 + 0xcb7b4p-20 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0xf2p-10 + 0x3e3p-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0xf2p-10 + 0x3e3p-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0xfe961079616p-45 + 0x1bc37e09e6d1p-45 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (1.0 + 0x1.234566p-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (3 + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (3 - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# cos +Test "cos (0x1p+120)": +float: 1 +ifloat: 1 +Test "cos (0x1p+127)": +float: 1 +ifloat: 1 +Test "cos (M_PI_6l * 2.0) == 0.5": +double: 1 +idouble: 1 +ifloat: 1 +Test "cos (M_PI_6l * 4.0) == -0.5": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# cos_downward +Test "cos_downward (1)": +float: 1 +ifloat: 1 +Test "cos_downward (2)": +float: 1 +ifloat: 1 +Test "cos_downward (3)": +float: 1 +ifloat: 1 +Test "cos_downward (4)": +float: 1 +ifloat: 1 +Test "cos_downward (5)": +float: 1 +ifloat: 1 +Test "cos_downward (7)": +float: 1 +ifloat: 1 +Test "cos_downward (8)": +float: 1 +ifloat: 1 + +# cos_tonearest +Test "cos_tonearest (7)": +float: 1 +ifloat: 1 + +# cos_towardzero +Test "cos_towardzero (2)": +float: 1 +ifloat: 1 +Test "cos_towardzero (3)": +float: 1 +ifloat: 1 +Test "cos_towardzero (5)": +float: 1 +ifloat: 1 +Test "cos_towardzero (7)": +float: 1 +ifloat: 1 +Test "cos_towardzero (8)": +float: 1 +ifloat: 1 + +# cos_upward +Test "cos_upward (10)": +float: 1 +ifloat: 1 +Test "cos_upward (6)": +float: 1 +ifloat: 1 +Test "cos_upward (7)": +float: 1 +ifloat: 1 +Test "cos_upward (9)": +float: 2 +ifloat: 2 + +# cosh_downward +Test "cosh_downward (22)": +float: 1 +ifloat: 1 +Test "cosh_downward (23)": +float: 1 +ifloat: 1 +Test "cosh_downward (24)": +float: 1 +ifloat: 1 + +# cosh_towardzero +Test "cosh_towardzero (22)": +float: 1 +ifloat: 1 +Test "cosh_towardzero (23)": +float: 1 +ifloat: 1 +Test "cosh_towardzero (24)": +float: 1 +ifloat: 1 + +# cpow +Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i)": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i)": +double: 2 +float: 3 +idouble: 2 +ifloat: 3 +Test "Real part of: cpow (2 + 3 i, 4 + 0 i)": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i)": +float: 2 +ifloat: 2 + +# csin +Test "Real part of: csin (-0.75 + 710.5 i)": +double: 1 +idouble: 1 +Test "Real part of: csin (-0.75 + 89.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: csin (-0.75 - 710.5 i)": +double: 1 +idouble: 1 +Test "Real part of: csin (-0.75 - 89.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: csin (0.75 + 710.5 i)": +double: 1 +idouble: 1 +Test "Real part of: csin (0.75 + 89.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: csin (0.75 - 710.5 i)": +double: 1 +idouble: 1 +Test "Real part of: csin (0.75 - 89.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: csin (0x1p-1074 + 1440 i)": +double: 1 +idouble: 1 + +# csinh +Test "Imaginary part of: csinh (-2 - 3 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (-710.5 + 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (-710.5 - 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (-89.5 + 0.75 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: csinh (-89.5 - 0.75 i)": +float: 1 +ifloat: 1 +Test "Real part of: csinh (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: csinh (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: csinh (1440 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (710.5 + 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (710.5 - 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (89.5 + 0.75 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: csinh (89.5 - 0.75 i)": +float: 1 +ifloat: 1 + +# csqrt +Test "Real part of: csqrt (-0x1.000002p-126 - 0x1.000002p-126 i)": +double: 1 +idouble: 1 +Test "Real part of: csqrt (-2 + 3 i)": +float: 1 +ifloat: 1 +Test "Real part of: csqrt (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: csqrt (0x1.000002p-126 + 0x1.000002p-126 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csqrt (0x1.fffffep+127 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: csqrt (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csqrt (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csqrt (0x1.fffffffffffffp+1023 + 0x1p+1023 i)": +double: 1 +idouble: 1 + +# ctan +Test "Real part of: ctan (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctan (-2 - 3 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ctan (0.75 + 1.25 i)": +double: 1 +idouble: 1 +Test "Real part of: ctan (0x1p1023 + 1 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ctan (0x1p127 + 1 i)": +double: 1 +idouble: 1 +Test "Real part of: ctan (0x3.243f6cp-1 + 0 i)": +float: 1 +ifloat: 1 + +# ctan_downward +Test "Real part of: ctan_downward (0x1.921fb6p+0 + 0x1p-149 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: ctan_downward (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 + +# ctan_tonearest +Test "Real part of: ctan_tonearest (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctan_tonearest (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 + +# ctan_towardzero +Test "Real part of: ctan_towardzero (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctan_towardzero (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 + +# ctan_upward +Test "Real part of: ctan_upward (0x1.921fb54442d18p+0 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Real part of: ctan_upward (0x1.921fb6p+0 + 0x1p-149 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: ctan_upward (0x1.921fb6p+0 + 0x1p-149 i)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# ctanh +Test "Real part of: ctanh (-2 - 3 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ctanh (-2 - 3 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ctanh (0 + 0x3.243f6cp-1 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctanh (0 + pi/4 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: ctanh (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ctanh (0.75 + 1.25 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: ctanh (1 + 0x1p1023 i)": +double: 1 +idouble: 1 +Test "Real part of: ctanh (1 + 0x1p127 i)": +double: 1 +idouble: 1 + +# ctanh_downward +Test "Real part of: ctanh_downward (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctanh_downward (0x1p-149 + 0x1.921fb6p+0 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# ctanh_tonearest +Test "Real part of: ctanh_tonearest (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctanh_tonearest (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 + +# ctanh_towardzero +Test "Real part of: ctanh_towardzero (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctanh_towardzero (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 + +# ctanh_upward +Test "Imaginary part of: ctanh_upward (0x1p-1074 + 0x1.921fb54442d18p+0 i)": +double: 1 +idouble: 1 +Test "Real part of: ctanh_upward (0x1p-149 + 0x1.921fb6p+0 i)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "Imaginary part of: ctanh_upward (0x1p-149 + 0x1.921fb6p+0 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# erf +Test "erf (0.75) == 0.711155633653515131598937834591410777": +double: 1 +idouble: 1 +Test "erf (1.25) == 0.922900128256458230136523481197281140": +double: 1 +idouble: 1 + +# erfc +Test "erfc (0x1.f7303cp+1)": +double: 1 +idouble: 1 +Test "erfc (0x1.ffa002p+2)": +float: 1 +ifloat: 1 +Test "erfc (2.0)": +double: 1 +idouble: 1 +Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8": +double: 1 +idouble: 1 + +# exp +Test "exp (1) == e": +double: 1 +idouble: 1 + +# exp10 +Test "exp10 (-1)": +double: 1 +idouble: 1 +Test "exp10 (-305)": +double: 1 +idouble: 1 +Test "exp10 (-36)": +double: 1 +idouble: 1 +Test "exp10 (3)": +double: 1 +idouble: 1 +Test "exp10 (36)": +double: 1 +idouble: 1 + +# exp_downward +Test "exp_downward (2)": +float: 1 +ifloat: 1 +Test "exp_downward (3)": +float: 1 +ifloat: 1 + +# exp_towardzero +Test "exp_towardzero (2)": +float: 1 +ifloat: 1 +Test "exp_towardzero (3)": +float: 1 +ifloat: 1 + +# exp_upward +Test "exp_upward (1)": +float: 1 +ifloat: 1 + +# expm1 +Test "expm1 (0.75) == 1.11700001661267466854536981983709561": +double: 1 +idouble: 1 +Test "expm1 (1)": +float: 1 +ifloat: 1 +Test "expm1 (500.0)": +double: 1 +idouble: 1 + +# gamma +Test "gamma (0.7)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "gamma (1.2)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# hypot +Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 + +# j0 +Test "j0 (-4.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "j0 (0.75)": +float: 1 +ifloat: 1 +Test "j0 (0x1.d7ce3ap+107)": +float: 2 +ifloat: 2 +Test "j0 (10.0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "j0 (2.0)": +float: 2 +ifloat: 2 +Test "j0 (4.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "j0 (8.0)": +float: 1 +ifloat: 1 + +# j1 +Test "j1 (0x1.3ffp+74)": +double: 1 +idouble: 1 +Test "j1 (0x1.ff00000000002p+840)": +double: 1 +idouble: 1 +Test "j1 (10.0)": +float: 2 +ifloat: 2 +Test "j1 (2.0)": +double: 1 +idouble: 1 +Test "j1 (8.0)": +double: 1 +idouble: 1 + +# jn +Test "jn (0, -4.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (0, 0.75)": +float: 1 +ifloat: 1 +Test "jn (0, 10.0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "jn (0, 2.0)": +float: 2 +ifloat: 2 +Test "jn (0, 4.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (0, 8.0)": +float: 1 +ifloat: 1 +Test "jn (1, 10.0)": +float: 2 +ifloat: 2 +Test "jn (1, 2.0)": +double: 1 +idouble: 1 +Test "jn (1, 8.0)": +double: 1 +idouble: 1 +Test "jn (10, 0.125)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (10, 0.75)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (10, 10.0)": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 +Test "jn (10, 2.0)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "jn (2, 0x1.ffff62p+99)": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +Test "jn (2, 2.4048255576957729)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "jn (3, 0.125)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 0.75)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 10.0)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "jn (3, 2.0)": +float: 1 +ifloat: 1 +Test "jn (3, 2.4048255576957729)": +double: 3 +idouble: 3 +Test "jn (4, 2.4048255576957729)": +double: 1 +idouble: 1 +Test "jn (5, 2.4048255576957729)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "jn (6, 2.4048255576957729)": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 +Test "jn (7, 2.4048255576957729)": +double: 3 +float: 5 +idouble: 3 +ifloat: 5 +Test "jn (8, 2.4048255576957729)": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +Test "jn (9, 2.4048255576957729)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# lgamma +Test "lgamma (0.7) == 0.260867246531666514385732417016759578": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# log10 +Test "log10 (0.75) == -0.124938736608299953132449886193870744": +double: 1 +idouble: 1 +Test "log10 (e) == log10(e)": +float: 1 +ifloat: 1 + +# log1p +Test "log1p (-0.25)": +float: 1 +ifloat: 1 + +# pow +Test "pow (0x0.ffffffp0, -0x1p24)": +float: 1 +ifloat: 1 +Test "pow (0x0.ffffffp0, 0x1p24)": +float: 1 +ifloat: 1 +Test "pow (0x1.000002p0, 0x1p24)": +float: 1 +ifloat: 1 + +# pow10 +Test "pow10 (-1)": +double: 1 +idouble: 1 +Test "pow10 (-305)": +double: 1 +idouble: 1 +Test "pow10 (-36)": +double: 1 +idouble: 1 +Test "pow10 (3)": +double: 1 +idouble: 1 +Test "pow10 (36)": +double: 1 +idouble: 1 + +# pow_downward +Test "pow_downward (1.5, 1.03125)": +float: 1 +ifloat: 1 + +# pow_towardzero +Test "pow_towardzero (1.5, 1.03125)": +float: 1 +ifloat: 1 + +# pow_upward +Test "pow_upward (1.0625, 1.125)": +float: 1 +ifloat: 1 + +# sin_downward +Test "sin_downward (10)": +float: 1 +ifloat: 1 +Test "sin_downward (3)": +float: 1 +ifloat: 1 +Test "sin_downward (5)": +float: 1 +ifloat: 1 +Test "sin_downward (6)": +float: 1 +ifloat: 1 + +# sin_tonearest +Test "sin_tonearest (1)": +float: 1 +ifloat: 1 + +# sin_towardzero +Test "sin_towardzero (1)": +float: 1 +ifloat: 1 +Test "sin_towardzero (10)": +float: 1 +ifloat: 1 +Test "sin_towardzero (4)": +float: 1 +ifloat: 1 +Test "sin_towardzero (5)": +float: 1 +ifloat: 1 +Test "sin_towardzero (9)": +float: 1 +ifloat: 1 + +# sin_upward +Test "sin_upward (1)": +float: 1 +ifloat: 1 +Test "sin_upward (2)": +float: 2 +ifloat: 2 +Test "sin_upward (4)": +float: 1 +ifloat: 1 +Test "sin_upward (9)": +float: 1 +ifloat: 1 + +# sincos +Test "sincos (0x1p+120) extra output 2": +float: 1 +ifloat: 1 +Test "sincos (0x1p+127) extra output 2": +float: 1 +ifloat: 1 +Test "sincos (M_PI_6l*2.0) extra output 1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sincos (M_PI_6l*2.0) extra output 2": +double: 1 +idouble: 1 +Test "sincos (pi/6) extra output 2": +float: 1 +ifloat: 1 + +# sinh_downward +Test "sinh_downward (22)": +float: 1 +ifloat: 1 +Test "sinh_downward (23)": +float: 1 +ifloat: 1 +Test "sinh_downward (24)": +float: 1 +ifloat: 1 + +# sinh_towardzero +Test "sinh_towardzero (22)": +float: 1 +ifloat: 1 +Test "sinh_towardzero (23)": +float: 1 +ifloat: 1 +Test "sinh_towardzero (24)": +float: 1 +ifloat: 1 + +# tan_downward +Test "tan_downward (1)": +float: 1 +ifloat: 1 +Test "tan_downward (10)": +float: 1 +ifloat: 1 +Test "tan_downward (2)": +float: 1 +ifloat: 1 +Test "tan_downward (6)": +float: 1 +ifloat: 1 +Test "tan_downward (8)": +float: 1 +ifloat: 1 +Test "tan_downward (9)": +float: 1 +ifloat: 1 + +# tan_towardzero +Test "tan_towardzero (10)": +float: 1 +ifloat: 1 +Test "tan_towardzero (3)": +float: 1 +ifloat: 1 +Test "tan_towardzero (4)": +float: 1 +ifloat: 1 +Test "tan_towardzero (5)": +float: 1 +ifloat: 1 +Test "tan_towardzero (9)": +float: 1 +ifloat: 1 + +# tan_upward +Test "tan_upward (1)": +float: 1 +ifloat: 1 +Test "tan_upward (10)": +float: 1 +ifloat: 1 +Test "tan_upward (3)": +float: 1 +ifloat: 1 +Test "tan_upward (5)": +float: 1 +ifloat: 1 + +# tgamma +Test "tgamma (-0.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0.5) == -2 sqrt (pi)": +double: 1 +idouble: 1 +Test "tgamma (-0x0.fffffffffffff8p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x0.ffffffp0)": +float: 1 +ifloat: 1 +Test "tgamma (-0x1.000002p0)": +double: 2 +idouble: 2 +Test "tgamma (-0x1.0a32a2p+5)": +float: 2 +ifloat: 2 +Test "tgamma (-0x13.ffffep0)": +float: 2 +ifloat: 2 +Test "tgamma (-0x14.000000000001p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x14.00002p0)": +float: 1 +ifloat: 1 +Test "tgamma (-0x1d.ffffep0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x1e.000000000001p0)": +double: 3 +idouble: 3 +Test "tgamma (-0x1e.00002p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x2.0000000000002p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x2.000004p0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (-0x2.fffffcp0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x27.fffffffffffep0)": +double: 1 +idouble: 1 +Test "tgamma (-0x28.000000000002p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x28.00004p0)": +double: 2 +idouble: 2 +Test "tgamma (-0x29.00004p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x29.ffffcp0)": +double: 1 +idouble: 1 +Test "tgamma (-0x3.000004p0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (-0x3.fffffcp0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x3.ffffffffffffep0)": +double: 2 +idouble: 2 +Test "tgamma (-0x31.fffffffffffep0)": +double: 3 +idouble: 3 +Test "tgamma (-0x4.000008p0)": +float: 1 +ifloat: 1 +Test "tgamma (-0x4.fffff8p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x4.ffffffffffffcp0)": +double: 1 +idouble: 1 +Test "tgamma (-0x5.000008p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x5.ffffffffffffcp0)": +double: 1 +idouble: 1 +Test "tgamma (-0x6.000008p0)": +float: 2 +ifloat: 2 +Test "tgamma (-0x6.fffff8p0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (-0x6.ffffffffffffcp0)": +double: 4 +idouble: 4 +Test "tgamma (-0x63.fffffffffffcp0)": +double: 2 +idouble: 2 +Test "tgamma (-0x64.000000000004p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x7.0000000000004p0)": +double: 3 +idouble: 3 +Test "tgamma (-0x7.000008p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x7.fffff8p0)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "tgamma (-0x7.ffffffffffffcp0)": +double: 3 +idouble: 3 +Test "tgamma (-0x8.00001p0)": +double: 2 +idouble: 2 +Test "tgamma (-0x9.ffffffffffff8p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x9.fffffp0)": +float: 1 +ifloat: 1 +Test "tgamma (-0x96.000000000008p0)": +double: 1 +idouble: 1 +Test "tgamma (-0xa.00001p0)": +double: 1 +idouble: 1 +Test "tgamma (-2.5)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "tgamma (-3.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-4.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-5.5)": +double: 1 +idouble: 1 +Test "tgamma (-6.5)": +float: 1 +ifloat: 1 +Test "tgamma (-7.5)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (-8.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-9.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0.5)": +float: 1 +ifloat: 1 +Test "tgamma (0.7)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0.7) == 1.29805533264755778568117117915281162": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0x1.fffffep0)": +float: 1 +ifloat: 1 +Test "tgamma (0x1.fffffffffffffp0)": +double: 1 +idouble: 1 +Test "tgamma (0x1p-24)": +float: 1 +ifloat: 1 +Test "tgamma (0x1p-53)": +double: 1 +idouble: 1 +Test "tgamma (0x2.30a43cp+4)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "tgamma (0x2.fffffcp0)": +float: 3 +ifloat: 3 +Test "tgamma (0x3.fffffcp0)": +float: 1 +ifloat: 1 +Test "tgamma (0x3.ffffffffffffep0)": +double: 1 +idouble: 1 +Test "tgamma (0x4.0000000000004p0)": +double: 1 +idouble: 1 +Test "tgamma (0x4.ffffffffffffcp0)": +double: 1 +idouble: 1 +Test "tgamma (0x5.0000000000004p0)": +double: 1 +idouble: 1 +Test "tgamma (0x5.000008p0)": +float: 2 +ifloat: 2 +Test "tgamma (0x5.fffff8p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0x6.0000000000004p0)": +double: 1 +idouble: 1 +Test "tgamma (0x6.000008p0)": +float: 2 +ifloat: 2 +Test "tgamma (0x6.fffff8p0)": +double: 1 +idouble: 1 +Test "tgamma (0x6.ffffffffffffcp0)": +double: 4 +idouble: 4 +Test "tgamma (0x7.0000000000004p0)": +double: 4 +idouble: 4 +Test "tgamma (0x7.000008p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0x7.fffff8p0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (0x7.ffffffffffffcp0)": +double: 2 +idouble: 2 +Test "tgamma (0x8.00001p0)": +double: 2 +idouble: 2 +Test "tgamma (0xa.b9fd72b0fb238p+4)": +double: 1 +idouble: 1 +Test "tgamma (10)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (18.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (19.5)": +double: 2 +idouble: 2 +Test "tgamma (2.5)": +float: 2 +ifloat: 2 +Test "tgamma (23.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (29.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (3)": +float: 1 +ifloat: 1 +Test "tgamma (3.5)": +float: 2 +ifloat: 2 +Test "tgamma (30.5)": +float: 1 +ifloat: 1 +Test "tgamma (33.5)": +float: 1 +ifloat: 1 +Test "tgamma (34.5)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "tgamma (4)": +float: 1 +ifloat: 1 +Test "tgamma (4.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (6)": +float: 1 +ifloat: 1 +Test "tgamma (6.5)": +float: 1 +ifloat: 1 +Test "tgamma (7)": +double: 1 +idouble: 1 +Test "tgamma (7.5)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (8)": +double: 1 +idouble: 1 +Test "tgamma (8.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (9)": +double: 1 +idouble: 1 +Test "tgamma (9.5)": +double: 1 +idouble: 1 + +# y0 +Test "y0 (0x1.3ffp+74)": +double: 1 +idouble: 1 +Test "y0 (0x1.ff00000000002p+840)": +double: 1 +idouble: 1 +Test "y0 (0x1p-10)": +double: 1 +idouble: 1 +Test "y0 (0x1p-110)": +double: 1 +idouble: 1 +Test "y0 (0x1p-20)": +float: 1 +ifloat: 1 +Test "y0 (0x1p-30)": +float: 1 +ifloat: 1 +Test "y0 (0x1p-40)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "y0 (0x1p-50)": +float: 1 +ifloat: 1 +Test "y0 (0x1p-70)": +double: 1 +idouble: 1 +Test "y0 (0x1p-80)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "y0 (1.0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (1.5)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (10.0)": +float: 1 +ifloat: 1 +Test "y0 (8.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# y1 +Test "y1 (0.125)": +double: 1 +idouble: 1 +Test "y1 (0x1.27e204p+99)": +double: 1 +idouble: 1 +Test "y1 (0x1p-10)": +double: 1 +idouble: 1 +Test "y1 (1.5)": +float: 1 +ifloat: 1 +Test "y1 (10.0)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "y1 (2.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "y1 (8.0)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# yn +Test "yn (0, 1.0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 1.5)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 10.0)": +float: 1 +ifloat: 1 +Test "yn (0, 8.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (1, 0.125)": +double: 1 +idouble: 1 +Test "yn (1, 1.5)": +float: 1 +ifloat: 1 +Test "yn (1, 10.0)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "yn (1, 2.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (1, 8.0)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "yn (10, 0.125)": +double: 1 +idouble: 1 +Test "yn (10, 0.75)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (10, 1.0)": +double: 1 +idouble: 1 +Test "yn (10, 10.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (10, 2.0)": +double: 2 +idouble: 2 +Test "yn (3, 0.125)": +double: 1 +idouble: 1 +Test "yn (3, 0.75)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (3, 10.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (3, 2.0)": +double: 1 +idouble: 1 + +# Maximal error of functions: +Function: "acos_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "acos_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "asin_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "asin_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "asin_upward": +float: 1 +ifloat: 1 + +Function: "atan2": +float: 1 +ifloat: 1 + +Function: "atanh": +float: 1 +ifloat: 1 + +Function: Real part of "cacos": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Imaginary part of "cacos": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Real part of "cacosh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Imaginary part of "cacosh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Real part of "casin": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "casin": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Real part of "casinh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Imaginary part of "casinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "catan": +float: 1 +ifloat: 1 + +Function: Imaginary part of "catan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "catanh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "catanh": +float: 1 +ifloat: 1 + +Function: "cbrt": +double: 1 +idouble: 1 + +Function: Real part of "ccos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "ccos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "cexp": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: Imaginary part of "cexp": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Real part of "clog": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "clog": +float: 1 +ifloat: 1 + +Function: Real part of "clog10": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 + +Function: Imaginary part of "clog10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "cos_downward": +float: 1 +ifloat: 1 + +Function: "cos_tonearest": +float: 1 +ifloat: 1 + +Function: "cos_towardzero": +float: 1 +ifloat: 1 + +Function: "cos_upward": +float: 2 +ifloat: 2 + +Function: "cosh_downward": +float: 1 +ifloat: 1 + +Function: "cosh_towardzero": +float: 1 +ifloat: 1 + +Function: Real part of "cpow": +double: 2 +float: 4 +idouble: 2 +ifloat: 4 + +Function: Imaginary part of "cpow": +float: 2 +ifloat: 2 + +Function: Real part of "csin": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "csinh": +float: 1 +ifloat: 1 + +Function: Imaginary part of "csinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "csqrt": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "csqrt": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "ctan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "ctan": +double: 1 +idouble: 1 + +Function: Real part of "ctan_downward": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: Imaginary part of "ctan_downward": +float: 1 +ifloat: 1 + +Function: Real part of "ctan_tonearest": +float: 1 +ifloat: 1 + +Function: Imaginary part of "ctan_tonearest": +float: 1 +ifloat: 1 + +Function: Real part of "ctan_towardzero": +float: 1 +ifloat: 1 + +Function: Imaginary part of "ctan_towardzero": +float: 1 +ifloat: 1 + +Function: Real part of "ctan_upward": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: Imaginary part of "ctan_upward": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Real part of "ctanh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "ctanh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Real part of "ctanh_downward": +float: 1 +ifloat: 1 + +Function: Imaginary part of "ctanh_downward": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: Real part of "ctanh_tonearest": +float: 1 +ifloat: 1 + +Function: Imaginary part of "ctanh_tonearest": +float: 1 +ifloat: 1 + +Function: Real part of "ctanh_towardzero": +float: 1 +ifloat: 1 + +Function: Imaginary part of "ctanh_towardzero": +float: 1 +ifloat: 1 + +Function: Real part of "ctanh_upward": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Imaginary part of "ctanh_upward": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "erf": +double: 1 +idouble: 1 + +Function: "erfc": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "exp": +double: 1 +idouble: 1 + +Function: "exp10": +double: 1 +idouble: 1 + +Function: "exp_downward": +float: 1 +ifloat: 1 + +Function: "exp_towardzero": +float: 1 +ifloat: 1 + +Function: "exp_upward": +float: 1 +ifloat: 1 + +Function: "expm1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "gamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "hypot": +float: 1 +ifloat: 1 + +Function: "j0": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 + +Function: "j1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "jn": +double: 4 +float: 5 +idouble: 4 +ifloat: 5 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "log": +float: 1 +ifloat: 1 + +Function: "log10": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "log1p": +float: 1 +ifloat: 1 + +Function: "pow": +float: 1 +ifloat: 1 + +Function: "pow10": +double: 1 +idouble: 1 + +Function: "pow_downward": +float: 1 +ifloat: 1 + +Function: "pow_towardzero": +float: 1 +ifloat: 1 + +Function: "pow_upward": +float: 1 +ifloat: 1 + +Function: "sin_downward": +float: 1 +ifloat: 1 + +Function: "sin_tonearest": +float: 1 +ifloat: 1 + +Function: "sin_towardzero": +float: 1 +ifloat: 1 + +Function: "sin_upward": +float: 2 +ifloat: 2 + +Function: "sincos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "sinh_downward": +float: 1 +ifloat: 1 + +Function: "sinh_towardzero": +float: 1 +ifloat: 1 + +Function: "tan": +double: 1 +idouble: 1 + +Function: "tan_downward": +float: 1 +ifloat: 1 + +Function: "tan_towardzero": +float: 1 +ifloat: 1 + +Function: "tan_upward": +float: 1 +ifloat: 1 + +Function: "tgamma": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 + +Function: "y0": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "y1": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 + +Function: "yn": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 + +# end of automatic generation diff --git a/test/math/libm-test-ulps-cris b/test/math/libm-test-ulps-cris new file mode 100644 index 000000000..46b2ac559 --- /dev/null +++ b/test/math/libm-test-ulps-cris @@ -0,0 +1,145 @@ +# Begin of automatic generation + +# cos +Test "cos (M_PI_6l * 2.0) == 0.5": +double: 1 +idouble: 1 +Test "cos (M_PI_6l * 4.0) == -0.5": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# erf +Test "erf (0.75) == 0.711155633653515131598937834591410777": +double: 1 +idouble: 1 +Test "erf (1.25) == 0.922900128256458230136523481197281140": +double: 1 +idouble: 1 + +# erfc +Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8": +double: 1 +idouble: 1 + +# exp +Test "exp (1) == e": +double: 1 +idouble: 1 + +# expm1 +Test "expm1 (0.75) == 1.11700001661267466854536981983709561": +double: 1 +idouble: 1 + +# hypot +Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 + +# lgamma +Test "lgamma (0.7) == 0.260867246531666514385732417016759578": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# log10 +Test "log10 (0.75) == -0.124938736608299953132449886193870744": +double: 1 +idouble: 1 +Test "log10 (e) == log10(e)": +float: 1 +ifloat: 1 + +# tgamma +Test "tgamma (-0.5) == -2 sqrt (pi)": +double: 1 +idouble: 1 +Test "tgamma (0.7) == 1.29805533264755778568117117915281162": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# Maximal error of functions: +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "erf": +double: 1 +idouble: 1 + +Function: "erfc": +double: 1 +idouble: 1 + +Function: "exp": +double: 1 +idouble: 1 + +Function: "expm1": +double: 1 +idouble: 1 + +Function: "hypot": +float: 1 +ifloat: 1 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "log": +float: 1 +ifloat: 1 + +Function: "log10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "tan": +double: 1 +idouble: 1 + +Function: "tgamma": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# end of automatic generation diff --git a/test/math/libm-test-ulps-generic b/test/math/libm-test-ulps-generic new file mode 100644 index 000000000..7cfa1f828 --- /dev/null +++ b/test/math/libm-test-ulps-generic @@ -0,0 +1,5 @@ +# File with deltas for math/libm-test +# This file is the fallback and contains +# no data +# You can create a new file with e.g. `test-double -u' +# followed by `gen-libm-test.pl -u ULPs -n'. diff --git a/test/math/libm-test-ulps-i386 b/test/math/libm-test-ulps-i386 new file mode 100644 index 000000000..a6fd6ac24 --- /dev/null +++ b/test/math/libm-test-ulps-i386 @@ -0,0 +1,1261 @@ +# Begin of automatic generation + +# acos +Test "acos (0.75) == 0.722734247813415611178377352641333362": +ildouble: 1 +ldouble: 1 + +# asin +Test "asin (-0.5) == -pi/6": +ildouble: 1 +ldouble: 1 +Test "asin (-1.0) == -pi/2": +ildouble: 1 +ldouble: 1 +Test "asin (0.5) == pi/6": +ildouble: 1 +ldouble: 1 +Test "asin (0.75) == 0.848062078981481008052944338998418080": +ildouble: 1 +ldouble: 1 +Test "asin (1.0) == pi/2": +ildouble: 1 +ldouble: 1 + +# atanh +Test "atanh (0.75) == 0.972955074527656652552676371721589865": +ildouble: 2 +ldouble: 1 + +# cacos +Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +# cacosh +Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": +double: 1 +float: 9 +idouble: 1 +ifloat: 9 +ildouble: 6 +ldouble: 6 +Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.75 + 1.25 i) == 1.13239363160530819522266333696834467 + 1.11752014915610270578240049553777969 i": +ildouble: 1 +ldouble: 1 + +# casin +Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +# casinh +Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": +double: 5 +float: 1 +idouble: 5 +ifloat: 1 +ildouble: 5 +ldouble: 5 +Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": +double: 3 +float: 6 +idouble: 3 +ifloat: 6 +ildouble: 5 +ldouble: 5 +Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# catan +Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# catanh +Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i": +double: 1 +idouble: 1 + +# cbrt +Test "cbrt (-27.0) == -3.0": +ildouble: 1 +ldouble: 1 +Test "cbrt (0.75) == 0.908560296416069829445605878163630251": +ildouble: 1 +ldouble: 1 + +# ccos +Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i": +ildouble: 1 +ldouble: 1 + +# ccosh +Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# cexp +Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": +ildouble: 1 +ldouble: 1 + +# clog +Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# clog10 +Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# cos +Test "cos (M_PI_6l * 2.0) == 0.5": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "cos (M_PI_6l * 4.0) == -0.5": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos (pi/2) == 0": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cosh +Test "cosh (0.75) == 1.29468328467684468784170818539018176": +ildouble: 1 + +# cpow +Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i": +float: 3 +ifloat: 3 +ildouble: 6 +ldouble: 6 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": +float: 1 +ifloat: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i": +double: 1 +float: 3 +idouble: 1 +ifloat: 3 +ildouble: 3 +ldouble: 3 +Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i": +double: 2 +float: 3 +idouble: 2 +ifloat: 3 +ildouble: 1 +ldouble: 1 + +# csin +Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i": +float: 1 +ifloat: 1 + +# csinh +Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": +float: 1 +ifloat: 1 + +# ctan +Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +double: 1 +idouble: 1 +ildouble: 439 +ldouble: 439 +Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +# ctanh +Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": +ildouble: 5 +ldouble: 5 +Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": +float: 1 +ifloat: 1 +ildouble: 25 +ldouble: 25 +Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i": +float: 1 +ifloat: 1 +Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# erf +Test "erf (1.25) == 0.922900128256458230136523481197281140": +double: 1 +idouble: 1 + +# erfc +Test "erfc (0.75) == 0.288844366346484868401062165408589223": +float: 1 +ifloat: 1 +Test "erfc (1.25) == 0.0770998717435417698634765188027188596": +ildouble: 1 +ldouble: 1 +Test "erfc (2.0) == 0.00467773498104726583793074363274707139": +double: 1 +idouble: 1 +Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# exp +Test "exp (0.75) == 2.11700001661267466854536981983709561": +ildouble: 1 +Test "exp (1000.0) == 0.197007111401704699388887935224332313e435": +ildouble: 754 +Test "exp (50.0) == 5184705528587072464087.45332293348538": +ildouble: 16 + +# exp10 +Test "exp10 (-1) == 0.1": +ildouble: 1 +ldouble: 1 +Test "exp10 (0.75) == 5.62341325190349080394951039776481231": +ildouble: 2 +ldouble: 2 +Test "exp10 (3) == 1000": +ildouble: 8 +ldouble: 8 + +# expm1 +Test "expm1 (1) == M_El - 1.0": +ildouble: 1 + +# gamma +Test "gamma (-0.5) == log(2*sqrt(pi))": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# hypot +Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 + +# j0 +Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "j0 (10.0) == -0.245935764451348335197760862485328754": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "j0 (2.0) == 0.223890779141235668051827454649948626": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "j0 (8.0) == 0.171650807137553906090869407851972001": +float: 1 +ifloat: 1 + +# j1 +Test "j1 (0.75) == 0.349243602174862192523281016426251335": +double: 1 +idouble: 1 +Test "j1 (10.0) == 0.0434727461688614366697487680258592883": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "j1 (2.0) == 0.576724807756873387202448242269137087": +double: 1 +idouble: 1 +Test "j1 (8.0) == 0.234636346853914624381276651590454612": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# jn +Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "jn (0, 10.0) == -0.245935764451348335197760862485328754": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "jn (0, 2.0) == 0.223890779141235668051827454649948626": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "jn (0, 8.0) == 0.171650807137553906090869407851972001": +float: 1 +ifloat: 1 +Test "jn (1, 0.75) == 0.349243602174862192523281016426251335": +double: 1 +idouble: 1 +Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (1, 2.0) == 0.576724807756873387202448242269137087": +double: 1 +idouble: 1 +Test "jn (1, 8.0) == 0.234636346853914624381276651590454612": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (10, 10.0) == 0.207486106633358857697278723518753428": +double: 5 +float: 2 +idouble: 5 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6": +double: 2 +idouble: 2 +ildouble: 1 +ldouble: 1 +Test "jn (3, -1.0) == -0.0195633539826684059189053216217515083": +ildouble: 1 +ldouble: 1 +Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 1.0) == 0.0195633539826684059189053216217515083": +ildouble: 1 +ldouble: 1 +Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563": +double: 5 +float: 2 +idouble: 5 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "jn (3, 2.0) == 0.128943249474402051098793332969239835": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# lgamma +Test "lgamma (-0.5) == log(2*sqrt(pi))": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "lgamma (0.7) == 0.260867246531666514385732417016759578": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# log +Test "log (e) == 1": +float: 1 +ifloat: 1 + +# log10 +Test "log10 (0.75) == -0.124938736608299953132449886193870744": +ildouble: 1 +ldouble: 1 +Test "log10 (e) == log10(e)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# sincos +Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# sin +Test "sin (0.80190127184058835) == 0.71867942238767868": +double: 1 +idouble: 1 + +# sinh +Test "sinh (0.75) == 0.822316731935829980703661634446913849": +double: 1 +ildouble: 1 + +# tan +Test "tan (pi/4) == 1": +double: 1 +idouble: 1 + +# tgamma +Test "tgamma (-0.5) == -2 sqrt (pi)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (0.5) == sqrt (pi)": +float: 1 +ifloat: 1 +Test "tgamma (0.7) == 1.29805533264755778568117117915281162": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (4) == 6": +ildouble: 1 +ldouble: 1 + +# y0 +Test "y0 (0.125) == -1.38968062514384052915582277745018693": +ildouble: 1 +ldouble: 1 +Test "y0 (0.75) == -0.137172769385772397522814379396581855": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "y0 (1.0) == 0.0882569642156769579829267660235151628": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y0 (1.5) == 0.382448923797758843955068554978089862": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "y0 (10.0) == 0.0556711672835993914244598774101900481": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y0 (8.0) == 0.223521489387566220527323400498620359": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# y1 +Test "y1 (0.125) == -5.19993611253477499595928744876579921": +ildouble: 1 +ldouble: 1 +Test "y1 (1.0) == -0.781212821300288716547150000047964821": +double: 1 +idouble: 1 +Test "y1 (10.0) == 0.249015424206953883923283474663222803": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +Test "y1 (2.0) == -0.107032431540937546888370772277476637": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "y1 (8.0) == -0.158060461731247494255555266187483550": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# yn +Test "yn (0, 0.125) == -1.38968062514384052915582277745018693": +ildouble: 1 +ldouble: 1 +Test "yn (0, 0.75) == -0.137172769385772397522814379396581855": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (0, 1.5) == 0.382448923797758843955068554978089862": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (0, 8.0) == 0.223521489387566220527323400498620359": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (1, 0.125) == -5.19993611253477499595928744876579921": +ildouble: 1 +ldouble: 1 +Test "yn (1, 1.0) == -0.781212821300288716547150000047964821": +double: 1 +idouble: 1 +Test "yn (1, 10.0) == 0.249015424206953883923283474663222803": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +Test "yn (1, 2.0) == -0.107032431540937546888370772277476637": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "yn (1, 8.0) == -0.158060461731247494255555266187483550": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "yn (10, 0.125) == -127057845771019398.252538486899753195": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (10, 0.75) == -2133501638.90573424452445412893839236": +float: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 +Test "yn (10, 1.0) == -121618014.278689189288130426667971145": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "yn (10, 10.0) == -0.359814152183402722051986577343560609": +double: 1 +float: 3 +idouble: 1 +ifloat: 3 +Test "yn (10, 2.0) == -129184.542208039282635913145923304214": +double: 2 +float: 3 +idouble: 2 +ifloat: 3 +Test "yn (3, 0.125) == -2612.69757350066712600220955744091741": +ildouble: 1 +ldouble: 1 +Test "yn (3, 0.75) == -12.9877176234475433186319774484809207": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (3, 10.0) == -0.251362657183837329779204747654240998": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (3, 2.0) == -1.12778377684042778608158395773179238": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# Maximal error of functions: +Function: "acos": +ildouble: 622 +ldouble: 622 + +Function: "asin": +ildouble: 1 +ldouble: 1 + +Function: "atanh": +ildouble: 2 +ldouble: 1 + +Function: Imaginary part of "cacos": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Real part of "cacosh": +double: 1 +float: 9 +idouble: 1 +ifloat: 9 +ildouble: 6 +ldouble: 6 + +Function: Imaginary part of "cacosh": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +ildouble: 1 +ldouble: 1 + +Function: Real part of "casin": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "casin": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Real part of "casinh": +double: 5 +float: 1 +idouble: 5 +ifloat: 1 +ildouble: 5 +ldouble: 5 + +Function: Imaginary part of "casinh": +double: 3 +float: 6 +idouble: 3 +ifloat: 6 +ildouble: 5 +ldouble: 5 + +Function: Imaginary part of "catan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "catanh": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cbrt": +ildouble: 1 +ldouble: 1 + +Function: Real part of "ccos": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ccos": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "cexp": +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "cexp": +ildouble: 1 +ldouble: 1 + +Function: Real part of "clog": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "clog10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "clog10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cosh": +ildouble: 1 + +Function: Real part of "cpow": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +ildouble: 763 +ldouble: 763 + +Function: Imaginary part of "cpow": +double: 2 +float: 3 +idouble: 2 +ifloat: 3 +ildouble: 2 +ldouble: 2 + +Function: Real part of "csin": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csin": +float: 1 +ifloat: 1 + +Function: Real part of "csinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Real part of "ctan": +double: 1 +idouble: 1 +ildouble: 439 +ldouble: 439 + +Function: Imaginary part of "ctan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +Function: Real part of "ctanh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 5 +ldouble: 5 + +Function: Imaginary part of "ctanh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 25 +ldouble: 25 + +Function: "erf": +double: 1 +idouble: 1 + +Function: "erfc": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "exp": +ildouble: 754 + +Function: "exp10": +ildouble: 8 +ldouble: 8 + +Function: "expm1": +ildouble: 1 + +Function: "gamma": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: "hypot": +float: 1 +ifloat: 1 + +Function: "j0": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "j1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "jn": +double: 5 +float: 2 +idouble: 5 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "log": +float: 1 +ifloat: 1 + +Function: "log10": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sincos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sin": +double: 1 +idouble: 1 + +Function: "sinh": +double: 1 +ildouble: 1 + +Function: "tan": +double: 1 +idouble: 1 + +Function: "tgamma": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "y0": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "y1": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "yn": +double: 2 +float: 3 +idouble: 2 +ifloat: 3 +ildouble: 4 +ldouble: 4 + +# end of automatic generation diff --git a/test/math/libm-test-ulps-ia64 b/test/math/libm-test-ulps-ia64 new file mode 100644 index 000000000..c5a2a0854 --- /dev/null +++ b/test/math/libm-test-ulps-ia64 @@ -0,0 +1,1146 @@ +# Begin of automatic generation + +# cacos +Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +# cacosh +Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": +double: 1 +float: 7 +idouble: 1 +ifloat: 7 +ildouble: 7 +ldouble: 7 +Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# casin +Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +# casinh +Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": +double: 5 +float: 1 +idouble: 5 +ifloat: 1 +ildouble: 5 +ldouble: 5 +Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": +double: 3 +float: 6 +idouble: 3 +ifloat: 6 +ildouble: 5 +ldouble: 5 +Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# catan +Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# catanh +Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i": +double: 4 +idouble: 4 +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i": +double: 1 +idouble: 1 + +# ccos +Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i": +ildouble: 1 +ldouble: 1 + +# ccosh +Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": +float: 1 +ifloat: 1 + +# cexp +Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": +float: 1 +ifloat: 1 +Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": +ildouble: 1 +ldouble: 1 + +# clog +Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# clog10 +Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# cos +Test "cos (0.80190127184058835) == 0.69534156199418473": +double: 1 +idouble: 1 +Test "cos (M_PI_6l * 2.0) == 0.5": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "cos (M_PI_6l * 4.0) == -0.5": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos (pi/2) == 0": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cpow +Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +ildouble: 6 +ldouble: 6 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i": +double: 2 +float: 3 +idouble: 2 +ifloat: 3 +ildouble: 3 +ldouble: 3 +Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": +double: 1 +float: 5 +idouble: 1 +ifloat: 5 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": +float: 2 +ifloat: 2 +ildouble: 4 +ldouble: 4 +Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i": +double: 2 +float: 3 +idouble: 2 +ifloat: 3 +ildouble: 1 +ldouble: 1 + +# csin +Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i": +float: 1 +ifloat: 1 + +# csinh +Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": +float: 1 +ifloat: 1 + +# csqrt +Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 +Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 + +# ctan +Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# ctanh +Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": +float: 1 +ifloat: 1 +ildouble: 24 +ldouble: 24 +Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i": +float: 1 +ifloat: 1 +Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": +double: 1 +idouble: 1 +Test "Imaginary part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# erf +Test "erf (1.25) == 0.922900128256458230136523481197281140": +double: 1 +idouble: 1 + +# erfc +Test "erfc (0.75) == 0.288844366346484868401062165408589223": +float: 1 +ifloat: 1 +Test "erfc (1.25) == 0.0770998717435417698634765188027188596": +ildouble: 1 +ldouble: 1 +Test "erfc (2.0) == 0.00467773498104726583793074363274707139": +double: 1 +idouble: 1 +Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# exp10 +Test "exp10 (-1) == 0.1": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "exp10 (0.75) == 5.62341325190349080394951039776481231": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "exp10 (3) == 1000": +double: 6 +float: 2 +idouble: 6 +ifloat: 2 +ildouble: 3 +ldouble: 3 + +# expm1 +Test "expm1 (1) == M_El - 1.0": +ildouble: 1 +ldouble: 1 + +# gamma +Test "gamma (-0.5) == log(2*sqrt(pi))": +ildouble: 1 +ldouble: 1 + +# hypot +Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 + +# j0 +Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "j0 (10.0) == -0.245935764451348335197760862485328754": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "j0 (2.0) == 0.223890779141235668051827454649948626": +float: 2 +ifloat: 2 +Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "j0 (8.0) == 0.171650807137553906090869407851972001": +float: 1 +ifloat: 1 + +# j1 +Test "j1 (10.0) == 0.0434727461688614366697487680258592883": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "j1 (2.0) == 0.576724807756873387202448242269137087": +double: 1 +idouble: 1 +Test "j1 (8.0) == 0.234636346853914624381276651590454612": +double: 1 +idouble: 1 + +# jn +Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "jn (0, 10.0) == -0.245935764451348335197760862485328754": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (0, 2.0) == 0.223890779141235668051827454649948626": +float: 2 +ifloat: 2 +Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "jn (0, 8.0) == 0.171650807137553906090869407851972001": +float: 1 +ifloat: 1 +Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "jn (1, 2.0) == 0.576724807756873387202448242269137087": +double: 1 +idouble: 1 +Test "jn (1, 8.0) == 0.234636346853914624381276651590454612": +double: 1 +idouble: 1 +Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9": +ildouble: 1 +ldouble: 1 +Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9": +ildouble: 1 +ldouble: 1 +Test "jn (10, 10.0) == 0.207486106633358857697278723518753428": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6": +float: 4 +ifloat: 4 +ildouble: 1 +ldouble: 1 +Test "jn (3, -1.0) == -0.0195633539826684059189053216217515083": +ildouble: 1 +ldouble: 1 +Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2": +double: 1 +idouble: 1 +Test "jn (3, 1.0) == 0.0195633539826684059189053216217515083": +ildouble: 1 +ldouble: 1 +Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "jn (3, 2.0) == 0.128943249474402051098793332969239835": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# lgamma +Test "lgamma (-0.5) == log(2*sqrt(pi))": +ildouble: 1 +ldouble: 1 +Test "lgamma (0.7) == 0.260867246531666514385732417016759578": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# log +Test "log (e) == 1": +float: 1 +ifloat: 1 + +# log10 +Test "log10 (e) == log10(e)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# sincos +Test "sincos (0.80190127184058835, &sin_res, &cos_res) puts 0.69534156199418473 in cos_res": +double: 1 +idouble: 1 +Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# tan +Test "tan (pi/4) == 1": +double: 1 +idouble: 1 + +# tgamma +Test "tgamma (-0.5) == -2 sqrt (pi)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (0.5) == sqrt (pi)": +float: 1 +ifloat: 1 +Test "tgamma (0.7) == 1.29805533264755778568117117915281162": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# y0 +Test "y0 (0.125) == -1.38968062514384052915582277745018693": +ildouble: 1 +ldouble: 1 +Test "y0 (1.0) == 0.0882569642156769579829267660235151628": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y0 (1.5) == 0.382448923797758843955068554978089862": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (10.0) == 0.0556711672835993914244598774101900481": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "y0 (2.0) == 0.510375672649745119596606592727157873": +double: 1 +idouble: 1 +Test "y0 (8.0) == 0.223521489387566220527323400498620359": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# y1 +Test "y1 (0.125) == -5.19993611253477499595928744876579921": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "y1 (10.0) == 0.249015424206953883923283474663222803": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "y1 (1.5) == -0.412308626973911295952829820633445323"; +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y1 (2.0) == -0.107032431540937546888370772277476637": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y1 (8.0) == -0.158060461731247494255555266187483550": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# yn +Test "yn (0, 0.125) == -1.38968062514384052915582277745018693": +ildouble: 1 +ldouble: 1 +Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (0, 1.5) == 0.382448923797758843955068554978089862": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (0, 2.0) == 0.510375672649745119596606592727157873": +double: 1 +idouble: 1 +Test "yn (0, 8.0) == 0.223521489387566220527323400498620359": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (1, 0.125) == -5.19993611253477499595928744876579921": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "yn (1, 10.0) == 0.249015424206953883923283474663222803": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "yn (1, 1.5) == -0.412308626973911295952829820633445323"; +float: 1 +ifloat: 1 +ldouble: 1 +ildouble: 1 +Test "yn (1, 2.0) == -0.107032431540937546888370772277476637": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (1, 8.0) == -0.158060461731247494255555266187483550": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "yn (10, 0.125) == -127057845771019398.252538486899753195": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 +Test "yn (10, 0.75) == -2133501638.90573424452445412893839236": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "yn (10, 1.0) == -121618014.278689189288130426667971145": +float: 2 +ifloat: 2 +Test "yn (10, 10.0) == -0.359814152183402722051986577343560609": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +Test "yn (10, 2.0) == -129184.542208039282635913145923304214": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "yn (3, 0.125) == -2612.69757350066712600220955744091741": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "yn (3, 0.75) == -12.9877176234475433186319774484809207": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (3, 10.0) == -0.251362657183837329779204747654240998": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (3, 2.0) == -1.12778377684042778608158395773179238": +double: 1 +idouble: 1 + +# Maximal error of functions: +Function: Imaginary part of "cacos": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Real part of "cacosh": +double: 1 +float: 7 +idouble: 1 +ifloat: 7 +ildouble: 7 +ldouble: 7 + +Function: Imaginary part of "cacosh": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "casin": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "casin": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Real part of "casinh": +double: 5 +float: 1 +idouble: 5 +ifloat: 1 +ildouble: 5 +ldouble: 5 + +Function: Imaginary part of "casinh": +double: 3 +float: 6 +idouble: 3 +ifloat: 6 +ildouble: 5 +ldouble: 5 + +Function: Imaginary part of "catan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "catanh": +double: 4 +idouble: 4 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ccos": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ccos": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "cexp": +float: 1 +ifloat: 1 + +Function: Imaginary part of "cexp": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "clog": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "clog10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "clog10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "cpow": +double: 2 +float: 5 +idouble: 2 +ifloat: 5 +ildouble: 6 +ldouble: 6 + +Function: Imaginary part of "cpow": +double: 2 +float: 3 +idouble: 2 +ifloat: 3 +ildouble: 4 +ldouble: 4 + +Function: Real part of "csin": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csin": +float: 1 +ifloat: 1 + +Function: Real part of "csinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Real part of "csqrt": +float: 1 +ifloat: 1 + +Function: Real part of "ctan": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "ctan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ctanh": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ctanh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 24 +ldouble: 24 + +Function: "erf": +double: 1 +idouble: 1 + +Function: "erfc": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "exp10": +double: 6 +float: 2 +idouble: 6 +ifloat: 2 +ildouble: 3 +ldouble: 3 + +Function: "expm1": +ildouble: 1 +ldouble: 1 + +Function: "gamma": +ildouble: 1 +ldouble: 1 + +Function: "hypot": +float: 1 +ifloat: 1 + +Function: "j0": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: "j1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "jn": +double: 3 +float: 4 +idouble: 3 +ifloat: 4 +ildouble: 2 +ldouble: 2 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "log": +float: 1 +ifloat: 1 + +Function: "log10": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sincos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "tan": +double: 1 +idouble: 1 + +Function: "tgamma": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "y0": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "y1": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "yn": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +# end of automatic generation diff --git a/test/math/libm-test-ulps-mips32 b/test/math/libm-test-ulps-mips32 new file mode 100644 index 000000000..7a421bfed --- /dev/null +++ b/test/math/libm-test-ulps-mips32 @@ -0,0 +1,4966 @@ +# Begin of automatic generation + +# acos_downward +Test "acos_downward (-0)": +float: 1 +ifloat: 1 +Test "acos_downward (-0.5)": +double: 1 +idouble: 1 +Test "acos_downward (-1)": +float: 1 +ifloat: 1 +Test "acos_downward (0)": +float: 1 +ifloat: 1 +Test "acos_downward (0.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# acos_towardzero +Test "acos_towardzero (-0)": +float: 1 +ifloat: 1 +Test "acos_towardzero (-0.5)": +double: 1 +idouble: 1 +Test "acos_towardzero (-1)": +float: 1 +ifloat: 1 +Test "acos_towardzero (0)": +float: 1 +ifloat: 1 +Test "acos_towardzero (0.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# asin_downward +Test "asin_downward (-0.5)": +double: 1 +idouble: 1 +Test "asin_downward (0.5)": +double: 1 +idouble: 1 +Test "asin_downward (1.0)": +float: 1 +ifloat: 1 + +# asin_towardzero +Test "asin_towardzero (-0.5)": +double: 1 +idouble: 1 +Test "asin_towardzero (-1.0)": +float: 1 +ifloat: 1 +Test "asin_towardzero (0.5)": +double: 1 +idouble: 1 +Test "asin_towardzero (1.0)": +float: 1 +ifloat: 1 + +# asin_upward +Test "asin_upward (-1.0)": +float: 1 +ifloat: 1 + +# atan2 +Test "atan2 (-0.75, -1.0)": +float: 1 +ifloat: 1 +Test "atan2 (-max_value, -min_value)": +float: 1 +ifloat: 1 +Test "atan2 (0.75, -1.0)": +float: 1 +ifloat: 1 +Test "atan2 (1.390625, 0.9296875)": +float: 1 +ifloat: 1 + +# atanh +Test "atanh (0.75)": +float: 1 +ifloat: 1 + +# cacos +Test "Imaginary part of: cacos (+0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (+0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (+0 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (+0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (+0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (+0 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0.25 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0.25 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0.25 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0.25 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0.5 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0.5 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (-0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (-0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1.fp-100 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-100 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0x0.ffffffp0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 1.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0x0.ffffffp0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 1.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1.fp-30 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-30 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 + 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 - 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 + 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 - 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-23 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1p-23 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-23 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-23 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1p-23 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-23 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 + 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 - 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 + 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 - 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-1.0 + 0x1p50 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-1.0 - 0x1p50 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0.25 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0.25 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0.5 + +0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1p-63 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0.5 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1p-63 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0.5 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0x0.ffffffp0 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0x0.ffffffp0 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacos (0x0.ffffffp0 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0x0.ffffffp0 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacos (0x1.0000000000001p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0x1.0000000000001p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0x1.000002p0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0x1.000002p0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (1.0 + 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (1.0 + 0x1.fp-10 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (1.0 - 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (1.0 - 0x1.fp-10 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 + +# cacosh +Test "Real part of: cacosh (+0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 + 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (+0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (+0 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 + 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (-0 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.25 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0.25 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (-0.25 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0.25 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (-0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0.5 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacosh (-0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacosh (-0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-100 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-100 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0x0.ffffffp0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 1.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0x0.ffffffp0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 1.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-30 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-30 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 + 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 - 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 + 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 - 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-23 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0x1p-23 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-23 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-23 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0x1p-23 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-23 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 + 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 - 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 + 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 - 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-1.0 + 0x1p50 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-1.0 - 0x1p50 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0.25 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0.25 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0.5 + +0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1p-63 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0.5 - 0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1p-63 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0x0.ffffffp0 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0x0.ffffffp0 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacosh (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacosh (0x0.ffffffp0 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0x0.ffffffp0 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacosh (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacosh (0x1.0000000000001p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0x1.0000000000001p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0x1.000002p0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacosh (0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0x1.000002p0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacosh (0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (1.0 + 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (1.0 + 0x1.fp-10 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacosh (1.0 - 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (1.0 - 0x1.fp-10 i)": +float: 2 +ifloat: 2 + +# casin +Test "Imaginary part of: casin (+0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (+0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (+0 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (+0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (+0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (+0 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.25 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0.25 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: casin (-0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: casin (-0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (-0x1.fp-10 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-0x1.fp-10 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (-0x1p-23 + 0.5 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-0x1p-23 + 0x1.000002p0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casin (-0x1p-23 - 0.5 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-0x1p-23 - 0x1.000002p0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (-1.0 + 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (-1.0 - 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0.25 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0.25 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: casin (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: casin (0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (0x1.fp-10 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (0x1.fp-10 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (0x1p-23 + 0.5 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (0x1p-23 + 0x1.000002p0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casin (0x1p-23 - 0.5 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (0x1p-23 - 0x1.000002p0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (1.0 + 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (1.0 - 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 + +# casinh +Test "Imaginary part of: casinh (-0.25 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (-0.25 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0.5 + +0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (-0.5 + 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (-0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (-0.5 - 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (-0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0x0.ffffffp0 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x0.ffffffp0 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (-0x1.000002p0 + 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casinh (-0x1.000002p0 - 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-0x1.fp-10 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0x1.fp-10 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0x1.fp-129 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1.fp-129 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-105 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-105 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-112 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-112 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-23 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-23 + 0x0.ffffffp0 i)": +float: 2 +ifloat: 2 +Test "Real part of: casinh (-0x1p-23 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0x1p-23 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-23 - 0x0.ffffffp0 i)": +float: 2 +ifloat: 2 +Test "Real part of: casinh (-0x1p-23 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0x1p-52 + 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-52 - 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.0 + +0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 + 0.25 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (-1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-100 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-129 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-30 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 - 0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 - 0.25 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (-1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-100 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-129 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-30 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (-1.5 + +0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.5 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.5 - 0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.5 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-1.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (0.25 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (0.25 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0.5 + +0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.5 + 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.5 - 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (0x0.ffffffp0 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x0.ffffffp0 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (0x1.000002p0 + 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0x1.000002p0 - 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (0x1.fp-10 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0x1.fp-10 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0x1.fp-129 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1.fp-129 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-105 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-105 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-112 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-112 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-23 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-23 + 0x0.ffffffp0 i)": +float: 2 +ifloat: 2 +Test "Real part of: casinh (0x1p-23 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0x1p-23 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-23 - 0x0.ffffffp0 i)": +float: 2 +ifloat: 2 +Test "Real part of: casinh (0x1p-23 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0x1p-52 + 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-52 - 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.0 + +0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 + 0.25 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 + 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-100 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-129 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-30 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 - 0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 - 0.25 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 - 0.5 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-100 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-129 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-30 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casinh (1.5 + +0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.5 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.5 - 0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.5 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (1.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 + +# catan +Test "Imaginary part of: catan (-0x0.fffffffffffff8p0 + 0x1p-27 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x0.ffffffp0 + 0x1p-13 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1.0000000000001p0 - 0x1p-27 i)": +double: 1 +idouble: 1 +Test "Real part of: catan (-0x1.000002p0 + 0x1p-126 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1.000002p0 - 0x1p-126 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1.000002p0 - 0x1p-13 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1.fp1023 - 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1.fp127 - 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1p-1020 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1p-1020 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: catan (-0x1p-13 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1p-13 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1p-13 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-54 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-54 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-57 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-57 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-1.0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-1.0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-2 - 3 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x0.fffffffffffff8p0 + 0x1p-27 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x0.ffffffp0 + 0x1p-13 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1.0000000000001p0 - 0x1p-27 i)": +double: 1 +idouble: 1 +Test "Real part of: catan (0x1.000002p0 + 0x1p-126 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1.000002p0 - 0x1p-126 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1.000002p0 - 0x1p-13 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1.fp1023 - 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1.fp127 - 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1p-1020 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1p-1020 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: catan (0x1p-13 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1p-13 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1p-13 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-54 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-54 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-57 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-57 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (1.0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (1.0 - 0x1p-13 i)": +float: 1 +ifloat: 1 + +# catanh +Test "Real part of: catanh (-0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (-0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (-0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-0x1.fp1023 - 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-0x1.fp127 - 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (-0x1p-126 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (-0x1p-126 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-0x1p-13 + 0x1.000002p0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (-0x1p-13 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (-0x1p-13 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-0x1p-13 - 0x1.000002p0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (-0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (-0x1p-13 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-0x1p-27 + 0x1.0000000000001p0 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-0x1p-27 - 0x1.0000000000001p0 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-1.0 + 0x1p-1020 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (-1.0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 + 0x1p-54 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 + 0x1p-57 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 - 0x1p-1020 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (-1.0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 - 0x1p-54 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 - 0x1p-57 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-2 - 3 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (0x1.fp1023 - 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (0x1.fp127 - 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (0x1p-126 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1p-126 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (0x1p-13 + 0x0.ffffffp0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1p-13 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1p-13 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (0x1p-13 - 0x0.ffffffp0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1p-13 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (0x1p-27 + 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (0x1p-27 - 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (1.0 + 0x1p-1020 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (1.0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 + 0x1p-54 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 + 0x1p-57 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 - 0x1p-1020 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (1.0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 - 0x1p-54 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 - 0x1p-57 i)": +float: 1 +ifloat: 1 + +# cbrt +Test "cbrt (-27.0)": +double: 1 +idouble: 1 +Test "cbrt (0.75)": +double: 1 +idouble: 1 +Test "cbrt (0.9921875)": +double: 1 +idouble: 1 + +# ccos +Test "Imaginary part of: ccos (-0.75 + 710.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccos (-0.75 + 89.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccos (-0.75 - 710.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccos (-0.75 - 89.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccos (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Real part of: ccos (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccos (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccos (0.75 + 710.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccos (0.75 + 89.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccos (0.75 - 710.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccos (0.75 - 89.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccos (0x1p-1074 + 1440 i)": +double: 1 +idouble: 1 + +# ccosh +Test "Real part of: ccosh (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (-710.5 + 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccosh (-710.5 - 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccosh (-89.5 + 0.75 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (-89.5 - 0.75 i)": +float: 1 +ifloat: 1 +Test "Real part of: ccosh (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (1440 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccosh (710.5 + 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccosh (710.5 - 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccosh (89.5 + 0.75 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (89.5 - 0.75 i)": +float: 1 +ifloat: 1 + +# cexp +Test "Imaginary part of: cexp (-2.0 - 3.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cexp (-95 + 0.75 i)": +double: 1 +idouble: 1 +Test "Real part of: cexp (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cexp (1440 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Real part of: cexp (50 + 0x1p127 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: cexp (50 + 0x1p127 i)": +double: 1 +idouble: 1 +Test "Real part of: cexp (500 + 0x1p1023 i)": +double: 1 +idouble: 1 +Test "Real part of: cexp (709.8125 + 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cexp (709.8125 + 0.75 i)": +double: 1 +idouble: 1 +Test "Real part of: cexp (88.75 + 0.75 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cexp (88.75 + 0.75 i)": +float: 2 +ifloat: 2 + +# clog +Test "Real part of: clog (-0x1.0000000123456p0 + 0x1.2345678p-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: clog (-0x1.0000000123456p0 + 0x1.2345678p-30 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog (-0x1.234566p-40 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1.fp+127 + 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1.fp+127 - 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1p-149 + 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog (-0x1p-149 + 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1p-149 - 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog (-0x1p-149 - 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x0.ffffffp0 + 0x0.ffffffp-100 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1.000566p0 + 0x1.234p-10 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1.fp+127 + 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1.fp+127 - 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1p-1074 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Real part of: clog (0x1p-147 + 0x1p-147 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1p-149 + 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1p-149 - 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog (0x2818p-15 + 0x798fp-15 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (1.0 + 0x1.234566p-10 i)": +float: 1 +ifloat: 1 + +# clog10 +Test "Imaginary part of: clog10 (-0 + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0 - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-1000 i)": +double: 2 +idouble: 2 +Test "Imaginary part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-30 i)": +double: 2 +idouble: 2 +Test "Imaginary part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-30 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+1023 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+1023 - 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+127 + 0x1p-149 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0x1.fp+127 - 0x1p-149 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0x1p-1074 + 0x1.fp+1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1p-1074 - 0x1.fp+1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1p-149 + 0x1.fp+127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1p-149 - 0x1.fp+127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-1.0 + 0x1.234566p-20 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-2 - 3 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-3 + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-3 - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 1 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + inf i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-inf - 0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf - 1 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0x0.fffffffffffff8p0 + 0x0.fffffffffffff8p-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x0.ffffffp0 + 0x0.ffffffp-100 i)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "Real part of: clog10 (0x1.000566p0 + 0x1.234p-10 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.000566p0 + 0x1.234p-10 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x1.000566p0 + 0x1.234p-100 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.234566p-30 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.234566p-50 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.234566p-60 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.fffffep+127 + 0x1.fffffep+127 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0x1.fffffep+127 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x10673dd0f2481p-51 + 0x7ef1d17cefbd2p-51 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x164c74eea876p-45 + 0x16f393482f77p-45 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1a6p-10 + 0x3a5p-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-1073 + 0x1p-1073 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-1074 + 0x1.fp+1023 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x1p-1074 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-1074 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-1074 - 0x1.fp+1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-147 + 0x1p-147 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-149 + 0x1.fp+127 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-149 + 0x1p-149 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-149 - 0x1.fp+127 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-509 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-510 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-511 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-61 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-62 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-63 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0x2818p-15 + 0x798fp-15 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x2818p-15 + 0x798fp-15 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog10 (0x2dd46725bp-35 + 0x7783a1284p-35 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x2ede88p-23 + 0x771c3fp-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x2ede88p-23 + 0x771c3fp-23 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x4447d7175p-35 + 0x6c445e00ap-35 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x5b06b680ea2ccp-52 + 0xef452b965da9fp-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x9b57bp-20 + 0xcb7b4p-20 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0xf2p-10 + 0x3e3p-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0xf2p-10 + 0x3e3p-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0xfe961079616p-45 + 0x1bc37e09e6d1p-45 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (1.0 + 0x1.234566p-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (3 + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (3 - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# cos +Test "cos (0x1p+120)": +float: 1 +ifloat: 1 +Test "cos (0x1p+127)": +float: 1 +ifloat: 1 +Test "cos (M_PI_6l * 2.0)": +double: 1 +idouble: 1 +Test "cos (M_PI_6l * 4.0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# cos_downward +Test "cos_downward (1)": +float: 1 +ifloat: 1 +Test "cos_downward (2)": +float: 1 +ifloat: 1 +Test "cos_downward (3)": +float: 1 +ifloat: 1 +Test "cos_downward (4)": +float: 1 +ifloat: 1 +Test "cos_downward (5)": +float: 1 +ifloat: 1 +Test "cos_downward (7)": +float: 1 +ifloat: 1 +Test "cos_downward (8)": +float: 1 +ifloat: 1 + +# cos_tonearest +Test "cos_tonearest (7)": +float: 1 +ifloat: 1 + +# cos_towardzero +Test "cos_towardzero (2)": +float: 1 +ifloat: 1 +Test "cos_towardzero (3)": +float: 1 +ifloat: 1 +Test "cos_towardzero (5)": +float: 1 +ifloat: 1 +Test "cos_towardzero (7)": +float: 1 +ifloat: 1 +Test "cos_towardzero (8)": +float: 1 +ifloat: 1 + +# cos_upward +Test "cos_upward (10)": +float: 1 +ifloat: 1 +Test "cos_upward (6)": +float: 1 +ifloat: 1 +Test "cos_upward (7)": +float: 1 +ifloat: 1 +Test "cos_upward (9)": +float: 2 +ifloat: 2 + +# cosh_downward +Test "cosh_downward (22)": +float: 1 +ifloat: 1 +Test "cosh_downward (23)": +float: 1 +ifloat: 1 +Test "cosh_downward (24)": +float: 1 +ifloat: 1 + +# cosh_towardzero +Test "cosh_towardzero (22)": +float: 1 +ifloat: 1 +Test "cosh_towardzero (23)": +float: 1 +ifloat: 1 +Test "cosh_towardzero (24)": +float: 1 +ifloat: 1 + +# cpow +Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i)": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i)": +double: 2 +float: 3 +idouble: 2 +ifloat: 3 +Test "Real part of: cpow (2 + 3 i, 4 + 0 i)": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i)": +float: 2 +ifloat: 2 + +# csin +Test "Real part of: csin (-0.75 + 710.5 i)": +double: 1 +idouble: 1 +Test "Real part of: csin (-0.75 + 89.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: csin (-0.75 - 710.5 i)": +double: 1 +idouble: 1 +Test "Real part of: csin (-0.75 - 89.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: csin (0.75 + 710.5 i)": +double: 1 +idouble: 1 +Test "Real part of: csin (0.75 + 89.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: csin (0.75 - 710.5 i)": +double: 1 +idouble: 1 +Test "Real part of: csin (0.75 - 89.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: csin (0x1p-1074 + 1440 i)": +double: 1 +idouble: 1 + +# csinh +Test "Imaginary part of: csinh (-2 - 3 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (-710.5 + 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (-710.5 - 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (-89.5 + 0.75 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: csinh (-89.5 - 0.75 i)": +float: 1 +ifloat: 1 +Test "Real part of: csinh (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: csinh (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: csinh (1440 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (710.5 + 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (710.5 - 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (89.5 + 0.75 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: csinh (89.5 - 0.75 i)": +float: 1 +ifloat: 1 + +# csqrt +Test "Real part of: csqrt (-0x1.000002p-126 - 0x1.000002p-126 i)": +double: 1 +idouble: 1 +Test "Real part of: csqrt (-2 + 3 i)": +float: 1 +ifloat: 1 +Test "Real part of: csqrt (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: csqrt (0x1.000002p-126 + 0x1.000002p-126 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csqrt (0x1.fffffep+127 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: csqrt (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csqrt (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csqrt (0x1.fffffffffffffp+1023 + 0x1p+1023 i)": +double: 1 +idouble: 1 + +# ctan +Test "Real part of: ctan (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctan (-2 - 3 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ctan (0.75 + 1.25 i)": +double: 1 +idouble: 1 +Test "Real part of: ctan (0x1p1023 + 1 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ctan (0x1p127 + 1 i)": +double: 1 +idouble: 1 +Test "Real part of: ctan (0x3.243f6cp-1 + 0 i)": +float: 1 +ifloat: 1 + +# ctan_downward +Test "Real part of: ctan_downward (0x1.921fb6p+0 + 0x1p-149 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: ctan_downward (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 + +# ctan_tonearest +Test "Real part of: ctan_tonearest (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctan_tonearest (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 + +# ctan_towardzero +Test "Real part of: ctan_towardzero (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctan_towardzero (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 + +# ctan_upward +Test "Real part of: ctan_upward (0x1.921fb54442d18p+0 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Real part of: ctan_upward (0x1.921fb6p+0 + 0x1p-149 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: ctan_upward (0x1.921fb6p+0 + 0x1p-149 i)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# ctanh +Test "Real part of: ctanh (-2 - 3 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ctanh (-2 - 3 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ctanh (0 + 0x3.243f6cp-1 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctanh (0 + pi/4 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: ctanh (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ctanh (0.75 + 1.25 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: ctanh (1 + 0x1p1023 i)": +double: 1 +idouble: 1 +Test "Real part of: ctanh (1 + 0x1p127 i)": +double: 1 +idouble: 1 + +# ctanh_downward +Test "Real part of: ctanh_downward (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctanh_downward (0x1p-149 + 0x1.921fb6p+0 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# ctanh_tonearest +Test "Real part of: ctanh_tonearest (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctanh_tonearest (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 + +# ctanh_towardzero +Test "Real part of: ctanh_towardzero (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctanh_towardzero (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 + +# ctanh_upward +Test "Imaginary part of: ctanh_upward (0x1p-1074 + 0x1.921fb54442d18p+0 i)": +double: 1 +idouble: 1 +Test "Real part of: ctanh_upward (0x1p-149 + 0x1.921fb6p+0 i)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "Imaginary part of: ctanh_upward (0x1p-149 + 0x1.921fb6p+0 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# erf +Test "erf (1.25)": +double: 1 +idouble: 1 + +# erfc +Test "erfc (0x1.f7303cp+1)": +double: 1 +idouble: 1 +Test "erfc (0x1.ffa002p+2)": +float: 1 +ifloat: 1 +Test "erfc (2.0)": +double: 1 +idouble: 1 +Test "erfc (4.125)": +double: 1 +idouble: 1 + +# exp10 +Test "exp10 (-1)": +double: 1 +idouble: 1 +Test "exp10 (-305)": +double: 1 +idouble: 1 +Test "exp10 (-36)": +double: 1 +idouble: 1 +Test "exp10 (3)": +double: 1 +idouble: 1 +Test "exp10 (36)": +double: 1 +idouble: 1 + +# exp_downward +Test "exp_downward (2)": +float: 1 +ifloat: 1 +Test "exp_downward (3)": +float: 1 +ifloat: 1 + +# exp_towardzero +Test "exp_towardzero (2)": +float: 1 +ifloat: 1 +Test "exp_towardzero (3)": +float: 1 +ifloat: 1 + +# exp_upward +Test "exp_upward (1)": +float: 1 +ifloat: 1 + +# expm1 +Test "expm1 (0.75)": +double: 1 +idouble: 1 +Test "expm1 (1)": +float: 1 +ifloat: 1 +Test "expm1 (500.0)": +double: 1 +idouble: 1 + +# gamma +Test "gamma (0.7)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "gamma (1.2)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# hypot +Test "hypot (-0.7, -12.4)": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4)": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7)": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7)": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4)": +float: 1 +ifloat: 1 +Test "hypot (0.7, 12.4)": +float: 1 +ifloat: 1 +Test "hypot (12.4, -0.7)": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7)": +float: 1 +ifloat: 1 + +# j0 +Test "j0 (-4.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "j0 (0.75)": +float: 1 +ifloat: 1 +Test "j0 (0x1.d7ce3ap+107)": +float: 2 +ifloat: 2 +Test "j0 (10.0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "j0 (2.0)": +float: 2 +ifloat: 2 +Test "j0 (4.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "j0 (8.0)": +float: 1 +ifloat: 1 + +# j1 +Test "j1 (0x1.3ffp+74)": +double: 1 +idouble: 1 +Test "j1 (0x1.ff00000000002p+840)": +double: 1 +idouble: 1 +Test "j1 (10.0)": +float: 2 +ifloat: 2 +Test "j1 (2.0)": +double: 1 +idouble: 1 +Test "j1 (8.0)": +double: 1 +idouble: 1 + +# jn +Test "jn (0, -4.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (0, 0.75)": +float: 1 +ifloat: 1 +Test "jn (0, 10.0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "jn (0, 2.0)": +float: 2 +ifloat: 2 +Test "jn (0, 4.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (0, 8.0)": +float: 1 +ifloat: 1 +Test "jn (1, 10.0)": +float: 2 +ifloat: 2 +Test "jn (1, 2.0)": +double: 1 +idouble: 1 +Test "jn (1, 8.0)": +double: 1 +idouble: 1 +Test "jn (10, 0.125)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (10, 0.75)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (10, 10.0)": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 +Test "jn (10, 2.0)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "jn (2, 0x1.ffff62p+99)": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +Test "jn (2, 2.4048255576957729)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "jn (3, 0.125)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 0.75)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 10.0)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "jn (3, 2.0)": +float: 1 +ifloat: 1 +Test "jn (3, 2.4048255576957729)": +double: 3 +idouble: 3 +Test "jn (4, 2.4048255576957729)": +double: 1 +idouble: 1 +Test "jn (5, 2.4048255576957729)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "jn (6, 2.4048255576957729)": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 +Test "jn (7, 2.4048255576957729)": +double: 3 +float: 5 +idouble: 3 +ifloat: 5 +Test "jn (8, 2.4048255576957729)": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +Test "jn (9, 2.4048255576957729)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# lgamma +Test "lgamma (0.7)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "lgamma (1.2)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# log10 +Test "log10 (0.75)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "log10 (e)": +float: 1 +ifloat: 1 + +# log1p +Test "log1p (-0.25)": +float: 1 +ifloat: 1 + +# pow +Test "pow (0x0.ffffffp0, -0x1p24)": +float: 1 +ifloat: 1 +Test "pow (0x0.ffffffp0, 0x1p24)": +float: 1 +ifloat: 1 +Test "pow (0x1.000002p0, 0x1p24)": +float: 1 +ifloat: 1 + +# pow10 +Test "pow10 (-1)": +double: 1 +idouble: 1 +Test "pow10 (-305)": +double: 1 +idouble: 1 +Test "pow10 (-36)": +double: 1 +idouble: 1 +Test "pow10 (3)": +double: 1 +idouble: 1 +Test "pow10 (36)": +double: 1 +idouble: 1 + +# pow_downward +Test "pow_downward (1.5, 1.03125)": +float: 1 +ifloat: 1 + +# pow_towardzero +Test "pow_towardzero (1.5, 1.03125)": +float: 1 +ifloat: 1 + +# pow_upward +Test "pow_upward (1.0625, 1.125)": +float: 1 +ifloat: 1 + +# sin_downward +Test "sin_downward (10)": +float: 1 +ifloat: 1 +Test "sin_downward (3)": +float: 1 +ifloat: 1 +Test "sin_downward (5)": +float: 1 +ifloat: 1 +Test "sin_downward (6)": +float: 1 +ifloat: 1 + +# sin_tonearest +Test "sin_tonearest (1)": +float: 1 +ifloat: 1 + +# sin_towardzero +Test "sin_towardzero (1)": +float: 1 +ifloat: 1 +Test "sin_towardzero (10)": +float: 1 +ifloat: 1 +Test "sin_towardzero (4)": +float: 1 +ifloat: 1 +Test "sin_towardzero (5)": +float: 1 +ifloat: 1 +Test "sin_towardzero (9)": +float: 1 +ifloat: 1 + +# sin_upward +Test "sin_upward (1)": +float: 1 +ifloat: 1 +Test "sin_upward (2)": +float: 2 +ifloat: 2 +Test "sin_upward (4)": +float: 1 +ifloat: 1 +Test "sin_upward (9)": +float: 1 +ifloat: 1 + +# sincos +Test "sincos (0x1p+120) extra output 2": +float: 1 +ifloat: 1 +Test "sincos (0x1p+127) extra output 2": +float: 1 +ifloat: 1 +Test "sincos (M_PI_6l*2.0) extra output 1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sincos (M_PI_6l*2.0) extra output 2": +double: 1 +idouble: 1 +Test "sincos (pi/6) extra output 2": +float: 1 +ifloat: 1 + +# sinh_downward +Test "sinh_downward (22)": +float: 1 +ifloat: 1 +Test "sinh_downward (23)": +float: 1 +ifloat: 1 +Test "sinh_downward (24)": +float: 1 +ifloat: 1 + +# sinh_towardzero +Test "sinh_towardzero (22)": +float: 1 +ifloat: 1 +Test "sinh_towardzero (23)": +float: 1 +ifloat: 1 +Test "sinh_towardzero (24)": +float: 1 +ifloat: 1 + +# tan_downward +Test "tan_downward (1)": +float: 1 +ifloat: 1 +Test "tan_downward (10)": +float: 1 +ifloat: 1 +Test "tan_downward (2)": +float: 1 +ifloat: 1 +Test "tan_downward (6)": +float: 1 +ifloat: 1 +Test "tan_downward (8)": +float: 1 +ifloat: 1 +Test "tan_downward (9)": +float: 1 +ifloat: 1 + +# tan_towardzero +Test "tan_towardzero (10)": +float: 1 +ifloat: 1 +Test "tan_towardzero (3)": +float: 1 +ifloat: 1 +Test "tan_towardzero (4)": +float: 1 +ifloat: 1 +Test "tan_towardzero (5)": +float: 1 +ifloat: 1 +Test "tan_towardzero (9)": +float: 1 +ifloat: 1 + +# tan_upward +Test "tan_upward (1)": +float: 1 +ifloat: 1 +Test "tan_upward (10)": +float: 1 +ifloat: 1 +Test "tan_upward (3)": +float: 1 +ifloat: 1 +Test "tan_upward (5)": +float: 1 +ifloat: 1 + +# tgamma +Test "tgamma (-0.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x0.fffffffffffff8p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x0.ffffffp0)": +float: 1 +ifloat: 1 +Test "tgamma (-0x1.000002p0)": +double: 2 +idouble: 2 +Test "tgamma (-0x1.0a32a2p+5)": +float: 2 +ifloat: 2 +Test "tgamma (-0x13.ffffep0)": +float: 2 +ifloat: 2 +Test "tgamma (-0x14.000000000001p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x14.00002p0)": +float: 1 +ifloat: 1 +Test "tgamma (-0x1d.ffffep0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x1e.000000000001p0)": +double: 3 +idouble: 3 +Test "tgamma (-0x1e.00002p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x2.0000000000002p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x2.000004p0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (-0x2.fffffcp0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x27.fffffffffffep0)": +double: 1 +idouble: 1 +Test "tgamma (-0x28.000000000002p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x28.00004p0)": +double: 2 +idouble: 2 +Test "tgamma (-0x29.00004p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x29.ffffcp0)": +double: 1 +idouble: 1 +Test "tgamma (-0x3.000004p0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (-0x3.fffffcp0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x3.ffffffffffffep0)": +double: 2 +idouble: 2 +Test "tgamma (-0x31.fffffffffffep0)": +double: 3 +idouble: 3 +Test "tgamma (-0x4.000008p0)": +float: 1 +ifloat: 1 +Test "tgamma (-0x4.fffff8p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x4.ffffffffffffcp0)": +double: 1 +idouble: 1 +Test "tgamma (-0x5.000008p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x5.ffffffffffffcp0)": +double: 1 +idouble: 1 +Test "tgamma (-0x6.000008p0)": +float: 2 +ifloat: 2 +Test "tgamma (-0x6.fffff8p0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (-0x6.ffffffffffffcp0)": +double: 4 +idouble: 4 +Test "tgamma (-0x63.fffffffffffcp0)": +double: 2 +idouble: 2 +Test "tgamma (-0x64.000000000004p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x7.0000000000004p0)": +double: 3 +idouble: 3 +Test "tgamma (-0x7.000008p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x7.fffff8p0)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "tgamma (-0x7.ffffffffffffcp0)": +double: 3 +idouble: 3 +Test "tgamma (-0x8.00001p0)": +double: 2 +idouble: 2 +Test "tgamma (-0x9.ffffffffffff8p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x9.fffffp0)": +float: 1 +ifloat: 1 +Test "tgamma (-0x96.000000000008p0)": +double: 1 +idouble: 1 +Test "tgamma (-0xa.00001p0)": +double: 1 +idouble: 1 +Test "tgamma (-2.5)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "tgamma (-3.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-4.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-5.5)": +double: 1 +idouble: 1 +Test "tgamma (-6.5)": +float: 1 +ifloat: 1 +Test "tgamma (-7.5)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (-8.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-9.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0.5)": +float: 1 +ifloat: 1 +Test "tgamma (0.7)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0x1.fffffep0)": +float: 1 +ifloat: 1 +Test "tgamma (0x1.fffffffffffffp0)": +double: 1 +idouble: 1 +Test "tgamma (0x1p-24)": +float: 1 +ifloat: 1 +Test "tgamma (0x1p-53)": +double: 1 +idouble: 1 +Test "tgamma (0x2.30a43cp+4)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "tgamma (0x2.fffffcp0)": +float: 3 +ifloat: 3 +Test "tgamma (0x3.fffffcp0)": +float: 1 +ifloat: 1 +Test "tgamma (0x3.ffffffffffffep0)": +double: 1 +idouble: 1 +Test "tgamma (0x4.0000000000004p0)": +double: 1 +idouble: 1 +Test "tgamma (0x4.ffffffffffffcp0)": +double: 1 +idouble: 1 +Test "tgamma (0x5.0000000000004p0)": +double: 1 +idouble: 1 +Test "tgamma (0x5.000008p0)": +float: 2 +ifloat: 2 +Test "tgamma (0x5.fffff8p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0x6.0000000000004p0)": +double: 1 +idouble: 1 +Test "tgamma (0x6.000008p0)": +float: 2 +ifloat: 2 +Test "tgamma (0x6.fffff8p0)": +double: 1 +idouble: 1 +Test "tgamma (0x6.ffffffffffffcp0)": +double: 4 +idouble: 4 +Test "tgamma (0x7.0000000000004p0)": +double: 4 +idouble: 4 +Test "tgamma (0x7.000008p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0x7.fffff8p0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (0x7.ffffffffffffcp0)": +double: 2 +idouble: 2 +Test "tgamma (0x8.00001p0)": +double: 2 +idouble: 2 +Test "tgamma (0xa.b9fd72b0fb238p+4)": +double: 1 +idouble: 1 +Test "tgamma (10)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (18.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (19.5)": +double: 2 +idouble: 2 +Test "tgamma (2.5)": +float: 2 +ifloat: 2 +Test "tgamma (23.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (29.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (3)": +float: 1 +ifloat: 1 +Test "tgamma (3.5)": +float: 2 +ifloat: 2 +Test "tgamma (30.5)": +float: 1 +ifloat: 1 +Test "tgamma (33.5)": +float: 1 +ifloat: 1 +Test "tgamma (34.5)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "tgamma (4)": +float: 1 +ifloat: 1 +Test "tgamma (4.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (6)": +float: 1 +ifloat: 1 +Test "tgamma (6.5)": +float: 1 +ifloat: 1 +Test "tgamma (7)": +double: 1 +idouble: 1 +Test "tgamma (7.5)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (8)": +double: 1 +idouble: 1 +Test "tgamma (8.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (9)": +double: 1 +idouble: 1 +Test "tgamma (9.5)": +double: 1 +idouble: 1 + +# y0 +Test "y0 (0x1.3ffp+74)": +double: 1 +idouble: 1 +Test "y0 (0x1.ff00000000002p+840)": +double: 1 +idouble: 1 +Test "y0 (0x1p-10)": +double: 1 +idouble: 1 +Test "y0 (0x1p-110)": +double: 1 +idouble: 1 +Test "y0 (0x1p-20)": +float: 1 +ifloat: 1 +Test "y0 (0x1p-30)": +float: 1 +ifloat: 1 +Test "y0 (0x1p-40)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "y0 (0x1p-50)": +float: 1 +ifloat: 1 +Test "y0 (0x1p-70)": +double: 1 +idouble: 1 +Test "y0 (0x1p-80)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "y0 (1.0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (1.5)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (10.0)": +float: 1 +ifloat: 1 +Test "y0 (8.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# y1 +Test "y1 (0.125)": +double: 1 +idouble: 1 +Test "y1 (0x1.27e204p+99)": +double: 1 +idouble: 1 +Test "y1 (0x1p-10)": +double: 1 +idouble: 1 +Test "y1 (1.5)": +float: 1 +ifloat: 1 +Test "y1 (10.0)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "y1 (2.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "y1 (8.0)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# yn +Test "yn (0, 1.0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 1.5)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 10.0)": +float: 1 +ifloat: 1 +Test "yn (0, 8.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (1, 0.125)": +double: 1 +idouble: 1 +Test "yn (1, 1.5)": +float: 1 +ifloat: 1 +Test "yn (1, 10.0)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "yn (1, 2.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (1, 8.0)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "yn (10, 0.125)": +double: 1 +idouble: 1 +Test "yn (10, 0.75)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (10, 1.0)": +double: 1 +idouble: 1 +Test "yn (10, 10.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (10, 2.0)": +double: 2 +idouble: 2 +Test "yn (3, 0.125)": +double: 1 +idouble: 1 +Test "yn (3, 0.75)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (3, 10.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (3, 2.0)": +double: 1 +idouble: 1 + +# Maximal error of functions: +Function: "acos_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "acos_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "asin_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "asin_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "asin_upward": +float: 1 +ifloat: 1 + +Function: "atan2": +float: 1 +ifloat: 1 + +Function: "atanh": +float: 1 +ifloat: 1 + +Function: Real part of "cacos": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Imaginary part of "cacos": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Real part of "cacosh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Imaginary part of "cacosh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Real part of "casin": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "casin": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Real part of "casinh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Imaginary part of "casinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "catan": +float: 1 +ifloat: 1 + +Function: Imaginary part of "catan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "catanh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "catanh": +float: 1 +ifloat: 1 + +Function: "cbrt": +double: 1 +idouble: 1 + +Function: Real part of "ccos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "ccos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "cexp": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: Imaginary part of "cexp": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Real part of "clog": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "clog": +float: 1 +ifloat: 1 + +Function: Real part of "clog10": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 + +Function: Imaginary part of "clog10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "cos_downward": +float: 1 +ifloat: 1 + +Function: "cos_tonearest": +float: 1 +ifloat: 1 + +Function: "cos_towardzero": +float: 1 +ifloat: 1 + +Function: "cos_upward": +float: 2 +ifloat: 2 + +Function: "cosh_downward": +float: 1 +ifloat: 1 + +Function: "cosh_towardzero": +float: 1 +ifloat: 1 + +Function: Real part of "cpow": +double: 2 +float: 4 +idouble: 2 +ifloat: 4 + +Function: Imaginary part of "cpow": +float: 2 +ifloat: 2 + +Function: Real part of "csin": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "csinh": +float: 1 +ifloat: 1 + +Function: Imaginary part of "csinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "csqrt": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "csqrt": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "ctan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "ctan": +double: 1 +idouble: 1 + +Function: Real part of "ctan_downward": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: Imaginary part of "ctan_downward": +float: 1 +ifloat: 1 + +Function: Real part of "ctan_tonearest": +float: 1 +ifloat: 1 + +Function: Imaginary part of "ctan_tonearest": +float: 1 +ifloat: 1 + +Function: Real part of "ctan_towardzero": +float: 1 +ifloat: 1 + +Function: Imaginary part of "ctan_towardzero": +float: 1 +ifloat: 1 + +Function: Real part of "ctan_upward": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: Imaginary part of "ctan_upward": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Real part of "ctanh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "ctanh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Real part of "ctanh_downward": +float: 1 +ifloat: 1 + +Function: Imaginary part of "ctanh_downward": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: Real part of "ctanh_tonearest": +float: 1 +ifloat: 1 + +Function: Imaginary part of "ctanh_tonearest": +float: 1 +ifloat: 1 + +Function: Real part of "ctanh_towardzero": +float: 1 +ifloat: 1 + +Function: Imaginary part of "ctanh_towardzero": +float: 1 +ifloat: 1 + +Function: Real part of "ctanh_upward": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Imaginary part of "ctanh_upward": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "erf": +double: 1 +idouble: 1 + +Function: "erfc": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "exp10": +double: 1 +idouble: 1 + +Function: "exp_downward": +float: 1 +ifloat: 1 + +Function: "exp_towardzero": +float: 1 +ifloat: 1 + +Function: "exp_upward": +float: 1 +ifloat: 1 + +Function: "expm1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "gamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "hypot": +float: 1 +ifloat: 1 + +Function: "j0": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 + +Function: "j1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "jn": +double: 4 +float: 5 +idouble: 4 +ifloat: 5 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "log10": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "log1p": +float: 1 +ifloat: 1 + +Function: "pow": +float: 1 +ifloat: 1 + +Function: "pow10": +double: 1 +idouble: 1 + +Function: "pow_downward": +float: 1 +ifloat: 1 + +Function: "pow_towardzero": +float: 1 +ifloat: 1 + +Function: "pow_upward": +float: 1 +ifloat: 1 + +Function: "sin_downward": +float: 1 +ifloat: 1 + +Function: "sin_tonearest": +float: 1 +ifloat: 1 + +Function: "sin_towardzero": +float: 1 +ifloat: 1 + +Function: "sin_upward": +float: 2 +ifloat: 2 + +Function: "sincos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "sinh_downward": +float: 1 +ifloat: 1 + +Function: "sinh_towardzero": +float: 1 +ifloat: 1 + +Function: "tan": +double: 1 +idouble: 1 + +Function: "tan_downward": +float: 1 +ifloat: 1 + +Function: "tan_towardzero": +float: 1 +ifloat: 1 + +Function: "tan_upward": +float: 1 +ifloat: 1 + +Function: "tgamma": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 + +Function: "y0": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "y1": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 + +Function: "yn": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 + +# end of automatic generation diff --git a/test/math/libm-test-ulps-mips64 b/test/math/libm-test-ulps-mips64 new file mode 100644 index 000000000..dc065e563 --- /dev/null +++ b/test/math/libm-test-ulps-mips64 @@ -0,0 +1,9633 @@ +# Begin of automatic generation + +# acos_downward +Test "acos_downward (-0)": +float: 1 +ifloat: 1 +Test "acos_downward (-0.5)": +double: 1 +idouble: 1 +Test "acos_downward (-1)": +float: 1 +ifloat: 1 +Test "acos_downward (0)": +float: 1 +ifloat: 1 +Test "acos_downward (0.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# acos_towardzero +Test "acos_towardzero (-0)": +float: 1 +ifloat: 1 +Test "acos_towardzero (-0.5)": +double: 1 +idouble: 1 +Test "acos_towardzero (-1)": +float: 1 +ifloat: 1 +Test "acos_towardzero (0)": +float: 1 +ifloat: 1 +Test "acos_towardzero (0.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# asin_downward +Test "asin_downward (-0.5)": +double: 1 +idouble: 1 +Test "asin_downward (0.5)": +double: 1 +idouble: 1 +Test "asin_downward (1.0)": +float: 1 +ifloat: 1 + +# asin_towardzero +Test "asin_towardzero (-0.5)": +double: 1 +idouble: 1 +Test "asin_towardzero (-1.0)": +float: 1 +ifloat: 1 +Test "asin_towardzero (0.5)": +double: 1 +idouble: 1 +Test "asin_towardzero (1.0)": +float: 1 +ifloat: 1 + +# asin_upward +Test "asin_upward (-1.0)": +float: 1 +ifloat: 1 + +# atan2 +Test "atan2 (-0.00756827042671106339, -.001792735857538728036)": +ildouble: 1 +ldouble: 1 +Test "atan2 (-0.75, -1.0)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "atan2 (-max_value, -min_value)": +float: 1 +ifloat: 1 +Test "atan2 (0.75, -1.0)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "atan2 (1.390625, 0.9296875)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# atanh +Test "atanh (0.75)": +float: 1 +ifloat: 1 + +# cacos +Test "Imaginary part of: cacos (+0 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (+0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (+0 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (+0 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (+0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (+0 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.0 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.0 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.0 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.0 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.0 + 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.0 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.0 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.0 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.0 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.0 - 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.25 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0.25 + 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.25 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0.25 - 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 + +0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 + 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 + 0x1.fp-129 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0.5 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 + 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 + 0x1p-112 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 + 0x1p-52 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.5 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0.5 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 - 0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 - 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 - 0x1.fp-129 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0.5 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 - 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 - 0x1p-112 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 - 0x1p-52 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0.5 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0.5 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x0.ffffffffffffffffffffffffffcp0 + 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x0.ffffffffffffffffffffffffffcp0 - 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x0.ffffffffffffffffp0 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x0.ffffffffffffffffp0 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (-0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (-0x1.0000000000000000000000000001p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.0000000000000000000000000001p0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.0000000000000000000000000001p0 + 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.0000000000000000000000000001p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.0000000000000000000000000001p0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.0000000000000000000000000001p0 - 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1.fp-100 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1.fp-100 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-10000 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-10000 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 + 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 - 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0x0.ffffffp0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1.fp-129 + 1.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0x0.ffffffp0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1.fp-129 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1.fp-129 - 1.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-16385 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-16385 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-16385 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-16385 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-16385 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-16385 + 1.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-16385 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-16385 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-16385 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-16385 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-16385 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1.fp-16385 - 1.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1.fp-30 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1.fp-30 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-105 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-105 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-105 + 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-105 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-105 - 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 + 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-112 - 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-113 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1p-113 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-113 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1p-113 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-23 + 0.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cacos (-0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1p-23 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-23 + 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-23 - 0.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cacos (-0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (-0x1p-23 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-23 - 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-52 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-52 + 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-52 - 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-63 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1p-63 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-63 + 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p-63 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1p-63 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-0x1p-63 - 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-0x1p500 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1p500 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1p5000 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-0x1p5000 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-1.0 + 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-1.0 + 0x1p50 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-1.0 + 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-1.0 + 0x1p5000 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-1.0 - 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-1.0 - 0x1p50 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (-1.0 - 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (-1.0 - 0x1p5000 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (-2 - 3 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0.0 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0.0 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0.0 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0.0 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0.0 + 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0.0 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0.0 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0.0 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0.0 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0.0 - 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0.25 + 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0.25 - 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0.5 + +0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0.5 + 0x1p-52 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0.5 + 0x1p-63 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0.5 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0.5 - 0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0.5 - 0x1p-52 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0.5 - 0x1p-63 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0.5 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0.5 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0x0.ffffffffffffffffffffffffffcp0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x0.ffffffffffffffffffffffffffcp0 + 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x0.ffffffffffffffffffffffffffcp0 + 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x0.ffffffffffffffffffffffffffcp0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x0.ffffffffffffffffffffffffffcp0 - 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x0.ffffffffffffffffffffffffffcp0 - 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x0.ffffffffffffffffffffffffffff8p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x0.ffffffffffffffffffffffffffff8p0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x0.ffffffffffffffffffffffffffff8p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x0.ffffffffffffffffffffffffffff8p0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x0.ffffffffffffffffp0 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x0.ffffffffffffffffp0 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x0.ffffffp0 + 0.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x0.ffffffp0 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacos (0x0.ffffffp0 - 0.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x0.ffffffp0 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (0x1.0000000000000000000000000001p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x1.0000000000000000000000000001p0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.0000000000000000000000000001p0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.0000000000000000000000000001p0 + 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.0000000000000000000000000001p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x1.0000000000000000000000000001p0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.0000000000000000000000000001p0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.0000000000000000000000000001p0 - 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x1.0000000000000002p0 + 0x1p-63 i)": +ildouble: 2 +ldouble: 2 +Test "Real part of: cacos (0x1.0000000000000002p0 - 0x1p-63 i)": +ildouble: 2 +ldouble: 2 +Test "Real part of: cacos (0x1.0000000000001p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x1.0000000000001p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x1.000002p0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x1.000002p0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0x1.fp-100 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x1.fp-100 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-10000 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-10000 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 + 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 - 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-16385 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-16385 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-16385 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-16385 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-16385 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-16385 + 1.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-16385 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-16385 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-16385 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-16385 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-16385 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-16385 - 1.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacos (0x1.fp16383 + 0x1.fp16383 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0x1p-105 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-105 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0x1p-105 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-105 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0x1p-112 + 0x0.ffffffffffffffffffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (0x1p-112 - 0x0.ffffffffffffffffffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-113 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-113 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cacos (0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0x1p-23 + 0x1.000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cacos (0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (0x1p-23 - 0x1.000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x1p-52 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x1p-52 + 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x1p-52 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x1p-52 - 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x1p-63 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-63 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-63 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (0x1p-63 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0x1p-63 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p-63 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p500 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p500 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p5000 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (0x1p5000 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (1.0 + 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (1.0 + 0x1.fp-10 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (1.0 + 0x1.fp-100 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (1.0 + 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (1.0 + 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (1.0 + 0x1p5000 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (1.0 - 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: cacos (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacos (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacos (1.0 - 0x1.fp-10 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacos (1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacos (1.0 - 0x1.fp-100 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (1.0 - 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (1.0 - 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacos (1.0 - 0x1p5000 i)": +ildouble: 1 +ldouble: 1 + +# cacosh +Test "Real part of: cacosh (+0 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (+0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (+0 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (+0 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (+0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (+0 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.0 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.0 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.0 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.0 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.0 + 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.0 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.0 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.0 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.0 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.0 - 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.25 + 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.25 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: cacosh (-0.25 - 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.25 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0.5 + +0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.5 + 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0.5 + 0x1.fp-129 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.5 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.5 + 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.5 + 0x1p-112 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.5 + 0x1p-52 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.5 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.5 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.5 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0.5 - 0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.5 - 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0.5 - 0x1.fp-129 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.5 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.5 - 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.5 - 0x1p-112 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.5 - 0x1p-52 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.5 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.5 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0.5 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x0.ffffffffffffffffffffffffffcp0 + 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x0.ffffffffffffffffffffffffffcp0 - 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x0.ffffffffffffffffp0 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x0.ffffffffffffffffp0 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacosh (-0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: cacosh (-0x1.0000000000000000000000000001p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.0000000000000000000000000001p0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.0000000000000000000000000001p0 + 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.0000000000000000000000000001p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.0000000000000000000000000001p0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.0000000000000000000000000001p0 - 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (-0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1.fp-100 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1.fp-100 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-10000 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-10000 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 + 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 - 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0x0.ffffffp0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 + 1.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0x0.ffffffp0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 0x1p-23 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1.fp-129 - 1.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-16385 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-16385 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-16385 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-16385 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-16385 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-16385 + 1.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-16385 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-16385 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-16385 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-16385 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-16385 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-16385 - 1.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1.fp-30 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1.fp-30 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1p-105 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1p-105 + 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1p-105 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1p-105 - 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 + 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-112 - 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-113 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1p-113 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1p-113 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1p-113 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1p-23 + 0.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cacosh (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0x1p-23 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1p-23 + 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1p-23 - 0.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cacosh (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (-0x1p-23 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1p-23 - 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1p-52 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 + 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-52 - 0x1p-52 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 + 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-63 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1p-63 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1p-63 + 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 - 0.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p-63 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1p-63 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-0x1p-63 - 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-0x1p500 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1p500 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1p5000 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-0x1p5000 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-1.0 + 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-1.0 + 0x1p50 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-1.0 + 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-1.0 + 0x1p5000 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-1.0 - 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-1.0 - 0x1p50 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (-1.0 - 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (-1.0 - 0x1p5000 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (-2 - 3 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.0 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.0 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.0 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.0 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.0 + 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.0 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.0 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.0 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.0 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.0 - 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.25 + 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.25 - 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0.5 + +0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1p-52 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.5 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0.5 + 0x1p-63 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0.5 - 0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1p-52 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.5 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0.5 - 0x1p-63 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0.5 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0x0.ffffffffffffffffffffffffffcp0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x0.ffffffffffffffffffffffffffcp0 + 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x0.ffffffffffffffffffffffffffcp0 + 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x0.ffffffffffffffffffffffffffcp0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x0.ffffffffffffffffffffffffffcp0 - 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x0.ffffffffffffffffffffffffffcp0 - 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x0.ffffffffffffffffffffffffffff8p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x0.ffffffffffffffffffffffffffff8p0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x0.ffffffffffffffffffffffffffff8p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x0.ffffffffffffffffffffffffffff8p0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x0.ffffffffffffffffp0 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x0.ffffffffffffffffp0 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x0.ffffffp0 + 0.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x0.ffffffp0 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacosh (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x0.ffffffp0 - 0.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x0.ffffffp0 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacosh (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.0000000000000000000000000001p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.0000000000000000000000000001p0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x1.0000000000000000000000000001p0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.0000000000000000000000000001p0 + 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.0000000000000000000000000001p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.0000000000000000000000000001p0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x1.0000000000000000000000000001p0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.0000000000000000000000000001p0 - 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x1.0000000000000002p0 + 0x1p-63 i)": +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cacosh (0x1.0000000000000002p0 - 0x1p-63 i)": +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cacosh (0x1.0000000000001p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x1.0000000000001p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x1.000002p0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x1.000002p0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x1.fp-100 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x1.fp-100 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-10000 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-10000 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 + 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 - 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-16385 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-16385 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-16385 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-16385 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-16385 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-16385 + 1.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-16385 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-16385 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-16385 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-16385 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-16385 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-16385 - 1.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (0x1.fp16383 + 0x1.fp16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-105 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x1p-105 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (0x1p-105 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x1p-105 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0x1p-112 + 0x0.ffffffffffffffffffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0x1p-112 - 0x0.ffffffffffffffffffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-113 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-113 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: cacosh (0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0x1p-23 + 0x1.000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: cacosh (0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cacosh (0x1p-23 - 0x1.000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x1p-52 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x1p-52 + 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x1p-52 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (0x1p-52 - 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0x1p-63 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-63 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-63 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (0x1p-63 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-63 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p-63 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p500 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p500 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p5000 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0x1p5000 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (1.0 + 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (1.0 + 0x1.fp-10 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacosh (1.0 + 0x1.fp-100 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (1.0 + 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (1.0 + 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (1.0 + 0x1p5000 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (1.0 - 0.25 i)": +double: 1 +idouble: 1 +Test "Real part of: cacosh (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cacosh (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: cacosh (1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cacosh (1.0 - 0x1.fp-10 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: cacosh (1.0 - 0x1.fp-100 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (1.0 - 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (1.0 - 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (1.0 - 0x1p5000 i)": +ildouble: 1 +ldouble: 1 + +# casin +Test "Imaginary part of: casin (+0 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (+0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (+0 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (+0 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (+0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (+0 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.0 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.0 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.0 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.0 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.0 + 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.0 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.0 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.0 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.0 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.0 - 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.25 + 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.25 - 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0.5 + 0x1p-112 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0.5 + 0x1p-23 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.5 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0.5 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.5 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0.5 - 0x1p-112 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0.5 - 0x1p-23 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.5 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0.5 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0.5 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x0.fffffffffffff8p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x0.fffffffffffff8p0 + 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-0x0.fffffffffffff8p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x0.fffffffffffff8p0 - 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-0x0.ffffffffffffffffffffffffffcp0 + 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x0.ffffffffffffffffffffffffffcp0 + 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x0.ffffffffffffffffffffffffffcp0 - 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x0.ffffffffffffffffffffffffffcp0 - 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x0.ffffffffffffffffffffffffffff8p0 + 0x1p-112 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x0.ffffffffffffffffffffffffffff8p0 - 0x1p-112 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x0.ffffffffffffffffp0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x0.ffffffffffffffffp0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x0.ffffffffffffffffp0 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x0.ffffffffffffffffp0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x0.ffffffffffffffffp0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x0.ffffffffffffffffp0 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x0.ffffffp0 + 0x1p-23 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: casin (-0x0.ffffffp0 - 0x1p-23 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: casin (-0x1.0000000000000000000000000001p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.0000000000000000000000000001p0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.0000000000000000000000000001p0 + 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.0000000000000000000000000001p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.0000000000000000000000000001p0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.0000000000000000000000000001p0 - 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x1.fp-10 + 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-0x1.fp-10 - 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (-0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-10000 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-10000 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x1.fp-1025 + 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 + 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x1.fp-1025 - 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 - 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-16385 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-16385 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-16385 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-16385 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-16385 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-16385 + 1.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-16385 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-16385 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-16385 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-16385 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-16385 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-16385 - 1.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x1.fp-30 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x1.fp-30 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-105 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-105 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (-0x1p-113 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p-113 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x1p-113 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p-113 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x1p-23 + 0.5 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (-0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (-0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-0x1p-23 + 0x1.000002p0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x1p-23 - 0.5 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (-0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (-0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (-0x1p-23 - 0x1.000002p0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x1p-52 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x1p-52 + 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x1p-52 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x1p-52 - 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-63 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x1p-63 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p-63 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-0x1p-63 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-0x1p-63 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p-63 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p500 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p500 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p5000 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-0x1p5000 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-1.0 + 0.25 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-1.0 + 0x1.fp-129 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-1.0 + 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-1.0 + 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-1.0 + 0x1p5000 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-1.0 - 0.25 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (-1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (-1.0 - 0x1.fp-129 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-1.0 - 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-1.0 - 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (-1.0 - 0x1p5000 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.0 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.0 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.0 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.0 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.0 + 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.0 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.0 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.0 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.0 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.0 - 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.25 + 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.25 - 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 + 0x1p-105 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0.5 + 0x1p-112 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.5 + 0x1p-112 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0.5 + 0x1p-23 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.5 + 0x1p-23 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.5 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0.5 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.5 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0.5 - 0x1p-105 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0.5 - 0x1p-112 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.5 - 0x1p-112 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0.5 - 0x1p-23 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.5 - 0x1p-23 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.5 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0.5 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0.5 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: casin (0x0.fffffffffffff8p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x0.fffffffffffff8p0 + 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x0.fffffffffffff8p0 + 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (0x0.fffffffffffff8p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x0.fffffffffffff8p0 - 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x0.fffffffffffff8p0 - 0x1p-52 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (0x0.ffffffffffffffffffffffffffcp0 + 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x0.ffffffffffffffffffffffffffcp0 + 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x0.ffffffffffffffffffffffffffcp0 - 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x0.ffffffffffffffffffffffffffcp0 - 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x0.ffffffffffffffffffffffffffff8p0 + 0x1p-112 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x0.ffffffffffffffffffffffffffff8p0 - 0x1p-112 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x0.ffffffffffffffffp0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x0.ffffffffffffffffp0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x0.ffffffffffffffffp0 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x0.ffffffffffffffffp0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x0.ffffffffffffffffp0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x0.ffffffffffffffffp0 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x0.ffffffp0 + 0x1p-23 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x0.ffffffp0 + 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Real part of: casin (0x0.ffffffp0 - 0x1p-23 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x0.ffffffp0 - 0x1p-23 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: casin (0x1.0000000000000000000000000001p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.0000000000000000000000000001p0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.0000000000000000000000000001p0 + 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.0000000000000000000000000001p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.0000000000000000000000000001p0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.0000000000000000000000000001p0 - 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.000002p0 + 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.000002p0 - 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x1.fp-10 + 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-10 + 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (0x1.fp-10 - 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-10 - 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp-100 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-100 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-1000 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-1000 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-10000 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-10000 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x1.fp-1025 + 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 + 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x1.fp-1025 - 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 - 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-1025 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-129 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-129 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-129 + 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-129 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-129 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-129 - 1.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-16385 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-16385 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-16385 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-16385 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-16385 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-16385 + 1.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-16385 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-16385 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-16385 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-16385 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-16385 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-16385 - 1.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x1.fp-30 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-30 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x1.fp-30 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp-30 - 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casin (0x1.fp16383 + 0x1.fp16383 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p-105 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-105 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p-105 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-105 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p-112 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-112 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Real part of: casin (0x1p-113 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p-113 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x1p-113 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p-113 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x1p-23 + 0.5 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (0x1p-23 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (0x1p-23 + 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (0x1p-23 + 0x1.000002p0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x1p-23 - 0.5 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (0x1p-23 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (0x1p-23 - 0x0.ffffffp0 i)": +double: 1 +idouble: 1 +Test "Real part of: casin (0x1p-23 - 0x1.000002p0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x1p-52 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p-52 + 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x1p-52 + 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x1p-52 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p-52 - 0.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x1p-52 - 0x1.0000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p-63 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-63 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x1p-63 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p-63 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p-63 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (0x1p-63 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0x1p-63 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p-63 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p500 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p500 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p5000 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (0x1p5000 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (1.0 + 0.25 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (1.0 + 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (1.0 + 0x1.fp-129 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (1.0 + 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (1.0 + 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (1.0 + 0x1p5000 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (1.0 - 0.25 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (1.0 - 0.5 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casin (1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (1.0 - 0x1.fp-129 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (1.0 - 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (1.0 - 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casin (1.0 - 0x1p5000 i)": +ildouble: 1 +ldouble: 1 + +# casinh +Test "Imaginary part of: casinh (-0.0 + 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0.0 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0.0 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0.0 - 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0.0 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0.0 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0.25 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0.25 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0.5 + +0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0.5 + 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0.5 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0.5 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0.5 + 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casinh (-0.5 + 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: casinh (-0.5 + 0x1p-52 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0.5 + 0x1p-52 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0.5 + 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (-0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0.5 - 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0.5 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0.5 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0.5 - 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casinh (-0.5 - 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: casinh (-0.5 - 0x1p-52 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0.5 - 0x1p-52 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0.5 - 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (-0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (-0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (-0x0.fffffffffffff8p0 + 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x0.fffffffffffff8p0 - 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x0.ffffffffffffffffffffffffffcp0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x0.ffffffffffffffffffffffffffcp0 + 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x0.ffffffffffffffffffffffffffcp0 + 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x0.ffffffffffffffffffffffffffcp0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x0.ffffffffffffffffffffffffffcp0 - 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x0.ffffffffffffffffffffffffffcp0 - 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x0.ffffffffffffffffp0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x0.ffffffffffffffffp0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x0.ffffffffffffffffp0 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x0.ffffffffffffffffp0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x0.ffffffffffffffffp0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x0.ffffffffffffffffp0 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x0.ffffffp0 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x0.ffffffp0 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1.0000000000000000000000000001p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000000000000000000001p0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000000000000000000001p0 + 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1.0000000000000000000000000001p0 + 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000000000000000000001p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000000000000000000001p0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000000000000000000001p0 - 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1.0000000000000000000000000001p0 - 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000000002p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000000002p0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000000002p0 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1.0000000000000002p0 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000000002p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000000002p0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000000002p0 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1.0000000000000002p0 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000001p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000001p0 + 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1.0000000000001p0 + 0x1p-52 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000001p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.0000000000001p0 - 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1.0000000000001p0 - 0x1p-52 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1.000002p0 + 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1.000002p0 - 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.fp-10 + 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.fp-10 - 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1.fp-1025 + 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1.fp-1025 - 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.fp-129 + 0.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (-0x1.fp-129 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.fp-129 - 0.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (-0x1.fp-129 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1.fp-16385 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.fp-16385 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1.fp-16385 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.fp-16385 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.fp-30 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1.fp-30 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-105 + 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-105 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1p-105 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-105 - 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-105 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1p-105 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-112 + 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1p-112 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1p-112 + 0x0.ffffffffffffffffffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-112 - 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1p-112 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1p-112 - 0x0.ffffffffffffffffffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-113 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-113 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-23 + 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1p-23 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-23 + 0x0.ffffffp0 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: casinh (-0x1p-23 + 0x0.ffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-23 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-23 - 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-0x1p-23 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-23 - 0x0.ffffffp0 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: casinh (-0x1p-23 - 0x0.ffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-23 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-52 + 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-52 - 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (-0x1p-63 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-63 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-63 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p-63 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p500 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p500 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p5000 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-0x1p5000 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 + +0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 + 0.25 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 + 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-1.0 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (-1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-100 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-1000 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-10000 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-129 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 + 0x1.fp-30 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-1.0 + 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 + 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 + 0x1p5000 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 - 0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 - 0.25 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 - 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-1.0 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (-1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-100 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-1000 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-10000 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-129 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 - 0x1.fp-30 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (-1.0 - 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 - 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.0 - 0x1p5000 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.5 + +0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.5 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.5 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.5 - 0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.5 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (-1.5 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0.0 + 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0.0 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0.0 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0.0 - 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0.0 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0.0 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0.25 + 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0.25 - 1.0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0.5 + +0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0.5 + 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0.5 + 0x1.fp-129 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0.5 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0.5 + 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casinh (0.5 + 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: casinh (0.5 + 0x1p-52 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0.5 + 0x1p-52 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0.5 + 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.5 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0.5 - 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0.5 - 0x1.fp-129 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0.5 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0.5 - 0x1p-105 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0x1p-112 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 0x1p-23 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casinh (0.5 - 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: casinh (0.5 - 0x1p-52 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0.5 - 0x1p-52 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0.5 - 0x1p-63 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.5 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: casinh (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x0.fffffffffffff8p0 + 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x0.fffffffffffff8p0 - 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x0.ffffffffffffffffffffffffffcp0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x0.ffffffffffffffffffffffffffcp0 + 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x0.ffffffffffffffffffffffffffcp0 + 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x0.ffffffffffffffffffffffffffcp0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x0.ffffffffffffffffffffffffffcp0 - 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x0.ffffffffffffffffffffffffffcp0 - 0x1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x0.ffffffffffffffffp0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x0.ffffffffffffffffp0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x0.ffffffffffffffffp0 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x0.ffffffffffffffffp0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x0.ffffffffffffffffp0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x0.ffffffffffffffffp0 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x0.ffffffp0 + 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x0.ffffffp0 - 0x1p-23 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1.0000000000000000000000000001p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000000000000000000001p0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000000000000000000001p0 + 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1.0000000000000000000000000001p0 + 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000000000000000000001p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000000000000000000001p0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000000000000000000001p0 - 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1.0000000000000000000000000001p0 - 0x1p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000000002p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000000002p0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000000002p0 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1.0000000000000002p0 + 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000000002p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000000002p0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000000002p0 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1.0000000000000002p0 - 0x1p-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000001p0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000001p0 + 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1.0000000000001p0 + 0x1p-52 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000001p0 - 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.0000000000001p0 - 0x1.fp-1025 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1.0000000000001p0 - 0x1p-52 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1.000002p0 + 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1.000002p0 - 0x1p-23 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.fp-10 + 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.fp-10 - 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1.fp-1025 + 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1.fp-1025 - 0x0.fffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.fp-129 + 0.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (0x1.fp-129 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.fp-129 - 0.5 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (0x1.fp-129 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1.fp-16385 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.fp-16385 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1.fp-16385 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.fp-16385 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.fp-30 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.fp-30 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1.fp16383 + 0x1.fp16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-105 + 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-105 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1p-105 + 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-105 - 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-105 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1p-105 - 0x0.ffffffffffffffffffffffffffcp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-112 + 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1p-112 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1p-112 + 0x0.ffffffffffffffffffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-112 - 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1p-112 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1p-112 - 0x0.ffffffffffffffffffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-113 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-113 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-23 + 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1p-23 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-23 + 0x0.ffffffp0 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: casinh (0x1p-23 + 0x0.ffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-23 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-23 - 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0x1p-23 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-23 - 0x0.ffffffp0 i)": +float: 2 +ifloat: 2 +Test "Imaginary part of: casinh (0x1p-23 - 0x0.ffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-23 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-52 + 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-52 - 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: casinh (0x1p-63 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-63 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-63 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p-63 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p500 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p500 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p5000 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0x1p5000 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 + +0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 + 0.25 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 + 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (1.0 + 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (1.0 + 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-100 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-1000 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-10000 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-129 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 + 0x1.fp-30 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (1.0 + 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 + 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 + 0x1p5000 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 - 0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 - 0.25 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 - 0.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (1.0 - 0.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (1.0 - 0x1.fp-10 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-100 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-1000 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-10000 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-129 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 - 0x1.fp-30 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (1.0 - 0x1.fp-30 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 - 0x1p500 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.0 - 0x1p5000 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.5 + +0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.5 + 0x1.fp-1025 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.5 + 0x1.fp-129 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.5 + 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.5 - 0 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.5 - 0x1.fp-1025 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.5 - 0x1.fp-129 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (1.5 - 0x1.fp-16385 i)": +ildouble: 1 +ldouble: 1 + +# catan +Test "Imaginary part of: catan (-0x0.fffffffffffff8p0 + 0x1p-27 i)": +double: 1 +idouble: 1 +Test "Real part of: catan (-0x0.ffffffffffffffffffffffffffff8p0 + 0x1p-16382 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (-0x0.ffffffffffffffffffffffffffff8p0 + 0x1p-57 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (-0x0.ffffffffffffffffffffffffffff8p0 - 0x1p-16382 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (-0x0.ffffffp0 + 0x1p-126 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (-0x0.ffffffp0 + 0x1p-13 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (-0x0.ffffffp0 - 0x1p-126 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (-0x1.0000000000000000000000000001p0 + 0x1p-16382 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (-0x1.0000000000000000000000000001p0 - 0x1p-16382 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (-0x1.0000000000000000000000000001p0 - 0x1p-57 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (-0x1.0000000000001p0 - 0x1p-27 i)": +double: 1 +idouble: 1 +Test "Real part of: catan (-0x1.000002p0 + 0x1p-126 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (-0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1.000002p0 - 0x1p-126 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (-0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1.000002p0 - 0x1p-13 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1.fp1023 - 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1.fp127 - 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1.fp16383 + 0x1.fp16383 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (-0x1.fp16383 - 0x1.fp16383 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (-0x1p-1020 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (-0x1p-1020 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: catan (-0x1p-13 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1p-13 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-0x1p-13 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-16380 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (-0x1p-16380 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (-0x1p-33 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (-0x1p-33 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (-0x1p-33 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (-0x1p-33 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (-0x1p-54 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-54 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-57 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (-0x1p-57 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (-1.0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (-1.0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (-2 - 3 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: catan (0.75 + 1.25 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (0x0.fffffffffffff8p0 + 0x1p-27 i)": +double: 1 +idouble: 1 +Test "Real part of: catan (0x0.ffffffffffffffffffffffffffff8p0 + 0x1p-16382 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (0x0.ffffffffffffffffffffffffffff8p0 + 0x1p-57 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (0x0.ffffffffffffffffffffffffffff8p0 - 0x1p-16382 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (0x0.ffffffp0 + 0x1p-126 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (0x0.ffffffp0 + 0x1p-13 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (0x0.ffffffp0 - 0x1p-126 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (0x1.0000000000000000000000000001p0 + 0x1p-16382 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (0x1.0000000000000000000000000001p0 - 0x1p-16382 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (0x1.0000000000000000000000000001p0 - 0x1p-57 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (0x1.0000000000001p0 - 0x1p-27 i)": +double: 1 +idouble: 1 +Test "Real part of: catan (0x1.000002p0 + 0x1p-126 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1.000002p0 - 0x1p-126 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1.000002p0 - 0x1p-13 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1.fp1023 - 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1.fp127 - 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1.fp16383 + 0x1.fp16383 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (0x1.fp16383 - 0x1.fp16383 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (0x1p-1020 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catan (0x1p-1020 - 1.0 i)": +double: 1 +idouble: 1 +Test "Real part of: catan (0x1p-13 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1p-13 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (0x1p-13 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-16380 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (0x1p-16380 - 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (0x1p-33 + 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (0x1p-33 + 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (0x1p-33 - 0x0.ffffffffffffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (0x1p-33 - 0x1.0000000000000002p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (0x1p-54 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-54 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-57 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catan (0x1p-57 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: catan (1.0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: catan (1.0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# catanh +Test "Imaginary part of: catanh (-0x0.ffffffffffffffffp0 + 0x1p-33 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (-0x0.ffffffffffffffffp0 - 0x1p-33 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (-0x1.0000000000000002p0 + 0x1p-33 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (-0x1.0000000000000002p0 - 0x1p-33 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (-0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (-0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (-0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-0x1.fp1023 - 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-0x1.fp127 - 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-0x1.fp16383 + 0x1.fp16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (-0x1.fp16383 - 0x1.fp16383 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (-0x1p-126 + 0x0.ffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (-0x1p-126 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (-0x1p-126 - 0x0.ffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (-0x1p-126 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (-0x1p-13 + 0x1.000002p0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (-0x1p-13 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (-0x1p-13 + 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (-0x1p-13 - 0x1.000002p0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (-0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (-0x1p-13 - 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (-0x1p-16382 + 0x0.ffffffffffffffffffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (-0x1p-16382 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (-0x1p-16382 - 0x0.ffffffffffffffffffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (-0x1p-16382 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (-0x1p-27 + 0x1.0000000000001p0 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-0x1p-27 - 0x1.0000000000001p0 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (-0x1p-57 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (-0x1p-57 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (-1.0 + 0x1p-1020 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (-1.0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 + 0x1p-16380 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (-1.0 + 0x1p-54 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 + 0x1p-57 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 - 0x1p-1020 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (-1.0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 - 0x1p-16380 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (-1.0 - 0x1p-54 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-1.0 - 0x1p-57 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (-2 - 3 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (0.75 + 1.25 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0.75 + 1.25 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0x0.ffffffffffffffffp0 + 0x1p-33 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0x0.ffffffffffffffffp0 - 0x1p-33 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0x1.0000000000000002p0 + 0x1p-33 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0x1.0000000000000002p0 - 0x1p-33 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0x1.000002p0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1.000002p0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (0x1.fp1023 + 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (0x1.fp1023 - 0x1.fp1023 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (0x1.fp127 + 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (0x1.fp127 - 0x1.fp127 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (0x1.fp16383 + 0x1.fp16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (0x1.fp16383 - 0x1.fp16383 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0x1p-126 + 0x0.ffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0x1p-126 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0x1p-126 - 0x0.ffffffp0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0x1p-126 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (0x1p-13 + 0x0.ffffffp0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0x1p-13 + 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1p-13 + 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (0x1p-13 - 0x0.ffffffp0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0x1p-13 - 0x1.000002p0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0x1p-13 - 1.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0x1p-16382 + 0x0.ffffffffffffffffffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (0x1p-16382 + 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0x1p-16382 - 0x0.ffffffffffffffffffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (0x1p-16382 - 0x1.0000000000000000000000000001p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (0x1p-27 + 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (0x1p-27 - 0x0.fffffffffffff8p0 i)": +double: 1 +idouble: 1 +Test "Real part of: catanh (0x1p-57 + 0x0.ffffffffffffffffffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (0x1p-57 - 0x0.ffffffffffffffffffffffffffff8p0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (1.0 + 0x1p-1020 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (1.0 + 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 + 0x1p-16380 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (1.0 + 0x1p-54 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 + 0x1p-57 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 - 0x1p-1020 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (1.0 - 0x1p-13 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 - 0x1p-16380 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: catanh (1.0 - 0x1p-54 i)": +float: 1 +ifloat: 1 +Test "Real part of: catanh (1.0 - 0x1p-57 i)": +float: 1 +ifloat: 1 + +# cbrt +Test "cbrt (-0.001)": +ildouble: 1 +ldouble: 1 +Test "cbrt (-27.0)": +double: 1 +idouble: 1 +Test "cbrt (0.75)": +double: 1 +idouble: 1 +Test "cbrt (0.9921875)": +double: 1 +idouble: 1 + +# ccos +Test "Imaginary part of: ccos (-0.75 + 11357.25 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (-0.75 + 710.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccos (-0.75 + 89.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (-0.75 + 89.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (-0.75 - 11357.25 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (-0.75 - 710.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccos (-0.75 - 89.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (-0.75 - 89.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccos (-2 - 3 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (-2 - 3 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccos (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccos (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccos (0.75 + 11357.25 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (0.75 + 710.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccos (0.75 + 89.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (0.75 + 89.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (0.75 - 11357.25 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (0.75 - 710.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccos (0.75 - 89.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (0.75 - 89.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (0x1p-1074 + 1440 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccos (0x1p-16434 + 22730 i)": +ildouble: 1 +ldouble: 1 + +# ccosh +Test "Imaginary part of: ccosh (-11357.25 + 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (-11357.25 - 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: ccosh (-2 - 3 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (-2 - 3 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (-710.5 + 0.75 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (-710.5 - 0.75 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccosh (-89.5 + 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (-89.5 + 0.75 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccosh (-89.5 - 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (-89.5 - 0.75 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccosh (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (11357.25 + 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (11357.25 - 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (1440 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ccosh (22730 + 0x1p-16434 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (710.5 + 0.75 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (710.5 - 0.75 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccosh (89.5 + 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (89.5 + 0.75 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccosh (89.5 - 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (89.5 - 0.75 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cexp +Test "Imaginary part of: cexp (-10000 + 0x1p16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cexp (-2.0 - 3.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (-2.0 - 3.0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (-720 + 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (-95 + 0.75 i)": +double: 1 +idouble: 1 +Test "Real part of: cexp (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cexp (0.75 + 1.25 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (1440 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cexp (22730 + 0x1p-16434 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cexp (50 + 0x1p127 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (50 + 0x1p127 i)": +double: 1 +idouble: 1 +Test "Real part of: cexp (500 + 0x1p1023 i)": +double: 1 +idouble: 1 +Test "Real part of: cexp (709.8125 + 0.75 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: cexp (709.8125 + 0.75 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cexp (88.75 + 0.75 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (88.75 + 0.75 i)": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# clog +Test "Real part of: clog (-0x1.0000000123456p0 + 0x1.2345678p-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: clog (-0x1.0000000123456p0 + 0x1.2345678p-30 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog (-0x1.234566p-40 - 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1.fp+127 + 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1.fp+127 - 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1.fp+16383 + 0x1p-16445 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1.fp+16383 + 0x1p-16494 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1.fp+16383 - 0x1p-16445 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1.fp+16383 - 0x1p-16494 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1p-149 + 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog (-0x1p-149 + 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1p-149 - 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog (-0x1p-149 - 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (-0x1p-16445 + 0x1.fp+16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1p-16445 - 0x1.fp+16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1p-16494 + 0x1.fp+16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (-0x1p-16494 - 0x1.fp+16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0x0.ffffffp0 + 0x0.ffffffp-100 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1.000566p0 + 0x1.234p-10 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog (0x1.000566p0 + 0x1.234p-10 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0x1.fp+127 + 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1.fp+127 - 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1.fp+16383 + 0x1.fp+16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0x1.fp+16383 + 0x1p-16445 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0x1.fp+16383 + 0x1p-16494 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0x1.fp+16383 - 0x1p-16445 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0x1.fp+16383 - 0x1p-16494 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0x10673dd0f2481p-51 + 0x7ef1d17cefbd2p-51 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0x1p-1074 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Real part of: clog (0x1p-147 + 0x1p-147 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1p-149 + 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1p-149 - 0x1.fp+127 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog (0x1p-16445 + 0x1.fp+16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0x1p-16445 - 0x1.fp+16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0x1p-16494 + 0x1.fp+16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0x1p-16494 - 0x1.fp+16383 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0x2818p-15 + 0x798fp-15 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0x298c62cb546588a7p-63 + 0x7911b1dfcc4ecdaep-63 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0x2ede88p-23 + 0x771c3fp-23 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0x3f96469050f650869c2p-75 + 0x6f16b2c9c8b05988335p-75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0x55cb6d0c83af5p-55 + 0x7fe33c0c7c4e90p-55 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0x5b06b680ea2ccp-52 + 0xef452b965da9fp-52 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0x659feap-24 + 0xeaf6f9p-24 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0x6771f22c64ed551b857c128b4cp-105 + 0x1f570e7a13cc3cf2f44fd793ea1p-105 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0x6b10b4f3520217b6p-64 + 0xe8893cbb449253a1p-64 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0x8ecbf810c4ae6p-52 + 0xd479468b09a37p-52 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0x9b57bp-20 + 0xcb7b4p-20 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0xdb85c467ee2aadd5f425fe0f4b8dp-114 + 0x3e83162a0f95f1dcbf97dddf410eap-114 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0xfd95243681c055c2632286921092p-113 + 0x1bccabcd29ca2152860ec29e34ef7p-113 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog (0xfe961079616p-45 + 0x1bc37e09e6d1p-45 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (1.0 + 0x1.234566p-10 i)": +float: 1 +ifloat: 1 + +# clog10 +Test "Imaginary part of: clog10 (-0 + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0 - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-1000 i)": +double: 2 +idouble: 2 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-30 i)": +double: 2 +idouble: 2 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0x1.0000000123456p0 + 0x1.2345678p-30 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+1023 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+1023 - 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1.fp+127 + 0x1p-149 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0x1.fp+127 - 0x1p-149 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0x1p-1074 + 0x1.fp+1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1p-1074 - 0x1.fp+1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1p-149 + 0x1.fp+127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-0x1p-149 - 0x1.fp+127 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-1.0 + 0x1.234566p-20 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (-2 - 3 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-2 - 3 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-3 + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-3 - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 1 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + inf i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-inf - 0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf - 1 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0.75 + 1.25 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x0.fffffffffffff8p0 + 0x0.fffffffffffff8p-1000 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x0.ffffffp0 + 0x0.ffffffp-100 i)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x1.00000000000000123456789abcp0 + 0x1.23456789p-1000 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1.00000000000000123456789abcp0 + 0x1.23456789p-1000 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1.00000000000000123456789abcp0 + 0x1.23456789p-60 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x1.000566p0 + 0x1.234p-10 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.000566p0 + 0x1.234p-10 i)": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: clog10 (0x1.000566p0 + 0x1.234p-100 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.000566p0 + 0x1.234p-100 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1.234566p-30 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog10 (0x1.234566p-50 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1.234566p-50 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: clog10 (0x1.234566p-60 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1.234566p-60 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.fffffep+127 + 0x1.fffffep+127 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0x1.fffffep+127 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x1.fp+16383 + 0x1.fp+16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x1.fp+16383 + 0x1p+16383 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x10673dd0f2481p-51 + 0x7ef1d17cefbd2p-51 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1367a310575591p-54 + 0x3cfcc0a0541f60p-54 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x1415bcaf2105940d49a636e98ae59p-115 + 0x7e6a150adfcd1b0921d44b31f40f4p-115 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x15cfbd1990d1ffp-53 + 0x176a3973e09a9ap-53 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x164c74eea876p-45 + 0x16f393482f77p-45 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1a6p-10 + 0x3a5p-10 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x1df515eb171a808b9e400266p-95 + 0x7c71eb0cd4688dfe98581c77p-95 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1df515eb171a808b9e400266p-95 + 0x7c71eb0cd4688dfe98581c77p-95 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x1p-1073 + 0x1p-1073 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-1074 + 0x1.fp+1023 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x1p-1074 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-1074 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-1074 - 0x1.fp+1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-147 + 0x1p-147 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-149 + 0x1.fp+127 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-149 + 0x1p-149 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-149 - 0x1.fp+127 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-509 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-510 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-511 + 1.0 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0x1p-61 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-62 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x1p-63 + 1.0 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0x2818p-15 + 0x798fp-15 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x2818p-15 + 0x798fp-15 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x2dd46725bp-35 + 0x7783a1284p-35 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x2ede88p-23 + 0x771c3fp-23 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0x2ede88p-23 + 0x771c3fp-23 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x3f96469050f650869c2p-75 + 0x6f16b2c9c8b05988335p-75 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x4447d7175p-35 + 0x6c445e00ap-35 i)": +double: 1 +idouble: 1 +Test "Real part of: clog10 (0x4d4ep-15 + 0x6605p-15 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x4d9c37e2b5cb4533p-63 + 0x65c98be2385a042ep-63 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x55cb6d0c83af5p-55 + 0x7fe33c0c7c4e90p-55 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x5b06b680ea2ccp-52 + 0xef452b965da9fp-52 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x602fd5037c4792efp-64 + 0xed3e2086dcca80b8p-64 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x6241ef0da53f539f02fad67dabp-106 + 0x3fb46641182f7efd9caa769dac0p-106 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0x659feap-24 + 0xeaf6f9p-24 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x659feap-24 + 0xeaf6f9p-24 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x6b10b4f3520217b6p-64 + 0xe8893cbb449253a1p-64 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0x9b57bp-20 + 0xcb7b4p-20 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0xdb85c467ee2aadd5f425fe0f4b8dp-114 + 0x3e83162a0f95f1dcbf97dddf410eap-114 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0xf2p-10 + 0x3e3p-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0xf2p-10 + 0x3e3p-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (0xfd95243681c055c2632286921092p-113 + 0x1bccabcd29ca2152860ec29e34ef7p-113 i)": +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: clog10 (0xfe961079616p-45 + 0x1bc37e09e6d1p-45 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (1.0 + 0x1.234566p-10 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (3 + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (3 - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf + inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf - inf i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# cos +Test "cos (0x1p+120)": +float: 1 +ifloat: 1 +Test "cos (0x1p+127)": +float: 1 +ifloat: 1 +Test "cos (M_PI_6l * 2.0)": +double: 1 +idouble: 1 +Test "cos (M_PI_6l * 4.0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cos_downward +Test "cos_downward (1)": +float: 1 +ifloat: 1 +Test "cos_downward (2)": +float: 1 +ifloat: 1 +Test "cos_downward (3)": +float: 1 +ifloat: 1 +Test "cos_downward (4)": +float: 1 +ifloat: 1 +Test "cos_downward (5)": +float: 1 +ifloat: 1 +Test "cos_downward (7)": +float: 1 +ifloat: 1 +Test "cos_downward (8)": +float: 1 +ifloat: 1 + +# cos_tonearest +Test "cos_tonearest (7)": +float: 1 +ifloat: 1 + +# cos_towardzero +Test "cos_towardzero (2)": +float: 1 +ifloat: 1 +Test "cos_towardzero (3)": +float: 1 +ifloat: 1 +Test "cos_towardzero (5)": +float: 1 +ifloat: 1 +Test "cos_towardzero (7)": +float: 1 +ifloat: 1 +Test "cos_towardzero (8)": +float: 1 +ifloat: 1 + +# cos_upward +Test "cos_upward (10)": +float: 1 +ifloat: 1 +Test "cos_upward (6)": +float: 1 +ifloat: 1 +Test "cos_upward (7)": +float: 1 +ifloat: 1 +Test "cos_upward (9)": +float: 2 +ifloat: 2 + +# cosh_downward +Test "cosh_downward (22)": +float: 1 +ifloat: 1 +Test "cosh_downward (23)": +float: 1 +ifloat: 1 +Test "cosh_downward (24)": +float: 1 +ifloat: 1 + +# cosh_tonearest +Test "cosh_tonearest (22)": +ildouble: 1 +ldouble: 1 + +# cosh_towardzero +Test "cosh_towardzero (22)": +float: 1 +ifloat: 1 +Test "cosh_towardzero (23)": +float: 1 +ifloat: 1 +Test "cosh_towardzero (24)": +float: 1 +ifloat: 1 + +# cpow +Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i)": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +ildouble: 4 +ldouble: 4 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i)": +double: 2 +float: 3 +idouble: 2 +ifloat: 3 +ildouble: 2 +ldouble: 2 +Test "Real part of: cpow (2 + 0 i, 10 + 0 i)": +ildouble: 2 +ldouble: 2 +Test "Real part of: cpow (2 + 3 i, 4 + 0 i)": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i)": +float: 2 +ifloat: 2 + +# csin +Test "Real part of: csin (-0.75 + 11357.25 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (-0.75 + 710.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (-0.75 + 89.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csin (-0.75 + 89.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (-0.75 - 11357.25 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (-0.75 - 710.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (-0.75 - 89.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csin (-0.75 - 89.5 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csin (-2 - 3 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (0.75 + 1.25 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (0.75 + 11357.25 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (0.75 + 710.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (0.75 + 89.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csin (0.75 + 89.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (0.75 - 11357.25 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (0.75 - 710.5 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (0.75 - 89.5 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csin (0.75 - 89.5 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (0x1p-1074 + 1440 i)": +double: 1 +idouble: 1 +Test "Real part of: csin (0x1p-16434 + 22730 i)": +ildouble: 1 +ldouble: 1 + +# csinh +Test "Imaginary part of: csinh (-11357.25 + 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (-11357.25 - 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: csinh (-2 - 3 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (-2 - 3 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (-710.5 + 0.75 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (-710.5 - 0.75 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: csinh (-89.5 + 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (-89.5 + 0.75 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: csinh (-89.5 - 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (-89.5 - 0.75 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: csinh (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: csinh (0.75 + 1.25 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: csinh (11357.25 + 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (11357.25 - 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (1440 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (22730 + 0x1p-16434 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (710.5 + 0.75 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (710.5 - 0.75 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: csinh (89.5 + 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (89.5 + 0.75 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: csinh (89.5 - 0.75 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (89.5 - 0.75 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# csqrt +Test "Real part of: csqrt (-0x1.0000000000000000000000000001p-16382 - 0x1.0000000000000000000000000001p-16382 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: csqrt (-0x1.0000000000000002p-16382 - 0x1.0000000000000002p-16382 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (-0x1.0000000000000002p-16382 - 0x1.0000000000000002p-16382 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: csqrt (-0x1.0000000000001p-1022 - 0x1.0000000000001p-1022 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: csqrt (-0x1.000002p-126 - 0x1.000002p-126 i)": +double: 1 +idouble: 1 +Test "Real part of: csqrt (-2 + 3 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: csqrt (-2 - 3 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0.75 + 1.25 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0x1.0000000000000000000000000001p-16382 + 0x1.0000000000000000000000000001p-16382 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: csqrt (0x1.0000000000000002p-16382 + 0x1.0000000000000002p-16382 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0x1.0000000000000002p-16382 + 0x1.0000000000000002p-16382 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0x1.0000000000001p-1022 + 0x1.0000000000001p-1022 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0x1.000002p-126 + 0x1.000002p-126 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csqrt (0x1.fffffep+127 + 1.0 i)": +float: 1 +ifloat: 1 +Test "Real part of: csqrt (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: csqrt (0x1.fffffffffffffp+1023 + 0x1.fffffffffffffp+1023 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0x1.fffffffffffffp+1023 + 0x1p+1023 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: csqrt (0x1.fp+16383 + 0x1.fp+16383 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0x1.fp+16383 + 0x1.fp+16383 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0x1.fp+16383 + 0x1p+16383 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0x1p-16440 + 0x1p-16441 i)": +ildouble: 1 +ldouble: 1 + +# ctan +Test "Real part of: ctan (-2 - 3 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctan (-2 - 3 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ctan (0.75 + 1.25 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan (0.75 + 1.25 i)": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: ctan (0x1p1023 + 1 i)": +double: 1 +idouble: 1 +Test "Imaginary part of: ctan (0x1p1023 + 1 i)": +ildouble: 2 +ldouble: 2 +Test "Real part of: ctan (0x1p127 + 1 i)": +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: ctan (0x1p127 + 1 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ctan (0x1p16383 + 1 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan (0x1p16383 + 1 i)": +ildouble: 2 +ldouble: 2 +Test "Real part of: ctan (0x3.243f6cp-1 + 0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ctan (1 + 355 i)": +ildouble: 2 +ldouble: 2 +Test "Real part of: ctan (1 + 365 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: ctan (1 + 45 i)": +ildouble: 2 +ldouble: 2 +Test "Real part of: ctan (1 + 47 i)": +ildouble: 1 +ldouble: 1 + +# ctan_downward +Test "Real part of: ctan_downward (0x1.921fb6p+0 + 0x1p-149 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: ctan_downward (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 + +# ctan_tonearest +Test "Imaginary part of: ctan_tonearest (0x1.921fb54442d1846ap+0 + 0x1p-16445 i)": +ildouble: 1 +ldouble: 1 +Test "Real part of: ctan_tonearest (0x1.921fb54442d18p+0 + 0x1p-1074 i)": +ildouble: 3 +ldouble: 3 +Test "Imaginary part of: ctan_tonearest (0x1.921fb54442d18p+0 + 0x1p-1074 i)": +ildouble: 3 +ldouble: 3 +Test "Real part of: ctan_tonearest (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan_tonearest (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +# ctan_towardzero +Test "Real part of: ctan_towardzero (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctan_towardzero (0x1.921fb6p+0 + 0x1p-149 i)": +float: 1 +ifloat: 1 + +# ctan_upward +Test "Real part of: ctan_upward (0x1.921fb54442d18p+0 + 0x1p-1074 i)": +double: 1 +idouble: 1 +Test "Real part of: ctan_upward (0x1.921fb6p+0 + 0x1p-149 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: ctan_upward (0x1.921fb6p+0 + 0x1p-149 i)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# ctanh +Test "Real part of: ctanh (-2 - 3 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ctanh (-2 - 3 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ctanh (0 + 0x3.243f6cp-1 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh (0 + pi/4 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ctanh (0.75 + 1.25 i)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ctanh (0.75 + 1.25 i)": +float: 2 +ifloat: 2 +Test "Real part of: ctanh (1 + 0x1p1023 i)": +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: ctanh (1 + 0x1p1023 i)": +double: 1 +idouble: 1 +Test "Real part of: ctanh (1 + 0x1p127 i)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh (1 + 0x1p127 i)": +ildouble: 2 +ldouble: 2 +Test "Real part of: ctanh (1 + 0x1p16383 i)": +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: ctanh (1 + 0x1p16383 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh (355 + 1 i)": +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: ctanh (365 + 1 i)": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh (45 + 1 i)": +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: ctanh (47 + 1 i)": +ildouble: 1 +ldouble: 1 + +# ctanh_downward +Test "Real part of: ctanh_downward (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctanh_downward (0x1p-149 + 0x1.921fb6p+0 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# ctanh_tonearest +Test "Real part of: ctanh_tonearest (0x1p-1074 + 0x1.921fb54442d18p+0 i)": +ildouble: 3 +ldouble: 3 +Test "Imaginary part of: ctanh_tonearest (0x1p-1074 + 0x1.921fb54442d18p+0 i)": +ildouble: 3 +ldouble: 3 +Test "Real part of: ctanh_tonearest (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: ctanh_tonearest (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ctanh_tonearest (0x1p-16445 + 0x1.921fb54442d1846ap+0 i)": +ildouble: 1 +ldouble: 1 + +# ctanh_towardzero +Test "Real part of: ctanh_towardzero (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctanh_towardzero (0x1p-149 + 0x1.921fb6p+0 i)": +float: 1 +ifloat: 1 + +# ctanh_upward +Test "Imaginary part of: ctanh_upward (0x1p-1074 + 0x1.921fb54442d18p+0 i)": +double: 1 +idouble: 1 +Test "Real part of: ctanh_upward (0x1p-149 + 0x1.921fb6p+0 i)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "Imaginary part of: ctanh_upward (0x1p-149 + 0x1.921fb6p+0 i)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# erf +Test "erf (1.25)": +double: 1 +idouble: 1 + +# erfc +Test "erfc (0x1.f7303cp+1)": +double: 1 +idouble: 1 +Test "erfc (0x1.ffa002p+2)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "erfc (0x1.ffffc8p+2)": +ildouble: 1 +ldouble: 1 +Test "erfc (2.0)": +double: 1 +idouble: 1 +Test "erfc (27.0)": +ildouble: 1 +ldouble: 1 +Test "erfc (4.125)": +double: 1 +idouble: 1 + +# exp10 +Test "exp10 (-1)": +double: 1 +idouble: 1 +Test "exp10 (-305)": +double: 1 +idouble: 1 +Test "exp10 (-36)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "exp10 (3)": +double: 1 +idouble: 1 +Test "exp10 (36)": +double: 1 +idouble: 1 +Test "exp10 (4932)": +ildouble: 1 +ldouble: 1 + +# exp2 +Test "exp2 (100.5)": +ildouble: 1 +ldouble: 1 + +# exp_downward +Test "exp_downward (2)": +float: 1 +ifloat: 1 +Test "exp_downward (3)": +float: 1 +ifloat: 1 + +# exp_towardzero +Test "exp_towardzero (2)": +float: 1 +ifloat: 1 +Test "exp_towardzero (3)": +float: 1 +ifloat: 1 + +# exp_upward +Test "exp_upward (1)": +float: 1 +ifloat: 1 + +# expm1 +Test "expm1 (-79.0)": +ildouble: 1 +ldouble: 1 +Test "expm1 (0.75)": +double: 1 +idouble: 1 +Test "expm1 (1)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "expm1 (500.0)": +double: 1 +idouble: 1 + +# gamma +Test "gamma (-0.5)": +ildouble: 1 +ldouble: 1 +Test "gamma (0.7)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "gamma (1.2)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# hypot +Test "hypot (-0.7, -12.4)": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4)": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7)": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7)": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4)": +float: 1 +ifloat: 1 +Test "hypot (0.7, 12.4)": +float: 1 +ifloat: 1 +Test "hypot (12.4, -0.7)": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7)": +float: 1 +ifloat: 1 + +# j0 +Test "j0 (-0x1.001000001p+593)": +ildouble: 1 +ldouble: 1 +Test "j0 (-4.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "j0 (0.75)": +float: 1 +ifloat: 1 +Test "j0 (0x1.d7ce3ap+107)": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "j0 (0x1p1023)": +ildouble: 1 +ldouble: 1 +Test "j0 (0x1p16383)": +ildouble: 2 +ldouble: 2 +Test "j0 (10.0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "j0 (2.0)": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "j0 (4.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "j0 (8.0)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# j1 +Test "j1 (-1.0)": +ildouble: 1 +ldouble: 1 +Test "j1 (0.75)": +ildouble: 1 +ldouble: 1 +Test "j1 (0x1.3ffp+74)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "j1 (0x1.ff00000000002p+840)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "j1 (0x1p1023)": +ildouble: 1 +ldouble: 1 +Test "j1 (0x1p16382)": +ildouble: 1 +ldouble: 1 +Test "j1 (0x1p16383)": +ildouble: 2 +ldouble: 2 +Test "j1 (1.0)": +ildouble: 1 +ldouble: 1 +Test "j1 (10.0)": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "j1 (2.0)": +double: 1 +idouble: 1 +Test "j1 (8.0)": +double: 1 +idouble: 1 +ildouble: 4 +ldouble: 4 + +# jn +Test "jn (0, -4.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (0, 0.75)": +float: 1 +ifloat: 1 +Test "jn (0, 10.0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "jn (0, 2.0)": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "jn (0, 4.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (0, 8.0)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (1, -1.0)": +ildouble: 1 +ldouble: 1 +Test "jn (1, 0.75)": +ildouble: 1 +ldouble: 1 +Test "jn (1, 1.0)": +ildouble: 1 +ldouble: 1 +Test "jn (1, 10.0)": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "jn (1, 2.0)": +double: 1 +idouble: 1 +Test "jn (1, 8.0)": +double: 1 +idouble: 1 +ildouble: 4 +ldouble: 4 +Test "jn (10, -1.0)": +ildouble: 1 +ldouble: 1 +Test "jn (10, 0.125)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (10, 0.75)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (10, 1.0)": +ildouble: 1 +ldouble: 1 +Test "jn (10, 10.0)": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 +ildouble: 2 +ldouble: 2 +Test "jn (10, 2.0)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "jn (2, 0x1.ffff62p+99)": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +Test "jn (2, 2.4048255576957729)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (3, 0.125)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 0.75)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 10.0)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "jn (3, 2.0)": +float: 1 +ifloat: 1 +Test "jn (3, 2.4048255576957729)": +double: 3 +idouble: 3 +ildouble: 1 +ldouble: 1 +Test "jn (4, 2.4048255576957729)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "jn (5, 2.4048255576957729)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "jn (6, 2.4048255576957729)": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 +ildouble: 5 +ldouble: 5 +Test "jn (7, 2.4048255576957729)": +double: 3 +float: 5 +idouble: 3 +ifloat: 5 +ildouble: 3 +ldouble: 3 +Test "jn (8, 2.4048255576957729)": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 8 +ldouble: 8 +Test "jn (9, 2.4048255576957729)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 3 +ldouble: 3 + +# lgamma +Test "lgamma (-0.5)": +ildouble: 1 +ldouble: 1 +Test "lgamma (0.7)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "lgamma (1.2)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# log10 +Test "log10 (0.75)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "log10 (e)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# log1p +Test "log1p (-0.25)": +float: 1 +ifloat: 1 + +# log2 +Test "log2 (0.75)": +ildouble: 1 +ldouble: 1 + +# pow +Test "pow (0x0.fffffffffffff8p0, -0x1.23456789abcdfp62)": +ildouble: 1 +ldouble: 1 +Test "pow (0x0.ffffffp0, -0x1p24)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "pow (0x0.ffffffp0, 0x1p24)": +float: 1 +ifloat: 1 +Test "pow (0x1.000002p0, 0x1p24)": +float: 1 +ifloat: 1 +Test "pow (10.0, -4930.0)": +ildouble: 1 +ldouble: 1 +Test "pow (10.0, 4929.0)": +ildouble: 1 +ldouble: 1 +Test "pow (10.0, 4930.0)": +ildouble: 1 +ldouble: 1 +Test "pow (10.0, 4931.0)": +ildouble: 1 +ldouble: 1 +Test "pow (10.0, 4932.0)": +ildouble: 1 +ldouble: 1 +Test "pow (1e4932, 0.75)": +ildouble: 1 +ldouble: 1 + +# pow10 +Test "pow10 (-1)": +double: 1 +idouble: 1 +Test "pow10 (-305)": +double: 1 +idouble: 1 +Test "pow10 (-36)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "pow10 (3)": +double: 1 +idouble: 1 +Test "pow10 (36)": +double: 1 +idouble: 1 +Test "pow10 (4932)": +ildouble: 1 +ldouble: 1 + +# pow_downward +Test "pow_downward (1.5, 1.03125)": +float: 1 +ifloat: 1 + +# pow_towardzero +Test "pow_towardzero (1.5, 1.03125)": +float: 1 +ifloat: 1 + +# pow_upward +Test "pow_upward (1.0625, 1.125)": +float: 1 +ifloat: 1 + +# sin_downward +Test "sin_downward (10)": +float: 1 +ifloat: 1 +Test "sin_downward (3)": +float: 1 +ifloat: 1 +Test "sin_downward (5)": +float: 1 +ifloat: 1 +Test "sin_downward (6)": +float: 1 +ifloat: 1 + +# sin_tonearest +Test "sin_tonearest (1)": +float: 1 +ifloat: 1 +Test "sin_tonearest (3)": +ildouble: 1 +ldouble: 1 + +# sin_towardzero +Test "sin_towardzero (1)": +float: 1 +ifloat: 1 +Test "sin_towardzero (10)": +float: 1 +ifloat: 1 +Test "sin_towardzero (4)": +float: 1 +ifloat: 1 +Test "sin_towardzero (5)": +float: 1 +ifloat: 1 +Test "sin_towardzero (9)": +float: 1 +ifloat: 1 + +# sin_upward +Test "sin_upward (1)": +float: 1 +ifloat: 1 +Test "sin_upward (2)": +float: 2 +ifloat: 2 +Test "sin_upward (4)": +float: 1 +ifloat: 1 +Test "sin_upward (9)": +float: 1 +ifloat: 1 + +# sincos +Test "sincos (0x1p+120) extra output 2": +float: 1 +ifloat: 1 +Test "sincos (0x1p+127) extra output 2": +float: 1 +ifloat: 1 +Test "sincos (M_PI_6l*2.0) extra output 1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sincos (M_PI_6l*2.0) extra output 2": +double: 1 +idouble: 1 +Test "sincos (pi/6) extra output 2": +float: 1 +ifloat: 1 + +# sinh_downward +Test "sinh_downward (22)": +float: 1 +ifloat: 1 +Test "sinh_downward (23)": +float: 1 +ifloat: 1 +Test "sinh_downward (24)": +float: 1 +ifloat: 1 + +# sinh_towardzero +Test "sinh_towardzero (22)": +float: 1 +ifloat: 1 +Test "sinh_towardzero (23)": +float: 1 +ifloat: 1 +Test "sinh_towardzero (24)": +float: 1 +ifloat: 1 + +# tan_downward +Test "tan_downward (1)": +float: 1 +ifloat: 1 +Test "tan_downward (10)": +float: 1 +ifloat: 1 +Test "tan_downward (2)": +float: 1 +ifloat: 1 +Test "tan_downward (6)": +float: 1 +ifloat: 1 +Test "tan_downward (8)": +float: 1 +ifloat: 1 +Test "tan_downward (9)": +float: 1 +ifloat: 1 + +# tan_towardzero +Test "tan_towardzero (10)": +float: 1 +ifloat: 1 +Test "tan_towardzero (3)": +float: 1 +ifloat: 1 +Test "tan_towardzero (4)": +float: 1 +ifloat: 1 +Test "tan_towardzero (5)": +float: 1 +ifloat: 1 +Test "tan_towardzero (9)": +float: 1 +ifloat: 1 + +# tan_upward +Test "tan_upward (1)": +float: 1 +ifloat: 1 +Test "tan_upward (10)": +float: 1 +ifloat: 1 +Test "tan_upward (3)": +float: 1 +ifloat: 1 +Test "tan_upward (5)": +float: 1 +ifloat: 1 + +# tanh +Test "tanh (-0.75)": +ildouble: 1 +ldouble: 1 +Test "tanh (-1.0)": +ildouble: 1 +ldouble: 1 +Test "tanh (0.75)": +ildouble: 1 +ldouble: 1 +Test "tanh (1.0)": +ildouble: 1 +ldouble: 1 + +# tgamma +Test "tgamma (-0.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x0.fffffffffffff8p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x0.ffffffffffffffffffffffffffff8p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x0.ffffffp0)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x1.0000000000000002p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x1.0000000000001p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x1.000002p0)": +double: 2 +idouble: 2 +Test "tgamma (-0x1.0a32a2p+5)": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x1.5800000080001p+7)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x1.fffffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x1.fffffffffffffp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x13.ffffep0)": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x13.ffffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x13.fffffffffffffffffffffffff8p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x13.ffffffffffffp0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x14.000000000000000000000000001p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x14.000000000001p0)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x14.00002p0)": +float: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 +Test "tgamma (-0x1d.ffffep0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x1d.fffffffffffffffffffffffff8p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x1d.ffffffffffffp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x1e.000000000000000000000000001p0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x1e.00000000000000000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x1e.000000000000002p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x1e.000000000001p0)": +double: 3 +idouble: 3 +Test "tgamma (-0x1e.00002p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x1f3.ffffffffffffffffffffffffffp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x1p-24)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x2.0000000000000000000000000002p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x2.0000000000002p0)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x2.000004p0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x2.fffffcp0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x2.ffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x27.fffffffffffep0)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x27.ffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x27.ffffffffffffffffffffffffffep0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x27.fffffffffffffffffffffffffp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x28.0000000000000000000000001p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x28.000000000002p0)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x28.00004p0)": +double: 2 +idouble: 2 +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x28.ffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x28.ffffffffffffffffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x28.fffffffffffffffffffffffffp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x29.000000000000000000000000002p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x29.0000000000000000000000001p0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x29.00004p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x29.ffffcp0)": +double: 1 +idouble: 1 +Test "tgamma (-0x29.fffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x29.ffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x29.ffffffffffffffffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x29.fffffffffffffffffffffffffp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x2a.000000000000000000000000002p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x2a.0000000000000000000000001p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x2a.000000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x2a.000000000002p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x2ed.fffffffffffffffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x2ee.00000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x3.00000000000000000000000001p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x3.000004p0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (-0x3.fffffcp0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x3.ffffffffffffep0)": +double: 2 +idouble: 2 +Test "tgamma (-0x3.fffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x3.fffffffffffffffffffffffffffep0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x31.fffffffffffep0)": +double: 3 +idouble: 3 +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x31.ffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x31.ffffffffffffffffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x31.fffffffffffffffffffffffffp0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x32.000000000000000000000000002p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x32.0000000000000000000000001p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x32.000000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x3e7.fffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x3e7.fffffffffffffffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x3e8.00000000000000000000000002p0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x3e8.00000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x4.0000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x4.000008p0)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x4.fffff8p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x4.ffffffffffffcp0)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x4.fffffffffffffffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x4.fffffffffffffffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x5.0000000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x5.0000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x5.000008p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x5.fffff8p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x5.ffffffffffffcp0)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x5.fffffffffffffff8p0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x5.fffffffffffffffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x5.fffffffffffffffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x5db.fffffffffffff8p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x5db.fffffffffffffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x5dc.00000000000000000000000004p0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x6.0000000000000000000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x6.00000000000000000000000002p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x6.0000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x6.000008p0)": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x6.fffff8p0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x6.ffffffffffffcp0)": +double: 4 +idouble: 4 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x6.fffffffffffffff8p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x6.fffffffffffffffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x63.fffffffffffcp0)": +double: 2 +idouble: 2 +Test "tgamma (-0x63.ffffffffffffff8p0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x63.ffffffffffffffffffffffffep0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x64.000000000000000000000000004p0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x64.0000000000000000000000002p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x64.000000000004p0)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x6d5.fffffffffffff8p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x6d6.00000000000000000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x6e3.00000000000000000000000004p0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x7.0000000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x7.0000000000004p0)": +double: 3 +idouble: 3 +Test "tgamma (-0x7.000008p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-0x7.fffff8p0)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "tgamma (-0x7.ffffffffffffcp0)": +double: 3 +idouble: 3 +Test "tgamma (-0x7.fffffffffffffff8p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x7.fffffffffffffffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x7.fffffffffffffffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x8.0000000000000000000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x8.00000000000000000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x8.0000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x8.00001p0)": +double: 2 +idouble: 2 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x9.ffffffffffff8p0)": +double: 1 +idouble: 1 +Test "tgamma (-0x9.fffffffffffffffffffffffffff8p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x9.fffffp0)": +float: 1 +ifloat: 1 +Test "tgamma (-0x95.ffffffffffffffp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x96.000000000000000000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x96.0000000000000000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0x96.00000000000001p0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0x96.000000000008p0)": +double: 1 +idouble: 1 +Test "tgamma (-0xa.0000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xa.00001p0)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xb4.ffffffffffffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xb4.ffffffffffffffp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xb5.0000000000000000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xb5.00000000000001p0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0xb5.000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xb5.ffffffffffffffffffffffffff8p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xb6.00000000000001p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xb6.000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xb6.fffffffffff8p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xb6.ffffffffffffffffffffffffff8p0)": +ildouble: 3 +ldouble: 3 +Test "tgamma (-0xb7.000000000000000000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xb7.00000000000001p0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0xb7.000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xb7.ffffffffffffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xb7.ffffffffffffffffffffffffff8p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xb8.00000000000001p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xbb.ffffffffffffffffffffffffcp0)": +ildouble: 3 +ldouble: 3 +Test "tgamma (-0xbb.ffffffffffffffffffffffffff8p0)": +ildouble: 4 +ldouble: 4 +Test "tgamma (-0xbc.000000000000000000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xbc.0000000000000000000000004p0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0xbc.00000000000001p0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0xbc.ffffffffffffffp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xbd.000000000000000000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xbd.00000000000001p0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0xbd.ffffffffffffffp0)": +ildouble: 2 +ldouble: 2 +Test "tgamma (-0xbe.000000000000000000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xbe.0000000000000000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xbe.ffffffffffffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xbe.ffffffffffffffp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xbf.000000000000000000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xbf.0000000000000000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xbf.00000000000001p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xf9.ffffffffffffffp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-0xfa.000000000000000000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (-2.5)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "tgamma (-3.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-4.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-5.5)": +double: 1 +idouble: 1 +Test "tgamma (-6.5)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (-7.5)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (-8.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (-9.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0.5)": +float: 1 +ifloat: 1 +Test "tgamma (0.7)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0x1.fffffep0)": +float: 1 +ifloat: 1 +Test "tgamma (0x1.fffffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x1.ffffffffffffffffffffffffffffp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x1.fffffffffffffp0)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (0x1p-113)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x1p-24)": +float: 1 +ifloat: 1 +Test "tgamma (0x1p-53)": +double: 1 +idouble: 1 +Test "tgamma (0x2.30a43cp+4)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "tgamma (0x2.fffffcp0)": +float: 3 +ifloat: 3 +Test "tgamma (0x2.ffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x3.0000000000002p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x3.fffffcp0)": +float: 1 +ifloat: 1 +Test "tgamma (0x3.ffffffffffffep0)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (0x3.fffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x3.fffffffffffffffffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x4.0000000000000000000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x4.0000000000004p0)": +double: 1 +idouble: 1 +Test "tgamma (0x4.000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x4.ffffffffffffcp0)": +double: 1 +idouble: 1 +Test "tgamma (0x4.fffffffffffffffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x4.fffffffffffffffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x5.0000000000000000000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x5.0000000000004p0)": +double: 1 +idouble: 1 +Test "tgamma (0x5.000008p0)": +float: 2 +ifloat: 2 +Test "tgamma (0x5.fffff8p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0x5.ffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x5.fffffffffffffff8p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x5.fffffffffffffffffffffffffep0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x6.0000000000000000000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x6.0000000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x6.0000000000004p0)": +double: 1 +idouble: 1 +Test "tgamma (0x6.000008p0)": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "tgamma (0x6.fffff8p0)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (0x6.ffffffffffffcp0)": +double: 4 +idouble: 4 +Test "tgamma (0x6.fffffffffffffff8p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x7.0000000000000000000000000004p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x7.0000000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x7.0000000000004p0)": +double: 4 +idouble: 4 +Test "tgamma (0x7.000008p0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0x7.fffff8p0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (0x7.ffffffffffffcp0)": +double: 2 +idouble: 2 +ildouble: 1 +ldouble: 1 +Test "tgamma (0x7.fffffffffffffffffffffffffffcp0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x8.0000000000000000000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x8.0000000000008p0)": +ildouble: 1 +ldouble: 1 +Test "tgamma (0x8.00001p0)": +double: 2 +idouble: 2 +Test "tgamma (0xa.b9fd72b0fb238p+4)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (0xa.b9fd72b0fb23a9ddbf0d3804f8p+4)": +ildouble: 2 +ldouble: 2 +Test "tgamma (10)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (18.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (19.5)": +double: 2 +idouble: 2 +ildouble: 1 +ldouble: 1 +Test "tgamma (2.5)": +float: 2 +ifloat: 2 +Test "tgamma (23.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (29.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (3)": +float: 1 +ifloat: 1 +Test "tgamma (3.5)": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "tgamma (30.5)": +float: 1 +ifloat: 1 +Test "tgamma (32.5)": +ildouble: 1 +ldouble: 1 +Test "tgamma (33.5)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (34.5)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "tgamma (4)": +float: 1 +ifloat: 1 +Test "tgamma (4.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (6)": +float: 1 +ifloat: 1 +Test "tgamma (6.5)": +float: 1 +ifloat: 1 +Test "tgamma (7)": +double: 1 +idouble: 1 +Test "tgamma (7.5)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "tgamma (8)": +double: 1 +idouble: 1 +Test "tgamma (8.5)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (9)": +double: 1 +idouble: 1 +Test "tgamma (9.5)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# y0 +Test "y0 (0x1.3ffp+74)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "y0 (0x1.ff00000000002p+840)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "y0 (0x1p-10)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "y0 (0x1p-110)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "y0 (0x1p-20)": +float: 1 +ifloat: 1 +Test "y0 (0x1p-30)": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "y0 (0x1p-40)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "y0 (0x1p-50)": +float: 1 +ifloat: 1 +Test "y0 (0x1p-60)": +ildouble: 1 +ldouble: 1 +Test "y0 (0x1p-70)": +double: 1 +idouble: 1 +Test "y0 (0x1p-80)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "y0 (0x1p1023)": +ildouble: 1 +ldouble: 1 +Test "y0 (0x1p16382)": +ildouble: 1 +ldouble: 1 +Test "y0 (0x1p16383)": +ildouble: 2 +ldouble: 2 +Test "y0 (1.0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (1.5)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (10.0)": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "y0 (8.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +# y1 +Test "y1 (0.125)": +double: 1 +idouble: 1 +Test "y1 (0.75)": +ildouble: 1 +ldouble: 1 +Test "y1 (0x1.001000001p+593)": +ildouble: 1 +ldouble: 1 +Test "y1 (0x1.27e204p+99)": +double: 1 +idouble: 1 +Test "y1 (0x1p-10)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "y1 (0x1p-30)": +ildouble: 1 +ldouble: 1 +Test "y1 (0x1p1023)": +ildouble: 1 +ldouble: 1 +Test "y1 (0x1p16383)": +ildouble: 2 +ldouble: 2 +Test "y1 (1.5)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y1 (10.0)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "y1 (2.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y1 (8.0)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# yn +Test "yn (0, 1.0)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 1.5)": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 10.0)": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "yn (0, 8.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "yn (1, 0.125)": +double: 1 +idouble: 1 +Test "yn (1, 0.75)": +ildouble: 1 +ldouble: 1 +Test "yn (1, 1.5)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (1, 10.0)": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "yn (1, 2.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (1, 8.0)": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "yn (10, 0.125)": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 +Test "yn (10, 0.75)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 5 +ldouble: 5 +Test "yn (10, 1.0)": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "yn (10, 10.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (10, 2.0)": +double: 2 +idouble: 2 +ildouble: 2 +ldouble: 2 +Test "yn (3, 0.125)": +double: 1 +idouble: 1 +Test "yn (3, 0.75)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (3, 10.0)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (3, 2.0)": +double: 1 +idouble: 1 + +# Maximal error of functions: +Function: "acos_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "acos_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "asin_downward": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "asin_towardzero": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "asin_upward": +float: 1 +ifloat: 1 + +Function: "atan2": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "atanh": +float: 1 +ifloat: 1 + +Function: Real part of "cacos": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "cacos": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: Real part of "cacosh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "cacosh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: Real part of "casin": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "casin": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: Real part of "casinh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "casinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Real part of "catan": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "catan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "catanh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "catanh": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cbrt": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ccos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ccos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "cexp": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "cexp": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: Real part of "clog": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "clog": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "clog10": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "clog10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cos_downward": +float: 1 +ifloat: 1 + +Function: "cos_tonearest": +float: 1 +ifloat: 1 + +Function: "cos_towardzero": +float: 1 +ifloat: 1 + +Function: "cos_upward": +float: 2 +ifloat: 2 + +Function: "cosh_downward": +float: 1 +ifloat: 1 + +Function: "cosh_tonearest": +ildouble: 1 +ldouble: 1 + +Function: "cosh_towardzero": +float: 1 +ifloat: 1 + +Function: Real part of "cpow": +double: 2 +float: 4 +idouble: 2 +ifloat: 4 +ildouble: 4 +ldouble: 4 + +Function: Imaginary part of "cpow": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: Real part of "csin": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csin": +ildouble: 1 +ldouble: 1 + +Function: Real part of "csinh": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "csqrt": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csqrt": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ctan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "ctan": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 + +Function: Real part of "ctan_downward": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: Imaginary part of "ctan_downward": +float: 1 +ifloat: 1 + +Function: Real part of "ctan_tonearest": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +Function: Imaginary part of "ctan_tonearest": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +Function: Real part of "ctan_towardzero": +float: 1 +ifloat: 1 + +Function: Imaginary part of "ctan_towardzero": +float: 1 +ifloat: 1 + +Function: Real part of "ctan_upward": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: Imaginary part of "ctan_upward": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Real part of "ctanh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "ctanh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: Real part of "ctanh_downward": +float: 1 +ifloat: 1 + +Function: Imaginary part of "ctanh_downward": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: Real part of "ctanh_tonearest": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +Function: Imaginary part of "ctanh_tonearest": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +Function: Real part of "ctanh_towardzero": +float: 1 +ifloat: 1 + +Function: Imaginary part of "ctanh_towardzero": +float: 1 +ifloat: 1 + +Function: Real part of "ctanh_upward": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: Imaginary part of "ctanh_upward": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "erf": +double: 1 +idouble: 1 + +Function: "erfc": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "exp10": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: "exp2": +ildouble: 1 +ldouble: 1 + +Function: "exp_downward": +float: 1 +ifloat: 1 + +Function: "exp_towardzero": +float: 1 +ifloat: 1 + +Function: "exp_upward": +float: 1 +ifloat: 1 + +Function: "expm1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "gamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "hypot": +float: 1 +ifloat: 1 + +Function: "j0": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: "j1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 4 +ldouble: 4 + +Function: "jn": +double: 4 +float: 5 +idouble: 4 +ifloat: 5 +ildouble: 8 +ldouble: 8 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "log10": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "log1p": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "log2": +ildouble: 1 +ldouble: 1 + +Function: "pow": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow10": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: "pow_downward": +float: 1 +ifloat: 1 + +Function: "pow_towardzero": +float: 1 +ifloat: 1 + +Function: "pow_upward": +float: 1 +ifloat: 1 + +Function: "sin_downward": +float: 1 +ifloat: 1 + +Function: "sin_tonearest": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sin_towardzero": +float: 1 +ifloat: 1 + +Function: "sin_upward": +float: 2 +ifloat: 2 + +Function: "sincos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sinh_downward": +float: 1 +ifloat: 1 + +Function: "sinh_towardzero": +float: 1 +ifloat: 1 + +Function: "tan": +double: 1 +idouble: 1 + +Function: "tan_downward": +float: 1 +ifloat: 1 + +Function: "tan_towardzero": +float: 1 +ifloat: 1 + +Function: "tan_upward": +float: 1 +ifloat: 1 + +Function: "tanh": +ildouble: 1 +ldouble: 1 + +Function: "tgamma": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 +ildouble: 4 +ldouble: 4 + +Function: "y0": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +Function: "y1": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: "yn": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 5 +ldouble: 5 + +# end of automatic generation diff --git a/test/math/libm-test-ulps-powerpc b/test/math/libm-test-ulps-powerpc new file mode 100644 index 000000000..8516e915e --- /dev/null +++ b/test/math/libm-test-ulps-powerpc @@ -0,0 +1,1336 @@ +# Begin of automatic generation + +# acos +Test "acos (2e-17) == 1.57079632679489659923132169163975144": +ildouble: 1 +ldouble: 1 + +# asin +Test "asin (0.75) == 0.848062078981481008052944338998418080": +ildouble: 2 +ldouble: 2 + +# atan2 +Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112": +ildouble: 1 +ldouble: 1 +Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025": +float: 1 +ifloat: 1 +Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025": +float: 1 +ifloat: 1 +Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# atanh +Test "atanh (0.75) == 0.972955074527656652552676371721589865": +float: 1 +ifloat: 1 + +# cabs +Test "cabs (0.75 + 1.25 i) == 1.45773797371132511771853821938639577": +ildouble: 1 +ldouble: 1 + +# cacosh +Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": +double: 1 +float: 7 +idouble: 1 +ifloat: 7 +Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": +double: 1 +float: 3 +idouble: 1 +ifloat: 3 + +# casin +Test "Real part of: casin (-2 - 3 i) == -0.57065278432109940071028387968566963 - 1.9833870299165354323470769028940395 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# casinh +Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": +double: 5 +float: 1 +idouble: 5 +ifloat: 1 +ildouble: 4 +ldouble: 4 +Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": +double: 3 +float: 6 +idouble: 3 +ifloat: 6 +ildouble: 1 +ldouble: 1 +Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# catan +Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": +float: 3 +ifloat: 3 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i": +float: 4 +ifloat: 4 + +# catanh +Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i": +double: 4 +idouble: 4 +Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i": +float: 4 +ifloat: 4 +Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i": +float: 6 +ifloat: 6 + +# cbrt +Test "cbrt (-27.0) == -3.0": +double: 1 +idouble: 1 +Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217": +double: 1 +idouble: 1 + +# ccos +Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i": +float: 1 +ifloat: 1 +Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i": +float: 1 +ifloat: 1 + +# ccosh +Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i": +float: 1 +ifloat: 1 +Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +# cexp +Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": +float: 1 +ifloat: 1 +Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": +ildouble: 1 +ldouble: 1 + +# clog +Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i": +float: 3 +ifloat: 3 +ildouble: 1 +ldouble: 1 +Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": +ildouble: 1 +ldouble: 1 + +# clog10 +Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": +double: 1 +float: 5 +idouble: 1 +ifloat: 5 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cos +Test "cos (M_PI_6l * 2.0) == 0.5": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "cos (M_PI_6l * 4.0) == -0.5": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "cos (pi/2) == 0": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "cos (16.0) == -0.9576594803233846418996372326511034717803" +ildouble: 2 +ldouble: 2 + +# cpow +Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": +ildouble: 2 +ldouble: 2 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i": +double: 2 +float: 3 +idouble: 2 +ifloat: 3 +Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": +double: 1 +float: 5 +idouble: 1 +ifloat: 5 +Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +# csinh +Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# csqrt +Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 +Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 + +# ctan +Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +double: 1 +idouble: 1 +Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i": +double: 1 +idouble: 1 + +# ctanh +Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i": +float: 1 +ifloat: 1 +Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# erf +Test "erf (1.25) == 0.922900128256458230136523481197281140": +double: 1 +idouble: 1 + +# erfc +Test "erfc (0.75) == 0.288844366346484868401062165408589223": +float: 1 +ifloat: 1 +Test "erfc (2.0) == 0.00467773498104726583793074363274707139": +double: 1 +idouble: 1 +Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8": +double: 1 +idouble: 1 + +# exp +Test "exp (0.75) == 2.11700001661267466854536981983709561": +ildouble: 1 +ldouble: 1 +Test "exp (50.0) == 5184705528587072464087.45332293348538": +ildouble: 1 +ldouble: 1 + +# exp10 +Test "exp10 (-1) == 0.1": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "exp10 (0.75) == 5.62341325190349080394951039776481231": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "exp10 (3) == 1000": +double: 6 +float: 2 +idouble: 6 +ifloat: 2 +ildouble: 8 +ldouble: 8 + +# exp2 +Test "exp2 (10) == 1024": +ildouble: 2 +ldouble: 2 + +# expm1 +Test "expm1 (0.75) == 1.11700001661267466854536981983709561": +double: 1 +idouble: 1 +Test "expm1 (1) == M_El - 1.0": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# hypot +Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.75, 1.25) == 1.45773797371132511771853821938639577": +ildouble: 1 +ldouble: 1 +Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 + +# j0 +Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "j0 (10.0) == -0.245935764451348335197760862485328754": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "j0 (2.0) == 0.223890779141235668051827454649948626": +float: 2 +ifloat: 2 +Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "j0 (8.0) == 0.171650807137553906090869407851972001": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# j1 +Test "j1 (10.0) == 0.0434727461688614366697487680258592883": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "j1 (2.0) == 0.576724807756873387202448242269137087": +double: 1 +idouble: 1 +Test "j1 (8.0) == 0.234636346853914624381276651590454612": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# jn +Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "jn (0, 10.0) == -0.245935764451348335197760862485328754": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (0, 2.0) == 0.223890779141235668051827454649948626": +float: 2 +ifloat: 2 +Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "jn (0, 8.0) == 0.171650807137553906090869407851972001": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "jn (1, 2.0) == 0.576724807756873387202448242269137087": +double: 1 +idouble: 1 +Test "jn (1, 8.0) == 0.234636346853914624381276651590454612": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9": +ildouble: 1 +ldouble: 1 +Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9": +ildouble: 1 +ldouble: 1 +Test "jn (10, 10.0) == 0.207486106633358857697278723518753428": +float: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 +Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6": +float: 4 +ifloat: 4 +Test "jn (3, -1.0) == -0.0195633539826684059189053216217515083": +ildouble: 1 +ldouble: 1 +Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2": +double: 1 +idouble: 1 +Test "jn (3, 1.0) == 0.0195633539826684059189053216217515083": +ildouble: 1 +ldouble: 1 +Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "jn (3, 2.0) == 0.128943249474402051098793332969239835": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +# lgamma +Test "lgamma (0.7) == 0.260867246531666514385732417016759578": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 3 +ldouble: 3 + +# log10 +Test "log10 (0.75) == -0.124938736608299953132449886193870744": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "log10 (e) == log10(e)": +float: 1 +ifloat: 1 + +# log1p +Test "log1p (-0.25) == -0.287682072451780927439219005993827432": +float: 1 +ifloat: 1 + +# log2 +Test "log2 (e) == M_LOG2El": +ildouble: 1 +ldouble: 1 + +# sin +Test "sin (16.0) == -0.2879033166650652947844562482186175296207" +ildouble: 2 +ldouble: 2 + +# sincos +Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res": +float: 1 +ifloat: 1 + +# sinh +Test "sinh (0.75) == 0.822316731935829980703661634446913849": +ildouble: 1 +ldouble: 1 + +# tan +Test "tan (pi/4) == 1": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# tanh +Test "tanh (-0.75) == -0.635148952387287319214434357312496495": +ildouble: 1 +ldouble: 1 +Test "tanh (0.75) == 0.635148952387287319214434357312496495": +ildouble: 1 +ldouble: 1 + +# tgamma +Test "tgamma (-0.5) == -2 sqrt (pi)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0.5) == sqrt (pi)": +float: 1 +ifloat: 1 +Test "tgamma (0.7) == 1.29805533264755778568117117915281162": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# y0 +Test "y0 (0.125) == -1.38968062514384052915582277745018693": +ildouble: 1 +ldouble: 1 +Test "y0 (0.75) == -0.137172769385772397522814379396581855": +ildouble: 1 +ldouble: 1 +Test "y0 (1.0) == 0.0882569642156769579829267660235151628": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y0 (1.5) == 0.382448923797758843955068554978089862": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (10.0) == 0.0556711672835993914244598774101900481": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y0 (2.0) == 0.510375672649745119596606592727157873": +double: 1 +idouble: 1 +Test "y0 (8.0) == 0.223521489387566220527323400498620359": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# y1 +Test "y1 (0.125) == -5.19993611253477499595928744876579921": +double: 1 +idouble: 1 +Test "y1 (1.5) == -0.412308626973911295952829820633445323": +float: 1 +ifloat: 1 +Test "y1 (10.0) == 0.249015424206953883923283474663222803": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "y1 (2.0) == -0.107032431540937546888370772277476637": +double: 1 +float: 1 +idouble: 2 +ifloat: 2 +Test "y1 (8.0) == -0.158060461731247494255555266187483550": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +# yn +Test "yn (0, 0.125) == -1.38968062514384052915582277745018693": +ildouble: 1 +ldouble: 1 +Test "yn (0, 0.75) == -0.137172769385772397522814379396581855": +ildouble: 1 +ldouble: 1 +Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (0, 1.5) == 0.382448923797758843955068554978089862": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (0, 2.0) == 0.510375672649745119596606592727157873": +double: 1 +idouble: 1 +Test "yn (0, 8.0) == 0.223521489387566220527323400498620359": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (1, 0.125) == -5.19993611253477499595928744876579921": +double: 1 +idouble: 1 +Test "yn (1, 1.5) == -0.412308626973911295952829820633445323": +float: 2 +ifloat: 2 +Test "yn (1, 10.0) == 0.249015424206953883923283474663222803": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (1, 2.0) == -0.107032431540937546888370772277476637": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (1, 8.0) == -0.158060461731247494255555266187483550": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "yn (3, 0.125) == -2612.69757350066712600220955744091741": +double: 1 +idouble: 1 +Test "yn (10, 0.125) == -127057845771019398.252538486899753195": +double: 1 +idouble: 1 +Test "yn (10, 0.75) == -2133501638.90573424452445412893839236": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "yn (10, 1.0) == -121618014.278689189288130426667971145": +float: 2 +ifloat: 2 +Test "yn (10, 10.0) == -0.359814152183402722051986577343560609": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "yn (10, 2.0) == -129184.542208039282635913145923304214": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (3, 0.125) == -2612.69757350066712600220955744091741": +double: 1 +idouble: 1 +Test "yn (3, 0.75) == -12.9877176234475433186319774484809207": +float: 1 +ifloat: 1 +Test "yn (3, 10.0) == -0.251362657183837329779204747654240998": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (3, 2.0) == -1.12778377684042778608158395773179238": +double: 1 +idouble: 1 + +# Maximal error of functions: +Function: "acos": +ildouble: 1 +ldouble: 1 + +Function: "acosh": +ildouble: 1 +ldouble: 1 + +Function: "asin": +ildouble: 2 +ldouble: 2 + +Function: "asinh": +ildouble: 1 +ldouble: 1 + +Function: "atan2": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "atanh": +float: 1 +ifloat: 1 + +Function: "cabs": +ildouble: 1 +ldouble: 1 + +Function: Real part of "cacos": +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "cacos": +ildouble: 1 +ldouble: 1 + +Function: Real part of "cacosh": +double: 1 +float: 7 +idouble: 1 +ifloat: 7 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "cacosh": +double: 1 +float: 3 +idouble: 1 +ifloat: 3 + +Function: Real part of "casin": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "casin": +ildouble: 1 +ldouble: 1 + +Function: Real part of "casinh": +double: 5 +float: 1 +idouble: 5 +ifloat: 1 +ildouble: 4 +ldouble: 4 + +Function: Imaginary part of "casinh": +double: 3 +float: 6 +idouble: 3 +ifloat: 6 +ildouble: 1 +ldouble: 1 + +Function: Real part of "catan": +float: 4 +ifloat: 4 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "catan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "catanh": +double: 4 +idouble: 4 + +Function: Imaginary part of "catanh": +float: 6 +ifloat: 6 + +Function: "cbrt": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ccos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ccos": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ccosh": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Real part of "cexp": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "cexp": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "clog": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "clog": +float: 3 +ifloat: 3 +ildouble: 1 +ldouble: 1 + +Function: Real part of "clog10": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +Function: Imaginary part of "clog10": +double: 1 +float: 5 +idouble: 1 +ifloat: 5 +ildouble: 1 +ldouble: 1 + +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "cosh": +ildouble: 1 +ldouble: 1 + +Function: Real part of "cpow": +double: 2 +float: 5 +idouble: 2 +ifloat: 5 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "cpow": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "cproj": +ildouble: 1 +ldouble: 1 + +Function: Real part of "csin": +ildouble: 1 +ldouble: 1 + +Function: Real part of "csinh": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "csqrt": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csqrt": +ildouble: 1 +ldouble: 1 + +Function: Real part of "ctan": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ctan": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ctanh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ctanh": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "erf": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: "erfc": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "exp": +ildouble: 1 +ldouble: 1 + +Function: "exp10": +double: 6 +float: 2 +idouble: 6 +ifloat: 2 +ildouble: 8 +ldouble: 8 + +Function: "exp2": +ildouble: 2 +ldouble: 2 + +Function: "expm1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "gamma": +ildouble: 1 +ldouble: 1 + +Function: "hypot": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "j0": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "j1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "jn": +double: 3 +float: 4 +idouble: 3 +ifloat: 4 +ildouble: 4 +ldouble: 4 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 3 +ldouble: 3 + +Function: "log": +ildouble: 1 +ldouble: 1 + +Function: "log10": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "log1p": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "log2": +ildouble: 1 +ldouble: 1 + +Function: "pow": +ildouble: 1 +ldouble: 1 + +Function: "sin": +ildouble: 1 +ldouble: 1 + +Function: "sincos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sinh": +ildouble: 1 +ldouble: 1 + +Function: "tan": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: "tanh": +ildouble: 1 +ldouble: 1 + +Function: "tgamma": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "y0": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "y1": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: "yn": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +# end of automatic generation diff --git a/test/math/libm-test-ulps-s390 b/test/math/libm-test-ulps-s390 new file mode 100644 index 000000000..989722e65 --- /dev/null +++ b/test/math/libm-test-ulps-s390 @@ -0,0 +1,1332 @@ +# Begin of automatic generation + +# atan2 +Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112": +ildouble: 1 +ldouble: 1 +Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# atanh +Test "atanh (0.75) == 0.972955074527656652552676371721589865": +float: 1 +ifloat: 1 + +# cacos +Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i": +ildouble: 1 +ldouble: 1 + +# cacosh +Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": +double: 1 +float: 7 +idouble: 1 +ifloat: 7 +Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": +double: 1 +float: 3 +idouble: 1 +ifloat: 3 +ildouble: 1 +ldouble: 1 + +# casin +Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": +ildouble: 1 +ldouble: 1 + +# casinh +Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": +double: 5 +float: 1 +idouble: 5 +ifloat: 1 +ildouble: 4 +ldouble: 4 +Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": +double: 3 +float: 6 +idouble: 3 +ifloat: 6 +ildouble: 2 +ldouble: 2 +Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# catan +Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": +float: 3 +ifloat: 3 +Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i": +float: 4 +ifloat: 4 +Test "Imaginary part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i": +ildouble: 1 +ldouble: 1 + +# catanh +Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i": +double: 4 +idouble: 4 +Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i": +float: 4 +ifloat: 4 +Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i": +float: 6 +ifloat: 6 +ildouble: 1 +ldouble: 1 + +# cbrt +Test "cbrt (-0.001) == -0.1": +ildouble: 1 +ldouble: 1 +Test "cbrt (-27.0) == -3.0": +double: 1 +idouble: 1 +Test "cbrt (0.75) == 0.908560296416069829445605878163630251": +double: 1 +idouble: 1 +Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217": +double: 1 +idouble: 1 + +# ccos +Test "Real part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i": +float: 1 +ifloat: 1 + +# ccosh +Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": +float: 1 +ifloat: 1 + +# cexp +Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": +ildouble: 1 +ldouble: 1 + +# clog +Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i": +float: 3 +ifloat: 3 +Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# clog10 +Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": +double: 1 +float: 5 +idouble: 1 +ifloat: 5 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# cos +Test "cos (M_PI_6l * 2.0) == 0.5": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos (M_PI_6l * 4.0) == -0.5": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos (pi/2) == 0": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# cpow +Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": +float: 1 +ifloat: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +ildouble: 4 +ldouble: 4 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i": +double: 2 +float: 3 +idouble: 2 +ifloat: 3 +ildouble: 10 +ldouble: 10 +Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i": +ildouble: 2 +ldouble: 2 +Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +ildouble: 3 +ldouble: 3 +Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": +float: 2 +ifloat: 2 +Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# csin +Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i": +ildouble: 1 +ldouble: 1 + +# csinh +Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i": +double: 1 +idouble: 1 +Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": +float: 1 +ifloat: 1 + +# csqrt +Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0.75 + 1.25 i) == 1.05065169626078392338656675760808326 + 0.594868882070379067881984030639932657 i": +ildouble: 1 +ldouble: 1 + +# ctan +Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 + +# ctanh +Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i": +float: 1 +ifloat: 1 +Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": +double: 1 +idouble: 1 + +# erf +Test "erf (1.25) == 0.922900128256458230136523481197281140": +double: 1 +idouble: 1 + +# erfc +Test "erfc (0.75) == 0.288844366346484868401062165408589223": +float: 1 +ifloat: 1 +Test "erfc (2.0) == 0.00467773498104726583793074363274707139": +double: 1 +idouble: 1 +Test "erfc (27.0) == 0.523704892378925568501606768284954709e-318": +ildouble: 1 +ldouble: 1 +Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8": +double: 1 +idouble: 1 + +# exp10 +Test "exp10 (-1) == 0.1": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "exp10 (0.75) == 5.62341325190349080394951039776481231": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "exp10 (3) == 1000": +double: 6 +float: 2 +idouble: 6 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# exp2 +Test "exp2 (10) == 1024": +ildouble: 2 +ldouble: 2 + +# expm1 +Test "expm1 (0.75) == 1.11700001661267466854536981983709561": +double: 1 +idouble: 1 +Test "expm1 (1) == M_El - 1.0": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# gamma +Test "gamma (-0.5) == log(2*sqrt(pi))": +ildouble: 1 +ldouble: 1 + +# hypot +Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 + +# j0 +Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "j0 (0.75) == 0.864242275166648623555731103820923211": +float: 1 +ifloat: 1 +Test "j0 (10.0) == -0.245935764451348335197760862485328754": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "j0 (2.0) == 0.223890779141235668051827454649948626": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "j0 (8.0) == 0.171650807137553906090869407851972001": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# j1 +Test "j1 (-1.0) == -0.440050585744933515959682203718914913": +ildouble: 1 +ldouble: 1 +Test "j1 (0.75) == 0.349243602174862192523281016426251335": +ildouble: 1 +ldouble: 1 +Test "j1 (1.0) == 0.440050585744933515959682203718914913": +ildouble: 1 +ldouble: 1 +Test "j1 (10.0) == 0.0434727461688614366697487680258592883": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "j1 (2.0) == 0.576724807756873387202448242269137087": +double: 1 +idouble: 1 +Test "j1 (8.0) == 0.234636346853914624381276651590454612": +double: 1 +idouble: 1 +ildouble: 4 +ldouble: 4 + +# jn +Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "jn (0, 0.75) == 0.864242275166648623555731103820923211": +float: 1 +ifloat: 1 +Test "jn (0, 10.0) == -0.245935764451348335197760862485328754": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "jn (0, 2.0) == 0.223890779141235668051827454649948626": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "jn (0, 8.0) == 0.171650807137553906090869407851972001": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (1, -1.0) == -0.440050585744933515959682203718914913": +ildouble: 1 +ldouble: 1 +Test "jn (1, 0.75) == 0.349243602174862192523281016426251335": +ildouble: 1 +ldouble: 1 +Test "jn (1, 1.0) == 0.440050585744933515959682203718914913": +ildouble: 1 +ldouble: 1 +Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "jn (1, 2.0) == 0.576724807756873387202448242269137087": +double: 1 +idouble: 1 +Test "jn (1, 8.0) == 0.234636346853914624381276651590454612": +double: 1 +idouble: 1 +ildouble: 4 +ldouble: 4 +Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9": +ildouble: 1 +ldouble: 1 +Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9": +ildouble: 1 +ldouble: 1 +Test "jn (10, 10.0) == 0.207486106633358857697278723518753428": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 +ildouble: 2 +ldouble: 2 +Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6": +float: 4 +ifloat: 4 +Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "jn (3, 2.0) == 0.128943249474402051098793332969239835": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# lgamma +Test "lgamma (-0.5) == log(2*sqrt(pi))": +ildouble: 1 +ldouble: 1 +Test "lgamma (0.7) == 0.260867246531666514385732417016759578": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# log10 +Test "log10 (0.75) == -0.124938736608299953132449886193870744": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "log10 (e) == log10(e)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# log1p +Test "log1p (-0.25) == -0.287682072451780927439219005993827432": +float: 1 +ifloat: 1 + +# log2 +Test "log2 (0.75) == -.415037499278843818546261056052183492": +ildouble: 1 +ldouble: 1 + +# sincos +Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res": +float: 1 +ifloat: 1 + +# sqrt +Test "sqrt (2) == M_SQRT2l": +ildouble: 1 +ldouble: 1 + +# tan +Test "tan (pi/4) == 1": +double: 1 +idouble: 1 + +# tanh +Test "tanh (-0.75) == -0.635148952387287319214434357312496495": +ildouble: 1 +ldouble: 1 +Test "tanh (-1.0) == -0.7615941559557648881194582826047935904": +ildouble: 1 +ldouble: 1 +Test "tanh (0.75) == 0.635148952387287319214434357312496495": +ildouble: 1 +ldouble: 1 +Test "tanh (1.0) == 0.7615941559557648881194582826047935904": +ildouble: 1 +ldouble: 1 + +# tgamma +Test "tgamma (-0.5) == -2 sqrt (pi)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (0.5) == sqrt (pi)": +float: 1 +ifloat: 1 +Test "tgamma (0.7) == 1.29805533264755778568117117915281162": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (4) == 6": +ildouble: 1 +ldouble: 1 + +# y0 +Test "y0 (1.0) == 0.0882569642156769579829267660235151628": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (1.5) == 0.382448923797758843955068554978089862": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (10.0) == 0.0556711672835993914244598774101900481": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "y0 (2.0) == 0.510375672649745119596606592727157873": +double: 1 +idouble: 1 +Test "y0 (8.0) == 0.223521489387566220527323400498620359": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +# y1 +Test "y1 (0.125) == -5.19993611253477499595928744876579921": +double: 1 +idouble: 1 +Test "y1 (0.75) == -1.03759455076928541973767132140642198": +ildouble: 1 +ldouble: 1 +Test "y1 (1.5) == -0.412308626973911295952829820633445323": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y1 (10.0) == 0.249015424206953883923283474663222803": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "y1 (2.0) == -0.107032431540937546888370772277476637": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y1 (8.0) == -0.158060461731247494255555266187483550": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# yn +Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 1.5) == 0.382448923797758843955068554978089862": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "yn (0, 2.0) == 0.510375672649745119596606592727157873": +double: 1 +idouble: 1 +Test "yn (0, 8.0) == 0.223521489387566220527323400498620359": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "yn (1, 0.125) == -5.19993611253477499595928744876579921": +double: 1 +idouble: 1 +Test "yn (1, 0.75) == -1.03759455076928541973767132140642198": +ildouble: 1 +ldouble: 1 +Test "yn (1, 1.5) == -0.412308626973911295952829820633445323": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (1, 10.0) == 0.249015424206953883923283474663222803": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "yn (1, 2.0) == -0.107032431540937546888370772277476637": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (1, 8.0) == -0.158060461731247494255555266187483550": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "yn (10, 0.125) == -127057845771019398.252538486899753195": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 +Test "yn (10, 0.75) == -2133501638.90573424452445412893839236": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 5 +ldouble: 5 +Test "yn (10, 1.0) == -121618014.278689189288130426667971145": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "yn (10, 10.0) == -0.359814152183402722051986577343560609": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "yn (10, 2.0) == -129184.542208039282635913145923304214": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (3, 0.125) == -2612.69757350066712600220955744091741": +double: 1 +idouble: 1 +Test "yn (3, 0.75) == -12.9877176234475433186319774484809207": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (3, 10.0) == -0.251362657183837329779204747654240998": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (3, 2.0) == -1.12778377684042778608158395773179238": +double: 1 +idouble: 1 + +# Maximal error of functions: +Function: "atan2": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "atanh": +float: 1 +ifloat: 1 + +Function: Imaginary part of "cacos": +ildouble: 1 +ldouble: 1 + +Function: Real part of "cacosh": +double: 1 +float: 7 +idouble: 1 +ifloat: 7 + +Function: Imaginary part of "cacosh": +double: 1 +float: 3 +idouble: 1 +ifloat: 3 +ildouble: 1 +ldouble: 1 + +Function: Real part of "casin": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "casin": +ildouble: 1 +ldouble: 1 + +Function: Real part of "casinh": +double: 5 +float: 1 +idouble: 5 +ifloat: 1 +ildouble: 4 +ldouble: 4 + +Function: Imaginary part of "casinh": +double: 3 +float: 6 +idouble: 3 +ifloat: 6 +ildouble: 2 +ldouble: 2 + +Function: Real part of "catan": +float: 4 +ifloat: 4 + +Function: Imaginary part of "catan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "catanh": +double: 4 +idouble: 4 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "catanh": +float: 6 +ifloat: 6 +ildouble: 1 +ldouble: 1 + +Function: "cbrt": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ccos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ccos": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ccosh": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "cexp": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "cexp": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "clog": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "clog": +float: 3 +ifloat: 3 + +Function: Real part of "clog10": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "clog10": +double: 1 +float: 5 +idouble: 1 +ifloat: 5 +ildouble: 1 +ldouble: 1 + +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "cpow": +double: 2 +float: 4 +idouble: 2 +ifloat: 4 +ildouble: 10 +ldouble: 10 + +Function: Imaginary part of "cpow": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: Real part of "csin": +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csin": +ildouble: 1 +ldouble: 1 + +Function: Real part of "csinh": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "csqrt": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csqrt": +ildouble: 1 +ldouble: 1 + +Function: Real part of "ctan": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ctan": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 + +Function: Real part of "ctanh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ctanh": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "erf": +double: 1 +idouble: 1 + +Function: "erfc": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "exp10": +double: 6 +float: 2 +idouble: 6 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "exp2": +ildouble: 2 +ldouble: 2 + +Function: "expm1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "gamma": +ildouble: 1 +ldouble: 1 + +Function: "hypot": +float: 1 +ifloat: 1 + +Function: "j0": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: "j1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 4 +ldouble: 4 + +Function: "jn": +double: 4 +float: 4 +idouble: 4 +ifloat: 4 +ildouble: 4 +ldouble: 4 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "log10": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "log1p": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "log2": +ildouble: 1 +ldouble: 1 + +Function: "sincos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sqrt": +ildouble: 1 +ldouble: 1 + +Function: "tan": +double: 1 +idouble: 1 + +Function: "tanh": +ildouble: 1 +ldouble: 1 + +Function: "tgamma": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "y0": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +Function: "y1": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "yn": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 5 +ldouble: 5 + +# end of automatic generation diff --git a/test/math/libm-test-ulps-sh b/test/math/libm-test-ulps-sh new file mode 100644 index 000000000..4831f4849 --- /dev/null +++ b/test/math/libm-test-ulps-sh @@ -0,0 +1,1094 @@ +# Begin of automatic generation + +# asin +Test "asin (-0.5) == -pi/6": +float: 2 +ifloat: 2 +Test "asin (0.5) == pi/6": +float: 2 +ifloat: 2 +Test "asin (0.7) == 0.7753974966107530637": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# atan2 +Test "atan2 (0.7, -1.0) == 2.530866689200584621918884506789267": +float: 3 +ifloat: 3 +Test "atan2 (-0.7, -1.0) == -2.530866689200584621918884506789267": +float: 3 +ifloat: 3 +Test "atan2 (1.4, -0.93) == 2.1571487668237843754887415992772736": +float: 4 +ifloat: 4 + +# atanh +Test "atanh (0.7) == 0.8673005276940531944": +double: 1 +idouble: 1 + +# cabs +Test "cabs (-0.7 + 12.4 i) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "cabs (-0.7 - 12.4 i) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "cabs (-12.4 + 0.7 i) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "cabs (-12.4 - 0.7 i) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "cabs (0.7 + 1.2 i) == 1.3892443989449804508432547041028554": +double: 1 +idouble: 1 +Test "cabs (0.7 + 12.4 i) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 + +# cacos +Test "Real part of: cacos (0.7 + 1.2 i) == 1.1351827477151551088992008271819053 - 1.0927647857577371459105272080819308 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cacos (0.7 + 1.2 i) == 1.1351827477151551088992008271819053 - 1.0927647857577371459105272080819308 i": +float: 1 +ifloat: 1 + +# cacosh +Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": +double: 1 +float: 7 +idouble: 1 +ifloat: 7 +Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": +double: 1 +float: 3 +idouble: 1 +ifloat: 3 +Test "Real part of: cacosh (0.7 + 1.2 i) == 1.0927647857577371459105272080819308 + 1.1351827477151551088992008271819053 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# casin +Test "Real part of: casin (0.7 + 1.2 i) == 0.4356135790797415103321208644578462 + 1.0927647857577371459105272080819308 i": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +Test "Imaginary part of: casin (0.7 + 1.2 i) == 0.4356135790797415103321208644578462 + 1.0927647857577371459105272080819308 i": +float: 1 +ifloat: 1 + +# casinh +Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": +double: 5 +float: 1 +idouble: 5 +ifloat: 1 +Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": +double: 3 +float: 6 +idouble: 3 +ifloat: 6 +Test "Real part of: casinh (0.7 + 1.2 i) == 0.97865459559367387689317593222160964 + 0.91135418953156011567903546856170941 i": +double: 1 +idouble: 1 +Test "Imaginary part of: casinh (0.7 + 1.2 i) == 0.97865459559367387689317593222160964 + 0.91135418953156011567903546856170941 i": +float: 1 +ifloat: 1 + +# catan +Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": +float: 3 +ifloat: 3 +Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: catan (0.7 + 1.2 i) == 1.0785743834118921877443707996386368 + 0.57705737765343067644394541889341712 i": +float: 4 +ifloat: 4 +Test "Imaginary part of: catan (0.7 + 1.2 i) == 1.0785743834118921877443707996386368 + 0.57705737765343067644394541889341712 i": +double: 1 +idouble: 1 + +# catanh +Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i": +double: 4 +idouble: 4 +Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i": +float: 4 +ifloat: 4 +Test "Real part of: catanh (0.7 + 1.2 i) == 0.2600749516525135959200648705635915 + 0.97024030779509898497385130162655963 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: catanh (0.7 + 1.2 i) == 0.2600749516525135959200648705635915 + 0.97024030779509898497385130162655963 i": +double: 1 +float: 6 +idouble: 1 +ifloat: 6 + +# cbrt +Test "cbrt (-27.0) == -3.0": +double: 1 +idouble: 1 +Test "cbrt (0.970299) == 0.99": +double: 1 +idouble: 1 + +# ccos +Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i": +float: 1 +ifloat: 1 +Test "Real part of: ccos (0.7 + 1.2 i) == 1.3848657645312111080 - 0.97242170335830028619 i": +double: 1 +idouble: 1 +Test "Imaginary part of: ccos (0.7 + 1.2 i) == 1.3848657645312111080 - 0.97242170335830028619 i": +double: 1 +idouble: 1 + +# ccosh +Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i": +float: 1 +ifloat: 1 +Test "Real part of: ccosh (0.7 + 1.2 i) == 0.4548202223691477654 + 0.7070296600921537682 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (0.7 + 1.2 i) == 0.4548202223691477654 + 0.7070296600921537682 i": +double: 1 +idouble: 1 + +# cexp +Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": +float: 1 +ifloat: 1 +Test "Real part of: cexp (0.7 + 1.2 i) == 0.7296989091503236012 + 1.8768962328348102821 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: cexp (0.7 + 1.2 i) == 0.7296989091503236012 + 1.8768962328348102821 i": +float: 1 +ifloat: 1 + +# clog +Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i": +double: 1 +float: 3 +idouble: 1 +ifloat: 3 + +# clog10 +Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": +double: 1 +float: 5 +idouble: 1 +ifloat: 5 +Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i": +float: 1 +ifloat: 1 +Test "Real part of: clog10 (0.7 + 1.2 i) == 0.1427786545038868803 + 0.4528483579352493248 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0.7 + 1.2 i) == 0.1427786545038868803 + 0.4528483579352493248 i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i": +float: 1 +ifloat: 1 + +# cos +Test "cos (0.7) == 0.7648421872844884262": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "cos (M_PI_6l * 2.0) == 0.5": +double: 1 +float: 0.5 +idouble: 1 +ifloat: 0.5 +Test "cos (M_PI_6l * 4.0) == -0.5": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "cos (pi/2) == 0": +double: 0.2758 +float: 0.3667 +idouble: 0.2758 +ifloat: 0.3667 + +# cpow +Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": +float: 2 +ifloat: 2 +Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i": +double: 1.1031 +float: 1.5 +idouble: 1.1031 +ifloat: 1.5 + +# csin +Test "Imaginary part of: csin (0.7 + 1.2 i) == 1.1664563419657581376 + 1.1544997246948547371 i": +float: 1 +ifloat: 1 + +# csinh +Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i": +double: 1 +idouble: 1 +Test "Real part of: csinh (0.7 + 1.2 i) == 0.27487868678117583582 + 1.1698665727426565139 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: csinh (0.7 + 1.2 i) == 0.27487868678117583582 + 1.1698665727426565139 i": +float: 1 +ifloat: 1 + +# csqrt +Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 +Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 +Test "Real part of: csqrt (0.7 + 1.2 i) == 1.022067610030026450706487883081139 + 0.58704531296356521154977678719838035 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: csqrt (0.7 + 1.2 i) == 1.022067610030026450706487883081139 + 0.58704531296356521154977678719838035 i": +float: 1 +ifloat: 1 + +# ctan +Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +double: 1 +idouble: 1 +Test "Real part of: ctan (0.7 + 1.2 i) == 0.1720734197630349001 + 0.9544807059989405538 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: ctan (0.7 + 1.2 i) == 0.1720734197630349001 + 0.9544807059989405538 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# ctanh +Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i": +float: 1 +ifloat: 1 +Test "Real part of: ctanh (0.7 + 1.2 i) == 1.3472197399061191630 + 0.4778641038326365540 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "Imaginary part of: ctanh (0.7 + 1.2 i) == 1.3472197399061191630 + 0.4778641038326365540 i": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# erfc +Test "erfc (0.7) == 0.32219880616258152702": +double: 1 +idouble: 1 +Test "erfc (1.2) == 0.089686021770364619762": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +Test "erfc (2.0) == 0.0046777349810472658379": +double: 1 +idouble: 1 +Test "erfc (4.1) == 0.67000276540848983727e-8": +double: 24 +float: 12 +idouble: 24 +ifloat: 12 + +# exp10 +Test "exp10 (-1) == 0.1": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "exp10 (0.7) == 5.0118723362727228500": +float: 1 +ifloat: 1 +Test "exp10 (3) == 1000": +double: 6 +float: 2 +idouble: 6 +ifloat: 2 + +# expm1 +Test "expm1 (1) == M_El - 1.0": +float: 1 +ifloat: 1 + +# fmod +Test "fmod (-6.5, -2.3) == -1.9": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "fmod (-6.5, 2.3) == -1.9": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "fmod (6.5, -2.3) == 1.9": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "fmod (6.5, 2.3) == 1.9": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# hypot +Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, 1.2) == 1.3892443989449804508432547041028554": +double: 1 +idouble: 1 +Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 + +# j0 +Test "j0 (10.0) == -0.24593576445134833520": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "j0 (2.0) == 0.22389077914123566805": +float: 2 +ifloat: 2 +Test "j0 (8.0) == 0.17165080713755390609": +float: 1 +ifloat: 1 + +# j1 +Test "j1 (10.0) == 0.043472746168861436670": +float: 2 +ifloat: 2 +Test "j1 (2.0) == 0.57672480775687338720": +double: 1 +idouble: 1 +Test "j1 (8.0) == 0.23463634685391462438": +double: 1 +idouble: 1 + +# jn +Test "jn (0, 10.0) == -0.24593576445134833520": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "jn (0, 2.0) == 0.22389077914123566805": +float: 2 +ifloat: 2 +Test "jn (0, 8.0) == 0.17165080713755390609": +float: 1 +ifloat: 1 +Test "jn (1, 10.0) == 0.043472746168861436670": +float: 2 +ifloat: 2 +Test "jn (1, 2.0) == 0.57672480775687338720": +double: 1 +idouble: 1 +Test "jn (1, 8.0) == 0.23463634685391462438": +double: 1 +idouble: 1 +Test "jn (10, 0.1) == 0.26905328954342155795e-19": +double: 6 +float: 4 +idouble: 6 +ifloat: 4 +Test "jn (10, 0.7) == 0.75175911502153953928e-11": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "jn (10, 10.0) == 0.20748610663335885770": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 +Test "jn (10, 2.0) == 0.25153862827167367096e-6": +float: 4 +ifloat: 4 +Test "jn (3, 0.1) == 0.000020820315754756261429": +double: 1 +idouble: 1 +Test "jn (3, 0.7) == 0.0069296548267508408077": +float: 1 +ifloat: 1 +Test "jn (3, 10.0) == 0.058379379305186812343": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "jn (3, 2.0) == 0.12894324947440205110": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# lgamma +Test "lgamma (0.7) == 0.260867246531666514385732417016759578": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# log +Test "log (0.7) == -0.35667494393873237891263871124118447": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# log10 +Test "log10 (0.7) == -0.15490195998574316929": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "log10 (e) == log10(e)": +float: 1 +ifloat: 1 + +# log1p +Test "log1p (-0.3) == -0.35667494393873237891263871124118447": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# log2 +Test "log2 (0.7) == -0.51457317282975824043": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# sincos +Test "sincos (0.7, &sin_res, &cos_res) puts 0.76484218728448842626 in cos_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": +double: 1 +float: 0.5 +idouble: 1 +ifloat: 0.5 +Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.866025403784438646764 in sin_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res": +double: 0.2758 +float: 0.3667 +idouble: 0.2758 +ifloat: 0.3667 +Test "sincos (pi/6, &sin_res, &cos_res) puts 0.866025403784438646764 in cos_res": +float: 1 +ifloat: 1 + +# sinh +Test "sinh (0.7) == 0.75858370183953350346": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# tan +Test "tan (pi/4) == 1": +double: 0.5 +idouble: 0.5 + +# tanh +Test "tanh (0.7) == 0.60436777711716349631": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# tgamma +Test "tgamma (-0.5) == -2 sqrt (pi)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (0.5) == sqrt (pi)": +float: 1 +ifloat: 1 +Test "tgamma (0.7) == 1.29805533264755778568117117915281162": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# y0 +Test "y0 (0.7) == -0.19066492933739506743": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (1.0) == 0.088256964215676957983": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (1.5) == 0.38244892379775884396": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (10.0) == 0.055671167283599391424": +float: 1 +ifloat: 1 +Test "y0 (8.0) == 0.22352148938756622053": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# y1 +Test "y1 (0.1) == -6.4589510947020269877": +double: 1 +idouble: 1 +Test "y1 (0.7) == -1.1032498719076333697": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "y1 (1.5) == -0.41230862697391129595": +float: 1 +ifloat: 1 +Test "y1 (10.0) == 0.24901542420695388392": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "y1 (2.0) == -0.10703243154093754689": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "y1 (8.0) == -0.15806046173124749426": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# yn +Test "yn (0, 0.7) == -0.19066492933739506743": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 1.0) == 0.088256964215676957983": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 1.5) == 0.38244892379775884396": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 10.0) == 0.055671167283599391424": +float: 1 +ifloat: 1 +Test "yn (0, 8.0) == 0.22352148938756622053": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (1, 0.1) == -6.4589510947020269877": +double: 1 +idouble: 1 +Test "yn (1, 0.7) == -1.1032498719076333697": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (1, 1.5) == -0.41230862697391129595": +float: 1 +ifloat: 1 +Test "yn (1, 10.0) == 0.24901542420695388392": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "yn (1, 2.0) == -0.10703243154093754689": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (1, 8.0) == -0.15806046173124749426": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "yn (10, 0.1) == -0.11831335132045197885e19": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +Test "yn (10, 0.7) == -0.42447194260703866924e10": +double: 3 +idouble: 3 +Test "yn (10, 1.0) == -0.12161801427868918929e9": +double: 1 +idouble: 1 +Test "yn (10, 10.0) == -0.35981415218340272205": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (10, 2.0) == -129184.54220803928264": +double: 2 +idouble: 2 +Test "yn (3, 0.1) == -5099.3323786129048894": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (3, 0.7) == -15.819479052819633505": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "yn (3, 10.0) == -0.25136265718383732978": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (3, 2.0) == -1.1277837768404277861": +double: 1 +idouble: 1 + +# Maximal error of functions: +Function: "asin": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "atan2": +float: 4 +ifloat: 4 + +Function: "atanh": +double: 1 +idouble: 1 + +Function: "cabs": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "cacos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "cacos": +float: 1 +ifloat: 1 + +Function: Real part of "cacosh": +double: 1 +float: 7 +idouble: 1 +ifloat: 7 + +Function: Imaginary part of "cacosh": +double: 1 +float: 3 +idouble: 1 +ifloat: 3 + +Function: Real part of "casin": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 + +Function: Imaginary part of "casin": +float: 1 +ifloat: 1 + +Function: Real part of "casinh": +double: 5 +float: 1 +idouble: 5 +ifloat: 1 + +Function: Imaginary part of "casinh": +double: 3 +float: 6 +idouble: 3 +ifloat: 6 + +Function: Real part of "catan": +float: 4 +ifloat: 4 + +Function: Imaginary part of "catan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "catanh": +double: 4 +float: 1 +idouble: 4 +ifloat: 1 + +Function: Imaginary part of "catanh": +double: 1 +float: 6 +idouble: 1 +ifloat: 6 + +Function: "cbrt": +double: 1 +idouble: 1 + +Function: Real part of "ccos": +double: 1 +idouble: 1 + +Function: Imaginary part of "ccos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "cexp": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "cexp": +float: 1 +ifloat: 1 + +Function: Imaginary part of "clog": +double: 1 +float: 3 +idouble: 1 +ifloat: 3 + +Function: Real part of "clog10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "clog10": +double: 1 +float: 5 +idouble: 1 +ifloat: 5 + +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: Real part of "cpow": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 + +Function: Imaginary part of "cpow": +double: 1.1031 +float: 2 +idouble: 1.1031 +ifloat: 2 + +Function: Imaginary part of "csin": +float: 1 +ifloat: 1 + +Function: Real part of "csinh": +float: 1 +ifloat: 1 + +Function: Imaginary part of "csinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "csqrt": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "csqrt": +float: 1 +ifloat: 1 + +Function: Real part of "ctan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "ctan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "ctanh": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 + +Function: Imaginary part of "ctanh": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "erfc": +double: 24 +float: 12 +idouble: 24 +ifloat: 12 + +Function: "exp10": +double: 6 +float: 2 +idouble: 6 +ifloat: 2 + +Function: "expm1": +float: 1 +ifloat: 1 + +Function: "fmod": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "hypot": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "j0": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 + +Function: "j1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "jn": +double: 6 +float: 4 +idouble: 6 +ifloat: 4 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "log": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "log10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "log1p": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "log2": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "sincos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "sinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "tan": +double: 0.5 +idouble: 0.5 + +Function: "tanh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "tgamma": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "y0": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "y1": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 + +Function: "yn": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 + +# end of automatic generation diff --git a/test/math/libm-test-ulps-sparc b/test/math/libm-test-ulps-sparc new file mode 100644 index 000000000..6a447a1e5 --- /dev/null +++ b/test/math/libm-test-ulps-sparc @@ -0,0 +1,1338 @@ +# Begin of automatic generation + +# atan2 +Test "atan2 (-0.00756827042671106339, -.001792735857538728036) == -1.80338464113663849327153994379639112": +float: 6 +ifloat: 6 +ildouble: 1 +ldouble: 1 +Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025": +float: 3 +ifloat: 3 +ildouble: 1 +ldouble: 1 +Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025": +float: 3 +ifloat: 3 +ildouble: 1 +ldouble: 1 +Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# atanh +Test "atanh (0.75) == 0.972955074527656652552676371721589865": +float: 1 +ifloat: 1 + +# cacos +Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i": +ildouble: 1 +ldouble: 1 + +# cacosh +Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": +double: 1 +float: 7 +idouble: 1 +ifloat: 7 +ildouble: 5 +ldouble: 5 +Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": +double: 1 +float: 3 +idouble: 1 +ifloat: 3 +ildouble: 1 +ldouble: 1 + +# casin +Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": +ildouble: 1 +ldouble: 1 + +# casinh +Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": +double: 5 +float: 1 +idouble: 5 +ifloat: 1 +ildouble: 4 +ldouble: 4 +Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": +double: 3 +float: 6 +idouble: 3 +ifloat: 6 +ildouble: 2 +ldouble: 2 +Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# catan +Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": +float: 3 +ifloat: 3 +Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i": +float: 4 +ifloat: 4 +Test "Imaginary part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i": +ildouble: 1 +ldouble: 1 + +# catanh +Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i": +double: 4 +idouble: 4 +Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i": +float: 4 +ifloat: 4 +Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i": +float: 6 +ifloat: 6 +ildouble: 1 +ldouble: 1 + +# cbrt +Test "cbrt (-0.001) == -0.1": +ildouble: 1 +ldouble: 1 +Test "cbrt (-27.0) == -3.0": +double: 1 +idouble: 1 +Test "cbrt (0.75) == 0.908560296416069829445605878163630251": +double: 1 +idouble: 1 +Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217": +double: 1 +idouble: 1 + +# ccos +Test "Real part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i": +float: 1 +ifloat: 1 + +# ccosh +Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": +float: 1 +ifloat: 1 + +# cexp +Test "Real part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": +ildouble: 1 +ldouble: 1 + +# clog +Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i": +float: 3 +ifloat: 3 +Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# clog10 +Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": +double: 1 +float: 5 +idouble: 1 +ifloat: 5 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# cos +Test "cos (M_PI_6l * 2.0) == 0.5": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos (M_PI_6l * 4.0) == -0.5": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos (pi/2) == 0": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cpow +Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": +float: 1 +ifloat: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +ildouble: 4 +ldouble: 4 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i": +double: 2 +float: 3 +idouble: 2 +ifloat: 3 +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i": +ildouble: 2 +ldouble: 2 +Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +ildouble: 3 +ldouble: 3 +Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": +float: 2 +ifloat: 2 +Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# csin +Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i": +ildouble: 1 +ldouble: 1 + +# csinh +Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i": +double: 1 +idouble: 1 +Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": +float: 1 +ifloat: 1 + +# csqrt +Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csqrt (0.75 + 1.25 i) == 1.05065169626078392338656675760808326 + 0.594868882070379067881984030639932657 i": +ildouble: 1 +ldouble: 1 + +# ctan +Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 + +# ctanh +Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i": +float: 1 +ifloat: 1 +Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": +double: 1 +idouble: 1 + +# erf +Test "erf (0.75) == 0.711155633653515131598937834591410777": +double: 1 +idouble: 1 +Test "erf (1.25) == 0.922900128256458230136523481197281140": +double: 1 +idouble: 1 + +# erfc +Test "erfc (2.0) == 0.00467773498104726583793074363274707139": +double: 1 +idouble: 1 +Test "erfc (27.0) == 0.523704892378925568501606768284954709e-318": +ildouble: 1 +ldouble: 1 +Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8": +double: 1 +idouble: 1 + +# exp +Test "exp (1) == e": +double: 1 +idouble: 1 + +# exp10 +Test "exp10 (-1) == 0.1": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "exp10 (0.75) == 5.62341325190349080394951039776481231": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "exp10 (3) == 1000": +double: 6 +float: 2 +idouble: 6 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# exp2 +Test "exp2 (10) == 1024": +ildouble: 2 +ldouble: 2 + +# expm1 +Test "expm1 (0.75) == 1.11700001661267466854536981983709561": +double: 1 +idouble: 1 +Test "expm1 (1) == M_El - 1.0": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# gamma +Test "gamma (-0.5) == log(2*sqrt(pi))": +ildouble: 1 +ldouble: 1 + +# hypot +Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 + +# j0 +Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "j0 (0.75) == 0.864242275166648623555731103820923211": +float: 1 +ifloat: 1 +Test "j0 (10.0) == -0.245935764451348335197760862485328754": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "j0 (2.0) == 0.223890779141235668051827454649948626": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "j0 (8.0) == 0.171650807137553906090869407851972001": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# j1 +Test "j1 (-1.0) == -0.440050585744933515959682203718914913": +ildouble: 1 +ldouble: 1 +Test "j1 (0.75) == 0.349243602174862192523281016426251335": +ildouble: 1 +ldouble: 1 +Test "j1 (1.0) == 0.440050585744933515959682203718914913": +ildouble: 1 +ldouble: 1 +Test "j1 (10.0) == 0.0434727461688614366697487680258592883": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "j1 (2.0) == 0.576724807756873387202448242269137087": +double: 1 +idouble: 1 +Test "j1 (8.0) == 0.234636346853914624381276651590454612": +double: 1 +idouble: 1 +ildouble: 4 +ldouble: 4 + +# jn +Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (0, 0.75) == 0.864242275166648623555731103820923211": +float: 1 +ifloat: 1 +Test "jn (0, 10.0) == -0.245935764451348335197760862485328754": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "jn (0, 2.0) == 0.223890779141235668051827454649948626": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (0, 8.0) == 0.171650807137553906090869407851972001": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (1, -1.0) == -0.440050585744933515959682203718914913": +ildouble: 1 +ldouble: 1 +Test "jn (1, 0.75) == 0.349243602174862192523281016426251335": +ildouble: 1 +ldouble: 1 +Test "jn (1, 1.0) == 0.440050585744933515959682203718914913": +ildouble: 1 +ldouble: 1 +Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "jn (1, 2.0) == 0.576724807756873387202448242269137087": +double: 1 +idouble: 1 +Test "jn (1, 8.0) == 0.234636346853914624381276651590454612": +double: 1 +idouble: 1 +ildouble: 4 +ldouble: 4 +Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9": +ildouble: 1 +ldouble: 1 +Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9": +ildouble: 1 +ldouble: 1 +Test "jn (10, 10.0) == 0.207486106633358857697278723518753428": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 +ildouble: 2 +ldouble: 2 +Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6": +float: 4 +ifloat: 4 +Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "jn (3, 2.0) == 0.128943249474402051098793332969239835": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# lgamma +Test "lgamma (-0.5) == log(2*sqrt(pi))": +ildouble: 1 +ldouble: 1 +Test "lgamma (0.7) == 0.260867246531666514385732417016759578": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# log10 +Test "log10 (0.75) == -0.124938736608299953132449886193870744": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +Test "log10 (e) == log10(e)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# log1p +Test "log1p (-0.25) == -0.287682072451780927439219005993827432": +float: 1 +ifloat: 1 +Test "log1p (M_El - 1.0) == 1": +ildouble: 1 +ldouble: 1 + +# log2 +Test "log2 (0.75) == -.415037499278843818546261056052183492": +ildouble: 1 +ldouble: 1 + +# sincos +Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res": +float: 1 +ifloat: 1 + +# sqrt +Test "sqrt (2) == M_SQRT2l": +ildouble: 1 +ldouble: 1 + +# tan +Test "tan (pi/4) == 1": +double: 1 +idouble: 1 + +# tanh +Test "tanh (-0.75) == -0.635148952387287319214434357312496495": +ildouble: 1 +ldouble: 1 +Test "tanh (-1.0) == -0.7615941559557648881194582826047935904": +ildouble: 1 +ldouble: 1 +Test "tanh (0.75) == 0.635148952387287319214434357312496495": +ildouble: 1 +ldouble: 1 +Test "tanh (1.0) == 0.7615941559557648881194582826047935904": +ildouble: 1 +ldouble: 1 + +# tgamma +Test "tgamma (-0.5) == -2 sqrt (pi)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (0.5) == sqrt (pi)": +float: 1 +ifloat: 1 +Test "tgamma (0.7) == 1.29805533264755778568117117915281162": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (4) == 6": +ildouble: 1 +ldouble: 1 + +# y0 +Test "y0 (1.0) == 0.0882569642156769579829267660235151628": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (1.5) == 0.382448923797758843955068554978089862": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (10.0) == 0.0556711672835993914244598774101900481": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "y0 (8.0) == 0.223521489387566220527323400498620359": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +# y1 +Test "y1 (0.125) == -5.19993611253477499595928744876579921": +double: 1 +idouble: 1 +Test "y1 (0.75) == -1.03759455076928541973767132140642198": +ildouble: 1 +ldouble: 1 +Test "y1 (1.5) == -0.412308626973911295952829820633445323": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y1 (10.0) == 0.249015424206953883923283474663222803": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "y1 (2.0) == -0.107032431540937546888370772277476637": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y1 (8.0) == -0.158060461731247494255555266187483550": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# yn +Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 1.5) == 0.382448923797758843955068554978089862": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481": +float: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "yn (0, 8.0) == 0.223521489387566220527323400498620359": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 +Test "yn (1, 0.125) == -5.19993611253477499595928744876579921": +double: 1 +idouble: 1 +Test "yn (1, 0.75) == -1.03759455076928541973767132140642198": +ildouble: 1 +ldouble: 1 +Test "yn (1, 1.5) == -0.412308626973911295952829820633445323": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (1, 10.0) == 0.249015424206953883923283474663222803": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "yn (1, 2.0) == -0.107032431540937546888370772277476637": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (1, 8.0) == -0.158060461731247494255555266187483550": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "yn (10, 0.125) == -127057845771019398.252538486899753195": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 +Test "yn (10, 0.75) == -2133501638.90573424452445412893839236": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 5 +ldouble: 5 +Test "yn (10, 1.0) == -121618014.278689189288130426667971145": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "yn (10, 10.0) == -0.359814152183402722051986577343560609": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (10, 2.0) == -129184.542208039282635913145923304214": +double: 2 +idouble: 2 +ildouble: 2 +ldouble: 2 +Test "yn (3, 0.125) == -2612.69757350066712600220955744091741": +double: 1 +idouble: 1 +Test "yn (3, 0.75) == -12.9877176234475433186319774484809207": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (3, 10.0) == -0.251362657183837329779204747654240998": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (3, 2.0) == -1.12778377684042778608158395773179238": +double: 1 +idouble: 1 + +# Maximal error of functions: +Function: "atan2": +float: 6 +ifloat: 6 +ildouble: 1 +ldouble: 1 + +Function: "atanh": +float: 1 +ifloat: 1 + +Function: Imaginary part of "cacos": +ildouble: 1 +ldouble: 1 + +Function: Real part of "cacosh": +double: 1 +float: 7 +idouble: 1 +ifloat: 7 +ildouble: 5 +ldouble: 5 + +Function: Imaginary part of "cacosh": +double: 1 +float: 3 +idouble: 1 +ifloat: 3 +ildouble: 1 +ldouble: 1 + +Function: Real part of "casin": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "casin": +ildouble: 1 +ldouble: 1 + +Function: Real part of "casinh": +double: 5 +float: 1 +idouble: 5 +ifloat: 1 +ildouble: 4 +ldouble: 4 + +Function: Imaginary part of "casinh": +double: 3 +float: 6 +idouble: 3 +ifloat: 6 +ildouble: 2 +ldouble: 2 + +Function: Real part of "catan": +float: 4 +ifloat: 4 + +Function: Imaginary part of "catan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "catanh": +double: 4 +idouble: 4 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "catanh": +float: 6 +ifloat: 6 +ildouble: 1 +ldouble: 1 + +Function: "cbrt": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ccos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ccos": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ccosh": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "cexp": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "cexp": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "clog": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "clog": +float: 3 +ifloat: 3 + +Function: Real part of "clog10": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "clog10": +double: 1 +float: 5 +idouble: 1 +ifloat: 5 +ildouble: 1 +ldouble: 1 + +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "cpow": +double: 2 +float: 4 +idouble: 2 +ifloat: 4 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "cpow": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: Real part of "csin": +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csin": +ildouble: 1 +ldouble: 1 + +Function: Real part of "csinh": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "csqrt": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csqrt": +ildouble: 1 +ldouble: 1 + +Function: Real part of "ctan": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ctan": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 + +Function: Real part of "ctanh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ctanh": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "erf": +double: 1 +idouble: 1 + +Function: "erfc": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: "exp": +double: 1 +idouble: 1 + +Function: "exp10": +double: 6 +float: 2 +idouble: 6 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "exp2": +ildouble: 2 +ldouble: 2 + +Function: "expm1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "gamma": +ildouble: 1 +ldouble: 1 + +Function: "hypot": +float: 1 +ifloat: 1 + +Function: "j0": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: "j1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 4 +ldouble: 4 + +Function: "jn": +double: 4 +float: 4 +idouble: 4 +ifloat: 4 +ildouble: 4 +ldouble: 4 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "log": +float: 1 +ifloat: 1 + +Function: "log10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "log1p": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "log2": +ildouble: 1 +ldouble: 1 + +Function: "sincos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "sqrt": +ildouble: 1 +ldouble: 1 + +Function: "tan": +double: 1 +idouble: 1 + +Function: "tanh": +ildouble: 1 +ldouble: 1 + +Function: "tgamma": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "y0": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +Function: "y1": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "yn": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 5 +ldouble: 5 + +# end of automatic generation diff --git a/test/math/libm-test-ulps-x86_64 b/test/math/libm-test-ulps-x86_64 new file mode 100644 index 000000000..0ced4be7b --- /dev/null +++ b/test/math/libm-test-ulps-x86_64 @@ -0,0 +1,1308 @@ +# Begin of automatic generation + +# acos +Test "acos (0.75) == 0.722734247813415611178377352641333362": +ildouble: 1 +ldouble: 1 + +# asin +Test "asin (-0.5) == -pi/6": +ildouble: 1 +ldouble: 1 +Test "asin (-1.0) == -pi/2": +ildouble: 1 +ldouble: 1 +Test "asin (0.5) == pi/6": +ildouble: 1 +ldouble: 1 +Test "asin (0.75) == 0.848062078981481008052944338998418080": +ildouble: 1 +ldouble: 1 +Test "asin (1.0) == pi/2": +ildouble: 1 +ldouble: 1 + +# atan2 +Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025": +float: 1 +ifloat: 1 +Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025": +float: 1 +ifloat: 1 +Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772": +float: 1 +ifloat: 1 + +# atanh +Test "atanh (0.75) == 0.972955074527656652552676371721589865": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# cacos +Test "Imaginary part of: cacos (0.75 + 1.25 i) == 1.11752014915610270578240049553777969 - 1.13239363160530819522266333696834467 i": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +# cacosh +Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": +double: 1 +float: 7 +idouble: 1 +ifloat: 7 +ildouble: 6 +ldouble: 6 +Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i": +double: 1 +float: 3 +idouble: 1 +ifloat: 3 +ildouble: 1 +ldouble: 1 +Test "Real part of: cacosh (0.75 + 1.25 i) == 1.13239363160530819522266333696834467 + 1.11752014915610270578240049553777969 i": +ildouble: 1 +ldouble: 1 + +# casin +Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +# casinh +Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": +double: 5 +float: 1 +idouble: 5 +ifloat: 1 +ildouble: 5 +ldouble: 5 +Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i": +double: 3 +float: 6 +idouble: 3 +ifloat: 6 +ildouble: 5 +ldouble: 5 +Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ldouble: 1 +ildouble: 1 + +# catan +Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": +float: 3 +ifloat: 3 +Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i": +float: 4 +ifloat: 4 + +# catanh +Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i": +double: 4 +idouble: 4 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i": +float: 4 +ifloat: 4 +Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i": +double: 1 +idouble: 1 +Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i": +float: 6 +ifloat: 6 + +# cbrt +Test "cbrt (-0.001) == -0.1": +ildouble: 1 +ldouble: 1 +Test "cbrt (-27.0) == -3.0": +double: 1 +idouble: 1 +Test "cbrt (0.75) == 0.908560296416069829445605878163630251": +double: 1 +idouble: 1 +Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# ccos +Test "Real part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i": +double: 1 +idouble: 1 +Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i": +ildouble: 1 +ldouble: 1 +float: 1 +ifloat: 1 + +# ccosh +Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i": +float: 1 +ifloat: 1 + +# cexp +Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i": +float: 1 +ifloat: 1 +Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i": +ildouble: 1 +ldouble: 1 + +# clog +Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i": +float: 3 +ifloat: 3 +Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# clog10 +Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i": +double: 1 +float: 5 +idouble: 1 +ifloat: 5 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf + inf i) == inf + 3/4 pi*log10(e) i": +double: 1 +idouble: 1 +Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# cos +Test "cos (M_PI_6l * 2.0) == 0.5": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "cos (M_PI_6l * 4.0) == -0.5": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos (pi/2) == 0": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "cos (0.80190127184058835) == 0.69534156199418473": +double: 1 +idouble: 1 + +# cpow +Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": +float: 1 +ifloat: 1 +ldouble: 1 +ildouble: 1 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i": +double: 1 +float: 4 +idouble: 1 +ifloat: 4 +ildouble: 5 +ldouble: 5 +Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i": +ildouble: 2 +ldouble: 2 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 0.0 i) == 0.75 + 1.25 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i": +double: 2 +float: 3 +idouble: 2 +ifloat: 3 +ildouble: 3 +ldouble: 3 +Test "Real part of: cpow (2 + 0 i, 10 + 0 i) == 1024.0 + 0.0 i": +ildouble: 1 +ldouble: 1 +Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": +double: 1 +float: 5 +idouble: 1 +ifloat: 5 +Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i": +float: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 +Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# csin +Test "Real part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csin (0.75 + 1.25 i) == 1.28722291002649188575873510790565441 + 1.17210635989270256101081285116138863 i": +float: 1 +ifloat: 1 +Test "Imaginary part of: csin (-2 - 3 i) == -9.15449914691142957346729954460983256 + 4.16890695996656435075481305885375484 i": +double: 1 +idouble: 1 + +# csinh +Test "Real part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i": +double: 1 +idouble: 1 +Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i": +float: 1 +ifloat: 1 + +# csqrt +Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 +Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i": +float: 1 +ifloat: 1 + +# ctan +Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +double: 1 +idouble: 1 +ildouble: 439 +ldouble: 439 +Test "Imaginary part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "Real part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i": +ildouble: 1 +ldouble: 1 +Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +# ctanh +Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": +float: 2 +ifloat: 2 +ildouble: 5 +ldouble: 5 +double: 1 +idouble: 1 +Test "Imaginary part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": +ildouble: 25 +ldouble: 25 +Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i": +float: 1 +ifloat: 1 +Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": +double: 1 +idouble: 1 +Test "Imaginary part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i": +ildouble: 1 +ldouble: 1 +double: 1 +idouble: 1 + +# erf +Test "erf (1.25) == 0.922900128256458230136523481197281140": +double: 1 +idouble: 1 + +# erfc +Test "erfc (1.25) == 0.0770998717435417698634765188027188596": +ildouble: 1 +ldouble: 1 +Test "erfc (2.0) == 0.00467773498104726583793074363274707139": +double: 1 +idouble: 1 +Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# exp10 +Test "exp10 (-1) == 0.1": +ildouble: 1 +ldouble: 1 +float: 1 +ifloat: 1 +double: 2 +idouble: 2 +Test "exp10 (0.75) == 5.62341325190349080394951039776481231": +ildouble: 2 +ldouble: 2 +float: 1 +ifloat: 1 +double: 1 +idouble: 1 +Test "exp10 (3) == 1000": +ildouble: 8 +ldouble: 8 +float: 2 +ifloat: 2 +double: 6 +idouble: 6 + +# expm1 +Test "expm1 (0.75) == 1.11700001661267466854536981983709561": +double: 1 +idouble: 1 +Test "expm1 (1) == M_El - 1.0": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# gamma +Test "gamma (-0.5) == log(2*sqrt(pi))": +ildouble: 1 +ldouble: 1 + +# hypot +Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 + +# j0 +Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "j0 (0.75) == 0.864242275166648623555731103820923211": +float: 1 +ifloat: 1 +Test "j0 (10.0) == -0.245935764451348335197760862485328754": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "j0 (2.0) == 0.223890779141235668051827454649948626": +float: 2 +ifloat: 2 +Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "j0 (8.0) == 0.171650807137553906090869407851972001": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# j1 +Test "j1 (10.0) == 0.0434727461688614366697487680258592883": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "j1 (2.0) == 0.576724807756873387202448242269137087": +double: 1 +idouble: 1 +Test "j1 (8.0) == 0.234636346853914624381276651590454612": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +# jn +Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (0, 0.75) == 0.864242275166648623555731103820923211": +float: 1 +ifloat: 1 +Test "jn (0, 10.0) == -0.245935764451348335197760862485328754": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "jn (0, 2.0) == 0.223890779141235668051827454649948626": +float: 2 +ifloat: 2 +Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (0, 8.0) == 0.171650807137553906090869407851972001": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "jn (1, 2.0) == 0.576724807756873387202448242269137087": +double: 1 +idouble: 1 +Test "jn (1, 8.0) == 0.234636346853914624381276651590454612": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "jn (10, -1.0) == 0.263061512368745320699785368779050294e-9": +ildouble: 1 +ldouble: 1 +Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "jn (10, 1.0) == 0.263061512368745320699785368779050294e-9": +ildouble: 1 +ldouble: 1 +Test "jn (10, 10.0) == 0.207486106633358857697278723518753428": +double: 4 +float: 3 +idouble: 4 +ifloat: 3 +ildouble: 2 +ldouble: 2 +Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6": +float: 4 +ifloat: 4 +ildouble: 1 +ldouble: 1 +Test "jn (3, -1.0) == -0.0195633539826684059189053216217515083": +ildouble: 1 +ldouble: 1 +Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "jn (3, 1.0) == 0.0195633539826684059189053216217515083": +ildouble: 1 +ldouble: 1 +Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "jn (3, 2.0) == 0.128943249474402051098793332969239835": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# lgamma +Test "lgamma (-0.5) == log(2*sqrt(pi))": +ildouble: 1 +ldouble: 1 +Test "lgamma (0.7) == 0.260867246531666514385732417016759578": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# log10 +Test "log10 (0.75) == -0.124938736608299953132449886193870744": +ildouble: 1 +ldouble: 1 +float: 2 +ifloat: 2 +double: 1 +idouble: 1 +Test "log10 (e) == log10(e)": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# log1p +Test "log1p (-0.25) == -0.287682072451780927439219005993827432": +float: 1 +ifloat: 1 + +# sincos +Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res": +float: 1 +ifloat: 1 +Test "sincos (0.80190127184058835, &sin_res, &cos_res) puts 0.69534156199418473 in cos_res": +double: 1 +idouble: 1 + +# tan +Test "tan (pi/4) == 1": +double: 1 +idouble: 1 + +# tgamma +Test "tgamma (-0.5) == -2 sqrt (pi)": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "tgamma (0.5) == sqrt (pi)": +float: 1 +ifloat: 1 +Test "tgamma (0.7) == 1.29805533264755778568117117915281162": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "tgamma (4) == 6": +ildouble: 1 +ldouble: 1 + +# y0 +Test "y0 (0.125) == -1.38968062514384052915582277745018693": +ildouble: 1 +ldouble: 1 +Test "y0 (1.0) == 0.0882569642156769579829267660235151628": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y0 (1.5) == 0.382448923797758843955068554978089862": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "y0 (10.0) == 0.0556711672835993914244598774101900481": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y0 (8.0) == 0.223521489387566220527323400498620359": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +# y1 +Test "y1 (0.125) == -5.19993611253477499595928744876579921": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "y1 (1.5) == -0.412308626973911295952829820633445323": +float: 1 +ifloat: 1 +Test "y1 (10.0) == 0.249015424206953883923283474663222803": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "y1 (2.0) == -0.107032431540937546888370772277476637": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "y1 (8.0) == -0.158060461731247494255555266187483550": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +# yn +Test "yn (0, 0.125) == -1.38968062514384052915582277745018693": +ildouble: 1 +ldouble: 1 +Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (0, 1.5) == 0.382448923797758843955068554978089862": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (0, 8.0) == 0.223521489387566220527323400498620359": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (1, 0.125) == -5.19993611253477499595928744876579921": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "yn (1, 1.5) == -0.412308626973911295952829820633445323": +float: 1 +ifloat: 1 +Test "yn (1, 10.0) == 0.249015424206953883923283474663222803": +double: 3 +float: 1 +idouble: 3 +ifloat: 1 +Test "yn (1, 2.0) == -0.107032431540937546888370772277476637": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 +Test "yn (1, 8.0) == -0.158060461731247494255555266187483550": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 +Test "yn (10, 0.125) == -127057845771019398.252538486899753195": +double: 1 +idouble: 1 +ildouble: 2 +ldouble: 2 +Test "yn (10, 0.75) == -2133501638.90573424452445412893839236": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 4 +ldouble: 4 +Test "yn (10, 1.0) == -121618014.278689189288130426667971145": +double: 1 +idouble: 1 +Test "yn (10, 10.0) == -0.359814152183402722051986577343560609": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (10, 2.0) == -129184.542208039282635913145923304214": +double: 2 +idouble: 2 +Test "yn (3, 0.125) == -2612.69757350066712600220955744091741": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 +Test "yn (3, 0.75) == -12.9877176234475433186319774484809207": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 +Test "yn (3, 10.0) == -0.251362657183837329779204747654240998": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "yn (3, 2.0) == -1.12778377684042778608158395773179238": +double: 1 +idouble: 1 + +# Maximal error of functions: +Function: "acos": +ildouble: 1 +ldouble: 1 + +Function: "asin": +ildouble: 1 +ldouble: 1 + +Function: "atan2": +float: 1 +ifloat: 1 + +Function: "atanh": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "cacos": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Real part of "cacosh": +double: 1 +float: 7 +idouble: 1 +ifloat: 7 +ildouble: 6 +ldouble: 6 + +Function: Imaginary part of "cacosh": +double: 1 +float: 3 +idouble: 1 +ifloat: 3 +ildouble: 1 +ldouble: 1 + +Function: Real part of "casin": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Imaginary part of "casin": +float: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Real part of "casinh": +double: 5 +float: 1 +idouble: 5 +ifloat: 1 +ildouble: 5 +ldouble: 5 + +Function: Imaginary part of "casinh": +double: 3 +float: 6 +idouble: 3 +ifloat: 6 +ildouble: 5 +ldouble: 5 + +Function: Real part of "catan": +float: 4 +ifloat: 4 + +Function: Imaginary part of "catan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "catanh": +double: 4 +idouble: 4 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "catanh": +float: 6 +ifloat: 6 + +Function: "cbrt": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ccos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "ccos": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Imaginary part of "ccosh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "cexp": +float: 1 +ifloat: 1 + +Function: Imaginary part of "cexp": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "clog": +float: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "clog": +float: 3 +ifloat: 3 + +Function: Real part of "clog10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "clog10": +double: 1 +float: 5 +idouble: 1 +ifloat: 5 +ildouble: 1 +ldouble: 1 + +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Real part of "cpow": +double: 2 +float: 5 +idouble: 2 +ifloat: 5 +ildouble: 5 +ldouble: 5 + +Function: Imaginary part of "cpow": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 2 +ldouble: 2 + +Function: Real part of "csin": +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csin": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: Real part of "csinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: Imaginary part of "csinh": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 2 +ldouble: 2 + +Function: Real part of "csqrt": +float: 1 +ifloat: 1 + +Function: Real part of "ctan": +double: 1 +idouble: 1 +ildouble: 439 +ldouble: 439 + +Function: Imaginary part of "ctan": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 3 +ldouble: 3 + +Function: Real part of "ctanh": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 5 +ldouble: 5 + +Function: Imaginary part of "ctanh": +float: 1 +ifloat: 1 +ildouble: 25 +ldouble: 25 +double: 1 +idouble: 1 + +Function: "erf": +double: 1 +idouble: 1 + +Function: "erfc": +double: 1 +idouble: 1 +ildouble: 1 +ldouble: 1 + +Function: "exp10": +ildouble: 8 +ldouble: 8 +float: 2 +ifloat: 2 +double: 6 +idouble: 6 + +Function: "expm1": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "gamma": +ildouble: 1 +ldouble: 1 + +Function: "hypot": +float: 1 +ifloat: 1 + +Function: "j0": +double: 2 +float: 2 +idouble: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "j1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "jn": +double: 4 +float: 4 +idouble: 4 +ifloat: 4 +ildouble: 2 +ldouble: 2 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "log10": +float: 2 +ifloat: 2 +ildouble: 1 +ldouble: 1 +double: 1 +idouble: 1 + +Function: "log1p": +float: 1 +ifloat: 1 + +Function: "sincos": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "tan": +double: 1 +idouble: 1 + +Function: "tgamma": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "y0": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 +ildouble: 1 +ldouble: 1 + +Function: "y1": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 1 +ldouble: 1 + +Function: "yn": +double: 3 +float: 2 +idouble: 3 +ifloat: 2 +ildouble: 4 +ldouble: 4 + +# end of automatic generation diff --git a/test/math/libm-test-ulps-xtensa b/test/math/libm-test-ulps-xtensa new file mode 100644 index 000000000..46b2ac559 --- /dev/null +++ b/test/math/libm-test-ulps-xtensa @@ -0,0 +1,145 @@ +# Begin of automatic generation + +# cos +Test "cos (M_PI_6l * 2.0) == 0.5": +double: 1 +idouble: 1 +Test "cos (M_PI_6l * 4.0) == -0.5": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# erf +Test "erf (0.75) == 0.711155633653515131598937834591410777": +double: 1 +idouble: 1 +Test "erf (1.25) == 0.922900128256458230136523481197281140": +double: 1 +idouble: 1 + +# erfc +Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8": +double: 1 +idouble: 1 + +# exp +Test "exp (1) == e": +double: 1 +idouble: 1 + +# expm1 +Test "expm1 (0.75) == 1.11700001661267466854536981983709561": +double: 1 +idouble: 1 + +# hypot +Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 + +# lgamma +Test "lgamma (0.7) == 0.260867246531666514385732417016759578": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# log10 +Test "log10 (0.75) == -0.124938736608299953132449886193870744": +double: 1 +idouble: 1 +Test "log10 (e) == log10(e)": +float: 1 +ifloat: 1 + +# tgamma +Test "tgamma (-0.5) == -2 sqrt (pi)": +double: 1 +idouble: 1 +Test "tgamma (0.7) == 1.29805533264755778568117117915281162": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# Maximal error of functions: +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "erf": +double: 1 +idouble: 1 + +Function: "erfc": +double: 1 +idouble: 1 + +Function: "exp": +double: 1 +idouble: 1 + +Function: "expm1": +double: 1 +idouble: 1 + +Function: "hypot": +float: 1 +ifloat: 1 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "log": +float: 1 +ifloat: 1 + +Function: "log10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "tan": +double: 1 +idouble: 1 + +Function: "tgamma": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# end of automatic generation diff --git a/test/math/libm-test.inc b/test/math/libm-test.inc index c9c2c8b41..f50b48b81 100644 --- a/test/math/libm-test.inc +++ b/test/math/libm-test.inc @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* Part of testsuite for libm. @@ -26,17 +25,17 @@ 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) - FLOAT: floating point type to test - - TEST_MSG: informal message to be displayed + FLOAT: floating point type to test + - TEST_MSG: informal message to be displayed CHOOSE(Clongdouble,Cdouble,Cfloat,Cinlinelongdouble,Cinlinedouble,Cinlinefloat): chooses one of the parameters as delta for testing equality - PRINTF_EXPR Floating point conversion specification to print a variable + PRINTF_EXPR Floating point conversion specification to print a variable of type FLOAT with printf. PRINTF_EXPR just contains the specifier, not the percent and width arguments, e.g. "f". PRINTF_XEXPR Like PRINTF_EXPR, but print in hexadecimal format. - PRINTF_NEXPR Like PRINTF_EXPR, but print nice. */ + PRINTF_NEXPR Like PRINTF_EXPR, but print nice. */ /* This testsuite has currently tests for: acos, acosh, asin, asinh, atan, atan2, atanh, @@ -116,6 +115,9 @@ # define _GNU_SOURCE #endif +#undef __CHK_COMPLEX_STUFF +#define __CHK_COMPLEX_STUFF 0 + #include "libm-test-ulps.h" #include <complex.h> #include <math.h> @@ -1121,8 +1123,10 @@ cacosh_test (void) END (cacosh, complex); } +#endif +#if __CHK_COMPLEX_STUFF static void carg_test (void) { @@ -1189,7 +1193,9 @@ carg_test (void) END (carg); } +#endif /* __CHK_COMPLEX_STUFF */ +#if 0 static void casin_test (void) { @@ -1684,7 +1690,7 @@ ceil_test (void) } -#if 0 +#if __CHK_COMPLEX_STUFF static void cexp_test (void) { @@ -1747,8 +1753,9 @@ cexp_test (void) END (cexp, complex); } +#endif /* __CHK_COMPLEX_STUFF */ - +#if 0 static void cimag_test (void) { @@ -2589,7 +2596,6 @@ fabs_test (void) } -#if 0 static void fdim_test (void) { @@ -2625,7 +2631,6 @@ fdim_test (void) END (fdim); } -#endif static void @@ -2695,7 +2700,6 @@ floor_test (void) } -#if 0 static void fma_test (void) { @@ -2798,7 +2802,6 @@ fmin_test (void) END (fmin); } -#endif static void @@ -3003,6 +3006,7 @@ isnormal_test (void) END (isnormal); } +#if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT) static void j0_test (void) { @@ -3149,6 +3153,7 @@ jn_test (void) END (jn); } +#endif /* __DO_XSI_MATH__ */ static void @@ -3413,8 +3418,6 @@ log1p_test (void) END (log1p); } - -#if 0 static void log2_test (void) { @@ -3444,8 +3447,6 @@ log2_test (void) END (log2); } -#endif - static void logb_test (void) @@ -3628,7 +3629,6 @@ modf_test (void) } -#if 0 static void nearbyint_test (void) { @@ -3709,7 +3709,6 @@ nexttoward_test (void) END (nexttoward); } -#endif static void @@ -3949,7 +3948,6 @@ remainder_test (void) END (remainder); } -#if 0 static void remquo_test (void) { @@ -3980,7 +3978,6 @@ remquo_test (void) END (remquo); } -#endif static void rint_test (void) @@ -4228,11 +4225,12 @@ round_test (void) #endif +#ifdef __UCLIBC_SUSV3_LEGACY__ static void scalb_test (void) { - START (scalb); +#ifndef TEST_LDOUBLE /* uclibc doesn't have scalbl */ TEST_ff_f (scalb, 2.0, 0.5, nan_value, INVALID_EXCEPTION); TEST_ff_f (scalb, 3.0, -2.5, nan_value, INVALID_EXCEPTION); @@ -4283,10 +4281,10 @@ scalb_test (void) TEST_ff_f (scalb, 0.8L, 4, 12.8L); TEST_ff_f (scalb, -0.854375L, 5, -27.34L); - +#endif /* TEST_LDOUBLE */ END (scalb); } - +#endif static void scalbn_test (void) @@ -4310,7 +4308,6 @@ scalbn_test (void) } -#if 0 static void scalbln_test (void) { @@ -4331,7 +4328,6 @@ scalbln_test (void) END (scalbn); } -#endif static void @@ -4515,7 +4511,8 @@ tanh_test (void) START (tanh); TEST_f_f (tanh, 0, 0); - TEST_f_f (tanh, minus_zero, minus_zero); + /* vda: uclibc: added IGNORE_ZERO_INF_SIGN to treat -0 as ok */ + TEST_f_f (tanh, minus_zero, minus_zero, IGNORE_ZERO_INF_SIGN); #ifndef TEST_INLINE TEST_f_f (tanh, plus_infty, 1); @@ -4535,7 +4532,6 @@ tanh_test (void) END (tanh); } -#if 0 static void tgamma_test (void) { @@ -4567,7 +4563,6 @@ tgamma_test (void) END (tgamma); } -#endif #if 0 @@ -4647,6 +4642,7 @@ trunc_test (void) } #endif +#if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT) static void y0_test (void) { @@ -4789,6 +4785,7 @@ yn_test (void) END (yn); } +#endif /* __DO_XSI_MATH__ */ static void @@ -4967,17 +4964,15 @@ main (int argc, char **argv) log_test (); log10_test (); log1p_test (); -#if 0 log2_test (); -#endif logb_test (); modf_test (); ilogb_test (); +#ifdef __UCLIBC_SUSV3_LEGACY__ scalb_test (); +#endif scalbn_test (); -#if 0 scalbln_test (); -#endif significand_test (); /* Power and absolute value functions: */ @@ -4992,16 +4987,12 @@ main (int argc, char **argv) erfc_test (); gamma_test (); lgamma_test (); -#if 0 tgamma_test (); -#endif /* Nearest integer functions: */ ceil_test (); floor_test (); -#if 0 nearbyint_test (); -#endif rint_test (); #if 0 rint_test_tonearest (); @@ -5019,13 +5010,10 @@ main (int argc, char **argv) /* Remainder functions: */ fmod_test (); remainder_test (); -#if 0 remquo_test (); -#endif /* Manipulation functions: */ copysign_test (); -#if 0 nextafter_test (); nexttoward_test (); @@ -5037,24 +5025,29 @@ main (int argc, char **argv) /* Multiply and add: */ fma_test (); + /* Complex functions: */ cabs_test (); +#if __CHK_COMPLEX_STUFF +#if 0 cacos_test (); cacosh_test (); +#endif carg_test (); +#if 0 casin_test (); casinh_test (); catan_test (); catanh_test (); ccos_test (); ccosh_test (); +#endif cexp_test (); +#if 0 cimag_test (); clog10_test (); clog_test (); -#if 0 conj_test (); -#endif cpow_test (); cproj_test (); creal_test (); @@ -5064,16 +5057,17 @@ main (int argc, char **argv) ctan_test (); ctanh_test (); #endif +#endif /* __CHK_COMPLEX_STUFF */ /* Bessel functions: */ -#if 0 +#if defined __DO_XSI_MATH__ && !(defined TEST_LDOUBLE || defined TEST_FLOAT) j0_test (); j1_test (); jn_test (); y0_test (); y1_test (); yn_test (); -#endif +#endif /* __DO_XSI_MATH__ */ if (output_ulps) fclose (ulps_file); diff --git a/test/math/rint.c b/test/math/rint.c index 04c195385..b595459a3 100644 --- a/test/math/rint.c +++ b/test/math/rint.c @@ -1,11 +1,33 @@ #include <math.h> +#include <float.h> #include <stdlib.h> +#include <stdint.h> #include <stdio.h> -int main(void) { - double d1, d2; - d1 = 0.6; d2 = rint(d1); - printf("d1 = %f, d2 = %f\n", d1, d2); - return 0; -} +#define check_d1(func, param, expected) \ +do { \ + int err; hex_union ur; hex_union up; \ + double result = func(param); up.f = param; ur.f = result; \ + errors += (err = (result != (expected))); \ + err \ + ? printf("FAIL: %s(%g/"HEXFMT")=%g/"HEXFMT" (expected %g)\n", \ + #func, (double)(param), (long long)up.hex, result, (long long)ur.hex, (double)(expected)) \ + : printf("PASS: %s(%g)=%g\n", #func, (double)(param), result); \ +} while (0) + +#define HEXFMT "%08llx" +typedef union { + double f; + uint64_t hex; +} hex_union; +double result; + +int errors = 0; +int main(void) +{ + check_d1(rint, 0.6, 1.0); + + printf("Errors: %d\n", errors); + return errors; +} diff --git a/test/math/signgam.c b/test/math/signgam.c new file mode 100644 index 000000000..2f1adbaad --- /dev/null +++ b/test/math/signgam.c @@ -0,0 +1,28 @@ +#define _XOPEN_SOURCE 600 +#include <math.h> +#include <float.h> +#include <stdio.h> + +double zero = 0.0; +double mzero; + +int main(void) +{ + double d; + int errors = 0; + + mzero = copysign(zero, -1.0); + + d = lgamma(zero); + printf("%g %d\n", d, signgam); + errors += !(d == HUGE_VAL); + errors += !(signgam == 1); + + d = lgamma(mzero); + printf("%g %d\n", d, signgam); + errors += !(d == HUGE_VAL); + errors += !(signgam == -1); + + printf("Errors: %d\n", errors); + return errors; +} diff --git a/test/math/test-double.c b/test/math/test-double.c index 4d239a71d..3c9733e03 100644 --- a/test/math/test-double.c +++ b/test/math/test-double.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #define FUNC(function) function #define FLOAT double diff --git a/test/math/test-float.c b/test/math/test-float.c index 26a4213b4..6764fff47 100644 --- a/test/math/test-float.c +++ b/test/math/test-float.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #define FUNC(function) function ## f #define FLOAT float diff --git a/test/math/test-fpucw.c b/test/math/test-fpucw.c index 6d638c66c..93237eae8 100644 --- a/test/math/test-fpucw.c +++ b/test/math/test-fpucw.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <fpu_control.h> #include <stdio.h> diff --git a/test/math/test-idouble.c b/test/math/test-idouble.c index 7606a89ff..e340e1951 100644 --- a/test/math/test-idouble.c +++ b/test/math/test-idouble.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #define FUNC(function) function #define FLOAT double diff --git a/test/math/test-ifloat.c b/test/math/test-ifloat.c index 9eb9ce502..b8291d1f5 100644 --- a/test/math/test-ifloat.c +++ b/test/math/test-ifloat.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #define FUNC(function) function ## f #define FLOAT float diff --git a/test/math/test-ildoubl.c b/test/math/test-ildoubl.c index 597edbca1..787380431 100644 --- a/test/math/test-ildoubl.c +++ b/test/math/test-ildoubl.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #define FUNC(function) function##l #define FLOAT long double diff --git a/test/math/test-ldouble.c b/test/math/test-ldouble.c index 272122766..a5ec7cba8 100644 --- a/test/math/test-ldouble.c +++ b/test/math/test-ldouble.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #define FUNC(function) function##l #define FLOAT long double diff --git a/test/math/tst-definitions.c b/test/math/tst-definitions.c index 7d352af40..3f71611ef 100644 --- a/test/math/tst-definitions.c +++ b/test/math/tst-definitions.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <limits.h> #include <math.h> diff --git a/test/misc/Makefile b/test/misc/Makefile index 48c549e73..09fa233a6 100644 --- a/test/misc/Makefile +++ b/test/misc/Makefile @@ -1,14 +1,8 @@ # uClibc misc tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -TESTS_DISABLED := outb tst-fnmatch bug-glob1 tst-gnuglob - +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -CFLAGS_dirent64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 - -DODIFF_dirent := 1 -DODIFF_dirent64 := 1 - -OPTS_bug-glob1 := $(PWD) -OPTS_tst-fnmatch := < tst-fnmatch.input diff --git a/test/misc/Makefile.in b/test/misc/Makefile.in new file mode 100644 index 000000000..a15ff97d6 --- /dev/null +++ b/test/misc/Makefile.in @@ -0,0 +1,48 @@ +# uClibc misc tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +TESTS_DISABLED := outb tst-fnmatch bug-glob1 tst-gnuglob + +ifeq ($(TARGET_avr32),y) +TESTS_DISABLED += tst-inotify +endif + +ifeq ($(UCLIBC_HAS_LFS),) +TESTS_DISABLED += dirent64 +TESTS_DISABLED += tst-statfs # assuming host has LFS on +endif +CFLAGS_dirent64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 + +ifeq ($(UCLIBC_LINUX_SPECIFIC),) +TESTS_DISABLED += tst-inotify +endif + +ifeq ($(UCLIBC_HAS_GLOB),) +TESTS_DISABLED += bug-glob2 +endif + +ifeq ($(UCLIBC_HAS_UTMPX),) +TESTS_DISABLED += tst-utmpx +endif + +ifeq ($(UCLIBC_HAS_UTMP),) +TESTS_DISABLED += tst-utmp +endif + +DODIFF_dirent := 1 +DODIFF_dirent64 := 1 +DODIFF_tst-statfs := 1 +DODIFF_tst-statvfs := 1 + +OPTS_bug-glob1 := $(PWD) +OPTS_tst-fnmatch := < tst-fnmatch.input + +MNTENTS = / /sys /proc /dev +OPTS_tst-statfs := $(MNTENTS) +OPTS_tst-statvfs := $(MNTENTS) + +CFLAGS_bug-glob2 = -fPIC +CFLAGS_opendir-tst1 = -fPIC +CFLAGS_tst-inotify = -fPIC +CFLAGS_tst-utmp = -fPIC +CFLAGS_tst-utmpx = -fPIC diff --git a/test/misc/bug-glob1.c b/test/misc/bug-glob1.c index aec84ad44..276983a0d 100644 --- a/test/misc/bug-glob1.c +++ b/test/misc/bug-glob1.c @@ -32,9 +32,7 @@ prepare (int argc, char *argv[]) again: strcpy (stpcpy (fname, argv[1]), ext); -/* - fname = mktemp (fname); -*/ +/* fname = mktemp (fname); */ close(mkstemp(fname)); unlink(fname); diff --git a/test/misc/bug-glob2.c b/test/misc/bug-glob2.c index f8b030e2c..069891b03 100644 --- a/test/misc/bug-glob2.c +++ b/test/misc/bug-glob2.c @@ -14,12 +14,10 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <errno.h> -#include <error.h> #include <dirent.h> #include <glob.h> #include <stdlib.h> diff --git a/test/misc/fdopen.c b/test/misc/fdopen.c index f64cfb6b9..97e66de0a 100644 --- a/test/misc/fdopen.c +++ b/test/misc/fdopen.c @@ -33,7 +33,7 @@ main (int argc, char *argv[]) assert (fclose (fp) == 0); fp = NULL; - fd = open (name, O_RDWR|O_CREAT); + fd = open (name, O_RDWR|O_CREAT, 0660); assert (fd != -1); assert (lseek (fd, 5, SEEK_SET) == 5); diff --git a/test/misc/opendir-tst1.c b/test/misc/opendir-tst1.c index 983d4b482..ffd785f80 100644 --- a/test/misc/opendir-tst1.c +++ b/test/misc/opendir-tst1.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <dirent.h> #include <errno.h> @@ -24,6 +23,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <sys/stat.h> /* Name of the FIFO. */ char tmpname[] = "fifoXXXXXX"; @@ -92,4 +92,4 @@ do_cleanup (void) /* Include the test skeleton. */ -#include <test-skeleton.c> +#include "../test-skeleton.c" diff --git a/test/misc/tst-fnmatch.c b/test/misc/tst-fnmatch.c index bb102c5bb..e7d5324bb 100644 --- a/test/misc/tst-fnmatch.c +++ b/test/misc/tst-fnmatch.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <errno.h> #include <error.h> diff --git a/test/misc/tst-fnmatch.input b/test/misc/tst-fnmatch.input index 9061d1994..bf69c12c0 100644 --- a/test/misc/tst-fnmatch.input +++ b/test/misc/tst-fnmatch.input @@ -15,9 +15,8 @@ # 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. +# License along with the GNU C Library; see the file COPYING.LIB. If +# not, see <http://www.gnu.org/licenses/>. # Derived from the IEEE 2003.2 text. The standard only contains some diff --git a/test/misc/tst-gnuglob.c b/test/misc/tst-gnuglob.c index 04c6743e9..53bc0cff2 100644 --- a/test/misc/tst-gnuglob.c +++ b/test/misc/tst-gnuglob.c @@ -15,9 +15,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <dirent.h> #include <errno.h> diff --git a/test/misc/tst-inotify.c b/test/misc/tst-inotify.c new file mode 100644 index 000000000..f9f6830e3 --- /dev/null +++ b/test/misc/tst-inotify.c @@ -0,0 +1,65 @@ +/* vi: set sw=4 ts=4 sts=4: */ +/* + * inotify test for uClibc + * Copyright (C) 2012 by Kevin Cernekee <cernekee@gmail.com> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <inttypes.h> +#include <sys/inotify.h> +#include <sys/fcntl.h> + +static int +do_test(void) +{ + int ifd, fd, ret, result = 0; + struct inotify_event e; + char tfile[] = "/tmp/inotify.XXXXXX"; + + fd = mkstemp(tfile); + close(fd); + + ifd = inotify_init1(IN_NONBLOCK); + if (ifd < 0) { + perror("inotify_init1()"); + result = 1; + } + if (inotify_add_watch(ifd, tfile, IN_DELETE_SELF) < 0) { + perror("inotify_add_watch()"); + result = 1; + } + + /* nonblocking inotify should return immediately with no events */ + ret = read(ifd, &e, sizeof(e)); + if (ret != -1 || errno != EAGAIN) { + fprintf(stderr, "first read() returned %d\n", ret); + result = 1; + } + + /* generate an event */ + unlink(tfile); + + /* now check whether our event was seen */ + ret = read(ifd, &e, sizeof(e)); + if (ret != sizeof(e)) { + fprintf(stderr, "second read() returned %d\n", ret); + result = 1; + } + + if (!(e.mask & IN_DELETE_SELF)) { + fprintf(stderr, "incorrect event mask: %" PRIx32 "\n", e.mask); + result = 1; + } + + return result; +} + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/misc/tst-mkostemps.c b/test/misc/tst-mkostemps.c new file mode 100644 index 000000000..272e747a1 --- /dev/null +++ b/test/misc/tst-mkostemps.c @@ -0,0 +1,159 @@ +/* + * Test application for mkstemp/mkstemps/mkostemp/mkostemps + * Copyright (C) 2015 by Romain Naour <romain.naour@openwide.fr> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <sys/stat.h> +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> + +#define assert(x) \ + if (!(x)) \ + { \ + fputs ("test failed: " #x "\n", stderr); \ + retval = 1; \ + goto the_end; \ + } + +int +main (int argc, char *argv[]) +{ + char name[256]; + char name_suffix[256]; + FILE *fp = NULL; + int retval = 0; + int fd; + int flags = O_RDONLY | O_CLOEXEC; + struct stat sb_f1; + struct stat sb_f2; + + /* mkstemp test */ + sprintf(name, "/tmp/%s-uClibc-test.XXXXXX", __FILE__); + + fd = mkstemp(name); + + fstat(fd, &sb_f1); + assert ((sb_f1.st_mode & S_IFMT) == S_IFREG) + + stat(name, &sb_f2); + assert ((sb_f2.st_mode & S_IFMT) == S_IFREG) + + assert (sb_f1.st_ino == sb_f2.st_ino) + + close(fd); + unlink (name); + + /* mkstemps test */ + sprintf(name_suffix, "/tmp/%s-uClibc-test.XXXXXX.txt", __FILE__); + + fd = mkstemps(name_suffix, 4); + + fstat(fd, &sb_f1); + assert ((sb_f1.st_mode & S_IFMT) == S_IFREG) + + stat(name_suffix, &sb_f2); + assert ((sb_f2.st_mode & S_IFMT) == S_IFREG) + + assert (sb_f1.st_ino == sb_f2.st_ino) + + close(fd); + unlink (name_suffix); + + /* mkostemp test */ + sprintf(name, "/tmp/%s-uClibc-test.XXXXXX", __FILE__); + + fd = mkostemp(name, flags); + + fstat(fd, &sb_f1); + assert ((sb_f1.st_mode & S_IFMT) == S_IFREG) + + stat(name, &sb_f2); + assert ((sb_f2.st_mode & S_IFMT) == S_IFREG) + + assert (sb_f1.st_ino == sb_f2.st_ino) + assert (sb_f1.st_mode == sb_f2.st_mode) + + close(fd); + unlink (name); + + /* mkostemps test */ + sprintf(name_suffix, "/tmp/%s-uClibc-test.XXXXXX.txt", __FILE__); + + fd = mkostemps(name_suffix, 4, flags); + + fstat(fd, &sb_f1); + assert ((sb_f1.st_mode & S_IFMT) == S_IFREG) + + stat(name_suffix, &sb_f2); + assert ((sb_f2.st_mode & S_IFMT) == S_IFREG) + + assert (sb_f1.st_ino == sb_f2.st_ino) + assert (sb_f1.st_mode == sb_f2.st_mode) + + close(fd); + unlink (name_suffix); + + /* suffixlen = 0 */ + sprintf(name_suffix, "/tmp/%s-uClibc-test.XXXXXX", __FILE__); + + fd = mkostemps(name_suffix, 0, flags); + + fstat(fd, &sb_f1); + assert ((sb_f1.st_mode & S_IFMT) == S_IFREG) + + stat(name_suffix, &sb_f2); + assert ((sb_f2.st_mode & S_IFMT) == S_IFREG) + + assert (sb_f1.st_ino == sb_f2.st_ino) + assert (sb_f1.st_mode == sb_f2.st_mode) + + close(fd); + unlink (name_suffix); + + /* stress tests */ + + /* template len < 6 */ + sprintf(name, "XXXXX"); + + fd = mkstemp(name); + + assert(fd == -1); + assert(errno == EINVAL); + + /* suffixlen < 0 */ + sprintf(name_suffix, "/tmp/%s-uClibc-test.XXXXXX.txt", __FILE__); + + fd = mkostemps(name_suffix, -1, flags); + + assert(fd == -1); + assert(errno == EINVAL); + + /* Missing one X */ + sprintf(name_suffix, "/tmp/%s-uClibc-test.XXXXX.txt", __FILE__); + + fd = mkostemps(name_suffix, 4, flags); + + assert(fd == -1); + assert(errno == EINVAL); + + /* wrong suffixlen */ + sprintf(name_suffix, "/tmp/%s-uClibc-test.XXXXXX.txt", __FILE__); + + fd = mkostemps(name_suffix, 2, flags); + + assert(fd == -1); + assert(errno == EINVAL); + +the_end: + if (fp != NULL) + assert (fclose (fp) == 0); + unlink (name); + unlink (name_suffix); + + return retval; +} diff --git a/test/misc/tst-scandir.c b/test/misc/tst-scandir.c new file mode 100644 index 000000000..e1c72e3c9 --- /dev/null +++ b/test/misc/tst-scandir.c @@ -0,0 +1,23 @@ +#include <dirent.h> +#include <errno.h> +#include <stdio.h> /* perror() */ +#include <stdlib.h> + +static int skip_all(const struct dirent *dirbuf) +{ + errno = EBADF; + return 0; +} + +int main(void) +{ + struct dirent **namelist; + int n; + + n = scandir(".", &namelist, skip_all, 0); + if (n < 0) { + perror("scandir"); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; +} diff --git a/test/misc/tst-statfs.c b/test/misc/tst-statfs.c new file mode 100644 index 000000000..b8b4229ba --- /dev/null +++ b/test/misc/tst-statfs.c @@ -0,0 +1,31 @@ +#include <sys/vfs.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int +main(int argc, char* argv[]) +{ + struct statfs s; + int ret = 0, i; + + for (i = 1; i < argc; i++) { + if (statfs(argv[i], &s) != 0) { + fprintf(stderr, "%s: %s: statfs failed. %s\n", + *argv, argv[i], strerror(errno)); + exit(EXIT_FAILURE); + } + ++ret; + printf("statfs %s:\n\tblocks=%lld\n\tblkfree=%lld\n\tbsize=%d\n", + argv[i], s.f_blocks, s.f_bfree, s.f_bsize); +#ifdef _STATFS_F_FRSIZE + printf("\tfrsize=%lld\n", s.f_frsize); +#elif defined __mips__ + printf("\tfrsize=mips, unsupported?\n"); +#else +# error no _STATFS_F_FRSIZE +#endif + } + exit(ret ? EXIT_SUCCESS : EXIT_FAILURE); +} diff --git a/test/misc/tst-statvfs.c b/test/misc/tst-statvfs.c new file mode 100644 index 000000000..4b67719e9 --- /dev/null +++ b/test/misc/tst-statvfs.c @@ -0,0 +1,26 @@ +#include <sys/statvfs.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int +main(int argc, char* argv[]) +{ + struct statvfs s; + int i; + + for (i = 1; i < argc; i++) { + if (statvfs(argv[i], &s) != 0) { + fprintf(stderr, "%s: %s: statvfs failed. %s\n", + *argv, argv[i], strerror(errno)); + exit(EXIT_FAILURE); + } + printf("statvfs %s:\n\tblocks=%lld\n\tblkfree=%lld\n\tbsize=%d\n", + argv[i], s.f_blocks, s.f_bfree, s.f_bsize); +#if 1 // def _STATFS_F_FRSIZE + printf("\tfrsize=%lld\n", s.f_frsize); +#endif + } + exit(EXIT_SUCCESS); +} diff --git a/test/misc/tst-utmp.c b/test/misc/tst-utmp.c index 12a208855..1b0333a32 100644 --- a/test/misc/tst-utmp.c +++ b/test/misc/tst-utmp.c @@ -14,12 +14,10 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <errno.h> -#include <error.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> @@ -39,6 +37,21 @@ # include <utmp.h> #endif +#ifndef _HAVE_UT_TYPE +# define _HAVE_UT_TYPE 0 +#endif +#ifndef _HAVE_UT_PID +# define _HAVE_UT_PID 0 +#endif +#ifndef _HAVE_UT_ID +# define _HAVE_UT_ID 0 +#endif +#ifndef _HAVE_UT_TV +# define _HAVE_UT_TV 0 +#endif +#ifndef _HAVE_UT_HOST +# define _HAVE_UT_HOST 0 +#endif #if _HAVE_UT_TYPE || defined UTMPX @@ -50,7 +63,7 @@ static void do_prepare (int argc, char *argv[]); #define PREPARE do_prepare /* This defines the `main' function and some more. */ -#include <test-skeleton.c> +#include "../test-skeleton.c" /* These are for the temporary file we generate. */ @@ -70,8 +83,11 @@ do_prepare (int argc, char *argv[]) /* Open our test file. */ fd = mkstemp (name); - if (fd == -1) - error (EXIT_FAILURE, errno, "cannot open test file `%s'", name); + if (fd == -1) { + fprintf (stderr, "cannot open test file `%s': ", name); + perror (NULL); + exit (EXIT_FAILURE); + } } struct utmp entry[] = @@ -111,7 +127,7 @@ do_init (void) { if (pututline (&entry[n]) == NULL) { - error (0, errno, "cannot write UTMP entry"); + perror ("cannot write UTMP entry"); return 1; } } @@ -136,7 +152,7 @@ do_check (void) if (n < num_entries && memcmp (ut, &entry[n], sizeof (struct utmp))) { - error (0, 0, "UTMP entry does not match"); + fprintf (stderr, "UTMP entry does not match\n"); return 1; } @@ -145,7 +161,7 @@ do_check (void) if (n != num_entries) { - error (0, 0, "number of UTMP entries is incorrect"); + fprintf (stderr, "number of UTMP entries is incorrect\n"); return 1; } @@ -177,7 +193,7 @@ simulate_login (const char *line, const char *user) if (pututline (&entry[n]) == NULL) { - error (0, errno, "cannot write UTMP entry"); + perror ("cannot write UTMP entry"); return 1; } @@ -187,7 +203,7 @@ simulate_login (const char *line, const char *user) } } - error (0, 0, "no entries available"); + fprintf (stderr, "no entries available\n"); return 1; } @@ -211,7 +227,7 @@ simulate_logout (const char *line) if (pututline (&entry[n]) == NULL) { - error (0, errno, "cannot write UTMP entry"); + perror ("cannot write UTMP entry"); return 1; } @@ -221,7 +237,7 @@ simulate_logout (const char *line) } } - error (0, 0, "no entry found for `%s'", line); + fprintf (stderr, "no entry found for `%s'\n", line); return 1; } @@ -238,7 +254,8 @@ check_login (const char *line) up = getutline (&ut); if (up == NULL) { - error (0, errno, "cannot get entry for line `%s'", line); + fprintf (stderr, "cannot get entry for line `%s': ", line); + perror(NULL); return 1; } @@ -250,7 +267,7 @@ check_login (const char *line) { if (memcmp (up, &entry[n], sizeof (struct utmp))) { - error (0, 0, "UTMP entry does not match"); + fprintf (stderr, "UTMP entry does not match\n"); return 1; } @@ -258,7 +275,7 @@ check_login (const char *line) } } - error (0, 0, "bogus entry for line `%s'", line); + fprintf (stderr, "bogus entry for line `%s'\n", line); return 1; } @@ -272,7 +289,7 @@ check_logout (const char *line) strcpy (ut.ut_line, line); if (getutline (&ut) != NULL) { - error (0, 0, "bogus login entry for `%s'", line); + fprintf (stderr, "bogus login entry for `%s'\n", line); return 1; } @@ -295,7 +312,8 @@ check_id (const char *id) up = getutid (&ut); if (up == NULL) { - error (0, errno, "cannot get entry for ID `%s'", id); + fprintf (stderr, "cannot get entry for ID `%s': ", id); + perror (NULL); return 1; } @@ -307,7 +325,7 @@ check_id (const char *id) { if (memcmp (up, &entry[n], sizeof (struct utmp))) { - error (0, 0, "UTMP entry does not match"); + fprintf (stderr, "UTMP entry does not match\n"); return 1; } @@ -315,7 +333,7 @@ check_id (const char *id) } } - error (0, 0, "bogus entry for ID `%s'", id); + fprintf (stderr, "bogus entry for ID `%s'\n", id); return 1; } @@ -332,7 +350,8 @@ check_type (int type) up = getutid (&ut); if (up == NULL) { - error (0, errno, "cannot get entry for type `%d'", type); + fprintf (stderr, "cannot get entry for type `%d': ", type); + perror (NULL); return 1; } @@ -344,7 +363,7 @@ check_type (int type) { if (memcmp (up, &entry[n], sizeof (struct utmp))) { - error (0, 0, "UTMP entry does not match"); + fprintf (stderr, "UTMP entry does not match\n"); return 1; } @@ -352,7 +371,7 @@ check_type (int type) } } - error (0, 0, "bogus entry for type `%d'", type); + fprintf (stderr, "bogus entry for type `%d'\n", type); return 1; } diff --git a/test/misc/tst-utmpx.c b/test/misc/tst-utmpx.c new file mode 100644 index 000000000..edb5551d7 --- /dev/null +++ b/test/misc/tst-utmpx.c @@ -0,0 +1,2 @@ +#define UTMPX +#include "tst-utmp.c" diff --git a/test/mmap/Makefile b/test/mmap/Makefile index b4c301014..89e7195fb 100644 --- a/test/mmap/Makefile +++ b/test/mmap/Makefile @@ -1,4 +1,8 @@ # uClibc mmap tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak diff --git a/test/mmap/mmap2.c b/test/mmap/mmap2.c index b9a8f9ac4..8b94c6199 100644 --- a/test/mmap/mmap2.c +++ b/test/mmap/mmap2.c @@ -25,7 +25,12 @@ int main(int argc, char **argv) { void* map_base = 0; int fd; off_t target = 0xfffff000; - if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) FATAL; + if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) { + /* skip test for non-root users */ + if (errno == EACCES) + return 0; + FATAL; + } printf("/dev/mem opened.\n"); fflush(stdout); diff --git a/test/nptl/Makefile b/test/nptl/Makefile new file mode 100644 index 000000000..c22b635b7 --- /dev/null +++ b/test/nptl/Makefile @@ -0,0 +1,8 @@ +# uClibc NPTL tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in +include ../Test.mak diff --git a/test/nptl/Makefile.in b/test/nptl/Makefile.in new file mode 100644 index 000000000..d43db2bc4 --- /dev/null +++ b/test/nptl/Makefile.in @@ -0,0 +1,220 @@ +# uClibc NPTL tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +TESTS := 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 \ + tst-align3 tst-cancel4 tst-cancel5 tst-cancel18 tst-cancel23 \ + tst-cancel25 tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx6 \ + tst-cancelx7 tst-cancelx8 tst-cancelx9 tst-cancelx10 tst-cancelx11 \ + tst-cancelx12 tst-cancelx13 tst-cancelx14 tst-cancelx15 tst-cancelx16 \ + tst-cancelx18 tst-cancelx20 tst-cancelx21 tst-cleanupx0 tst-cleanupx1 \ + tst-cleanupx2 tst-cleanupx3 tst-cleanupx4 tst-cond22 tst-cond23 \ + tst-getpid1 tst-getpid2 tst-getpid3 tst-join6 tst-tsd6 \ + tst-oddstacklimit tst-oncex3 tst-oncex4 tst-rwlock2a \ + tst-basic7 tst-vfork1x tst-vfork2x tst-sem10 tst-sem11 \ + tst-sem12 tst-typesizes tst-initializers1-c89 tst-initializers1-c99 \ + tst-initializers1-gnu89 tst-initializers1-gnu99 \ + tst-atfork2 + +# +# These are for the RT library and POSIX timers. +# +TESTS += 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 + +ifeq ($(UCLIBC_HAS_OBSOLETE_BSD_SIGNAL),) +TESTS_DISABLED += tst-exec2 tst-exec3 tst-exec4 +endif + +ifeq ($(UCLIBC_SUSV4_LEGACY),) +TESTS_DISABLED += tst-basic5 tst-cancel4 tst-cancel5 tst-cancelx4 +endif + +GLIBC_TESTS_DISABLED := tst-eintr1_glibc tst-eintr2_glibc \ + tst-eintr3_glibc tst-eintr4_glibc tst-eintr5_glibc \ + tst-tls1_glibc tst-tls2_glibc + + +ifeq ($(HAVE_SHARED),) +TESTS_DISABLED += tst-tls3 tst-tls4 tst-tls5 tst-dlsym1 tst-fini1 \ + tst-unload +else +GLIBC_TESTS_DISABLED += tst-tls3_glibc tst-tls4_glibc tst-tls5_glibc +endif + +EXTRA_CFLAGS := -DNOT_IN_libc=1 -D_LIBC -D__USE_GNU -std=gnu99 \ + $(PTINC) \ + -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \ + -I$(top_srcdir)libc/sysdeps/linux \ + -I$(top_builddir)include \ + -include $(top_builddir)include/libc-symbols.h + +ifeq ($(TARGET_ARCH),i386) +CFLAGS_tst-align := -malign-double -mpreferred-stack-boundary=4 +endif +ifeq ($(TARGET_ARCH),i686) +CFLAGS_tst-align := -malign-double -mpreferred-stack-boundary=4 -msse +endif +CFLAGS_tst-cleanup4aux.o := -W +CFLAGS_tst-initializers1 := -W -Werror +CFLAGS_tst-tls3mod.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc +CFLAGS_tst-tls4moda.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc +CFLAGS_tst-tls4modb.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc +CFLAGS_tst-tls5mod.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc +CFLAGS_tst-tls5moda.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc +CFLAGS_tst-tls5modb.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc +CFLAGS_tst-tls5modc.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc +CFLAGS_tst-tls5modd.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc +CFLAGS_tst-tls5mode.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc +CFLAGS_tst-tls5modf.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc + +CFLAGS_tst-fini1mod.so := -fPIC -DPIC -DSHARED -shared -DNOT_IN_libc +LDFLAGS_tst-cond11 = -lrt +LDFLAGS_tst-cond19 = -lrt +LDFLAGS_tst-cancel18 = -lrt +LDFLAGS_tst-cancelx18 = -lrt +LDFLAGS_tst-clock2 = -lrt +LDFLAGS_tst-rwlock14 = -lrt +LDFLAGS_tst-fini1 = -Wl,-rpath=./ tst-fini1mod.so +LDFLAGS_tst-fini1mod.so = -Wl,-soname=tst-fini1mod.so +LDFLAGS_tst-unload = -ldl +LDFLAGS_tst-cancel5 := -lpthread +LDFLAGS_tst-cancel23 := -lc -lpthread +LDFLAGS_tst-vfork1x := -lc -lpthread +LDFLAGS_tst-vfork2x := -lc -lpthread + +CFLAGS_tst-cancelx2 += -fexceptions +CFLAGS_tst-cancelx3 += -fexceptions +CFLAGS_tst-cancelx4 += -fexceptions +CFLAGS_tst-cancelx6 += -fexceptions +CFLAGS_tst-cancelx7 += -fexceptions +CFLAGS_tst-cancelx8 += -fexceptions +CFLAGS_tst-cancelx9 += -fexceptions +CFLAGS_tst-cancelx10 += -fexceptions +CFLAGS_tst-cancelx11 += -fexceptions +CFLAGS_tst-cancelx12 += -fexceptions +CFLAGS_tst-cancelx13 += -fexceptions +CFLAGS_tst-cancelx14 += -fexceptions +CFLAGS_tst-cancelx15 += -fexceptions +CFLAGS_tst-cancelx16 += -fexceptions +CFLAGS_tst-cancelx18 += -fexceptions +CFLAGS_tst-cancelx20 += -fexceptions -fasynchronous-unwind-tables +CFLAGS_tst-cancelx21 += -fexceptions -fasynchronous-unwind-tables +CFLAGS_tst-cleanupx0 += -fexceptions -fasynchronous-unwind-tables +CFLAGS_tst-cleanupx1 += -fexceptions -fasynchronous-unwind-tables +CFLAGS_tst-cleanupx2 += -fexceptions +CFLAGS_tst-cleanupx3 += -fexceptions + +CFLAGS_tst-oncex3 += -fexceptions +CFLAGS_tst-oncex4 += -fexceptions +CFLAGS_tst-align += $(stack-align-test-flags) +CFLAGS_tst-align3 += $(stack-align-test-flags) +CFLAGS_tst-initializers1 = -W -Wall -Werror +CFLAGS_tst-sem11 += -fexceptions -fasynchronous-unwind-tables +CFLAGS_tst-sem12 += -fexceptions -fasynchronous-unwind-tables +CFLAGS_tst-initializers1 = -W -Wall -Werror +CFLAGS_tst-initializers1-c89 = $(CFLAGS-tst-initializers1) -std=c89 +CFLAGS_tst-initializers1-c99 = $(CFLAGS-tst-initializers1) -std=c99 +CFLAGS_tst-initializers1-gnu89 = $(CFLAGS-tst-initializers1) -std=gnu89 +CFLAGS_tst-initializers1-gnu99 = $(CFLAGS-tst-initializers1) -std=gnu99 + +EXTRA_LDFLAGS = $(if $(findstring -lpthread,$(LDFLAGS_$@)),,-lpthread) + +LDFLAGS_tst-atfork2 := -ldl +LDFLAGS_libatfork.so := -shared -static-libgcc -lpthread +LDFLAGS_tst-cleanup4 := tst-cleanup4aux.o +LDFLAGS_tst-cleanupx4 := tst-cleanup4aux.o +LDFLAGS_tst-clock2 := -lrt +LDFLAGS_tst-cond11 := -lrt +LDFLAGS_tst-cond19 := -lrt +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 -lpthread +LDFLAGS_tst-cputimer1 := -lrt -lpthread +LDFLAGS_tst-cputimer2 := -lrt -lpthread +LDFLAGS_tst-cputimer3 := -lrt -lpthread +LDFLAGS_tst-mqueue1 := -lrt +LDFLAGS_tst-mqueue2 := -lrt +LDFLAGS_tst-mqueue3 := -lrt -lpthread +LDFLAGS_tst-mqueue4 := -lrt +LDFLAGS_tst-mqueue5 := -lrt -lpthread +LDFLAGS_tst-mqueue6 := -lrt -lpthread +LDFLAGS_tst-mqueue7 := -lrt +LDFLAGS_tst-mqueue8 := -lrt +LDFLAGS_tst-mqueue9 := -lrt +LDFLAGS_tst-timer2 := -lrt -lpthread +LDFLAGS_tst-timer3 := -lrt -lpthread +LDFLAGS_tst-timer4 := -lrt -lpthread +LDFLAGS_tst-timer5 := -lrt -lpthread +LDFLAGS_tst-dlsym1 := -ldl -rdynamic +LDFLAGS_tst-tls3mod.so := -shared -static-libgcc -lpthread +LDFLAGS_tst-tls4moda.so := -shared -static-libgcc +LDFLAGS_tst-tls4modb.so := -shared -static-libgcc +LDFLAGS_tst-tls5mod.so := -shared -static-libgcc -Wl,-soname,tst-tls5mod.so +LDFLAGS_tst-tls5moda.so := -shared -static-libgcc +LDFLAGS_tst-tls5modb.so := -shared -static-libgcc +LDFLAGS_tst-tls5modc.so := -shared -static-libgcc +LDFLAGS_tst-tls5modd.so := -shared -static-libgcc +LDFLAGS_tst-tls5mode.so := -shared -static-libgcc +LDFLAGS_tst-tls5modf.so := -shared -static-libgcc +LDFLAGS_tst-cleanupx4 := tst-cleanup4aux.o + +# +# Special case +# +tst-cleanup4aux.o: + $(Q)$(CC) $(CFLAGS) $(CFLAGS_$@) $(EXTRA_CFLAGS) -c tst-cleanup4aux.c -o $@ + +tst-cleanup4: tst-cleanup4aux.o +tst-tls3: tst-tls3mod.so +tst-tls4: tst-tls4moda.so tst-tls4modb.so +tst-tls5: tst-tls5mod.so + +tst-cleanupx4 : tst-cleanup4aux.o +tst-fini1: tst-fini1mod.so + +tst-atfork2: libatfork.so +tst-atfork2_glibc: libatfork.so.glibc + +OPTS_tst-cancel7 = -c ./tst-cancel7 +OPTS_tst-mqueue7 = -- ./tst-mqueue7 +OPTS_tst-exec4 = ./tst-exec4 + +WRAPPER := env LD_LIBRARY_PATH="$$PWD:.:$(LD_LIBRARY_PATH)" TIMEOUTFACTOR=10 diff --git a/test/nptl/eintr.c b/test/nptl/eintr.c new file mode 100644 index 000000000..d6425b51b --- /dev/null +++ b/test/nptl/eintr.c @@ -0,0 +1,88 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <signal.h> +#include <unistd.h> + + +static int the_sig; + + +static void +eintr_handler (int sig) +{ + if (sig != the_sig) + { + write (STDOUT_FILENO, "eintr_handler: signal number wrong\n", 35); + _exit (1); + } + write (STDOUT_FILENO, ".", 1); +} + + +static void * +eintr_source (void *arg) +{ + struct timespec ts = { .tv_sec = 0, .tv_nsec = 500000 }; + + if (arg == NULL) + { + sigset_t ss; + sigemptyset (&ss); + sigaddset (&ss, the_sig); + pthread_sigmask (SIG_BLOCK, &ss, NULL); + } + + while (1) + { + if (arg != NULL) + pthread_kill (*(pthread_t *) arg, the_sig); + else + kill (getpid (), the_sig); + + nanosleep (&ts, NULL); + } + + /* NOTREACHED */ + return NULL; +} + + +static void +setup_eintr (int sig, pthread_t *thp) +{ + struct sigaction sa; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = eintr_handler; + if (sigaction (sig, &sa, NULL) != 0) + { + puts ("setup_eintr: sigaction failed"); + exit (1); + } + the_sig = sig; + + /* Create the thread which will fire off the signals. */ + pthread_t th; + if (pthread_create (&th, NULL, eintr_source, thp) != 0) + { + puts ("setup_eintr: pthread_create failed"); + exit (1); + } +} diff --git a/test/nptl/libatfork.c b/test/nptl/libatfork.c new file mode 100644 index 000000000..f4ddca057 --- /dev/null +++ b/test/nptl/libatfork.c @@ -0,0 +1,27 @@ +#include <stdio.h> +#include <pthread.h> + +static void atfork_prepare(void) +{ + /* nothing to do */ +} + +static void atfork_parent(void) +{ + /* nothing to do */ +} + +static void atfork_child(void) +{ + /* nothing to do */ +} + +static __attribute__((constructor)) void init(void) +{ + pthread_atfork(atfork_prepare, atfork_parent, atfork_child); +} + +static __attribute__((destructor)) void done(void) +{ + /* nothing to do */ +} diff --git a/test/nptl/tst-align.c b/test/nptl/tst-align.c new file mode 100644 index 000000000..df66b38b7 --- /dev/null +++ b/test/nptl/tst-align.c @@ -0,0 +1,70 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include "tst-stack-align.h" + +static void * +tf (void *arg) +{ + bool ok = true; + + puts ("in thread"); + + if (TEST_STACK_ALIGN ()) + ok = false; + + return ok ? NULL : (void *) -1l; +} + +static int +do_test (void) +{ + bool ok = true; + + puts ("in main"); + + if (TEST_STACK_ALIGN ()) + ok = false; + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + void *res; + if (pthread_join (th, &res) != 0) + { + puts ("join failed"); + return 1; + } + + if (res != NULL) + ok = false; + + return ok ? 0 : 1; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-align2.c b/test/nptl/tst-align2.c new file mode 100644 index 000000000..7d3a09913 --- /dev/null +++ b/test/nptl/tst-align2.c @@ -0,0 +1,86 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <sched.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include <string.h> +#include <sys/wait.h> +#include <unistd.h> +#include "tst-stack-align.h" + +static int +f (void *arg) +{ + bool ok = true; + + if (TEST_STACK_ALIGN ()) + ok = false; + + return ok ? 0 : 1; +} + +static int +do_test (void) +{ + bool ok = true; + + puts ("in main"); + + if (TEST_STACK_ALIGN ()) + ok = false; + +#ifdef __ia64__ + extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base, + size_t __child_stack_size, int __flags, + void *__arg, ...); + char st[256 * 1024]; + pid_t p = __clone2 (f, st, sizeof (st), 0, 0); +#else + char st[128 * 1024]; + pid_t p = clone (f, st + sizeof (st), 0, 0); +#endif + if (p == -1) + { + printf("clone failed: %m\n"); + return 1; + } + + int e; + if (waitpid (p, &e, __WCLONE) != p) + { + puts ("waitpid failed"); + kill (p, SIGKILL); + return 1; + } + if (!WIFEXITED (e)) + { + if (WIFSIGNALED (e)) + printf ("died from signal %s\n", strsignal (WTERMSIG (e))); + else + puts ("did not terminate correctly"); + return 1; + } + if (WEXITSTATUS (e) != 0) + ok = false; + + return ok ? 0 : 1; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-align3.c b/test/nptl/tst-align3.c new file mode 100644 index 000000000..fb0a8e4ec --- /dev/null +++ b/test/nptl/tst-align3.c @@ -0,0 +1,56 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> +#include "tst-stack-align.h" + +static bool ok = true; +static pthread_once_t once = PTHREAD_ONCE_INIT; + +static void +once_test (void) +{ + puts ("in once_test"); + + if (TEST_STACK_ALIGN ()) + ok = false; +} + +static int +do_test (void) +{ + puts ("in main"); + + if (TEST_STACK_ALIGN ()) + ok = false; + + if (pthread_once (&once, once_test)) + { + puts ("pthread once failed"); + return 1; + } + + return ok ? 0 : 1; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-atfork1.c b/test/nptl/tst-atfork1.c new file mode 100644 index 000000000..129893747 --- /dev/null +++ b/test/nptl/tst-atfork1.c @@ -0,0 +1,120 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/wait.h> + + +static int val; + + +static void +prepare1 (void) +{ + val *= 2; +} + +static void +prepare2 (void) +{ + ++val; +} + +static void +parent1 (void) +{ + val += 4; +} + +static void +parent2 (void) +{ + val *= 4; +} + +static void +child1 (void) +{ + val += 8; +} + +static void +child2 (void) +{ + val *= 8; +} + + +static int +do_test (void) +{ + pid_t pid; + int status = 0; + + if (pthread_atfork (prepare1, parent1, child1) != 0) + { + puts ("1st atfork failed"); + exit (1); + } + if (pthread_atfork (prepare2, parent2, child2) != 0) + { + puts ("2nd atfork failed"); + exit (1); + } + + pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + exit (1); + } + + if (pid != 0) + { + /* Parent. */ + if (val != 24) + { + printf ("expected val=%d, got %d\n", 24, val); + exit (1); + } + + if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid) + { + puts ("waitpid failed"); + exit (1); + } + } + else + { + /* Child. */ + if (val != 80) + { + printf ("expected val=%d, got %d\n", 80, val); + exit (2); + } + } + + return status; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-atfork2.c b/test/nptl/tst-atfork2.c new file mode 100644 index 000000000..1c303de63 --- /dev/null +++ b/test/nptl/tst-atfork2.c @@ -0,0 +1,24 @@ +#include <stdio.h> +#include <unistd.h> +#include <dlfcn.h> + +int main(int argc, char *argv[]) +{ + void *h; + pid_t pid; + + h = dlopen("libatfork.so", RTLD_NOW); + if (!h) + { + printf("Failed to open libatfork.so\n"); + return 1; + } + dlclose(h); + + if ((pid = fork()) < 0) { + printf("Fork failed\n"); + return 1; + } + + return 0; +} diff --git a/test/nptl/tst-attr1.c b/test/nptl/tst-attr1.c new file mode 100644 index 000000000..987f87ff5 --- /dev/null +++ b/test/nptl/tst-attr1.c @@ -0,0 +1,305 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +int +do_test (void) +{ + int i; + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + pthread_mutexattr_t ma; + + if (pthread_mutexattr_init (&ma) != 0) + { + puts ("mutexattr_init failed"); + exit (1); + } + + pthread_rwlockattr_t rwa; + + if (pthread_rwlockattr_init (&rwa) != 0) + { + puts ("rwlockattr_init failed"); + exit (1); + } + + /* XXX Remove if default value is clear. */ + pthread_attr_setinheritsched (&a, PTHREAD_INHERIT_SCHED); + pthread_attr_setschedpolicy (&a, SCHED_OTHER); + pthread_attr_setscope (&a, PTHREAD_SCOPE_SYSTEM); + + for (i = 0; i < 10000; ++i) + { + long int r = random (); + + if (r != PTHREAD_CREATE_DETACHED && r != PTHREAD_CREATE_JOINABLE) + { + int e = pthread_attr_setdetachstate (&a, r); + + if (e == 0) + { + printf ("attr_setdetachstate with value %ld succeeded\n", r); + exit (1); + } + if (e != EINVAL) + { + puts ("attr_setdetachstate didn't return EINVAL"); + exit (1); + } + + int s; + if (pthread_attr_getdetachstate (&a, &s) != 0) + { + puts ("attr_getdetachstate failed"); + exit (1); + } + + if (s != PTHREAD_CREATE_JOINABLE) + { + printf ("\ +detach state changed to %d by invalid setdetachstate call\n", s); + exit (1); + } + } + + if (r != PTHREAD_INHERIT_SCHED && r != PTHREAD_EXPLICIT_SCHED) + { + int e = pthread_attr_setinheritsched (&a, r); + + if (e == 0) + { + printf ("attr_setinheritsched with value %ld succeeded\n", r); + exit (1); + } + if (e != EINVAL) + { + puts ("attr_setinheritsched didn't return EINVAL"); + exit (1); + } + + int s; + if (pthread_attr_getinheritsched (&a, &s) != 0) + { + puts ("attr_getinheritsched failed"); + exit (1); + } + + if (s != PTHREAD_INHERIT_SCHED) + { + printf ("\ +inheritsched changed to %d by invalid setinheritsched call\n", s); + exit (1); + } + } + + if (r != SCHED_OTHER && r != SCHED_RR && r != SCHED_FIFO) + { + int e = pthread_attr_setschedpolicy (&a, r); + + if (e == 0) + { + printf ("attr_setschedpolicy with value %ld succeeded\n", r); + exit (1); + } + if (e != EINVAL) + { + puts ("attr_setschedpolicy didn't return EINVAL"); + exit (1); + } + + int s; + if (pthread_attr_getschedpolicy (&a, &s) != 0) + { + puts ("attr_getschedpolicy failed"); + exit (1); + } + + if (s != SCHED_OTHER) + { + printf ("\ +schedpolicy changed to %d by invalid setschedpolicy call\n", s); + exit (1); + } + } + + if (r != PTHREAD_SCOPE_SYSTEM && r != PTHREAD_SCOPE_PROCESS) + { + int e = pthread_attr_setscope (&a, r); + + if (e == 0) + { + printf ("attr_setscope with value %ld succeeded\n", r); + exit (1); + } + if (e != EINVAL) + { + puts ("attr_setscope didn't return EINVAL"); + exit (1); + } + + int s; + if (pthread_attr_getscope (&a, &s) != 0) + { + puts ("attr_getscope failed"); + exit (1); + } + + if (s != PTHREAD_SCOPE_SYSTEM) + { + printf ("\ +contentionscope changed to %d by invalid setscope call\n", s); + exit (1); + } + } + + if (r != PTHREAD_PROCESS_PRIVATE && r != PTHREAD_PROCESS_SHARED) + { + int e = pthread_mutexattr_setpshared (&ma, r); + + if (e == 0) + { + printf ("mutexattr_setpshared with value %ld succeeded\n", r); + exit (1); + } + if (e != EINVAL) + { + puts ("mutexattr_setpshared didn't return EINVAL"); + exit (1); + } + + int s; + if (pthread_mutexattr_getpshared (&ma, &s) != 0) + { + puts ("mutexattr_getpshared failed"); + exit (1); + } + + if (s != PTHREAD_PROCESS_PRIVATE) + { + printf ("\ +pshared changed to %d by invalid mutexattr_setpshared call\n", s); + exit (1); + } + + e = pthread_rwlockattr_setpshared (&rwa, r); + + if (e == 0) + { + printf ("rwlockattr_setpshared with value %ld succeeded\n", r); + exit (1); + } + if (e != EINVAL) + { + puts ("rwlockattr_setpshared didn't return EINVAL"); + exit (1); + } + + if (pthread_rwlockattr_getpshared (&rwa, &s) != 0) + { + puts ("rwlockattr_getpshared failed"); + exit (1); + } + + if (s != PTHREAD_PROCESS_PRIVATE) + { + printf ("\ +pshared changed to %d by invalid rwlockattr_setpshared call\n", s); + exit (1); + } + } + + if (r != PTHREAD_CANCEL_ENABLE && r != PTHREAD_CANCEL_DISABLE) + { + int e = pthread_setcancelstate (r, NULL); + + if (e == 0) + { + printf ("setcancelstate with value %ld succeeded\n", r); + exit (1); + } + + if (e != EINVAL) + { + puts ("setcancelstate didn't return EINVAL"); + exit (1); + } + + int s; + if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, &s) != 0) + { + puts ("setcancelstate failed for PTHREAD_CANCEL_ENABLE"); + exit (1); + } + + if (s != PTHREAD_CANCEL_ENABLE) + { + puts ("invalid setcancelstate changed state"); + exit (1); + } + } + + if (r != PTHREAD_CANCEL_DEFERRED && r != PTHREAD_CANCEL_ASYNCHRONOUS) + { + int e = pthread_setcanceltype (r, NULL); + + if (e == 0) + { + printf ("setcanceltype with value %ld succeeded\n", r); + exit (1); + } + + if (e != EINVAL) + { + puts ("setcanceltype didn't return EINVAL"); + exit (1); + } + + int s; + if (pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &s) != 0) + { + puts ("setcanceltype failed for PTHREAD_CANCEL_DEFERRED"); + exit (1); + } + + if (s != PTHREAD_CANCEL_DEFERRED) + { + puts ("invalid setcanceltype changed state"); + exit (1); + } + } + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-attr2.c b/test/nptl/tst-attr2.c new file mode 100644 index 000000000..e8f9cc986 --- /dev/null +++ b/test/nptl/tst-attr2.c @@ -0,0 +1,316 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +int +do_test (void) +{ + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + /* Check default value of detach state. */ + int s; + if (pthread_attr_getdetachstate (&a, &s) != 0) + { + puts ("1st attr_getdestachstate failed"); + exit (1); + } + if (s != PTHREAD_CREATE_JOINABLE) + { + printf ("\ +default detach state wrong: %d, expected %d (PTHREAD_CREATE_JOINABLE)\n", + s, PTHREAD_CREATE_JOINABLE); + exit (1); + } + + int e = pthread_attr_setdetachstate (&a, PTHREAD_CREATE_DETACHED); + if (e != 0) + { + puts ("1st attr_setdetachstate failed"); + exit (1); + } + if (pthread_attr_getdetachstate (&a, &s) != 0) + { + puts ("2nd attr_getdestachstate failed"); + exit (1); + } + if (s != PTHREAD_CREATE_DETACHED) + { + puts ("PTHREAD_CREATE_DETACHED set, but not given back"); + exit (1); + } + + e = pthread_attr_setdetachstate (&a, PTHREAD_CREATE_JOINABLE); + if (e != 0) + { + puts ("2nd attr_setdetachstate failed"); + exit (1); + } + if (pthread_attr_getdetachstate (&a, &s) != 0) + { + puts ("3rd attr_getdestachstate failed"); + exit (1); + } + if (s != PTHREAD_CREATE_JOINABLE) + { + puts ("PTHREAD_CREATE_JOINABLE set, but not given back"); + exit (1); + } + + + size_t g; + if (pthread_attr_getguardsize (&a, &g) != 0) + { + puts ("1st attr_getguardsize failed"); + exit (1); + } + if (g != (size_t) sysconf (_SC_PAGESIZE)) + { + printf ("default guardsize %zu, expected %ld (PAGESIZE)\n", + g, sysconf (_SC_PAGESIZE)); + exit (1); + } + + e = pthread_attr_setguardsize (&a, 0); + if (e != 0) + { + puts ("1st attr_setguardsize failed"); + exit (1); + } + if (pthread_attr_getguardsize (&a, &g) != 0) + { + puts ("2nd attr_getguardsize failed"); + exit (1); + } + if (g != 0) + { + printf ("guardsize set to zero but %zu returned\n", g); + exit (1); + } + + e = pthread_attr_setguardsize (&a, 1); + if (e != 0) + { + puts ("2nd attr_setguardsize failed"); + exit (1); + } + if (pthread_attr_getguardsize (&a, &g) != 0) + { + puts ("3rd attr_getguardsize failed"); + exit (1); + } + if (g != 1) + { + printf ("guardsize set to 1 but %zu returned\n", g); + exit (1); + } + + + if (pthread_attr_getinheritsched (&a, &s) != 0) + { + puts ("1st attr_getinheritsched failed"); + exit (1); + } + /* XXX What is the correct default value. */ + if (s != PTHREAD_INHERIT_SCHED && s != PTHREAD_EXPLICIT_SCHED) + { + puts ("incorrect default value for inheritsched"); + exit (1); + } + + e = pthread_attr_setinheritsched (&a, PTHREAD_EXPLICIT_SCHED); + if (e != 0) + { + puts ("1st attr_setinheritsched failed"); + exit (1); + } + if (pthread_attr_getinheritsched (&a, &s) != 0) + { + puts ("2nd attr_getinheritsched failed"); + exit (1); + } + if (s != PTHREAD_EXPLICIT_SCHED) + { + printf ("inheritsched set to PTHREAD_EXPLICIT_SCHED, but got %d\n", s); + exit (1); + } + + e = pthread_attr_setinheritsched (&a, PTHREAD_INHERIT_SCHED); + if (e != 0) + { + puts ("2nd attr_setinheritsched failed"); + exit (1); + } + if (pthread_attr_getinheritsched (&a, &s) != 0) + { + puts ("3rd attr_getinheritsched failed"); + exit (1); + } + if (s != PTHREAD_INHERIT_SCHED) + { + printf ("inheritsched set to PTHREAD_INHERIT_SCHED, but got %d\n", s); + exit (1); + } + + + if (pthread_attr_getschedpolicy (&a, &s) != 0) + { + puts ("1st attr_getschedpolicy failed"); + exit (1); + } + /* XXX What is the correct default value. */ + if (s != SCHED_OTHER && s != SCHED_FIFO && s != SCHED_RR) + { + puts ("incorrect default value for schedpolicy"); + exit (1); + } + + e = pthread_attr_setschedpolicy (&a, SCHED_RR); + if (e != 0) + { + puts ("1st attr_setschedpolicy failed"); + exit (1); + } + if (pthread_attr_getschedpolicy (&a, &s) != 0) + { + puts ("2nd attr_getschedpolicy failed"); + exit (1); + } + if (s != SCHED_RR) + { + printf ("schedpolicy set to SCHED_RR, but got %d\n", s); + exit (1); + } + + e = pthread_attr_setschedpolicy (&a, SCHED_FIFO); + if (e != 0) + { + puts ("2nd attr_setschedpolicy failed"); + exit (1); + } + if (pthread_attr_getschedpolicy (&a, &s) != 0) + { + puts ("3rd attr_getschedpolicy failed"); + exit (1); + } + if (s != SCHED_FIFO) + { + printf ("schedpolicy set to SCHED_FIFO, but got %d\n", s); + exit (1); + } + + e = pthread_attr_setschedpolicy (&a, SCHED_OTHER); + if (e != 0) + { + puts ("3rd attr_setschedpolicy failed"); + exit (1); + } + if (pthread_attr_getschedpolicy (&a, &s) != 0) + { + puts ("4th attr_getschedpolicy failed"); + exit (1); + } + if (s != SCHED_OTHER) + { + printf ("schedpolicy set to SCHED_OTHER, but got %d\n", s); + exit (1); + } + + + if (pthread_attr_getscope (&a, &s) != 0) + { + puts ("1st attr_getscope failed"); + exit (1); + } + /* XXX What is the correct default value. */ + if (s != PTHREAD_SCOPE_SYSTEM && s != PTHREAD_SCOPE_PROCESS) + { + puts ("incorrect default value for contentionscope"); + exit (1); + } + + e = pthread_attr_setscope (&a, PTHREAD_SCOPE_PROCESS); + if (e != ENOTSUP) + { + if (e != 0) + { + puts ("1st attr_setscope failed"); + exit (1); + } + if (pthread_attr_getscope (&a, &s) != 0) + { + puts ("2nd attr_getscope failed"); + exit (1); + } + if (s != PTHREAD_SCOPE_PROCESS) + { + printf ("\ +contentionscope set to PTHREAD_SCOPE_PROCESS, but got %d\n", s); + exit (1); + } + } + + e = pthread_attr_setscope (&a, PTHREAD_SCOPE_SYSTEM); + if (e != 0) + { + puts ("2nd attr_setscope failed"); + exit (1); + } + if (pthread_attr_getscope (&a, &s) != 0) + { + puts ("3rd attr_getscope failed"); + exit (1); + } + if (s != PTHREAD_SCOPE_SYSTEM) + { + printf ("contentionscope set to PTHREAD_SCOPE_SYSTEM, but got %d\n", s); + exit (1); + } + + char buf[1]; + e = pthread_attr_setstack (&a, buf, 1); + if (e != EINVAL) + { + puts ("setstack with size 1 did not produce EINVAL"); + exit (1); + } + + e = pthread_attr_setstacksize (&a, 1); + if (e != EINVAL) + { + puts ("setstacksize with size 1 did not produce EINVAL"); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-attr3.c b/test/nptl/tst-attr3.c new file mode 100644 index 000000000..5ccf9abba --- /dev/null +++ b/test/nptl/tst-attr3.c @@ -0,0 +1,419 @@ +/* pthread_getattr_np test. + Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <error.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +static void * +tf (void *arg) +{ + pthread_attr_t a, *ap, a2; + int err; + void *result = NULL; + + if (arg == NULL) + { + ap = &a2; + err = pthread_attr_init (ap); + if (err) + { + error (0, err, "pthread_attr_init failed"); + return tf; + } + } + else + ap = (pthread_attr_t *) arg; + + err = pthread_getattr_np (pthread_self (), &a); + if (err) + { + error (0, err, "pthread_getattr_np failed"); + result = tf; + } + + int detachstate1, detachstate2; + err = pthread_attr_getdetachstate (&a, &detachstate1); + if (err) + { + error (0, err, "pthread_attr_getdetachstate failed"); + result = tf; + } + else + { + err = pthread_attr_getdetachstate (ap, &detachstate2); + if (err) + { + error (0, err, "pthread_attr_getdetachstate failed"); + result = tf; + } + else if (detachstate1 != detachstate2) + { + error (0, 0, "detachstate differs %d != %d", + detachstate1, detachstate2); + result = tf; + } + } + + void *stackaddr; + size_t stacksize; + err = pthread_attr_getstack (&a, &stackaddr, &stacksize); + if (err) + { + error (0, err, "pthread_attr_getstack failed"); + result = tf; + } + else if ((void *) &a < stackaddr + || (void *) &a >= stackaddr + stacksize) + { + error (0, 0, "pthread_attr_getstack returned range does not cover thread's stack"); + result = tf; + } + else + printf ("thread stack %p-%p (0x%zx)\n", stackaddr, stackaddr + stacksize, + stacksize); + + size_t guardsize1, guardsize2; + err = pthread_attr_getguardsize (&a, &guardsize1); + if (err) + { + error (0, err, "pthread_attr_getguardsize failed"); + result = tf; + } + else + { + err = pthread_attr_getguardsize (ap, &guardsize2); + if (err) + { + error (0, err, "pthread_attr_getguardsize failed"); + result = tf; + } + else if (guardsize1 != guardsize2) + { + error (0, 0, "guardsize differs %zd != %zd", + guardsize1, guardsize2); + result = tf; + } + else + printf ("thread guardsize %zd\n", guardsize1); + } + + int scope1, scope2; + err = pthread_attr_getscope (&a, &scope1); + if (err) + { + error (0, err, "pthread_attr_getscope failed"); + result = tf; + } + else + { + err = pthread_attr_getscope (ap, &scope2); + if (err) + { + error (0, err, "pthread_attr_getscope failed"); + result = tf; + } + else if (scope1 != scope2) + { + error (0, 0, "scope differs %d != %d", + scope1, scope2); + result = tf; + } + } + + int inheritsched1, inheritsched2; + err = pthread_attr_getinheritsched (&a, &inheritsched1); + if (err) + { + error (0, err, "pthread_attr_getinheritsched failed"); + result = tf; + } + else + { + err = pthread_attr_getinheritsched (ap, &inheritsched2); + if (err) + { + error (0, err, "pthread_attr_getinheritsched failed"); + result = tf; + } + else if (inheritsched1 != inheritsched2) + { + error (0, 0, "inheritsched differs %d != %d", + inheritsched1, inheritsched2); + result = tf; + } + } + + cpu_set_t c1, c2; + err = pthread_getaffinity_np (pthread_self (), sizeof (c1), &c1); + if (err == 0) + { + err = pthread_attr_getaffinity_np (&a, sizeof (c2), &c2); + if (err) + { + error (0, err, "pthread_attr_getaffinity_np failed"); + result = tf; + } + else if (memcmp (&c1, &c2, sizeof (c1))) + { + error (0, 0, "pthread_attr_getaffinity_np returned different CPU mask than pthread_getattr_np"); + result = tf; + } + } + + err = pthread_attr_destroy (&a); + if (err) + { + error (0, err, "pthread_attr_destroy failed"); + result = tf; + } + + if (ap == &a2) + { + err = pthread_attr_destroy (ap); + if (err) + { + error (0, err, "pthread_attr_destroy failed"); + result = tf; + } + } + + return result; +} + + +static int +do_test (void) +{ + int result = 0; + pthread_attr_t a; + cpu_set_t c1, c2; + + int err = pthread_attr_init (&a); + if (err) + { + error (0, err, "pthread_attr_init failed"); + result = 1; + } + + err = pthread_attr_getaffinity_np (&a, sizeof (c1), &c1); + if (err && err != ENOSYS) + { + error (0, err, "pthread_attr_getaffinity_np failed"); + result = 1; + } + + err = pthread_attr_destroy (&a); + if (err) + { + error (0, err, "pthread_attr_destroy failed"); + result = 1; + } + + err = pthread_getattr_np (pthread_self (), &a); + if (err) + { + error (0, err, "pthread_getattr_np failed"); + result = 1; + } + + int detachstate; + err = pthread_attr_getdetachstate (&a, &detachstate); + if (err) + { + error (0, err, "pthread_attr_getdetachstate failed"); + result = 1; + } + else if (detachstate != PTHREAD_CREATE_JOINABLE) + { + error (0, 0, "initial thread not joinable"); + result = 1; + } + + void *stackaddr; + size_t stacksize; + err = pthread_attr_getstack (&a, &stackaddr, &stacksize); + if (err) + { + error (0, err, "pthread_attr_getstack failed"); + result = 1; + } + else if ((void *) &a < stackaddr + || (void *) &a >= stackaddr + stacksize) + { + error (0, 0, "pthread_attr_getstack returned range does not cover main's stack"); + result = 1; + } + else + printf ("initial thread stack %p-%p (0x%zx)\n", stackaddr, + stackaddr + stacksize, stacksize); + + size_t guardsize; + err = pthread_attr_getguardsize (&a, &guardsize); + if (err) + { + error (0, err, "pthread_attr_getguardsize failed"); + result = 1; + } + else if (guardsize != 0) + { + error (0, 0, "pthread_attr_getguardsize returned %zd != 0", + guardsize); + result = 1; + } + + int scope; + err = pthread_attr_getscope (&a, &scope); + if (err) + { + error (0, err, "pthread_attr_getscope failed"); + result = 1; + } + else if (scope != PTHREAD_SCOPE_SYSTEM) + { + error (0, 0, "pthread_attr_getscope returned %d != PTHREAD_SCOPE_SYSTEM", + scope); + result = 1; + } + + int inheritsched; + err = pthread_attr_getinheritsched (&a, &inheritsched); + if (err) + { + error (0, err, "pthread_attr_getinheritsched failed"); + result = 1; + } + else if (inheritsched != PTHREAD_INHERIT_SCHED) + { + error (0, 0, "pthread_attr_getinheritsched returned %d != PTHREAD_INHERIT_SCHED", + inheritsched); + result = 1; + } + + err = pthread_getaffinity_np (pthread_self (), sizeof (c1), &c1); + if (err == 0) + { + err = pthread_attr_getaffinity_np (&a, sizeof (c2), &c2); + if (err) + { + error (0, err, "pthread_attr_getaffinity_np failed"); + result = 1; + } + else if (memcmp (&c1, &c2, sizeof (c1))) + { + error (0, 0, "pthread_attr_getaffinity_np returned different CPU mask than pthread_getattr_np"); + result = 1; + } + } + + err = pthread_attr_destroy (&a); + if (err) + { + error (0, err, "pthread_attr_destroy failed"); + result = 1; + } + + pthread_t th; + err = pthread_create (&th, NULL, tf, NULL); + if (err) + { + error (0, err, "pthread_create #1 failed"); + result = 1; + } + else + { + void *ret; + err = pthread_join (th, &ret); + if (err) + { + error (0, err, "pthread_join #1 failed"); + result = 1; + } + else if (ret != NULL) + result = 1; + } + + err = pthread_attr_init (&a); + if (err) + { + error (0, err, "pthread_attr_init failed"); + result = 1; + } + + err = pthread_create (&th, &a, tf, &a); + if (err) + { + error (0, err, "pthread_create #2 failed"); + result = 1; + } + else + { + void *ret; + err = pthread_join (th, &ret); + if (err) + { + error (0, err, "pthread_join #2 failed"); + result = 1; + } + else if (ret != NULL) + result = 1; + } + + err = pthread_attr_setguardsize (&a, 16 * sysconf (_SC_PAGESIZE)); + if (err) + { + error (0, err, "pthread_attr_setguardsize failed"); + result = 1; + } + + err = pthread_create (&th, &a, tf, &a); + if (err) + { + error (0, err, "pthread_create #3 failed"); + result = 1; + } + else + { + void *ret; + err = pthread_join (th, &ret); + if (err) + { + error (0, err, "pthread_join #3 failed"); + result = 1; + } + else if (ret != NULL) + result = 1; + } + + err = pthread_attr_destroy (&a); + if (err) + { + error (0, err, "pthread_attr_destroy failed"); + result = 1; + } + + return result; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-barrier1.c b/test/nptl/tst-barrier1.c new file mode 100644 index 000000000..4e396c97a --- /dev/null +++ b/test/nptl/tst-barrier1.c @@ -0,0 +1,70 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> + + +static int +do_test (void) +{ + pthread_barrier_t b; + int e; + int cnt; + + e = pthread_barrier_init (&b, NULL, 0); + if (e == 0) + { + puts ("barrier_init with count 0 succeeded"); + return 1; + } + if (e != EINVAL) + { + puts ("barrier_init with count 0 didn't return EINVAL"); + return 1; + } + + if (pthread_barrier_init (&b, NULL, 1) != 0) + { + puts ("real barrier_init failed"); + return 1; + } + + for (cnt = 0; cnt < 10; ++cnt) + { + e = pthread_barrier_wait (&b); + + if (e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait didn't return PTHREAD_BARRIER_SERIAL_THREAD"); + return 1; + } + } + + if (pthread_barrier_destroy (&b) != 0) + { + puts ("barrier_destroy failed"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-barrier2.c b/test/nptl/tst-barrier2.c new file mode 100644 index 000000000..8ffcda063 --- /dev/null +++ b/test/nptl/tst-barrier2.c @@ -0,0 +1,184 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/wait.h> + + +static int +do_test (void) +{ + size_t ps = sysconf (_SC_PAGESIZE); + char tmpfname[] = "/tmp/tst-barrier2.XXXXXX"; + char data[ps]; + void *mem; + int fd; + pthread_barrier_t *b; + pthread_barrierattr_t a; + pid_t pid; + int serials = 0; + int cnt; + int status; + int p; + + fd = mkstemp (tmpfname); + if (fd == -1) + { + printf ("cannot open temporary file: %m\n"); + return 1; + } + + /* Make sure it is always removed. */ + unlink (tmpfname); + + /* Create one page of data. */ + memset (data, '\0', ps); + + /* Write the data to the file. */ + if (write (fd, data, ps) != (ssize_t) ps) + { + puts ("short write"); + return 1; + } + + mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (mem == MAP_FAILED) + { + printf ("mmap failed: %m\n"); + return 1; + } + + b = (pthread_barrier_t *) (((uintptr_t) mem + __alignof (pthread_barrier_t)) + & ~(__alignof (pthread_barrier_t) - 1)); + + if (pthread_barrierattr_init (&a) != 0) + { + puts ("barrierattr_init failed"); + return 1; + } + + if (pthread_barrierattr_getpshared (&a, &p) != 0) + { + puts ("1st barrierattr_getpshared failed"); + return 1; + } + + if (p != PTHREAD_PROCESS_PRIVATE) + { + puts ("default pshared value wrong"); + return 1; + } + + if (pthread_barrierattr_setpshared (&a, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("barrierattr_setpshared failed"); + return 1; + } + + if (pthread_barrierattr_getpshared (&a, &p) != 0) + { + puts ("2nd barrierattr_getpshared failed"); + return 1; + } + + if (p != PTHREAD_PROCESS_SHARED) + { + puts ("pshared value after setpshared call wrong"); + return 1; + } + + if (pthread_barrier_init (b, &a, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + if (pthread_barrierattr_destroy (&a) != 0) + { + puts ("barrierattr_destroy failed"); + return 1; + } + + puts ("going to fork now"); + pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + return 1; + } + + /* Just to be sure we don't hang forever. */ + alarm (4); + +#define N 30 + for (cnt = 0; cnt < N; ++cnt) + { + int e; + + e = pthread_barrier_wait (b); + if (e == PTHREAD_BARRIER_SERIAL_THREAD) + ++serials; + else if (e != 0) + { + printf ("%s: barrier_wait returned value %d != 0 and PTHREAD_BARRIER_SERIAL_THREAD\n", + pid == 0 ? "child" : "parent", e); + return 1; + } + } + + alarm (0); + + printf ("%s: was %d times the serial thread\n", + pid == 0 ? "child" : "parent", serials); + + if (pid == 0) + /* The child. Pass the number of times we had the serializing + thread back to the parent. */ + exit (serials); + + if (waitpid (pid, &status, 0) != pid) + { + puts ("waitpid failed"); + return 1; + } + + if (!WIFEXITED (status)) + { + puts ("child exited abnormally"); + return 1; + } + + if (WEXITSTATUS (status) + serials != N) + { + printf ("total number of serials is %d, expected %d\n", + WEXITSTATUS (status) + serials, N); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-barrier3.c b/test/nptl/tst-barrier3.c new file mode 100644 index 000000000..9c4e2b25f --- /dev/null +++ b/test/nptl/tst-barrier3.c @@ -0,0 +1,153 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +/* Test of POSIX barriers. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#define NTHREADS 20 + +#define ROUNDS 20 + +static pthread_barrier_t barriers[NTHREADS]; + +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; +static int counters[NTHREADS]; +static int serial[NTHREADS]; + +static void * +worker (void *arg) +{ + void *result = NULL; + int nr = (long int) arg; + int i; + + for (i = 0; i < ROUNDS; ++i) + { + int j; + int retval; + + if (nr == 0) + { + memset (counters, '\0', sizeof (counters)); + memset (serial, '\0', sizeof (serial)); + } + + retval = pthread_barrier_wait (&barriers[NTHREADS - 1]); + if (retval != 0 && retval != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("thread %d failed to wait for all the others\n", nr); + result = (void *) 1; + } + + for (j = nr; j < NTHREADS; ++j) + { + /* Increment the counter for this round. */ + pthread_mutex_lock (&lock); + ++counters[j]; + pthread_mutex_unlock (&lock); + + /* Wait for the rest. */ + retval = pthread_barrier_wait (&barriers[j]); + + /* Test the result. */ + if (nr == 0 && counters[j] != j + 1) + { + printf ("barrier in round %d released but count is %d\n", + j, counters[j]); + result = (void *) 1; + } + + if (retval != 0) + { + if (retval != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("thread %d in round %d has nonzero return value != PTHREAD_BARRIER_SERIAL_THREAD\n", + nr, j); + result = (void *) 1; + } + else + { + pthread_mutex_lock (&lock); + ++serial[j]; + pthread_mutex_unlock (&lock); + } + } + + /* Wait for the rest again. */ + retval = pthread_barrier_wait (&barriers[j]); + + /* Now we can check whether exactly one thread was serializing. */ + if (nr == 0 && serial[j] != 1) + { + printf ("not exactly one serial thread in round %d\n", j); + result = (void *) 1; + } + } + } + + return result; +} + + +#define TEST_FUNCTION do_test () +#define TIMEOUT 60 +static int +do_test (void) +{ + pthread_t threads[NTHREADS]; + int i; + void *res; + int result = 0; + + /* Initialized the barrier variables. */ + for (i = 0; i < NTHREADS; ++i) + if (pthread_barrier_init (&barriers[i], NULL, i + 1) != 0) + { + printf ("Failed to initialize barrier %d\n", i); + exit (1); + } + + /* Start the threads. */ + for (i = 0; i < NTHREADS; ++i) + if (pthread_create (&threads[i], NULL, worker, (void *) (long int) i) != 0) + { + printf ("Failed to start thread %d\n", i); + exit (1); + } + + /* And wait for them. */ + for (i = 0; i < NTHREADS; ++i) + if (pthread_join (threads[i], &res) != 0 || res != NULL) + { + printf ("thread %d returned a failure\n", i); + result = 1; + } + else + printf ("joined threads %d\n", i); + + if (result == 0) + puts ("all OK"); + + return result; +} + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-barrier4.c b/test/nptl/tst-barrier4.c new file mode 100644 index 000000000..cad9fb727 --- /dev/null +++ b/test/nptl/tst-barrier4.c @@ -0,0 +1,121 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +/* This is a test for behavior not guaranteed by POSIX. */ +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + + +static pthread_barrier_t b1; +static pthread_barrier_t b2; + + +#define N 20 + +static void * +tf (void *arg) +{ + int round = 0; + + while (round++ < 30) + { + if (pthread_barrier_wait (&b1) == PTHREAD_BARRIER_SERIAL_THREAD) + { + pthread_barrier_destroy (&b1); + if (pthread_barrier_init (&b1, NULL, N) != 0) + { + puts ("tf: 1st barrier_init failed"); + exit (1); + } + } + + if (pthread_barrier_wait (&b2) == PTHREAD_BARRIER_SERIAL_THREAD) + { + pthread_barrier_destroy (&b2); + if (pthread_barrier_init (&b2, NULL, N) != 0) + { + puts ("tf: 2nd barrier_init failed"); + exit (1); + } + } + } + + return NULL; +} + + +static int +do_test (void) +{ + pthread_attr_t at; + int cnt; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + + if (pthread_barrier_init (&b1, NULL, N) != 0) + { + puts ("1st barrier_init failed"); + return 1; + } + + if (pthread_barrier_init (&b2, NULL, N) != 0) + { + puts ("2nd barrier_init failed"); + return 1; + } + + pthread_t th[N - 1]; + for (cnt = 0; cnt < N - 1; ++cnt) + if (pthread_create (&th[cnt], &at, tf, NULL) != 0) + { + puts ("pthread_create failed"); + return 1; + } + + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + + tf (NULL); + + for (cnt = 0; cnt < N - 1; ++cnt) + if (pthread_join (th[cnt], NULL) != 0) + { + puts ("pthread_join failed"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-basic1.c b/test/nptl/tst-basic1.c new file mode 100644 index 000000000..748bbb7f0 --- /dev/null +++ b/test/nptl/tst-basic1.c @@ -0,0 +1,81 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <unistd.h> +#include <sys/types.h> + + +static pid_t pid; + +static void * +tf (void *a) +{ + if (getpid () != pid) + { + write (2, "pid mismatch\n", 13); + _exit (1); + } + + return a; +} + + +int +do_test (void) +{ + pid = getpid (); + +#define N 2 + pthread_t t[N]; + int i; + + for (i = 0; i < N; ++i) + if (pthread_create (&t[i], NULL, tf, (void *) (long int) (i + 1)) != 0) + { + write (2, "create failed\n", 14); + _exit (1); + } + else + printf ("created thread %d\n", i); + + for (i = 0; i < N; ++i) + { + void *r; + int e; + if ((e = pthread_join (t[i], &r)) != 0) + { + printf ("join failed: %d\n", e); + _exit (1); + } + else if (r != (void *) (long int) (i + 1)) + { + write (2, "result wrong\n", 13); + _exit (1); + } + else + printf ("joined thread %d\n", i); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-basic2.c b/test/nptl/tst-basic2.c new file mode 100644 index 000000000..58ed6ac53 --- /dev/null +++ b/test/nptl/tst-basic2.c @@ -0,0 +1,120 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdint.h> +#include <stdlib.h> +#include <unistd.h> + + +#define N 20 + +static pthread_t th[N]; +static pthread_mutex_t lock[N]; + + +static void *tf (void *a) +{ + uintptr_t idx = (uintptr_t) a; + + pthread_mutex_lock (&lock[idx]); + + return pthread_equal (pthread_self (), th[idx]) ? NULL : (void *) 1l; +} + + +int +do_test (void) +{ + if (pthread_equal (pthread_self (), pthread_self ()) == 0) + { + puts ("pthread_equal (pthread_self (), pthread_self ()) failed"); + exit (1); + } + + pthread_attr_t at; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + + int i; + for (i = 0; i < N; ++i) + { + if (pthread_mutex_init (&lock[i], NULL) != 0) + { + puts ("mutex_init failed"); + exit (1); + } + + if (pthread_mutex_lock (&lock[i]) != 0) + { + puts ("mutex_lock failed"); + exit (1); + } + + if (pthread_create (&th[i], &at, tf, (void *) (long int) i) != 0) + { + puts ("create failed"); + exit (1); + } + + if (pthread_mutex_unlock (&lock[i]) != 0) + { + puts ("mutex_unlock failed"); + exit (1); + } + + printf ("created thread %d\n", i); + } + + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + + int result = 0; + for (i = 0; i < N; ++i) + { + void *r; + int e; + if ((e = pthread_join (th[i], &r)) != 0) + { + printf ("join failed: %d\n", e); + _exit (1); + } + else if (r != NULL) + result = 1; + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-basic3.c b/test/nptl/tst-basic3.c new file mode 100644 index 000000000..a3e2603bd --- /dev/null +++ b/test/nptl/tst-basic3.c @@ -0,0 +1,86 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static int nrunning = 1; + + +static void +final_test (void) +{ + puts ("final_test has been called"); + +#define THE_SIGNAL SIGUSR1 + kill (getpid (), SIGUSR1); +} + + +static void * +tf (void *a) +{ + if (pthread_join ((pthread_t) a, NULL) != 0) + { + printf ("join failed while %d are running\n", nrunning); + _exit (1); + } + + printf ("%2d left\n", --nrunning); + + return NULL; +} + + +int +do_test (void) +{ +#define N 20 + pthread_t t[N]; + pthread_t last = pthread_self (); + int i; + + atexit (final_test); + + printf ("starting %d + 1 threads\n", N); + for (i = 0; i < N; ++i) + { + if (pthread_create (&t[i], NULL, tf, (void *) last) != 0) + { + puts ("create failed"); + _exit (1); + } + + ++nrunning; + + last = t[i]; + } + + printf ("%2d left\n", --nrunning); + + pthread_exit (NULL); +} + + +#define EXPECTED_SIGNAL THE_SIGNAL +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-basic4.c b/test/nptl/tst-basic4.c new file mode 100644 index 000000000..b69ca200b --- /dev/null +++ b/test/nptl/tst-basic4.c @@ -0,0 +1,100 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/wait.h> + + +static void +final_test (void) +{ + puts ("final_test has been called"); + +#define THE_SIGNAL SIGUSR1 + kill (getpid (), SIGUSR1); +} + + +static void * +tf (void *a) +{ + pid_t pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + exit (1); + } + + if (pid == 0) + { + atexit (final_test); + + pthread_exit (NULL); + } + + int r; + int e = TEMP_FAILURE_RETRY (waitpid (pid, &r, 0)); + if (e != pid) + { + puts ("waitpid failed"); + exit (1); + } + + if (! WIFSIGNALED (r)) + { + puts ("child not signled"); + exit (1); + } + + if (WTERMSIG (r) != THE_SIGNAL) + { + puts ("child's termination signal wrong"); + exit (1); + } + + return NULL; +} + + +int +do_test (void) +{ + pthread_t th; + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + _exit (1); + } + + if (pthread_join (th, NULL) != 0) + { + puts ("join failed"); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-basic5.c b/test/nptl/tst-basic5.c new file mode 100644 index 000000000..76b59096e --- /dev/null +++ b/test/nptl/tst-basic5.c @@ -0,0 +1,73 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + + + +int +do_test (void) +{ + int c = pthread_getconcurrency (); + if (c != 0) + { + puts ("initial concurrencylevel wrong"); + exit (1); + } + + if (pthread_setconcurrency (1) != 0) + { + puts ("setconcurrency failed"); + exit (1); + } + + c = pthread_getconcurrency (); + if (c != 1) + { + puts ("getconcurrency didn't return the value previous set"); + exit (1); + } + + int e = pthread_setconcurrency (-1); + if (e == 0) + { + puts ("setconcurrency of negative value didn't failed"); + exit (1); + } + if (e != EINVAL) + { + puts ("setconcurrency didn't return EINVAL for negative value"); + exit (1); + } + + c = pthread_getconcurrency (); + if (c != 1) + { + puts ("invalid getconcurrency changed level"); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-basic6.c b/test/nptl/tst-basic6.c new file mode 100644 index 000000000..91e5fe2c7 --- /dev/null +++ b/test/nptl/tst-basic6.c @@ -0,0 +1,131 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + + +static char *p; + +static pthread_barrier_t b; +#define BT \ + e = pthread_barrier_wait (&b); \ + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) \ + { \ + puts ("barrier_wait failed"); \ + exit (1); \ + } + + +static void * +tf (void *a) +{ + int e; + + BT; + + char *p2 = getcwd (NULL, 0); + if (p2 == NULL) + { + puts ("2nd getcwd failed"); + exit (1); + } + + if (strcmp (p, p2) != 0) + { + printf ("initial cwd mismatch: \"%s\" vs \"%s\"\n", p, p2); + exit (1); + } + + free (p); + free (p2); + + if (chdir ("..") != 0) + { + puts ("chdir failed"); + exit (1); + } + + p = getcwd (NULL, 0); + if (p == NULL) + { + puts ("getcwd failed"); + exit (1); + } + + return a; +} + + +int +do_test (void) +{ + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + p = getcwd (NULL, 0); + if (p == NULL) + { + puts ("getcwd failed"); + exit (1); + } + + int e; + BT; + + if (pthread_join (th, NULL) != 0) + { + puts ("join failed"); + exit (1); + } + + char *p2 = getcwd (NULL, 0); + if (p2 == NULL) + { + puts ("2nd getcwd failed"); + exit (1); + } + + if (strcmp (p, p2) != 0) + { + printf ("cwd after chdir mismatch: \"%s\" vs \"%s\"\n", p, p2); + exit (1); + } + + free (p); + free (p2); + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-basic7.c b/test/nptl/tst-basic7.c new file mode 100644 index 000000000..15b618786 --- /dev/null +++ b/test/nptl/tst-basic7.c @@ -0,0 +1,75 @@ +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <limits.h> +#include <sys/mman.h> +#include <sys/resource.h> + +static void use_stack (size_t needed); + +void (*use_stack_ptr) (size_t) = use_stack; + +static void +use_stack (size_t needed) +{ + size_t sz = sysconf (_SC_PAGESIZE); + char *buf = alloca (sz); + memset (buf, '\0', sz); + + if (needed > sz) + use_stack_ptr (needed - sz); +} + +static void +use_up_memory (void) +{ + struct rlimit rl; + getrlimit (RLIMIT_AS, &rl); + rl.rlim_cur = 10 * 1024 * 1024; + setrlimit (RLIMIT_AS, &rl); + + char *c; + int PAGESIZE = getpagesize (); + while (1) + { + c = mmap (NULL, PAGESIZE, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0); + if (c == MAP_FAILED) + break; + } +} + +static void * +child (void *arg) +{ + sleep (1); + return arg; +} + +static int +do_test (void) +{ + int err; + pthread_t tid; + + /* Allocate the memory needed for the stack. */ + use_stack_ptr (PTHREAD_STACK_MIN); + + use_up_memory (); + + err = pthread_create (&tid, NULL, child, NULL); + if (err != 0) + { + printf ("pthread_create returns %d: %s\n", err, + err == EAGAIN ? "OK" : "FAIL"); + return err != EAGAIN; + } + + /* We did not fail to allocate memory despite the preparation. Oh well. */ + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel1.c b/test/nptl/tst-cancel1.c new file mode 100644 index 000000000..8b2ca07b1 --- /dev/null +++ b/test/nptl/tst-cancel1.c @@ -0,0 +1,162 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + + +static pthread_mutex_t m1 = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t m2 = PTHREAD_MUTEX_INITIALIZER; + +static int cntr; + + +static void +cleanup (void *arg) +{ + if (arg != (void *) 42l) + cntr = 42; + else + cntr = 1; +} + + +static void * +tf (void *arg) +{ + /* Ignore all signals. This must not have any effect on delivering + the cancellation signal. */ + sigset_t ss; + + sigfillset (&ss); + + if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0) + { + puts ("pthread_sigmask failed"); + exit (1); + } + + pthread_cleanup_push (cleanup, (void *) 42l); + + int err = pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + if (err != 0) + { + printf ("setcanceltype failed: %s\n", strerror (err)); + exit (1); + } + /* The following code is not standard compliant: the mutex functions + must not be called with asynchronous cancellation enabled. */ + + err = pthread_mutex_unlock (&m2); + if (err != 0) + { + printf ("child: mutex_unlock failed: %s\n", strerror (err)); + exit (1); + } + + err = pthread_mutex_lock (&m1); + if (err != 0) + { + printf ("child: 1st mutex_lock failed: %s\n", strerror (err)); + exit (1); + } + + /* We should never come here. */ + + pthread_cleanup_pop (0); + + return NULL; +} + + +static int +do_test (void) +{ + int err; + pthread_t th; + int result = 0; + void *retval; + + /* Get the mutexes. */ + err = pthread_mutex_lock (&m1); + if (err != 0) + { + printf ("parent: 1st mutex_lock failed: %s\n", strerror (err)); + return 1; + } + err = pthread_mutex_lock (&m2); + if (err != 0) + { + printf ("parent: 2nd mutex_lock failed: %s\n", strerror (err)); + return 1; + } + + err = pthread_create (&th, NULL, tf, NULL); + if (err != 0) + { + printf ("create failed: %s\n", strerror (err)); + return 1; + } + + err = pthread_mutex_lock (&m2); + if (err != 0) + { + printf ("parent: 3rd mutex_lock failed: %s\n", strerror (err)); + return 1; + } + + err = pthread_cancel (th); + if (err != 0) + { + printf ("cancel failed: %s\n", strerror (err)); + return 1; + } + + err = pthread_join (th, &retval); + if (err != 0) + { + printf ("join failed: %s\n", strerror (err)); + return 1; + } + + if (retval != PTHREAD_CANCELED) + { + printf ("wrong return value: %p\n", retval); + result = 1; + } + + if (cntr == 42) + { + puts ("cleanup handler called with wrong argument"); + result = 1; + } + else if (cntr != 1) + { + puts ("cleanup handling not called"); + result = 1; + } + + return result; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel10.c b/test/nptl/tst-cancel10.c new file mode 100644 index 000000000..534ddf439 --- /dev/null +++ b/test/nptl/tst-cancel10.c @@ -0,0 +1,125 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + + +static void +cleanup (void *arg) +{ + /* Just for fun. */ + if (pthread_cancel (pthread_self ()) != 0) + { + puts ("cleanup: cancel failed"); + exit (1); + } + + printf ("cleanup for %ld\n", (long int) arg); +} + + +static void * +tf (void *arg) +{ + long int n = (long int) arg; + + pthread_cleanup_push (cleanup, arg); + + if (pthread_setcanceltype ((n & 1) == 0 + ? PTHREAD_CANCEL_DEFERRED + : PTHREAD_CANCEL_ASYNCHRONOUS, NULL) != 0) + { + puts ("setcanceltype failed"); + exit (1); + } + + if (pthread_cancel (pthread_self ()) != 0) + { + puts ("cancel failed"); + exit (1); + } + + pthread_testcancel (); + + /* We should never come here. */ + + pthread_cleanup_pop (0); + + return NULL; +} + + +static int +do_test (void) +{ + pthread_attr_t at; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + +#define N 20 + int i; + pthread_t th[N]; + + for (i = 0; i < N; ++i) + if (pthread_create (&th[i], &at, tf, (void *) (long int) i) != 0) + { + puts ("create failed"); + exit (1); + } + + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + + for (i = 0; i < N; ++i) + { + void *r; + if (pthread_join (th[i], &r) != 0) + { + puts ("join failed"); + exit (1); + } + + if (r != PTHREAD_CANCELED) + { + puts ("thread not canceled"); + exit (1); + } + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel11.c b/test/nptl/tst-cancel11.c new file mode 100644 index 000000000..c09158237 --- /dev/null +++ b/test/nptl/tst-cancel11.c @@ -0,0 +1,122 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + + +static pthread_barrier_t bar; +static int fd[2]; + + +static void +cleanup (void *arg) +{ + static int ncall; + + if (++ncall != 1) + { + puts ("second call to cleanup"); + exit (1); + } + + printf ("cleanup call #%d\n", ncall); +} + + +static void * +tf (void *arg) +{ + pthread_cleanup_push (cleanup, NULL); + + int e = pthread_barrier_wait (&bar); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("tf: 1st barrier_wait failed"); + exit (1); + } + + /* This call should block and be cancelable. */ + char buf[20]; + read (fd[0], buf, sizeof (buf)); + + pthread_cleanup_pop (0); + + return NULL; +} + + +static int +do_test (void) +{ + pthread_t th; + + if (pthread_barrier_init (&bar, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + if (pipe (fd) != 0) + { + puts ("pipe failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + int e = pthread_barrier_wait (&bar); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("1st barrier_wait failed"); + exit (1); + } + + if (pthread_cancel (th) != 0) + { + puts ("1st cancel failed"); + exit (1); + } + + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("join failed"); + exit (1); + } + + if (r != PTHREAD_CANCELED) + { + puts ("thread not canceled"); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel12.c b/test/nptl/tst-cancel12.c new file mode 100644 index 000000000..8b3faa607 --- /dev/null +++ b/test/nptl/tst-cancel12.c @@ -0,0 +1,126 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <semaphore.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + + +static pthread_barrier_t bar; +static sem_t sem; + + +static void +cleanup (void *arg) +{ + static int ncall; + + if (++ncall != 1) + { + puts ("second call to cleanup"); + exit (1); + } + + printf ("cleanup call #%d\n", ncall); +} + + +static void * +tf (void *arg) +{ + pthread_cleanup_push (cleanup, NULL); + + int e = pthread_barrier_wait (&bar); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("tf: 1st barrier_wait failed"); + exit (1); + } + + /* This call should block and be cancelable. */ + sem_wait (&sem); + + pthread_cleanup_pop (0); + + puts ("sem_wait returned"); + + return NULL; +} + + +static int +do_test (void) +{ + pthread_t th; + + if (pthread_barrier_init (&bar, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + if (sem_init (&sem, 0, 1) != 0) + { + puts ("sem_init failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + /* Check whether cancellation is honored even before sem_wait does + anything. */ + if (pthread_cancel (th) != 0) + { + puts ("1st cancel failed"); + exit (1); + } + + int e = pthread_barrier_wait (&bar); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("1st barrier_wait failed"); + exit (1); + } + + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("join failed"); + exit (1); + } + + if (r != PTHREAD_CANCELED) + { + puts ("thread not canceled"); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel13.c b/test/nptl/tst-cancel13.c new file mode 100644 index 000000000..cf3ce20f5 --- /dev/null +++ b/test/nptl/tst-cancel13.c @@ -0,0 +1,128 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <semaphore.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + + +static pthread_barrier_t bar; +static sem_t sem; + + +static void +cleanup (void *arg) +{ + static int ncall; + + if (++ncall != 1) + { + puts ("second call to cleanup"); + exit (1); + } + + printf ("cleanup call #%d\n", ncall); +} + + +static void * +tf (void *arg) +{ + pthread_cleanup_push (cleanup, NULL); + + int e = pthread_barrier_wait (&bar); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("tf: 1st barrier_wait failed"); + exit (1); + } + + /* This call should block and be cancelable. */ + sem_wait (&sem); + + pthread_cleanup_pop (0); + + puts ("sem_wait returned"); + + return NULL; +} + + +static int +do_test (void) +{ + pthread_t th; + + if (pthread_barrier_init (&bar, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + if (sem_init (&sem, 0, 0) != 0) + { + puts ("sem_init failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + int e = pthread_barrier_wait (&bar); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("1st barrier_wait failed"); + exit (1); + } + + /* Give the child a chance to go to sleep in sem_wait. */ + sleep (1); + + /* Check whether cancellation is honored when waiting in sem_wait. */ + if (pthread_cancel (th) != 0) + { + puts ("1st cancel failed"); + exit (1); + } + + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("join failed"); + exit (1); + } + + if (r != PTHREAD_CANCELED) + { + puts ("thread not canceled"); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel14.c b/test/nptl/tst-cancel14.c new file mode 100644 index 000000000..defbbdd84 --- /dev/null +++ b/test/nptl/tst-cancel14.c @@ -0,0 +1,136 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <semaphore.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/time.h> + + +static pthread_barrier_t bar; +static sem_t sem; + + +static void +cleanup (void *arg) +{ + static int ncall; + + if (++ncall != 1) + { + puts ("second call to cleanup"); + exit (1); + } + + printf ("cleanup call #%d\n", ncall); +} + + +static void * +tf (void *arg) +{ + pthread_cleanup_push (cleanup, NULL); + + int e = pthread_barrier_wait (&bar); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("tf: 1st barrier_wait failed"); + exit (1); + } + + struct timeval tv; + (void) gettimeofday (&tv, NULL); + + struct timespec ts; + TIMEVAL_TO_TIMESPEC (&tv, &ts); + + /* Timeout in 5 seconds. */ + ts.tv_sec += 5; + + /* This call should block and be cancelable. */ + sem_timedwait (&sem, &ts); + + pthread_cleanup_pop (0); + + puts ("sem_timedwait returned"); + + return NULL; +} + + +static int +do_test (void) +{ + pthread_t th; + + if (pthread_barrier_init (&bar, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + if (sem_init (&sem, 0, 1) != 0) + { + puts ("sem_init failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + /* Check whether cancellation is honored even before sem_timedwait does + anything. */ + if (pthread_cancel (th) != 0) + { + puts ("1st cancel failed"); + exit (1); + } + + int e = pthread_barrier_wait (&bar); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("1st barrier_wait failed"); + exit (1); + } + + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("join failed"); + exit (1); + } + + if (r != PTHREAD_CANCELED) + { + puts ("thread not canceled"); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel15.c b/test/nptl/tst-cancel15.c new file mode 100644 index 000000000..eb2d713e6 --- /dev/null +++ b/test/nptl/tst-cancel15.c @@ -0,0 +1,141 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <semaphore.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/time.h> + + +static pthread_barrier_t bar; +static sem_t sem; + + +static void +cleanup (void *arg) +{ + static int ncall; + + if (++ncall != 1) + { + puts ("second call to cleanup"); + exit (1); + } + + printf ("cleanup call #%d\n", ncall); +} + + +static void * +tf (void *arg) +{ + int e; + + pthread_cleanup_push (cleanup, NULL); + + e = pthread_barrier_wait (&bar); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("tf: 1st barrier_wait failed"); + exit (1); + } + + struct timeval tv; + (void) gettimeofday (&tv, NULL); + + struct timespec ts; + TIMEVAL_TO_TIMESPEC (&tv, &ts); + + /* Timeout in 5 seconds. */ + ts.tv_sec += 5; + + /* This call should block and be cancelable. */ + errno = 0; + e = sem_timedwait (&sem, &ts); + + pthread_cleanup_pop (0); + + printf ("sem_timedwait returned, e = %d, errno = %d\n", e, errno); + + return NULL; +} + + +static int +do_test (void) +{ + pthread_t th; + + if (pthread_barrier_init (&bar, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + if (sem_init (&sem, 0, 0) != 0) + { + puts ("sem_init failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + int e = pthread_barrier_wait (&bar); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("1st barrier_wait failed"); + exit (1); + } + + /* Give the child a chance to go to sleep in sem_wait. */ + sleep (1); + + /* Check whether cancellation is honored when waiting in sem_timedwait. */ + if (pthread_cancel (th) != 0) + { + puts ("1st cancel failed"); + exit (1); + } + + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("join failed"); + exit (1); + } + + if (r != PTHREAD_CANCELED) + { + puts ("thread not canceled"); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel16.c b/test/nptl/tst-cancel16.c new file mode 100644 index 000000000..6af657c47 --- /dev/null +++ b/test/nptl/tst-cancel16.c @@ -0,0 +1,230 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/wait.h> + + +static pthread_barrier_t b2; +static int fd; +static int called; + + +static void +cl (void *arg) +{ + called = 1; +} + + +static void * +tf (void *arg) +{ + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child thread: barrier_wait failed"); + exit (1); + } + + pthread_cleanup_push (cl, NULL); + + /* This call should never return. */ + (void) lockf (fd, F_LOCK, 0); + + pthread_cleanup_pop (0); + + return NULL; +} + + +static int +do_test (void) +{ + char fname[] = "/tmp/cancel16XXXXXX"; + fd = mkstemp (fname); + if (fd == -1) + { + puts ("mkstemp failed"); + return 1; + } + unlink (fname); + + char mem[sizeof (pthread_barrier_t)]; + memset (mem, '\0', sizeof (mem)); + if (TEMP_FAILURE_RETRY (pwrite (fd, mem, sizeof (mem), 0)) != sizeof (mem)) + { + puts ("pwrite failed"); + return 1; + } + + void *p = mmap (NULL, sizeof (mem), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); + if (p == MAP_FAILED) + { + puts ("mmap failed"); + return 1; + } + pthread_barrier_t *b = (pthread_barrier_t *) p; + + pthread_barrierattr_t ba; + if (pthread_barrierattr_init (&ba) != 0) + { + puts ("barrierattr_init failed"); + return 1; + } + if (pthread_barrierattr_setpshared (&ba, 1) != 0) + { + puts ("barrierattr_setshared failed"); + return 1; + } + + if (pthread_barrier_init (b, &ba, 2) != 0) + { + puts ("1st barrier_init failed"); + return 1; + } + if (pthread_barrierattr_destroy (&ba) != 0) + { + puts ("barrier_destroy failed"); + return 1; + } + + pid_t pid = fork (); + if (pid == 0) + { + /* Child. Lock the file and wait. */ + if (lockf (fd, F_LOCK, 0) != 0) + { + puts ("child process: lockf failed"); + _exit (1); + } + + int r = pthread_barrier_wait (b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child process: 1st barrier_wait failed"); + _exit (1); + } + + /* Make sure the process dies. */ + alarm (5); + + r = pthread_barrier_wait (b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child process: 2nd barrier_wait failed"); + _exit (1); + } + + _exit (0); + } + if (pid == -1) + { + puts ("fork failed"); + return 1; + } + + int r = pthread_barrier_wait (b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("main: 1st barrier_wait failed"); + _exit (1); + } + + if (pthread_barrier_init (&b2, NULL, 2) != 0) + { + puts ("2nd barrier_init failed"); + return 1; + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("main: 2nd barrier_wait failed"); + return 1; + } + + /* Delay. */ + sleep (1); + + if (pthread_cancel (th) != 0) + { + puts ("cancel failed"); + return 1; + } + + void *result; + if (pthread_join (th, &result) != 0) + { + puts ("join failed"); + return 1; + } + if (result != PTHREAD_CANCELED) + { + puts ("thread not canceled"); + return 1; + } + if (called == 0) + { + puts ("cleanup handler not called"); + return 1; + } + + r = pthread_barrier_wait (b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("main: 3rd barrier_wait failed"); + return 1; + } + + int status; + if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid) + { + puts ("waitpid failed"); + return 1; + } + if (WEXITSTATUS (status) != 0) + { + printf ("child process exits with %d\n", WEXITSTATUS (status)); + return 1; + } + + if (lockf (fd, F_LOCK, 0) != 0) + { + puts ("main: lockf failed"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel18.c b/test/nptl/tst-cancel18.c new file mode 100644 index 000000000..e653119d6 --- /dev/null +++ b/test/nptl/tst-cancel18.c @@ -0,0 +1,173 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <unistd.h> + + +static pthread_barrier_t b; + + +/* Cleanup handling test. */ +static int cl_called; + +static void +cl (void *arg) +{ + ++cl_called; +} + + +static void * +tf (void *arg) +{ + int r = pthread_barrier_wait (&b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + pthread_cleanup_push (cl, NULL); + + struct timespec ts = { .tv_sec = arg == NULL ? 10000000 : 0, .tv_nsec = 0 }; + TEMP_FAILURE_RETRY (clock_nanosleep (CLOCK_REALTIME, 0, &ts, &ts)); + + pthread_cleanup_pop (0); + + puts ("clock_nanosleep returned"); + + exit (1); +} + + +static int +do_test (void) +{ + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("1st create failed"); + return 1; + } + + int r = pthread_barrier_wait (&b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 }; + while (nanosleep (&ts, &ts) != 0) + continue; + + puts ("going to cancel in-time"); + if (pthread_cancel (th) != 0) + { + puts ("1st cancel failed"); + return 1; + } + + void *status; + if (pthread_join (th, &status) != 0) + { + puts ("1st join failed"); + return 1; + } + if (status != PTHREAD_CANCELED) + { + puts ("1st thread not canceled"); + return 1; + } + + if (cl_called == 0) + { + puts ("cleanup handler not called"); + return 1; + } + if (cl_called > 1) + { + puts ("cleanup handler called more than once"); + return 1; + } + + puts ("in-time cancellation succeeded"); + + + cl_called = 0; + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("2nd create failed"); + return 1; + } + + puts ("going to cancel early"); + if (pthread_cancel (th) != 0) + { + puts ("2nd cancel failed"); + return 1; + } + + r = pthread_barrier_wait (&b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + if (pthread_join (th, &status) != 0) + { + puts ("2nd join failed"); + return 1; + } + if (status != PTHREAD_CANCELED) + { + puts ("2nd thread not canceled"); + return 1; + } + + if (cl_called == 0) + { + printf ("cleanup handler not called\n"); + return 1; + } + if (cl_called > 1) + { + printf ("cleanup handler called more than once\n"); + return 1; + } + + puts ("early cancellation succeeded"); + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel19.c b/test/nptl/tst-cancel19.c new file mode 100644 index 000000000..921df3f9d --- /dev/null +++ b/test/nptl/tst-cancel19.c @@ -0,0 +1,286 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <error.h> +#include <fcntl.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/select.h> +#include <sys/time.h> +#include <unistd.h> + +static void * +tf (void *arg) +{ + return NULL; +} + +static void +handler (int sig) +{ +} + +static void __attribute__ ((noinline)) +clobber_lots_of_regs (void) +{ +#define X1(n) long r##n = 10##n; __asm__ __volatile__ ("" : "+r" (r##n)); +#define X2(n) X1(n##0) X1(n##1) X1(n##2) X1(n##3) X1(n##4) +#define X3(n) X2(n##0) X2(n##1) X2(n##2) X2(n##3) X2(n##4) + X3(0) X3(1) X3(2) X3(3) X3(4) +#undef X1 +#define X1(n) __asm__ __volatile__ ("" : : "r" (r##n)); + X3(0) X3(1) X3(2) X3(3) X3(4) +#undef X1 +#undef X2 +#undef X3 +} + +static int +do_test (void) +{ + pthread_t th; + int old, rc; + int ret = 0; + int fd[2]; + + rc = pipe (fd); + if (rc < 0) + error (EXIT_FAILURE, errno, "couldn't create pipe"); + + rc = pthread_create (&th, NULL, tf, NULL); + if (rc) + error (EXIT_FAILURE, rc, "couldn't create thread"); + + rc = pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &old); + if (rc) + { + error (0, rc, "1st pthread_setcanceltype failed"); + ret = 1; + } + if (old != PTHREAD_CANCEL_DEFERRED && old != PTHREAD_CANCEL_ASYNCHRONOUS) + { + error (0, 0, "1st pthread_setcanceltype returned invalid value %d", + old); + ret = 1; + } + + clobber_lots_of_regs (); + close (fd[0]); + + rc = pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &old); + if (rc) + { + error (0, rc, "pthread_setcanceltype after close failed"); + ret = 1; + } + if (old != PTHREAD_CANCEL_DEFERRED) + { + error (0, 0, "pthread_setcanceltype after close returned invalid value %d", + old); + ret = 1; + } + + clobber_lots_of_regs (); + close (fd[1]); + + rc = pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &old); + if (rc) + { + error (0, rc, "pthread_setcanceltype after 2nd close failed"); + ret = 1; + } + if (old != PTHREAD_CANCEL_ASYNCHRONOUS) + { + error (0, 0, "pthread_setcanceltype after 2nd close returned invalid value %d", + old); + ret = 1; + } + + struct sigaction sa = { .sa_handler = handler, .sa_flags = 0 }; + sigemptyset (&sa.sa_mask); + sigaction (SIGALRM, &sa, NULL); + + struct itimerval it; + it.it_value.tv_sec = 1; + it.it_value.tv_usec = 0; + it.it_interval = it.it_value; + setitimer (ITIMER_REAL, &it, NULL); + + clobber_lots_of_regs (); + pause (); + + memset (&it, 0, sizeof (it)); + setitimer (ITIMER_REAL, &it, NULL); + + rc = pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &old); + if (rc) + { + error (0, rc, "pthread_setcanceltype after pause failed"); + ret = 1; + } + if (old != PTHREAD_CANCEL_DEFERRED) + { + error (0, 0, "pthread_setcanceltype after pause returned invalid value %d", + old); + ret = 1; + } + + it.it_value.tv_sec = 1; + it.it_value.tv_usec = 0; + it.it_interval = it.it_value; + setitimer (ITIMER_REAL, &it, NULL); + + clobber_lots_of_regs (); + pause (); + + memset (&it, 0, sizeof (it)); + setitimer (ITIMER_REAL, &it, NULL); + + rc = pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &old); + if (rc) + { + error (0, rc, "pthread_setcanceltype after 2nd pause failed"); + ret = 1; + } + if (old != PTHREAD_CANCEL_ASYNCHRONOUS) + { + error (0, 0, "pthread_setcanceltype after 2nd pause returned invalid value %d", + old); + ret = 1; + } + + char fname[] = "/tmp/tst-cancel19-dir-XXXXXX\0foo/bar"; + char *enddir = strchr (fname, '\0'); + if (mkdtemp (fname) == NULL) + { + error (0, errno, "mkdtemp failed"); + ret = 1; + } + *enddir = '/'; + + clobber_lots_of_regs (); + creat (fname, 0400); + + rc = pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &old); + if (rc) + { + error (0, rc, "pthread_setcanceltype after creat failed"); + ret = 1; + } + if (old != PTHREAD_CANCEL_DEFERRED) + { + error (0, 0, "pthread_setcanceltype after creat returned invalid value %d", + old); + ret = 1; + } + + clobber_lots_of_regs (); + creat (fname, 0400); + + rc = pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &old); + if (rc) + { + error (0, rc, "pthread_setcanceltype after 2nd creat failed"); + ret = 1; + } + if (old != PTHREAD_CANCEL_ASYNCHRONOUS) + { + error (0, 0, "pthread_setcanceltype after 2nd creat returned invalid value %d", + old); + ret = 1; + } + + clobber_lots_of_regs (); + open (fname, O_CREAT, 0400); + + rc = pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &old); + if (rc) + { + error (0, rc, "pthread_setcanceltype after open failed"); + ret = 1; + } + if (old != PTHREAD_CANCEL_DEFERRED) + { + error (0, 0, "pthread_setcanceltype after open returned invalid value %d", + old); + ret = 1; + } + + clobber_lots_of_regs (); + open (fname, O_CREAT, 0400); + + rc = pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &old); + if (rc) + { + error (0, rc, "pthread_setcanceltype after 2nd open failed"); + ret = 1; + } + if (old != PTHREAD_CANCEL_ASYNCHRONOUS) + { + error (0, 0, "pthread_setcanceltype after 2nd open returned invalid value %d", + old); + ret = 1; + } + + *enddir = '\0'; + rmdir (fname); + + clobber_lots_of_regs (); + select (-1, NULL, NULL, NULL, NULL); + + rc = pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &old); + if (rc) + { + error (0, rc, "pthread_setcanceltype after select failed"); + ret = 1; + } + if (old != PTHREAD_CANCEL_DEFERRED) + { + error (0, 0, "pthread_setcanceltype after select returned invalid value %d", + old); + ret = 1; + } + + clobber_lots_of_regs (); + select (-1, NULL, NULL, NULL, NULL); + + rc = pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &old); + if (rc) + { + error (0, rc, "pthread_setcanceltype after 2nd select failed"); + ret = 1; + } + if (old != PTHREAD_CANCEL_ASYNCHRONOUS) + { + error (0, 0, "pthread_setcanceltype after 2nd select returned invalid value %d", + old); + ret = 1; + } + + pthread_join (th, NULL); + + return ret; +} + +#define TIMEOUT 20 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel2.c b/test/nptl/tst-cancel2.c new file mode 100644 index 000000000..45c9e8ea9 --- /dev/null +++ b/test/nptl/tst-cancel2.c @@ -0,0 +1,99 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <unistd.h> + + +static int fd[2]; + + +static void * +tf (void *arg) +{ + /* The buffer size must be larger than the pipe size so that the + write blocks. */ + char buf[100000]; + + if (write (fd[1], buf, sizeof (buf)) == sizeof (buf)) + { + puts ("write succeeded"); + return (void *) 1l; + } + + return (void *) 42l; +} + + +static int +do_test (void) +{ + pthread_t th; + void *r; + struct sigaction sa; + + sa.sa_handler = SIG_IGN; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + + if (sigaction (SIGPIPE, &sa, NULL) != 0) + { + puts ("sigaction failed"); + return 1; + } + + if (pipe (fd) != 0) + { + puts ("pipe failed"); + return 1; + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + if (pthread_cancel (th) != 0) + { + puts ("cancel failed"); + return 1; + } + + /* This will cause the write in the child to return. */ + close (fd[0]); + + if (pthread_join (th, &r) != 0) + { + puts ("join failed"); + return 1; + } + + if (r != PTHREAD_CANCELED) + { + printf ("result is wrong: expected %p, got %p\n", PTHREAD_CANCELED, r); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel20.c b/test/nptl/tst-cancel20.c new file mode 100644 index 000000000..7e9199fe5 --- /dev/null +++ b/test/nptl/tst-cancel20.c @@ -0,0 +1,263 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static int fd[4]; +static pthread_barrier_t b; +volatile int in_sh_body; +unsigned long cleanups; + +static void +cl (void *arg) +{ + cleanups = (cleanups << 4) | (long) arg; +} + + +static void __attribute__((noinline)) +sh_body (void) +{ + char c; + + pthread_cleanup_push (cl, (void *) 1L); + + in_sh_body = 1; + if (read (fd[2], &c, 1) == 1) + { + puts ("read succeeded"); + exit (1); + } + + pthread_cleanup_pop (0); +} + + +static void +sh (int sig) +{ + pthread_cleanup_push (cl, (void *) 2L); + sh_body (); + in_sh_body = 0; + + pthread_cleanup_pop (0); +} + + +static void __attribute__((noinline)) +tf_body (void) +{ + char c; + + pthread_cleanup_push (cl, (void *) 3L); + + int r = pthread_barrier_wait (&b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child thread: barrier_wait failed"); + exit (1); + } + + if (read (fd[0], &c, 1) == 1) + { + puts ("read succeeded"); + exit (1); + } + + read (fd[0], &c, 1); + + pthread_cleanup_pop (0); +} + + +static void * +tf (void *arg) +{ + pthread_cleanup_push (cl, (void *) 4L); + tf_body (); + pthread_cleanup_pop (0); + return NULL; +} + + +static int +do_one_test (void) +{ + in_sh_body = 0; + cleanups = 0; + if (pipe (fd) != 0 || pipe (fd + 2) != 0) + { + puts ("pipe failed"); + return 1; + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + int r = pthread_barrier_wait (&b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("parent thread: barrier_wait failed"); + return 1; + } + + sleep (1); + + r = pthread_kill (th, SIGHUP); + if (r) + { + errno = r; + printf ("pthread_kill failed %m\n"); + return 1; + } + + while (in_sh_body == 0) + sleep (1); + + if (pthread_cancel (th) != 0) + { + puts ("cancel failed"); + return 1; + } + + /* This will cause the read in the child to return. */ + close (fd[0]); + close (fd[1]); + close (fd[2]); + close (fd[3]); + + void *ret; + if (pthread_join (th, &ret) != 0) + { + puts ("join failed"); + return 1; + } + + if (ret != PTHREAD_CANCELED) + { + puts ("result is wrong"); + return 1; + } + + if (cleanups != 0x1234L) + { + printf ("called cleanups %lx\n", cleanups); + return 1; + } + + return 0; +} + + +static int +do_test (void) +{ + stack_t ss; + ss.ss_sp = malloc (2 * SIGSTKSZ); + if (ss.ss_sp == NULL) + { + puts ("failed to allocate alternate stack"); + return 1; + } + ss.ss_flags = 0; + ss.ss_size = 2 * SIGSTKSZ; + if (sigaltstack (&ss, NULL) < 0) + { + printf ("sigaltstack failed %m\n"); + return 1; + } + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + struct sigaction sa; + sa.sa_handler = sh; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + + if (sigaction (SIGHUP, &sa, NULL) != 0) + { + puts ("sigaction failed"); + return 1; + } + + puts ("sa_flags = 0 test"); + if (do_one_test ()) + return 1; + + sa.sa_handler = sh; + sigemptyset (&sa.sa_mask); + sa.sa_flags = SA_ONSTACK; + + if (sigaction (SIGHUP, &sa, NULL) != 0) + { + puts ("sigaction failed"); + return 1; + } + + puts ("sa_flags = SA_ONSTACK test"); + if (do_one_test ()) + return 1; + + sa.sa_sigaction = (void (*)(int, siginfo_t *, void *)) sh; + sigemptyset (&sa.sa_mask); + sa.sa_flags = SA_SIGINFO; + + if (sigaction (SIGHUP, &sa, NULL) != 0) + { + puts ("sigaction failed"); + return 1; + } + + puts ("sa_flags = SA_SIGINFO test"); + if (do_one_test ()) + return 1; + + sa.sa_sigaction = (void (*)(int, siginfo_t *, void *)) sh; + sigemptyset (&sa.sa_mask); + sa.sa_flags = SA_SIGINFO | SA_ONSTACK; + + if (sigaction (SIGHUP, &sa, NULL) != 0) + { + puts ("sigaction failed"); + return 1; + } + + puts ("sa_flags = SA_SIGINFO|SA_ONSTACK test"); + if (do_one_test ()) + return 1; + + return 0; +} + +#define TIMEOUT 40 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel21.c b/test/nptl/tst-cancel21.c new file mode 100644 index 000000000..489c18ab0 --- /dev/null +++ b/test/nptl/tst-cancel21.c @@ -0,0 +1,293 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/wait.h> +#include <unistd.h> + + +static int fd[4]; +static pthread_barrier_t b; +volatile int in_sh_body; +unsigned long cleanups; + +static void +cl (void *arg) +{ + cleanups = (cleanups << 4) | (long) arg; +} + + +static void __attribute__((noinline)) +sh_body (void) +{ + char c; + + pthread_cleanup_push (cl, (void *) 1L); + + in_sh_body = 1; + if (read (fd[2], &c, 1) == 1) + { + puts ("read succeeded"); + exit (1); + } + + pthread_cleanup_pop (0); +} + + +static void +sh (int sig) +{ + pthread_cleanup_push (cl, (void *) 2L); + sh_body (); + in_sh_body = 0; + + pthread_cleanup_pop (0); +} + + +static void __attribute__((noinline)) +tf_body (void) +{ + char c; + + pthread_cleanup_push (cl, (void *) 3L); + + int r = pthread_barrier_wait (&b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child thread: barrier_wait failed"); + exit (1); + } + + if (read (fd[0], &c, 1) == 1) + { + puts ("read succeeded"); + exit (1); + } + + read (fd[0], &c, 1); + + pthread_cleanup_pop (0); +} + + +static void * +tf (void *arg) +{ + pthread_t th = (pthread_t) arg; + + int r = pthread_barrier_wait (&b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("parent thread: barrier_wait failed"); + exit (1); + } + + sleep (1); + + r = pthread_kill (th, SIGHUP); + if (r) + { + errno = r; + printf ("pthread_kill failed %m\n"); + exit (1); + } + + while (in_sh_body == 0) + sleep (1); + + if (pthread_cancel (th) != 0) + { + puts ("cancel failed"); + exit (1); + } + + /* This will cause the read in the initial thread to return. */ + close (fd[0]); + close (fd[1]); + close (fd[2]); + close (fd[3]); + + void *ret; + if (pthread_join (th, &ret) != 0) + { + puts ("join failed"); + exit (1); + } + + if (ret != PTHREAD_CANCELED) + { + puts ("result is wrong"); + exit (1); + } + + if (cleanups != 0x1234L) + { + printf ("called cleanups %lx\n", cleanups); + exit (1); + } + + if (pthread_barrier_destroy (&b)) + { + puts ("barrier destroy failed"); + exit (1); + } + + exit (0); +} + + +static int +do_one_test (void) +{ + in_sh_body = 0; + + pid_t pid = fork (); + + if (pid == -1) + { + printf ("fork failed: %m\n"); + return 1; + } + + if (pid) + { + int status; + if (waitpid (pid, &status, 0) < 0) + { + printf ("waitpid failed %m\n"); + return 1; + } + + return !WIFEXITED (status) || WEXITSTATUS (status); + } + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + cleanups = 0; + if (pipe (fd) != 0 || pipe (fd + 2) != 0) + { + puts ("pipe failed"); + exit (1); + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, (void *) pthread_self ()) != 0) + { + puts ("create failed"); + exit (1); + } + + pthread_cleanup_push (cl, (void *) 4L); + tf_body (); + pthread_cleanup_pop (0); + exit (1); +} + + +static int +do_test (void) +{ + stack_t ss; + ss.ss_sp = malloc (2 * SIGSTKSZ); + if (ss.ss_sp == NULL) + { + puts ("failed to allocate alternate stack"); + return 1; + } + ss.ss_flags = 0; + ss.ss_size = 2 * SIGSTKSZ; + if (sigaltstack (&ss, NULL) < 0) + { + printf ("sigaltstack failed %m\n"); + return 1; + } + + struct sigaction sa; + sa.sa_handler = sh; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + + if (sigaction (SIGHUP, &sa, NULL) != 0) + { + puts ("sigaction failed"); + return 1; + } + + puts ("sa_flags = 0 test"); + if (do_one_test ()) + return 1; + + sa.sa_handler = sh; + sigemptyset (&sa.sa_mask); + sa.sa_flags = SA_ONSTACK; + + if (sigaction (SIGHUP, &sa, NULL) != 0) + { + puts ("sigaction failed"); + return 1; + } + + puts ("sa_flags = SA_ONSTACK test"); + if (do_one_test ()) + return 1; + + sa.sa_sigaction = (void (*)(int, siginfo_t *, void *)) sh; + sigemptyset (&sa.sa_mask); + sa.sa_flags = SA_SIGINFO; + + if (sigaction (SIGHUP, &sa, NULL) != 0) + { + puts ("sigaction failed"); + return 1; + } + + puts ("sa_flags = SA_SIGINFO test"); + if (do_one_test ()) + return 1; + + sa.sa_sigaction = (void (*)(int, siginfo_t *, void *)) sh; + sigemptyset (&sa.sa_mask); + sa.sa_flags = SA_SIGINFO | SA_ONSTACK; + + if (sigaction (SIGHUP, &sa, NULL) != 0) + { + puts ("sigaction failed"); + return 1; + } + + puts ("sa_flags = SA_SIGINFO|SA_ONSTACK test"); + if (do_one_test ()) + return 1; + + return 0; +} + +#define TIMEOUT 40 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel22.c b/test/nptl/tst-cancel22.c new file mode 100644 index 000000000..8febbf0e1 --- /dev/null +++ b/test/nptl/tst-cancel22.c @@ -0,0 +1,121 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +pthread_barrier_t b; +int seen; + +static void * +tf (void *arg) +{ + int i; + int old; + int r = pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &old); + if (r != 0) + { + puts ("setcancelstate failed"); + exit (1); + } + + r = pthread_barrier_wait (&b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + for (i = 0; i < 10; ++i) + { + struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 }; + TEMP_FAILURE_RETRY (nanosleep (&ts, &ts)); + } + + seen = 1; + pthread_setcancelstate (old, NULL); + + struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 }; + TEMP_FAILURE_RETRY (nanosleep (&ts, &ts)); + + exit (1); +} + + +static int +do_test (void) +{ + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier init failed"); + return 1; + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("thread creation failed"); + return 1; + } + + int r = pthread_barrier_wait (&b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + return 1; + } + + if (pthread_cancel (th) != 0) + { + puts ("cancel failed"); + return 1; + } + + void *status; + if (pthread_join (th, &status) != 0) + { + puts ("join failed"); + return 1; + } + if (status != PTHREAD_CANCELED) + { + puts ("thread not canceled"); + return 1; + } + + if (pthread_barrier_destroy (&b) != 0) + { + puts ("barrier_destroy failed"); + return 1; + } + + if (seen != 1) + { + puts ("thread cancelled when PTHREAD_CANCEL_DISABLED"); + return 1; + } + + return 0; +} + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel23.c b/test/nptl/tst-cancel23.c new file mode 100644 index 000000000..211168748 --- /dev/null +++ b/test/nptl/tst-cancel23.c @@ -0,0 +1 @@ +#include "tst-cancel22.c" diff --git a/test/nptl/tst-cancel25.c b/test/nptl/tst-cancel25.c new file mode 100644 index 000000000..00b99ad55 --- /dev/null +++ b/test/nptl/tst-cancel25.c @@ -0,0 +1,171 @@ +#include <pthreadP.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> + + +static pthread_barrier_t b; +static pthread_t th2; + + +static void * +tf2 (void *arg) +{ + sigset_t mask; + if (pthread_sigmask (SIG_SETMASK, NULL, &mask) != 0) + { + puts ("pthread_sigmask failed"); + exit (1); + } + if (sigismember (&mask, SIGCANCEL)) + { + puts ("SIGCANCEL blocked in new thread"); + exit (1); + } + + /* Sync with the main thread so that we do not test anything else. */ + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + while (1) + { + /* Just a cancelable call. */ + struct timespec ts = { 10000, 0 }; + nanosleep (&ts, 0); + } + + return NULL; +} + + +static void +unwhand (void *arg) +{ + if (pthread_create (&th2, NULL, tf2, NULL) != 0) + { + puts ("unwhand: create failed"); + exit (1); + } +} + + +static void * +tf (void *arg) +{ + pthread_cleanup_push (unwhand, NULL); + + /* Sync with the main thread so that we do not test anything else. */ + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + while (1) + { + /* Just a cancelable call. */ + struct timespec ts = { 10000, 0 }; + nanosleep (&ts, 0); + } + + pthread_cleanup_pop (0); + + return NULL; +} + + +static int +do_test (void) +{ + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + pthread_t th1; + if (pthread_create (&th1, NULL, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + return 1; + } + + /* Make sure tf1 enters nanosleep. */ + struct timespec ts = { 0, 500000000 }; + while (nanosleep (&ts, &ts) != 0) + ; + + if (pthread_cancel (th1) != 0) + { + puts ("1st cancel failed"); + return 1; + } + + void *res; + if (pthread_join (th1, &res) != 0) + { + puts ("1st join failed"); + return 1; + } + if (res != PTHREAD_CANCELED) + { + puts ("1st thread not canceled"); + return 1; + } + + e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + return 1; + } + + /* Make sure tf2 enters nanosleep. */ + ts.tv_sec = 0; + ts.tv_nsec = 500000000; + while (nanosleep (&ts, &ts) != 0) + ; + + puts ("calling pthread_cancel the second time"); + if (pthread_cancel (th2) != 0) + { + puts ("2nd cancel failed"); + return 1; + } + + puts ("calling pthread_join the second time"); + if (pthread_join (th2, &res) != 0) + { + puts ("2nd join failed"); + return 1; + } + if (res != PTHREAD_CANCELED) + { + puts ("2nd thread not canceled"); + return 1; + } + + if (pthread_barrier_destroy (&b) != 0) + { + puts ("barrier_destroy failed"); + return 0; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#define TIMEOUT 4 +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel3.c b/test/nptl/tst-cancel3.c new file mode 100644 index 000000000..e1c111d29 --- /dev/null +++ b/test/nptl/tst-cancel3.c @@ -0,0 +1,97 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <unistd.h> + + +static int fd[2]; + + +static void * +tf (void *arg) +{ + char buf[100]; + + if (read (fd[0], buf, sizeof (buf)) == sizeof (buf)) + { + puts ("read succeeded"); + return (void *) 1l; + } + + return NULL; +} + + +static int +do_test (void) +{ + pthread_t th; + void *r; + struct sigaction sa; + + sa.sa_handler = SIG_IGN; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + + if (sigaction (SIGPIPE, &sa, NULL) != 0) + { + puts ("sigaction failed"); + return 1; + } + + if (pipe (fd) != 0) + { + puts ("pipe failed"); + return 1; + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + if (pthread_cancel (th) != 0) + { + puts ("cancel failed"); + return 1; + } + + /* This will cause the read in the child to return. */ + close (fd[0]); + + if (pthread_join (th, &r) != 0) + { + puts ("join failed"); + return 1; + } + + if (r != PTHREAD_CANCELED) + { + puts ("result is wrong"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel4.c b/test/nptl/tst-cancel4.c new file mode 100644 index 000000000..ecaf297cc --- /dev/null +++ b/test/nptl/tst-cancel4.c @@ -0,0 +1,2393 @@ +/* Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +/* NOTE: this tests functionality beyond POSIX. POSIX does not allow + exit to be called more than once. */ + +#include <errno.h> +#include <fcntl.h> +#include <limits.h> +#include <pthread.h> +#include <stddef.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <termios.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/msg.h> +#include <sys/poll.h> +#include <sys/select.h> +#include <sys/socket.h> +#include <sys/uio.h> +#include <sys/un.h> +#include <sys/wait.h> + +#include "pthreadP.h" + + +/* Since STREAMS are not supported in the standard Linux kernel and + there we don't advertise STREAMS as supported is no need to test + the STREAMS related functions. This affects + getmsg() getpmsg() putmsg() + putpmsg() + + lockf() and fcntl() are tested in tst-cancel16. + + pthread_join() is tested in tst-join5. + + pthread_testcancel()'s only purpose is to allow cancellation. This + is tested in several places. + + sem_wait() and sem_timedwait() are checked in tst-cancel1[2345] tests. + + mq_send(), mq_timedsend(), mq_receive() and mq_timedreceive() are checked + in tst-mqueue8{,x} tests. + + aio_suspend() is tested in tst-cancel17. + + clock_nanosleep() is tested in tst-cancel18. +*/ + +/* Pipe descriptors. */ +static int fds[2]; + +/* Temporary file descriptor, to be closed after each round. */ +static int tempfd = -1; +static int tempfd2 = -1; +/* Name of temporary file to be removed after each round. */ +static char *tempfname; +/* Temporary message queue. */ +static int tempmsg = -1; + +/* Often used barrier for two threads. */ +static pthread_barrier_t b2; + + +#ifndef IPC_ADDVAL +# define IPC_ADDVAL 0 +#endif + +/* The WRITE_BUFFER_SIZE value needs to be chosen such that if we set + the socket send buffer size to '1', a write of this size on that + socket will block. + + The Linux kernel imposes a minimum send socket buffer size which + has changed over the years. As of Linux 3.10 the value is: + + 2 * (2048 + SKB_DATA_ALIGN(sizeof(struct sk_buff))) + + which is attempting to make sure that with standard MTUs, + TCP can always queue up at least 2 full sized packets. + + Furthermore, there is logic in the socket send paths that + will allow one more packet (of any size) to be queued up as + long as some socket buffer space remains. Blocking only + occurs when we try to queue up a new packet and the send + buffer space has already been fully consumed. + + Therefore we must set this value to the largest possible value of + the formula above (and since it depends upon the size of "struct + sk_buff", it is dependent upon machine word size etc.) plus some + slack space. */ + +#define WRITE_BUFFER_SIZE 16384 + +/* Cleanup handling test. */ +static int cl_called; + +static void +cl (void *arg) +{ + ++cl_called; +} + + + +static void * +tf_read (void *arg) +{ + int fd; + int r; + + if (arg == NULL) + fd = fds[0]; + else + { + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX"; + tempfd = fd = mkstemp (fname); + if (fd == -1) + printf ("%s: mkstemp failed\n", __FUNCTION__); + unlink (fname); + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + ssize_t s; + pthread_cleanup_push (cl, NULL); + + char buf[100]; + s = read (fd, buf, sizeof (buf)); + + pthread_cleanup_pop (0); + + printf ("%s: read returns with %zd\n", __FUNCTION__, s); + + exit (1); +} + + +static void * +tf_readv (void *arg) +{ + int fd; + int r; + + if (arg == NULL) + fd = fds[0]; + else + { + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX"; + tempfd = fd = mkstemp (fname); + if (fd == -1) + printf ("%s: mkstemp failed\n", __FUNCTION__); + unlink (fname); + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + ssize_t s; + pthread_cleanup_push (cl, NULL); + + char buf[100]; + struct iovec iov[1] = { [0] = { .iov_base = buf, .iov_len = sizeof (buf) } }; + s = readv (fd, iov, 1); + + pthread_cleanup_pop (0); + + printf ("%s: readv returns with %zd\n", __FUNCTION__, s); + + exit (1); +} + + +static void * +tf_write (void *arg) +{ + int fd; + int r; + + if (arg == NULL) + fd = fds[1]; + else + { + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX"; + tempfd = fd = mkstemp (fname); + if (fd == -1) + printf ("%s: mkstemp failed\n", __FUNCTION__); + unlink (fname); + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + ssize_t s; + pthread_cleanup_push (cl, NULL); + + char buf[WRITE_BUFFER_SIZE]; + memset (buf, '\0', sizeof (buf)); + s = write (fd, buf, sizeof (buf)); + + pthread_cleanup_pop (0); + + printf ("%s: write returns with %zd\n", __FUNCTION__, s); + + exit (1); +} + + +static void * +tf_writev (void *arg) +{ + int fd; + int r; + + if (arg == NULL) + fd = fds[1]; + else + { + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX"; + tempfd = fd = mkstemp (fname); + if (fd == -1) + printf ("%s: mkstemp failed\n", __FUNCTION__); + unlink (fname); + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + ssize_t s; + pthread_cleanup_push (cl, NULL); + + char buf[WRITE_BUFFER_SIZE]; + memset (buf, '\0', sizeof (buf)); + struct iovec iov[1] = { [0] = { .iov_base = buf, .iov_len = sizeof (buf) } }; + s = writev (fd, iov, 1); + + pthread_cleanup_pop (0); + + printf ("%s: writev returns with %zd\n", __FUNCTION__, s); + + exit (1); +} + +/* sleep is not early cancelable, disable for now */ +#if 0 +static void * +tf_sleep (void *arg) +{ + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + pthread_cleanup_push (cl, NULL); + + sleep (arg == NULL ? 1000000 : 0); + + pthread_cleanup_pop (0); + + printf ("%s: sleep returns\n", __FUNCTION__); + + exit (1); +} +#endif + +static void * +tf_usleep (void *arg) +{ + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + pthread_cleanup_push (cl, NULL); + + usleep (arg == NULL ? (useconds_t) ULONG_MAX : 0); + + pthread_cleanup_pop (0); + + printf ("%s: usleep returns\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_nanosleep (void *arg) +{ + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + pthread_cleanup_push (cl, NULL); + + struct timespec ts = { .tv_sec = arg == NULL ? 10000000 : 0, .tv_nsec = 0 }; + TEMP_FAILURE_RETRY (nanosleep (&ts, &ts)); + + pthread_cleanup_pop (0); + + printf ("%s: nanosleep returns\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_select (void *arg) +{ + int fd; + int r; + + if (arg == NULL) + fd = fds[0]; + else + { + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX"; + tempfd = fd = mkstemp (fname); + if (fd == -1) + printf ("%s: mkstemp failed\n", __FUNCTION__); + unlink (fname); + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + fd_set rfs; + FD_ZERO (&rfs); + FD_SET (fd, &rfs); + + int s; + pthread_cleanup_push (cl, NULL); + + s = select (fd + 1, &rfs, NULL, NULL, NULL); + + pthread_cleanup_pop (0); + + printf ("%s: select returns with %d (%s)\n", __FUNCTION__, s, + strerror (errno)); + + exit (1); +} + + +static void * +tf_pselect (void *arg) +{ + int fd; + int r; + + if (arg == NULL) + fd = fds[0]; + else + { + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX"; + tempfd = fd = mkstemp (fname); + if (fd == -1) + printf ("%s: mkstemp failed\n", __FUNCTION__); + unlink (fname); + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + fd_set rfs; + FD_ZERO (&rfs); + FD_SET (fd, &rfs); + + int s; + pthread_cleanup_push (cl, NULL); + + s = pselect (fd + 1, &rfs, NULL, NULL, NULL, NULL); + + pthread_cleanup_pop (0); + + printf ("%s: pselect returns with %d (%s)\n", __FUNCTION__, s, + strerror (errno)); + + exit (1); +} + + +static void * +tf_poll (void *arg) +{ + int fd; + int r; + + if (arg == NULL) + fd = fds[0]; + else + { + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX"; + tempfd = fd = mkstemp (fname); + if (fd == -1) + printf ("%s: mkstemp failed\n", __FUNCTION__); + unlink (fname); + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + struct pollfd rfs[1] = { [0] = { .fd = fd, .events = POLLIN } }; + + int s; + pthread_cleanup_push (cl, NULL); + + s = poll (rfs, 1, -1); + + pthread_cleanup_pop (0); + + printf ("%s: poll returns with %d (%s)\n", __FUNCTION__, s, + strerror (errno)); + + exit (1); +} + + +static void * +tf_ppoll (void *arg) +{ + int fd; + int r; + + if (arg == NULL) + fd = fds[0]; + else + { + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX"; + tempfd = fd = mkstemp (fname); + if (fd == -1) + printf ("%s: mkstemp failed\n", __FUNCTION__); + unlink (fname); + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + struct pollfd rfs[1] = { [0] = { .fd = fd, .events = POLLIN } }; + + int s; + pthread_cleanup_push (cl, NULL); + + s = ppoll (rfs, 1, NULL, NULL); + + pthread_cleanup_pop (0); + + printf ("%s: ppoll returns with %d (%s)\n", __FUNCTION__, s, + strerror (errno)); + + exit (1); +} + + +static void * +tf_wait (void *arg) +{ + pid_t pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + exit (1); + } + + if (pid == 0) + { + /* Make the program disappear after a while. */ + if (arg == NULL) + sleep (10); + exit (0); + } + + int r; + if (arg != NULL) + { + struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 }; + while (nanosleep (&ts, &ts) != 0) + continue; + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + int s; + pthread_cleanup_push (cl, NULL); + + s = wait (NULL); + + pthread_cleanup_pop (0); + + printf ("%s: wait returns with %d (%s)\n", __FUNCTION__, s, + strerror (errno)); + + exit (1); +} + + +static void * +tf_waitpid (void *arg) +{ + + pid_t pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + exit (1); + } + + if (pid == 0) + { + /* Make the program disappear after a while. */ + if (arg == NULL) + sleep (10); + exit (0); + } + + int r; + if (arg != NULL) + { + struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 }; + while (nanosleep (&ts, &ts) != 0) + continue; + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + int s; + pthread_cleanup_push (cl, NULL); + + s = waitpid (-1, NULL, 0); + + pthread_cleanup_pop (0); + + printf ("%s: waitpid returns with %d (%s)\n", __FUNCTION__, s, + strerror (errno)); + + exit (1); +} + + +static void * +tf_waitid (void *arg) +{ + pid_t pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + exit (1); + } + + if (pid == 0) + { + /* Make the program disappear after a while. */ + if (arg == NULL) + sleep (10); + exit (0); + } + + int r; + if (arg != NULL) + { + struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 }; + while (nanosleep (&ts, &ts) != 0) + continue; + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + int s; + pthread_cleanup_push (cl, NULL); + +#ifndef WEXITED +# define WEXITED 0 +#endif + siginfo_t si; + s = waitid (P_PID, pid, &si, WEXITED); + + pthread_cleanup_pop (0); + + printf ("%s: waitid returns with %d (%s)\n", __FUNCTION__, s, + strerror (errno)); + + exit (1); +} + + +static void * +tf_sigpause (void *arg) +{ + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + pthread_cleanup_push (cl, NULL); + + sigpause (SIGCANCEL); + + pthread_cleanup_pop (0); + + printf ("%s: sigpause returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_sigsuspend (void *arg) +{ + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + pthread_cleanup_push (cl, NULL); + + /* Just for fun block all signals. */ + sigset_t mask; + sigfillset (&mask); + sigsuspend (&mask); + + pthread_cleanup_pop (0); + + printf ("%s: sigsuspend returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_sigwait (void *arg) +{ + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + /* Block SIGUSR1. */ + sigset_t mask; + sigemptyset (&mask); + sigaddset (&mask, SIGUSR1); + if (pthread_sigmask (SIG_BLOCK, &mask, NULL) != 0) + { + printf ("%s: pthread_sigmask failed\n", __FUNCTION__); + exit (1); + } + + int sig; + pthread_cleanup_push (cl, NULL); + + /* Wait for SIGUSR1. */ + sigwait (&mask, &sig); + + pthread_cleanup_pop (0); + + printf ("%s: sigwait returned with signal %d\n", __FUNCTION__, sig); + + exit (1); +} + + +static void * +tf_sigwaitinfo (void *arg) +{ + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + /* Block SIGUSR1. */ + sigset_t mask; + sigemptyset (&mask); + sigaddset (&mask, SIGUSR1); + if (pthread_sigmask (SIG_BLOCK, &mask, NULL) != 0) + { + printf ("%s: pthread_sigmask failed\n", __FUNCTION__); + exit (1); + } + + siginfo_t info; + pthread_cleanup_push (cl, NULL); + + /* Wait for SIGUSR1. */ + sigwaitinfo (&mask, &info); + + pthread_cleanup_pop (0); + + printf ("%s: sigwaitinfo returned with signal %d\n", __FUNCTION__, + info.si_signo); + + exit (1); +} + + +static void * +tf_sigtimedwait (void *arg) +{ + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + /* Block SIGUSR1. */ + sigset_t mask; + sigemptyset (&mask); + sigaddset (&mask, SIGUSR1); + if (pthread_sigmask (SIG_BLOCK, &mask, NULL) != 0) + { + printf ("%s: pthread_sigmask failed\n", __FUNCTION__); + exit (1); + } + + /* Wait for SIGUSR1. */ + siginfo_t info; + struct timespec ts = { .tv_sec = 60, .tv_nsec = 0 }; + pthread_cleanup_push (cl, NULL); + + sigtimedwait (&mask, &info, &ts); + + pthread_cleanup_pop (0); + + printf ("%s: sigtimedwait returned with signal %d\n", __FUNCTION__, + info.si_signo); + + exit (1); +} + + +static void * +tf_pause (void *arg) +{ + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + pthread_cleanup_push (cl, NULL); + + pause (); + + pthread_cleanup_pop (0); + + printf ("%s: pause returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_accept (void *arg) +{ + struct sockaddr_un sun; + /* To test a non-blocking accept call we make the call file by using + a datagrame socket. */ + int pf = arg == NULL ? SOCK_STREAM : SOCK_DGRAM; + + tempfd = socket (AF_UNIX, pf, 0); + if (tempfd == -1) + { + printf ("%s: socket call failed\n", __FUNCTION__); + exit (1); + } + + int tries = 0; + do + { + if (++tries > 10) + { + printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__); + /* prevent endless loop, when bind fails forever */ + exit (1); + } + + strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-1-XXXXXX"); + if (mktemp (sun.sun_path) == NULL) + { + printf ("%s: cannot generate temp file name\n", __FUNCTION__); + exit (1); + } + sun.sun_family = AF_UNIX; + } + while (bind (tempfd, (struct sockaddr *) &sun, + offsetof (struct sockaddr_un, sun_path) + + strlen (sun.sun_path) + 1) != 0); + + unlink (sun.sun_path); + + listen (tempfd, 5); + + socklen_t len = sizeof (sun); + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + pthread_cleanup_push (cl, NULL); + + accept (tempfd, (struct sockaddr *) &sun, &len); + + pthread_cleanup_pop (0); + + printf ("%s: accept returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_send (void *arg) +{ + struct sockaddr_un sun; + + tempfd = socket (AF_UNIX, SOCK_STREAM, 0); + if (tempfd == -1) + { + printf ("%s: first socket call failed\n", __FUNCTION__); + exit (1); + } + + int tries = 0; + do + { + if (++tries > 10) + { + printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__); + exit (1); + } + + strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-2-XXXXXX"); + if (mktemp (sun.sun_path) == NULL) + { + printf ("%s: cannot generate temp file name\n", __FUNCTION__); + exit (1); + } + sun.sun_family = AF_UNIX; + } + while (bind (tempfd, (struct sockaddr *) &sun, + offsetof (struct sockaddr_un, sun_path) + + strlen (sun.sun_path) + 1) != 0); + + listen (tempfd, 5); + + tempfd2 = socket (AF_UNIX, SOCK_STREAM, 0); + if (tempfd2 == -1) + { + printf ("%s: second socket call failed\n", __FUNCTION__); + exit (1); + } + + if (connect (tempfd2, (struct sockaddr *) &sun, sizeof (sun)) != 0) + { + printf ("%s: connect failed\n", __FUNCTION__); + exit(1); + } + + unlink (sun.sun_path); + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + pthread_cleanup_push (cl, NULL); + + /* Very large block, so that the send call blocks. */ + char mem[700000]; + + send (tempfd2, mem, arg == NULL ? sizeof (mem) : 1, 0); + + pthread_cleanup_pop (0); + + printf ("%s: send returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_recv (void *arg) +{ + struct sockaddr_un sun; + + tempfd = socket (AF_UNIX, SOCK_STREAM, 0); + if (tempfd == -1) + { + printf ("%s: first socket call failed\n", __FUNCTION__); + exit (1); + } + + int tries = 0; + do + { + if (++tries > 10) + { + printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__); + exit (1); + } + + strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-3-XXXXXX"); + if (mktemp (sun.sun_path) == NULL) + { + printf ("%s: cannot generate temp file name\n", __FUNCTION__); + exit (1); + } + sun.sun_family = AF_UNIX; + } + while (bind (tempfd, (struct sockaddr *) &sun, + offsetof (struct sockaddr_un, sun_path) + + strlen (sun.sun_path) + 1) != 0); + + listen (tempfd, 5); + + tempfd2 = socket (AF_UNIX, SOCK_STREAM, 0); + if (tempfd2 == -1) + { + printf ("%s: second socket call failed\n", __FUNCTION__); + exit (1); + } + + if (connect (tempfd2, (struct sockaddr *) &sun, sizeof (sun)) != 0) + { + printf ("%s: connect failed\n", __FUNCTION__); + exit(1); + } + + unlink (sun.sun_path); + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + pthread_cleanup_push (cl, NULL); + + char mem[70]; + + recv (tempfd2, mem, arg == NULL ? sizeof (mem) : 0, 0); + + pthread_cleanup_pop (0); + + printf ("%s: recv returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_recvfrom (void *arg) +{ + struct sockaddr_un sun; + + tempfd = socket (AF_UNIX, SOCK_DGRAM, 0); + if (tempfd == -1) + { + printf ("%s: first socket call failed\n", __FUNCTION__); + exit (1); + } + + int tries = 0; + do + { + if (++tries > 10) + { + printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__); + exit (1); + } + + strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-4-XXXXXX"); + if (mktemp (sun.sun_path) == NULL) + { + printf ("%s: cannot generate temp file name\n", __FUNCTION__); + exit (1); + } + sun.sun_family = AF_UNIX; + } + while (bind (tempfd, (struct sockaddr *) &sun, + offsetof (struct sockaddr_un, sun_path) + + strlen (sun.sun_path) + 1) != 0); + + tempfname = strdup (sun.sun_path); + + tempfd2 = socket (AF_UNIX, SOCK_DGRAM, 0); + if (tempfd2 == -1) + { + printf ("%s: second socket call failed\n", __FUNCTION__); + exit (1); + } + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + pthread_cleanup_push (cl, NULL); + + char mem[70]; + socklen_t len = sizeof (sun); + + recvfrom (tempfd2, mem, arg == NULL ? sizeof (mem) : 0, 0, + (struct sockaddr *) &sun, &len); + + pthread_cleanup_pop (0); + + printf ("%s: recvfrom returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_recvmsg (void *arg) +{ + struct sockaddr_un sun; + + tempfd = socket (AF_UNIX, SOCK_DGRAM, 0); + if (tempfd == -1) + { + printf ("%s: first socket call failed\n", __FUNCTION__); + exit (1); + } + + int tries = 0; + do + { + if (++tries > 10) + { + printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__); + exit (1); + } + + strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-5-XXXXXX"); + if (mktemp (sun.sun_path) == NULL) + { + printf ("%s: cannot generate temp file name\n", __FUNCTION__); + exit (1); + } + sun.sun_family = AF_UNIX; + } + while (bind (tempfd, (struct sockaddr *) &sun, + offsetof (struct sockaddr_un, sun_path) + + strlen (sun.sun_path) + 1) != 0); + + tempfname = strdup (sun.sun_path); + + tempfd2 = socket (AF_UNIX, SOCK_DGRAM, 0); + if (tempfd2 == -1) + { + printf ("%s: second socket call failed\n", __FUNCTION__); + exit (1); + } + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + pthread_cleanup_push (cl, NULL); + + char mem[70]; + struct iovec iov[1]; + iov[0].iov_base = mem; + iov[0].iov_len = arg == NULL ? sizeof (mem) : 0; + + struct msghdr m; + m.msg_name = &sun; + m.msg_namelen = sizeof (sun); + m.msg_iov = iov; + m.msg_iovlen = 1; + m.msg_control = NULL; + m.msg_controllen = 0; + + recvmsg (tempfd2, &m, 0); + + pthread_cleanup_pop (0); + + printf ("%s: recvmsg returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_open (void *arg) +{ + if (arg == NULL) + // XXX If somebody can provide a portable test case in which open() + // blocks we can enable this test to run in both rounds. + abort (); + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + pthread_cleanup_push (cl, NULL); + + open ("Makefile", O_RDONLY); + + pthread_cleanup_pop (0); + + printf ("%s: open returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_close (void *arg) +{ + if (arg == NULL) + // XXX If somebody can provide a portable test case in which close() + // blocks we can enable this test to run in both rounds. + abort (); + + char fname[] = "/tmp/tst-cancel-fd-XXXXXX"; + tempfd = mkstemp (fname); + if (tempfd == -1) + { + printf ("%s: mkstemp failed\n", __FUNCTION__); + exit (1); + } + unlink (fname); + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + pthread_cleanup_push (cl, NULL); + + close (tempfd); + + pthread_cleanup_pop (0); + + printf ("%s: close returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_pread (void *arg) +{ + if (arg == NULL) + // XXX If somebody can provide a portable test case in which pread() + // blocks we can enable this test to run in both rounds. + abort (); + + tempfd = open ("Makefile", O_RDONLY); + if (tempfd == -1) + { + printf ("%s: cannot open Makefile\n", __FUNCTION__); + exit (1); + } + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + pthread_cleanup_push (cl, NULL); + + char mem[10]; + pread (tempfd, mem, sizeof (mem), 0); + + pthread_cleanup_pop (0); + + printf ("%s: pread returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_pwrite (void *arg) +{ + if (arg == NULL) + // XXX If somebody can provide a portable test case in which pwrite() + // blocks we can enable this test to run in both rounds. + abort (); + + char fname[] = "/tmp/tst-cancel4-fd-XXXXXX"; + tempfd = mkstemp (fname); + if (tempfd == -1) + { + printf ("%s: mkstemp failed\n", __FUNCTION__); + exit (1); + } + unlink (fname); + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + pthread_cleanup_push (cl, NULL); + + char mem[10]; + pwrite (tempfd, mem, sizeof (mem), 0); + + pthread_cleanup_pop (0); + + printf ("%s: pwrite returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_fsync (void *arg) +{ + if (arg == NULL) + // XXX If somebody can provide a portable test case in which fsync() + // blocks we can enable this test to run in both rounds. + abort (); + + tempfd = open ("Makefile", O_RDONLY); + if (tempfd == -1) + { + printf ("%s: cannot open Makefile\n", __FUNCTION__); + exit (1); + } + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + pthread_cleanup_push (cl, NULL); + + fsync (tempfd); + + pthread_cleanup_pop (0); + + printf ("%s: fsync returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_fdatasync (void *arg) +{ + if (arg == NULL) + // XXX If somebody can provide a portable test case in which fdatasync() + // blocks we can enable this test to run in both rounds. + abort (); + + tempfd = open ("Makefile", O_RDONLY); + if (tempfd == -1) + { + printf ("%s: cannot open Makefile\n", __FUNCTION__); + exit (1); + } + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + pthread_cleanup_push (cl, NULL); + + fdatasync (tempfd); + + pthread_cleanup_pop (0); + + printf ("%s: fdatasync returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_msync (void *arg) +{ + if (arg == NULL) + // XXX If somebody can provide a portable test case in which msync() + // blocks we can enable this test to run in both rounds. + abort (); + + tempfd = open ("Makefile", O_RDONLY); + if (tempfd == -1) + { + printf ("%s: cannot open Makefile\n", __FUNCTION__); + exit (1); + } + void *p = mmap (NULL, 10, PROT_READ, MAP_SHARED, tempfd, 0); + if (p == MAP_FAILED) + { + printf ("%s: mmap failed\n", __FUNCTION__); + exit (1); + } + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + pthread_cleanup_push (cl, NULL); + + msync (p, 10, 0); + + pthread_cleanup_pop (0); + + printf ("%s: msync returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_sendto (void *arg) +{ + if (arg == NULL) + // XXX If somebody can provide a portable test case in which sendto() + // blocks we can enable this test to run in both rounds. + abort (); + + struct sockaddr_un sun; + + tempfd = socket (AF_UNIX, SOCK_DGRAM, 0); + if (tempfd == -1) + { + printf ("%s: first socket call failed\n", __FUNCTION__); + exit (1); + } + + int tries = 0; + do + { + if (++tries > 10) + { + printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__); + exit (1); + } + + strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-6-XXXXXX"); + if (mktemp (sun.sun_path) == NULL) + { + printf ("%s: cannot generate temp file name\n", __FUNCTION__); + exit (1); + } + sun.sun_family = AF_UNIX; + } + while (bind (tempfd, (struct sockaddr *) &sun, + offsetof (struct sockaddr_un, sun_path) + + strlen (sun.sun_path) + 1) != 0); + tempfname = strdup (sun.sun_path); + + tempfd2 = socket (AF_UNIX, SOCK_DGRAM, 0); + if (tempfd2 == -1) + { + printf ("%s: second socket call failed\n", __FUNCTION__); + exit (1); + } + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + pthread_cleanup_push (cl, NULL); + + char mem[1]; + + sendto (tempfd2, mem, arg == NULL ? sizeof (mem) : 1, 0, + (struct sockaddr *) &sun, + offsetof (struct sockaddr_un, sun_path) + strlen (sun.sun_path) + 1); + + pthread_cleanup_pop (0); + + printf ("%s: sendto returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_sendmsg (void *arg) +{ + if (arg == NULL) + // XXX If somebody can provide a portable test case in which sendmsg() + // blocks we can enable this test to run in both rounds. + abort (); + + struct sockaddr_un sun; + + tempfd = socket (AF_UNIX, SOCK_DGRAM, 0); + if (tempfd == -1) + { + printf ("%s: first socket call failed\n", __FUNCTION__); + exit (1); + } + + int tries = 0; + do + { + if (++tries > 10) + { + printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__); + exit (1); + } + + strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-7-XXXXXX"); + if (mktemp (sun.sun_path) == NULL) + { + printf ("%s: cannot generate temp file name\n", __FUNCTION__); + exit (1); + } + sun.sun_family = AF_UNIX; + } + while (bind (tempfd, (struct sockaddr *) &sun, + offsetof (struct sockaddr_un, sun_path) + + strlen (sun.sun_path) + 1) != 0); + tempfname = strdup (sun.sun_path); + + tempfd2 = socket (AF_UNIX, SOCK_DGRAM, 0); + if (tempfd2 == -1) + { + printf ("%s: second socket call failed\n", __FUNCTION__); + exit (1); + } + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + pthread_cleanup_push (cl, NULL); + + char mem[1]; + struct iovec iov[1]; + iov[0].iov_base = mem; + iov[0].iov_len = 1; + + struct msghdr m; + m.msg_name = &sun; + m.msg_namelen = (offsetof (struct sockaddr_un, sun_path) + + strlen (sun.sun_path) + 1); + m.msg_iov = iov; + m.msg_iovlen = 1; + m.msg_control = NULL; + m.msg_controllen = 0; + + sendmsg (tempfd2, &m, 0); + + pthread_cleanup_pop (0); + + printf ("%s: sendmsg returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_creat (void *arg) +{ + if (arg == NULL) + // XXX If somebody can provide a portable test case in which sendmsg() + // blocks we can enable this test to run in both rounds. + abort (); + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + pthread_cleanup_push (cl, NULL); + + creat ("tmp/tst-cancel-4-should-not-exist", 0666); + + pthread_cleanup_pop (0); + + printf ("%s: creat returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_connect (void *arg) +{ + if (arg == NULL) + // XXX If somebody can provide a portable test case in which connect() + // blocks we can enable this test to run in both rounds. + abort (); + + struct sockaddr_un sun; + + tempfd = socket (AF_UNIX, SOCK_STREAM, 0); + if (tempfd == -1) + { + printf ("%s: first socket call failed\n", __FUNCTION__); + exit (1); + } + + int tries = 0; + do + { + if (++tries > 10) + { + printf ("%s: too many unsuccessful bind calls\n", __FUNCTION__); + exit (1); + } + + strcpy (sun.sun_path, "/tmp/tst-cancel4-socket-2-XXXXXX"); + if (mktemp (sun.sun_path) == NULL) + { + printf ("%s: cannot generate temp file name\n", __FUNCTION__); + exit (1); + } + sun.sun_family = AF_UNIX; + } + while (bind (tempfd, (struct sockaddr *) &sun, + offsetof (struct sockaddr_un, sun_path) + + strlen (sun.sun_path) + 1) != 0); + tempfname = strdup (sun.sun_path); + + listen (tempfd, 5); + + tempfd2 = socket (AF_UNIX, SOCK_STREAM, 0); + if (tempfd2 == -1) + { + printf ("%s: second socket call failed\n", __FUNCTION__); + exit (1); + } + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + pthread_cleanup_push (cl, NULL); + + connect (tempfd2, (struct sockaddr *) &sun, sizeof (sun)); + + pthread_cleanup_pop (0); + + printf ("%s: connect returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_tcdrain (void *arg) +{ + if (arg == NULL) + // XXX If somebody can provide a portable test case in which tcdrain() + // blocks we can enable this test to run in both rounds. + abort (); + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + pthread_cleanup_push (cl, NULL); + + /* Regardless of stderr being a terminal, the tcdrain call should be + canceled. */ + tcdrain (STDERR_FILENO); + + pthread_cleanup_pop (0); + + printf ("%s: tcdrain returned\n", __FUNCTION__); + + exit (1); +} + + +static void * +tf_msgrcv (void *arg) +{ + tempmsg = msgget (IPC_PRIVATE, 0666 | IPC_CREAT); + if (tempmsg == -1) + { + printf ("%s: msgget failed: %s\n", __FUNCTION__, strerror (errno)); + exit (1); + } + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + if (arg != NULL) + { + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + } + + ssize_t s; + + pthread_cleanup_push (cl, NULL); + + struct + { + long int type; + char mem[10]; + } m; + int randnr; + /* We need a positive random number. */ + do + randnr = random () % 64000; + while (randnr <= 0); + do + { + errno = 0; + s = msgrcv (tempmsg, (struct msgbuf *) &m, 10, randnr, 0); + } + while (errno == EIDRM || errno == EINTR); + + pthread_cleanup_pop (0); + + printf ("%s: msgrcv returned %zd with errno = %m\n", __FUNCTION__, s); + + msgctl (tempmsg, IPC_RMID, NULL); + + exit (1); +} + + +static void * +tf_msgsnd (void *arg) +{ + if (arg == NULL) + // XXX If somebody can provide a portable test case in which msgsnd() + // blocks we can enable this test to run in both rounds. + abort (); + + tempmsg = msgget (IPC_PRIVATE, 0666 | IPC_CREAT); + if (tempmsg == -1) + { + printf ("%s: msgget failed: %s\n", __FUNCTION__, strerror (errno)); + exit (1); + } + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: 2nd barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + pthread_cleanup_push (cl, NULL); + + struct + { + long int type; + char mem[1]; + } m; + /* We need a positive random number. */ + do + m.type = random () % 64000; + while (m.type <= 0); + msgsnd (tempmsg, (struct msgbuf *) &m, sizeof (m.mem), 0); + + pthread_cleanup_pop (0); + + printf ("%s: msgsnd returned\n", __FUNCTION__); + + msgctl (tempmsg, IPC_RMID, NULL); + + exit (1); +} + + +static struct +{ + const char *name; + void *(*tf) (void *); + int nb; + int only_early; +} tests[] = +{ +#define ADD_TEST(name, nbar, early) { #name, tf_##name, nbar, early } + ADD_TEST (read, 2, 0), + ADD_TEST (readv, 2, 0), + ADD_TEST (select, 2, 0), + ADD_TEST (pselect, 2, 0), + ADD_TEST (poll, 2, 0), + ADD_TEST (ppoll, 2, 0), + ADD_TEST (write, 2, 0), + ADD_TEST (writev, 2, 0), + ADD_TEST (usleep, 2, 0), + ADD_TEST (nanosleep, 2, 0), + ADD_TEST (wait, 2, 0), + ADD_TEST (waitid, 2, 0), + ADD_TEST (waitpid, 2, 0), + ADD_TEST (sigpause, 2, 0), + ADD_TEST (sigsuspend, 2, 0), + ADD_TEST (sigwait, 2, 0), + ADD_TEST (sigwaitinfo, 2, 0), + ADD_TEST (sigtimedwait, 2, 0), + ADD_TEST (pause, 2, 0), + ADD_TEST (accept, 2, 0), + ADD_TEST (send, 2, 0), + ADD_TEST (recv, 2, 0), + ADD_TEST (recvfrom, 2, 0), + ADD_TEST (recvmsg, 2, 0), + ADD_TEST (open, 2, 1), + ADD_TEST (close, 2, 1), + ADD_TEST (pread, 2, 1), + ADD_TEST (pwrite, 2, 1), + ADD_TEST (fsync, 2, 1), + ADD_TEST (fdatasync, 2, 1), + ADD_TEST (msync, 2, 1), + ADD_TEST (sendto, 2, 1), + ADD_TEST (sendmsg, 2, 1), + ADD_TEST (creat, 2, 1), + ADD_TEST (connect, 2, 1), + ADD_TEST (tcdrain, 2, 1), + ADD_TEST (msgrcv, 2, 0), + ADD_TEST (msgsnd, 2, 1), +}; +#define ntest_tf (sizeof (tests) / sizeof (tests[0])) + + +static int +do_test (void) +{ + int val; + socklen_t len; + + if (socketpair (AF_UNIX, SOCK_STREAM, PF_UNIX, fds) != 0) + { + perror ("socketpair"); + exit (1); + } + + val = 1; + len = sizeof(val); + setsockopt (fds[1], SOL_SOCKET, SO_SNDBUF, &val, sizeof(val)); + if (getsockopt (fds[1], SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) + { + perror ("getsockopt"); + exit (1); + } + if (val >= WRITE_BUFFER_SIZE) + { + puts ("minimum write buffer size too large"); + exit (1); + } + setsockopt (fds[1], SOL_SOCKET, SO_SNDBUF, &val, sizeof(val)); + + int result = 0; + size_t cnt; + for (cnt = 0; cnt < ntest_tf; ++cnt) + { + if (tests[cnt].only_early) + continue; + + if (pthread_barrier_init (&b2, NULL, tests[cnt].nb) != 0) + { + puts ("b2 init failed"); + exit (1); + } + + /* Reset the counter for the cleanup handler. */ + cl_called = 0; + + pthread_t th; + if (pthread_create (&th, NULL, tests[cnt].tf, NULL) != 0) + { + printf ("create for '%s' test failed\n", tests[cnt].name); + result = 1; + continue; + } + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + result = 1; + continue; + } + + struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 }; + while (nanosleep (&ts, &ts) != 0) + continue; + + if (pthread_cancel (th) != 0) + { + printf ("cancel for '%s' failed\n", tests[cnt].name); + result = 1; + continue; + } + + void *status; + if (pthread_join (th, &status) != 0) + { + printf ("join for '%s' failed\n", tests[cnt].name); + result = 1; + continue; + } + if (status != PTHREAD_CANCELED) + { + printf ("thread for '%s' not canceled\n", tests[cnt].name); + result = 1; + continue; + } + + if (pthread_barrier_destroy (&b2) != 0) + { + puts ("barrier_destroy failed"); + result = 1; + continue; + } + + if (cl_called == 0) + { + printf ("cleanup handler not called for '%s'\n", tests[cnt].name); + result = 1; + continue; + } + if (cl_called > 1) + { + printf ("cleanup handler called more than once for '%s'\n", + tests[cnt].name); + result = 1; + continue; + } + + printf ("in-time cancel test of '%s' successful\n", tests[cnt].name); + + if (tempfd != -1) + { + close (tempfd); + tempfd = -1; + } + if (tempfd2 != -1) + { + close (tempfd2); + tempfd2 = -1; + } + if (tempfname != NULL) + { + unlink (tempfname); + free (tempfname); + tempfname = NULL; + } + if (tempmsg != -1) + { + msgctl (tempmsg, IPC_RMID, NULL); + tempmsg = -1; + } + } + + for (cnt = 0; cnt < ntest_tf; ++cnt) + { + if (pthread_barrier_init (&b2, NULL, tests[cnt].nb) != 0) + { + puts ("b2 init failed"); + exit (1); + } + + /* Reset the counter for the cleanup handler. */ + cl_called = 0; + + pthread_t th; + if (pthread_create (&th, NULL, tests[cnt].tf, (void *) 1l) != 0) + { + printf ("create for '%s' test failed\n", tests[cnt].name); + result = 1; + continue; + } + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + result = 1; + continue; + } + + if (pthread_cancel (th) != 0) + { + printf ("cancel for '%s' failed\n", tests[cnt].name); + result = 1; + continue; + } + + r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + result = 1; + continue; + } + + void *status; + if (pthread_join (th, &status) != 0) + { + printf ("join for '%s' failed\n", tests[cnt].name); + result = 1; + continue; + } + if (status != PTHREAD_CANCELED) + { + printf ("thread for '%s' not canceled\n", tests[cnt].name); + result = 1; + continue; + } + + if (pthread_barrier_destroy (&b2) != 0) + { + puts ("barrier_destroy failed"); + result = 1; + continue; + } + + if (cl_called == 0) + { + printf ("cleanup handler not called for '%s'\n", tests[cnt].name); + result = 1; + continue; + } + if (cl_called > 1) + { + printf ("cleanup handler called more than once for '%s'\n", + tests[cnt].name); + result = 1; + continue; + } + + printf ("early cancel test of '%s' successful\n", tests[cnt].name); + + if (tempfd != -1) + { + close (tempfd); + tempfd = -1; + } + if (tempfd2 != -1) + { + close (tempfd2); + tempfd2 = -1; + } + if (tempfname != NULL) + { + unlink (tempfname); + free (tempfname); + tempfname = NULL; + } + if (tempmsg != -1) + { + msgctl (tempmsg, IPC_RMID, NULL); + tempmsg = -1; + } + } + + return result; +} + +#define TIMEOUT 60 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel5.c b/test/nptl/tst-cancel5.c new file mode 100644 index 000000000..1c879eba8 --- /dev/null +++ b/test/nptl/tst-cancel5.c @@ -0,0 +1 @@ +#include "tst-cancel4.c" diff --git a/test/nptl/tst-cancel6.c b/test/nptl/tst-cancel6.c new file mode 100644 index 000000000..4e11277ea --- /dev/null +++ b/test/nptl/tst-cancel6.c @@ -0,0 +1,78 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static void * +tf (void *arg) +{ + char buf[100]; + fgets (buf, sizeof (buf), arg); + /* This call should never return. */ + return NULL; +} + + +static int +do_test (void) +{ + int fd[2]; + if (pipe (fd) != 0) + { + puts ("pipe failed"); + return 1; + } + + FILE *fp = fdopen (fd[0], "r"); + if (fp == NULL) + { + puts ("fdopen failed"); + return 1; + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, fp) != 0) + { + puts ("pthread_create failed"); + return 1; + } + + sleep (1); + + if (pthread_cancel (th) != 0) + { + puts ("pthread_cancel failed"); + return 1; + } + + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("pthread_join failed"); + return 1; + } + + return r != PTHREAD_CANCELED; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel7.c b/test/nptl/tst-cancel7.c new file mode 100644 index 000000000..9e7d22ed5 --- /dev/null +++ b/test/nptl/tst-cancel7.c @@ -0,0 +1,208 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +const char *command; +const char *pidfile; +char pidfilename[] = "/tmp/tst-cancel7-XXXXXX"; + +static void * +tf (void *arg) +{ + const char *args = " -d -p "; + char *cmd = alloca (strlen (command) + strlen (args) + + strlen (pidfilename) + 1); + + strcpy (stpcpy (stpcpy (cmd, command), args), pidfilename); + system (cmd); + /* This call should never return. */ + return NULL; +} + + +static void +sl (void) +{ + FILE *f = fopen (pidfile, "w"); + if (f == NULL) + exit (1); + + fprintf (f, "%lld\n", (long long) getpid ()); + fflush (f); + + struct flock fl = + { + .l_type = F_WRLCK, + .l_start = 0, + .l_whence = SEEK_SET, + .l_len = 1 + }; + if (fcntl (fileno (f), F_SETLK, &fl) != 0) + exit (1); + + sigset_t ss; + sigfillset (&ss); + sigsuspend (&ss); + exit (0); +} + + +static void +do_prepare (int argc, char *argv[]) +{ + if (command == NULL) + command = argv[0]; + + if (pidfile) + sl (); + + int fd = mkstemp (pidfilename); + if (fd == -1) + { + puts ("mkstemp failed"); + exit (1); + } + + write (fd, " ", 1); + close (fd); +} + + +static int +do_test (void) +{ + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("pthread_create failed"); + return 1; + } + + do + sleep (1); + while (access (pidfilename, R_OK) != 0); + + if (pthread_cancel (th) != 0) + { + puts ("pthread_cancel failed"); + return 1; + } + + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("pthread_join failed"); + return 1; + } + + sleep (1); + + FILE *f = fopen (pidfilename, "r+"); + if (f == NULL) + { + puts ("no pidfile"); + return 1; + } + + long long ll; + if (fscanf (f, "%lld\n", &ll) != 1) + { + puts ("could not read pid"); + unlink (pidfilename); + return 1; + } + + struct flock fl = + { + .l_type = F_WRLCK, + .l_start = 0, + .l_whence = SEEK_SET, + .l_len = 1 + }; + if (fcntl (fileno (f), F_GETLK, &fl) != 0) + { + puts ("F_GETLK failed"); + unlink (pidfilename); + return 1; + } + + if (fl.l_type != F_UNLCK) + { + printf ("child %lld still running\n", (long long) fl.l_pid); + if (fl.l_pid == ll) + kill (fl.l_pid, SIGKILL); + + unlink (pidfilename); + return 1; + } + + fclose (f); + + unlink (pidfilename); + + return r != PTHREAD_CANCELED; +} + +#if 0 /* unused */ +static void +do_cleanup (void) +{ + FILE *f = fopen (pidfilename, "r+"); + long long ll; + + if (f != NULL && fscanf (f, "%lld\n", &ll) == 1) + { + struct flock fl = + { + .l_type = F_WRLCK, + .l_start = 0, + .l_whence = SEEK_SET, + .l_len = 1 + }; + if (fcntl (fileno (f), F_GETLK, &fl) == 0 && fl.l_type != F_UNLCK + && fl.l_pid == ll) + kill (fl.l_pid, SIGKILL); + + fclose (f); + } + + unlink (pidfilename); +} +#endif + +#define CMDLINE_OPTIONS \ + "c:p:" +#define CMDLINE_PROCESS \ + case 'c': \ + command = optarg; \ + break; \ + case 'p': \ + pidfile = optarg; \ + break; +#define PREPARE(argc, argv) do_prepare (argc, argv) +#define TEST_FUNCTION do_test () +#define TIMEOUT 5 +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel8.c b/test/nptl/tst-cancel8.c new file mode 100644 index 000000000..1c91d47a0 --- /dev/null +++ b/test/nptl/tst-cancel8.c @@ -0,0 +1,142 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static pthread_barrier_t bar; + +static int global; + + +static void +cleanup (void *arg) +{ + global = 1; +} + + +static void * +tf (void *arg) +{ + /* Enable cancellation, but defer it. */ + if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) != 0) + { + puts ("setcancelstate failed"); + exit (1); + } + if (pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, NULL) != 0) + { + puts ("setcanceltype failed"); + exit (1); + } + + /* Add cleanup handler. */ + pthread_cleanup_push (cleanup, NULL); + + /* Synchronize with the main thread. */ + int r = pthread_barrier_wait (&bar); + if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("tf: first barrier_wait failed"); + exit (1); + } + + /* And again. Once this is done the main thread should have canceled + this thread. */ + r = pthread_barrier_wait (&bar); + if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("tf: second barrier_wait failed"); + exit (1); + } + + /* Remove the cleanup handler without executing it. */ + pthread_cleanup_pop (0); + + /* Now react on the cancellation. */ + pthread_testcancel (); + + /* This call should never return. */ + return NULL; +} + + +static int +do_test (void) +{ + if (pthread_barrier_init (&bar, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("pthread_create failed"); + return 1; + } + + int r = pthread_barrier_wait (&bar); + if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("first barrier_wait failed"); + exit (1); + } + + if (pthread_cancel (th) != 0) + { + puts ("pthread_cancel failed"); + return 1; + } + + r = pthread_barrier_wait (&bar); + if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("second barrier_wait failed"); + exit (1); + } + + void *result; + if (pthread_join (th, &result) != 0) + { + puts ("pthread_join failed"); + return 1; + } + + if (result != PTHREAD_CANCELED) + { + puts ("thread was not canceled"); + exit (1); + } + + if (global != 0) + { + puts ("cancellation handler has been called"); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancel9.c b/test/nptl/tst-cancel9.c new file mode 100644 index 000000000..40a62c588 --- /dev/null +++ b/test/nptl/tst-cancel9.c @@ -0,0 +1,125 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <fcntl.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + + +static pthread_barrier_t b; + + +static void +cleanup (void *arg) +{ + fputs ("in cleanup\n", stdout); +} + + +static void * +tf (void *arg) +{ + int fd = open ("/dev/null", O_RDWR); + if (fd == -1) + { + puts ("cannot open /dev/null"); + exit (1); + } + FILE *fp = fdopen (fd, "w"); + if (fp == NULL) + { + puts ("fdopen failed"); + exit (1); + } + + pthread_cleanup_push (cleanup, NULL); + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + while (1) + /* fprintf() uses write() which is a cancallation point. */ + fprintf (fp, "foo"); + + pthread_cleanup_pop (0); + + return NULL; +} + + +static int +do_test (void) +{ + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + sleep (1); + + puts ("cancel now"); + + if (pthread_cancel (th) != 0) + { + puts ("cancel failed"); + exit (1); + } + + puts ("waiting for the child"); + + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("join failed"); + exit (1); + } + + if (r != PTHREAD_CANCELED) + { + puts ("thread wasn't canceled"); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cancelx10.c b/test/nptl/tst-cancelx10.c new file mode 100644 index 000000000..e5bbb34e6 --- /dev/null +++ b/test/nptl/tst-cancelx10.c @@ -0,0 +1 @@ +#include "tst-cancel10.c" diff --git a/test/nptl/tst-cancelx11.c b/test/nptl/tst-cancelx11.c new file mode 100644 index 000000000..ffcc2eefc --- /dev/null +++ b/test/nptl/tst-cancelx11.c @@ -0,0 +1 @@ +#include "tst-cancel11.c" diff --git a/test/nptl/tst-cancelx12.c b/test/nptl/tst-cancelx12.c new file mode 100644 index 000000000..f90ae61ba --- /dev/null +++ b/test/nptl/tst-cancelx12.c @@ -0,0 +1 @@ +#include "tst-cancel12.c" diff --git a/test/nptl/tst-cancelx13.c b/test/nptl/tst-cancelx13.c new file mode 100644 index 000000000..37c4c39c3 --- /dev/null +++ b/test/nptl/tst-cancelx13.c @@ -0,0 +1 @@ +#include "tst-cancel13.c" diff --git a/test/nptl/tst-cancelx14.c b/test/nptl/tst-cancelx14.c new file mode 100644 index 000000000..ba4e77584 --- /dev/null +++ b/test/nptl/tst-cancelx14.c @@ -0,0 +1 @@ +#include "tst-cancel14.c" diff --git a/test/nptl/tst-cancelx15.c b/test/nptl/tst-cancelx15.c new file mode 100644 index 000000000..005c1f6e3 --- /dev/null +++ b/test/nptl/tst-cancelx15.c @@ -0,0 +1 @@ +#include "tst-cancel15.c" diff --git a/test/nptl/tst-cancelx16.c b/test/nptl/tst-cancelx16.c new file mode 100644 index 000000000..99af3b197 --- /dev/null +++ b/test/nptl/tst-cancelx16.c @@ -0,0 +1 @@ +#include "tst-cancel16.c" diff --git a/test/nptl/tst-cancelx18.c b/test/nptl/tst-cancelx18.c new file mode 100644 index 000000000..56da18f38 --- /dev/null +++ b/test/nptl/tst-cancelx18.c @@ -0,0 +1 @@ +#include "tst-cancel18.c" diff --git a/test/nptl/tst-cancelx2.c b/test/nptl/tst-cancelx2.c new file mode 100644 index 000000000..95dc8a857 --- /dev/null +++ b/test/nptl/tst-cancelx2.c @@ -0,0 +1 @@ +#include "tst-cancel2.c" diff --git a/test/nptl/tst-cancelx20.c b/test/nptl/tst-cancelx20.c new file mode 100644 index 000000000..6bd86376c --- /dev/null +++ b/test/nptl/tst-cancelx20.c @@ -0,0 +1 @@ +#include "tst-cancel20.c" diff --git a/test/nptl/tst-cancelx21.c b/test/nptl/tst-cancelx21.c new file mode 100644 index 000000000..2a01061ea --- /dev/null +++ b/test/nptl/tst-cancelx21.c @@ -0,0 +1 @@ +#include "tst-cancel21.c" diff --git a/test/nptl/tst-cancelx3.c b/test/nptl/tst-cancelx3.c new file mode 100644 index 000000000..3937f10b9 --- /dev/null +++ b/test/nptl/tst-cancelx3.c @@ -0,0 +1 @@ +#include "tst-cancel3.c" diff --git a/test/nptl/tst-cancelx4.c b/test/nptl/tst-cancelx4.c new file mode 100644 index 000000000..1c879eba8 --- /dev/null +++ b/test/nptl/tst-cancelx4.c @@ -0,0 +1 @@ +#include "tst-cancel4.c" diff --git a/test/nptl/tst-cancelx6.c b/test/nptl/tst-cancelx6.c new file mode 100644 index 000000000..6926e21c2 --- /dev/null +++ b/test/nptl/tst-cancelx6.c @@ -0,0 +1 @@ +#include "tst-cancel6.c" diff --git a/test/nptl/tst-cancelx7.c b/test/nptl/tst-cancelx7.c new file mode 100644 index 000000000..4df1a5881 --- /dev/null +++ b/test/nptl/tst-cancelx7.c @@ -0,0 +1 @@ +#include "tst-cancel7.c" diff --git a/test/nptl/tst-cancelx8.c b/test/nptl/tst-cancelx8.c new file mode 100644 index 000000000..0555c7ceb --- /dev/null +++ b/test/nptl/tst-cancelx8.c @@ -0,0 +1 @@ +#include "tst-cancel8.c" diff --git a/test/nptl/tst-cancelx9.c b/test/nptl/tst-cancelx9.c new file mode 100644 index 000000000..9d84663d7 --- /dev/null +++ b/test/nptl/tst-cancelx9.c @@ -0,0 +1 @@ +#include "tst-cancel9.c" diff --git a/test/nptl/tst-cleanup0.c b/test/nptl/tst-cleanup0.c new file mode 100644 index 000000000..401115d73 --- /dev/null +++ b/test/nptl/tst-cleanup0.c @@ -0,0 +1,75 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static int global; + + +static void +ch (void *arg) +{ + int val = (long int) arg; + + printf ("ch (%d)\n", val); + + global *= val; + global += val; +} + + +static void +endfct (void) +{ + /* We force exit right here. */ + _exit (global); +} + + +static int +do_test (void) +{ + atexit (endfct); + + pthread_cancel (pthread_self ()); + + pthread_cleanup_push (ch, (void *) 1l); + + pthread_cleanup_push (ch, (void *) 2l); + + pthread_cleanup_push (ch, (void *) 3l); + +// pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + + pthread_cleanup_pop (1); + + pthread_cleanup_pop (1); + + pthread_cleanup_pop (1); + + return 100; +} + + +#define EXPECTED_STATUS 9 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cleanup1.c b/test/nptl/tst-cleanup1.c new file mode 100644 index 000000000..e89f434f5 --- /dev/null +++ b/test/nptl/tst-cleanup1.c @@ -0,0 +1,99 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static int global; + + +static void +ch (void *arg) +{ + int val = (long int) arg; + + printf ("ch (%d)\n", val); + + global *= val; + global += val; +} + + +static void * +tf (void *a) +{ + pthread_cancel (pthread_self ()); + + pthread_cleanup_push (ch, (void *) 1l); + + pthread_cleanup_push (ch, (void *) 2l); + + pthread_cleanup_push (ch, (void *) 3l); + + pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + + pthread_cleanup_pop (1); + + pthread_cleanup_pop (1); + + pthread_cleanup_pop (1); + + return NULL; +} + + +int +do_test (void) +{ + pthread_t th; + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + write (2, "create failed\n", 14); + _exit (1); + } + + void *r; + int e; + if ((e = pthread_join (th, &r)) != 0) + { + printf ("join failed: %d\n", e); + _exit (1); + } + + if (r != PTHREAD_CANCELED) + { + puts ("thread not canceled"); + exit (1); + } + + if (global != 9) + { + printf ("global = %d, expected 9\n", global); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cleanup2.c b/test/nptl/tst-cleanup2.c new file mode 100644 index 000000000..d01301b9f --- /dev/null +++ b/test/nptl/tst-cleanup2.c @@ -0,0 +1,62 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Bao Duong <bduong@progress.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, see + <http://www.gnu.org/licenses/>. */ + +#include <setjmp.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> + +static sigjmp_buf jmpbuf; + +static void +sig_handler (int signo) +{ + siglongjmp (jmpbuf, 1); +} + +static int +do_test (void) +{ + char *p = NULL; + struct sigaction sa; + + sa.sa_handler = sig_handler; + sigemptyset (&sa.sa_mask); + sa.sa_flags = SA_SIGINFO; + + if (sigaction (SIGSEGV, &sa, 0)) + { + perror ("installing SIGSEGV handler\n"); + exit (1); + } + + puts ("Attempting to sprintf to null ptr"); + if (setjmp (jmpbuf)) + { + puts ("Exiting main..."); + return 0; + } + + sprintf (p, "This should segv\n"); + + return 1; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cleanup3.c b/test/nptl/tst-cleanup3.c new file mode 100644 index 000000000..67bd9eb6f --- /dev/null +++ b/test/nptl/tst-cleanup3.c @@ -0,0 +1,97 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static int global; + + +static void +ch (void *arg) +{ + int val = (long int) arg; + + printf ("ch (%d)\n", val); + + global *= val; + global += val; +} + + +static void * +tf (void *a) +{ + pthread_cleanup_push (ch, (void *) 1l); + + pthread_cleanup_push (ch, (void *) 2l); + + pthread_cleanup_push (ch, (void *) 3l); + + pthread_exit ((void *) 1l); + + pthread_cleanup_pop (1); + + pthread_cleanup_pop (1); + + pthread_cleanup_pop (1); + + return NULL; +} + + +int +do_test (void) +{ + pthread_t th; + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + write (2, "create failed\n", 14); + _exit (1); + } + + void *r; + int e; + if ((e = pthread_join (th, &r)) != 0) + { + printf ("join failed: %d\n", e); + _exit (1); + } + + if (r != (void *) 1l) + { + puts ("thread not canceled"); + exit (1); + } + + if (global != 9) + { + printf ("global = %d, expected 9\n", global); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cleanup4.c b/test/nptl/tst-cleanup4.c new file mode 100644 index 000000000..3fe399820 --- /dev/null +++ b/test/nptl/tst-cleanup4.c @@ -0,0 +1,197 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +/* LinuxThreads pthread_cleanup_{push,pop} helpers. */ +extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer, + void (*__routine) (void *), + void *__arg); +extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer, + int __execute); + +static int fds[2]; +static pthread_barrier_t b2; +static int global; + +/* Defined in tst-cleanup4aux.c, never compiled with -fexceptions. */ +extern void fn5 (void); +extern void fn7 (void); +extern void fn9 (void); + +void +clh (void *arg) +{ + int val = (long int) arg; + + printf ("clh (%d)\n", val); + + global *= val; + global += val; +} + + +static __attribute__((noinline)) void +fn_read (void) +{ + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + char c; + read (fds[0], &c, 1); +} + + +__attribute__((noinline)) void +fn0 (void) +{ + pthread_cleanup_push (clh, (void *) 1l); + + fn_read (); + + pthread_cleanup_pop (1); +} + + +__attribute__((noinline)) void +fn1 (void) +{ + /* This is the old LinuxThreads pthread_cleanup_{push,pop}. */ + struct _pthread_cleanup_buffer b; + _pthread_cleanup_push (&b, clh, (void *) 2l); + + fn0 (); + + _pthread_cleanup_pop (&b, 1); +} + + +static __attribute__((noinline)) void +fn2 (void) +{ + pthread_cleanup_push (clh, (void *) 3l); + + fn1 (); + + pthread_cleanup_pop (1); +} + + +static void * +tf (void *a) +{ + switch ((long) a) + { + case 0: + fn2 (); + break; + case 1: + fn5 (); + break; + case 2: + fn7 (); + break; + case 3: + fn9 (); + break; + } + + return NULL; +} + + +int +do_test (void) +{ + int result = 0; + + if (pipe (fds) != 0) + { + puts ("pipe failed"); + exit (1); + } + + if (pthread_barrier_init (&b2, NULL, 2) != 0) + { + puts ("b2 init failed"); + exit (1); + } + + const int expect[] = + { + 15, /* 1 2 3 */ + 276, /* 1 4 5 6 */ + 120, /* 1 7 8 */ + 460 /* 1 2 9 10 */ + }; + + long i; + for (i = 0; i < 4; ++i) + { + global = 0; + + printf ("test %ld\n", i); + + pthread_t th; + if (pthread_create (&th, NULL, tf, (void *) i) != 0) + { + puts ("create failed"); + exit (1); + } + + int e = pthread_barrier_wait (&b2); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __FUNCTION__); + exit (1); + } + + pthread_cancel (th); + + void *r; + if ((e = pthread_join (th, &r)) != 0) + { + printf ("join failed: %d\n", e); + _exit (1); + } + + if (r != PTHREAD_CANCELED) + { + puts ("thread not canceled"); + exit (1); + } + + if (global != expect[i]) + { + printf ("global = %d, expected %d\n", global, expect[i]); + result = 1; + } + } + + return result; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cleanup4aux.c b/test/nptl/tst-cleanup4aux.c new file mode 100644 index 000000000..029c4939f --- /dev/null +++ b/test/nptl/tst-cleanup4aux.c @@ -0,0 +1,120 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer, + void (*__routine) (void *), + void *__arg); +extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *__buffer, + int __execute); + +extern void clh (void *arg); +extern void fn0 (void); +extern void fn1 (void); +extern void fn5 (void); +extern void fn7 (void); +extern void fn9 (void); + + +static __attribute__((noinline)) void +fn3 (void) +{ + /* This is the old LinuxThreads pthread_cleanup_{push,pop}. */ + struct _pthread_cleanup_buffer b; + _pthread_cleanup_push (&b, clh, (void *) 4l); + + fn0 (); + + _pthread_cleanup_pop (&b, 1); +} + + +static __attribute__((noinline)) void +fn4 (void) +{ + pthread_cleanup_push (clh, (void *) 5l); + + fn3 (); + + pthread_cleanup_pop (1); +} + + +void +fn5 (void) +{ + /* This is the old LinuxThreads pthread_cleanup_{push,pop}. */ + struct _pthread_cleanup_buffer b; + _pthread_cleanup_push (&b, clh, (void *) 6l); + + fn4 (); + + _pthread_cleanup_pop (&b, 1); +} + + +static __attribute__((noinline)) void +fn6 (void) +{ + pthread_cleanup_push (clh, (void *) 7l); + + fn0 (); + + pthread_cleanup_pop (1); +} + + +void +fn7 (void) +{ + /* This is the old LinuxThreads pthread_cleanup_{push,pop}. */ + struct _pthread_cleanup_buffer b; + _pthread_cleanup_push (&b, clh, (void *) 8l); + + fn6 (); + + _pthread_cleanup_pop (&b, 1); +} + + +static __attribute__((noinline)) void +fn8 (void) +{ + pthread_cleanup_push (clh, (void *) 9l); + + fn1 (); + + pthread_cleanup_pop (1); +} + + +void +fn9 (void) +{ + /* This is the old LinuxThreads pthread_cleanup_{push,pop}. */ + struct _pthread_cleanup_buffer b; + _pthread_cleanup_push (&b, clh, (void *) 10l); + + fn8 (); + + _pthread_cleanup_pop (&b, 1); +} diff --git a/test/nptl/tst-cleanupx0.c b/test/nptl/tst-cleanupx0.c new file mode 100644 index 000000000..0012ab1b2 --- /dev/null +++ b/test/nptl/tst-cleanupx0.c @@ -0,0 +1 @@ +#include "tst-cleanup0.c" diff --git a/test/nptl/tst-cleanupx1.c b/test/nptl/tst-cleanupx1.c new file mode 100644 index 000000000..21e9e58bd --- /dev/null +++ b/test/nptl/tst-cleanupx1.c @@ -0,0 +1 @@ +#include "tst-cleanup1.c" diff --git a/test/nptl/tst-cleanupx2.c b/test/nptl/tst-cleanupx2.c new file mode 100644 index 000000000..8b9e35093 --- /dev/null +++ b/test/nptl/tst-cleanupx2.c @@ -0,0 +1 @@ +#include "tst-cleanup2.c" diff --git a/test/nptl/tst-cleanupx3.c b/test/nptl/tst-cleanupx3.c new file mode 100644 index 000000000..90baf904f --- /dev/null +++ b/test/nptl/tst-cleanupx3.c @@ -0,0 +1 @@ +#include "tst-cleanup3.c" diff --git a/test/nptl/tst-cleanupx4.c b/test/nptl/tst-cleanupx4.c new file mode 100644 index 000000000..8dea954b5 --- /dev/null +++ b/test/nptl/tst-cleanupx4.c @@ -0,0 +1 @@ +#include "tst-cleanup4.c" diff --git a/test/nptl/tst-clock.c b/test/nptl/tst-clock.c new file mode 100644 index 000000000..2023cbc6d --- /dev/null +++ b/test/nptl/tst-clock.c @@ -0,0 +1,123 @@ +/* Test program for POSIX clock_* functions. + Copyright (C) 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.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, see + <http://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <string.h> +#include <time.h> + + +/* We want to see output immediately. */ +#define STDOUT_UNBUFFERED + +/* We expect to run at least 10 seconds. */ +#define TIMEOUT 15 + +static int +clock_test (clockid_t cl) +{ + struct timespec old_ts; + struct timespec ts; + struct timespec waitit; + int result = 0; + int i; + + memset (&ts, '\0', sizeof ts); + + waitit.tv_sec = 0; + waitit.tv_nsec = 500000000; + + /* Get and print resolution of the clock. */ + if (clock_getres (cl, &ts) == 0) + { + if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000) + { + printf ("clock %d: nanosecond value of resolution wrong\n", cl); + result = 1; + } + else + printf ("clock %d: resolution = %ld.%09ld secs\n", + cl, ts.tv_sec, ts.tv_nsec); + } + else + { + printf ("clock %d: cannot get resolution\n", cl); + result = 1; + } + + memset (&ts, '\0', sizeof ts); + memset (&old_ts, '\0', sizeof old_ts); + + /* Next get the current time value a few times. */ + for (i = 0; i < 10; ++i) + { + if (clock_gettime (cl, &ts) == 0) + { + if (ts.tv_nsec < 0 || ts.tv_nsec >= 1000000000) + { + printf ("clock %d: nanosecond value of time wrong (try %d)\n", + cl, i); + result = 1; + } + else + { + printf ("clock %d: time = %ld.%09ld secs\n", + cl, ts.tv_sec, ts.tv_nsec); + + if (memcmp (&ts, &old_ts, sizeof ts) == 0) + { + printf ("clock %d: time hasn't changed (try %d)\n", cl, i); + result = 1; + + old_ts = ts; + } + } + } + else + { + printf ("clock %d: cannot get time (try %d)\n", cl, i); + result = 1; + } + + /* Wait a bit before the next iteration. */ + nanosleep (&waitit, NULL); + } + + return result; +} + +static int +do_test (void) +{ + clockid_t cl; + int result; + + result = clock_test (CLOCK_REALTIME); + + if (clock_getcpuclockid (0, &cl) == 0) + /* XXX It's not yet a bug when this fails. */ + clock_test (cl); + else + printf("CPU clock unavailble, skipping test\n"); + + return result; +} +#define TEST_FUNCTION do_test () + + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-clock1.c b/test/nptl/tst-clock1.c new file mode 100644 index 000000000..7e483b534 --- /dev/null +++ b/test/nptl/tst-clock1.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <unistd.h> + + +int +do_test (void) +{ +#if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0 + clockid_t cl; + /* This is really only a linking-test here. */ + int e = pthread_getcpuclockid (pthread_self (), &cl); + if (e != 0) + { +# if _POSIX_THREAD_CPUTIME == 0 + if (sysconf (_SC_THREAD_CPUTIME) >= 0) +# endif + { + puts ("cpuclock advertized, but cannot get ID"); + exit (1); + } + } +#endif + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-clock2.c b/test/nptl/tst-clock2.c new file mode 100644 index 000000000..df6ec00db --- /dev/null +++ b/test/nptl/tst-clock2.c @@ -0,0 +1,201 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <unistd.h> + + +#if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0 +static pthread_barrier_t b2; +static pthread_barrier_t bN; + + +static void * +tf (void *arg) +{ + int e = pthread_barrier_wait (&b2); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + e = pthread_barrier_wait (&bN); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + return NULL; +} +#endif + + +int +do_test (void) +{ +#if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0 +# define N 10 + +# if _POSIX_THREAD_CPUTIME == 0 + if (sysconf (_SC_THREAD_CPUTIME) < 0) + { + puts ("_POSIX_THREAD_CPUTIME option not available"); + return 0; + } +# endif + + if (pthread_barrier_init (&b2, NULL, 2) != 0 + || pthread_barrier_init (&bN, NULL, N + 1) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 }; + TEMP_FAILURE_RETRY (nanosleep (&ts, &ts)); + + pthread_t th[N + 1]; + clockid_t cl[N + 1]; +# ifndef CLOCK_THREAD_CPUTIME_ID + if (pthread_getcpuclockid (pthread_self (), &cl[0]) != 0) + { + puts ("own pthread_getcpuclockid failed"); + return 1; + } +# else + cl[0] = CLOCK_THREAD_CPUTIME_ID; +# endif + + pthread_attr_t at; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + + int i; + int e; + for (i = 0; i < N; ++i) + { + if (pthread_create (&th[i], &at, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + e = pthread_barrier_wait (&b2); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + return 1; + } + + ts.tv_sec = 0; + ts.tv_nsec = 100000000; + TEMP_FAILURE_RETRY (nanosleep (&ts, &ts)); + + if (pthread_getcpuclockid (th[i], &cl[i + 1]) != 0) + { + puts ("pthread_getcpuclockid failed"); + return 1; + } + } + + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + + struct timespec t[N + 1]; + for (i = 0; i < N + 1; ++i) + if (clock_gettime (cl[i], &t[i]) != 0) + { + printf ("clock_gettime round %d failed\n", i); + return 1; + } + + for (i = 0; i < N; ++i) + { + struct timespec diff; + + diff.tv_sec = t[i].tv_sec - t[i + 1].tv_sec; + diff.tv_nsec = t[i].tv_nsec - t[i + 1].tv_nsec; + if (diff.tv_nsec < 0) + { + diff.tv_nsec += 1000000000; + --diff.tv_sec; + } + + if (diff.tv_sec < 0 || (diff.tv_sec == 0 && diff.tv_nsec < 100000000)) + { + printf ("\ +difference between thread %d and %d too small (%ld.%09ld)\n", + i, i + 1, (long int) diff.tv_sec, (long int) diff.tv_nsec); + return 1; + } + + printf ("diff %d->%d: %ld.%09ld\n", + i, i + 1, (long int) diff.tv_sec, (long int) diff.tv_nsec); + } + + ts.tv_sec = 0; + ts.tv_nsec = 0; + for (i = 0; i < N + 1; ++i) + if (clock_settime (cl[i], &ts) != 0) + { + printf ("clock_settime(%d) round %d failed\n", cl[i], i); + return 1; + } + + for (i = 0; i < N + 1; ++i) + { + if (clock_gettime (cl[i], &ts) != 0) + { + puts ("clock_gettime failed"); + return 1; + } + + if (ts.tv_sec > t[i].tv_sec + || (ts.tv_sec == t[i].tv_sec && ts.tv_nsec > t[i].tv_nsec)) + { + puts ("clock_settime didn't reset clock"); + return 1; + } + } +#endif + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-clock_nanosleep.c b/test/nptl/tst-clock_nanosleep.c new file mode 100644 index 000000000..a2d1f0085 --- /dev/null +++ b/test/nptl/tst-clock_nanosleep.c @@ -0,0 +1,57 @@ +/* Copyright (C) 2003 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <stdio.h> +#include <unistd.h> +#include <sys/time.h> +#include <time.h> + + +/* Test that clock_nanosleep() does sleep. */ +static int +do_test (void) +{ + /* Current time. */ + struct timeval tv1; + (void) gettimeofday (&tv1, NULL); + + struct timespec ts; + ts.tv_sec = 1; + ts.tv_nsec = 0; + TEMP_FAILURE_RETRY (clock_nanosleep (CLOCK_REALTIME, 0, &ts, &ts)); + + /* At least one second must have passed. */ + struct timeval tv2; + (void) gettimeofday (&tv2, NULL); + + tv2.tv_sec -= tv1.tv_sec; + tv2.tv_usec -= tv1.tv_usec; + if (tv2.tv_usec < 0) + --tv2.tv_sec; + + if (tv2.tv_sec < 1) + { + puts ("clock_nanosleep didn't sleep long enough"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond1.c b/test/nptl/tst-cond1.c new file mode 100644 index 000000000..30efe5b5e --- /dev/null +++ b/test/nptl/tst-cond1.c @@ -0,0 +1,93 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <error.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + + +static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; + + +static void * +tf (void *p) +{ + int err; + + err = pthread_mutex_lock (&mut); + if (err != 0) + error (EXIT_FAILURE, err, "child: cannot get mutex"); + + puts ("child: got mutex; signalling"); + + pthread_cond_signal (&cond); + + puts ("child: unlock"); + + err = pthread_mutex_unlock (&mut); + if (err != 0) + error (EXIT_FAILURE, err, "child: cannot unlock"); + + puts ("child: done"); + + return NULL; +} + + +static int +do_test (void) +{ + pthread_t th; + int err; + + printf ("&cond = %p\n&mut = %p\n", &cond, &mut); + + puts ("parent: get mutex"); + + err = pthread_mutex_lock (&mut); + if (err != 0) + error (EXIT_FAILURE, err, "parent: cannot get mutex"); + + puts ("parent: create child"); + + err = pthread_create (&th, NULL, tf, NULL); + if (err != 0) + error (EXIT_FAILURE, err, "parent: cannot create thread"); + + puts ("parent: wait for condition"); + + err = pthread_cond_wait (&cond, &mut); + if (err != 0) + error (EXIT_FAILURE, err, "parent: cannot wait fir signal"); + + puts ("parent: got signal"); + + err = pthread_join (th, NULL); + if (err != 0) + error (EXIT_FAILURE, err, "parent: failed to join"); + + puts ("done"); + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond10.c b/test/nptl/tst-cond10.c new file mode 100644 index 000000000..cd5247727 --- /dev/null +++ b/test/nptl/tst-cond10.c @@ -0,0 +1,172 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <error.h> +#include <pthread.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> + + +#define N 10 +#define ROUNDS 100 + +static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; +static pthread_barrier_t bN1; +static pthread_barrier_t b2; + + +static void * +tf (void *p) +{ + if (pthread_mutex_lock (&mut) != 0) + { + puts ("child: 1st mutex_lock failed"); + exit (1); + } + + int e = pthread_barrier_wait (&b2); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child: 1st barrier_wait failed"); + exit (1); + } + + if (pthread_cond_wait (&cond, &mut) != 0) + { + puts ("child: cond_wait failed"); + exit (1); + } + + if (pthread_mutex_unlock (&mut) != 0) + { + puts ("child: mutex_unlock failed"); + exit (1); + } + + e = pthread_barrier_wait (&bN1); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child: 2nd barrier_wait failed"); + exit (1); + } + + return NULL; +} + + +static int +do_test (void) +{ + if (pthread_barrier_init (&bN1, NULL, N + 1) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + if (pthread_barrier_init (&b2, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + pthread_attr_t at; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + + int r; + for (r = 0; r < ROUNDS; ++r) + { + printf ("round %d\n", r + 1); + + int i; + pthread_t th[N]; + for (i = 0; i < N; ++i) + { + if (pthread_create (&th[i], &at, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + int e = pthread_barrier_wait (&b2); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("parent: 1st barrier_wait failed"); + exit (1); + } + } + + if (pthread_mutex_lock (&mut) != 0) + { + puts ("parent: mutex_lock failed"); + exit (1); + } + if (pthread_mutex_unlock (&mut) != 0) + { + puts ("parent: mutex_unlock failed"); + exit (1); + } + + /* N single signal calls. Without locking. This tests that no + signal gets lost. */ + for (i = 0; i < N; ++i) + if (pthread_cond_signal (&cond) != 0) + { + puts ("cond_signal failed"); + exit (1); + } + + int e = pthread_barrier_wait (&bN1); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("parent: 2nd barrier_wait failed"); + exit (1); + } + + for (i = 0; i < N; ++i) + if (pthread_join (th[i], NULL) != 0) + { + puts ("join failed"); + exit (1); + } + } + + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond11.c b/test/nptl/tst-cond11.c new file mode 100644 index 000000000..4aaf38002 --- /dev/null +++ b/test/nptl/tst-cond11.c @@ -0,0 +1,190 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <time.h> +#include <unistd.h> + + +#if defined _POSIX_CLOCK_SELECTION && _POSIX_CLOCK_SELECTION >= 0 +static int +run_test (clockid_t cl) +{ + pthread_condattr_t condattr; + pthread_cond_t cond; + pthread_mutexattr_t mutattr; + pthread_mutex_t mut; + + printf ("clock = %d\n", (int) cl); + + if (pthread_condattr_init (&condattr) != 0) + { + puts ("condattr_init failed"); + return 1; + } + + if (pthread_condattr_setclock (&condattr, cl) != 0) + { + puts ("condattr_setclock failed"); + return 1; + } + + clockid_t cl2; + if (pthread_condattr_getclock (&condattr, &cl2) != 0) + { + puts ("condattr_getclock failed"); + return 1; + } + if (cl != cl2) + { + printf ("condattr_getclock returned wrong value: %d, expected %d\n", + (int) cl2, (int) cl); + return 1; + } + + if (pthread_cond_init (&cond, &condattr) != 0) + { + puts ("cond_init failed"); + return 1; + } + + if (pthread_condattr_destroy (&condattr) != 0) + { + puts ("condattr_destroy failed"); + return 1; + } + + if (pthread_mutexattr_init (&mutattr) != 0) + { + puts ("mutexattr_init failed"); + return 1; + } + + if (pthread_mutexattr_settype (&mutattr, PTHREAD_MUTEX_ERRORCHECK) != 0) + { + puts ("mutexattr_settype failed"); + return 1; + } + + if (pthread_mutex_init (&mut, &mutattr) != 0) + { + puts ("mutex_init failed"); + return 1; + } + + if (pthread_mutexattr_destroy (&mutattr) != 0) + { + puts ("mutexattr_destroy failed"); + return 1; + } + + if (pthread_mutex_lock (&mut) != 0) + { + puts ("mutex_lock failed"); + return 1; + } + + if (pthread_mutex_lock (&mut) != EDEADLK) + { + puts ("2nd mutex_lock did not return EDEADLK"); + return 1; + } + + struct timespec ts; + if (clock_gettime (cl, &ts) != 0) + { + puts ("clock_gettime failed"); + return 1; + } + + /* Wait one second. */ + ++ts.tv_sec; + + int e = pthread_cond_timedwait (&cond, &mut, &ts); + if (e == 0) + { + puts ("cond_timedwait succeeded"); + return 1; + } + else if (e != ETIMEDOUT) + { + puts ("cond_timedwait did not return ETIMEDOUT"); + return 1; + } + + if (pthread_mutex_unlock (&mut) != 0) + { + puts ("mutex_unlock failed"); + return 1; + } + + if (pthread_mutex_destroy (&mut) != 0) + { + puts ("mutex_destroy failed"); + return 1; + } + + if (pthread_cond_destroy (&cond) != 0) + { + puts ("cond_destroy failed"); + return 1; + } + + return 0; +} +#endif + + +static int +do_test (void) +{ +#if !defined _POSIX_CLOCK_SELECTION || _POSIX_CLOCK_SELECTION == -1 + + puts ("_POSIX_CLOCK_SELECTION not supported, test skipped"); + return 0; + +#else + + int res = run_test (CLOCK_REALTIME); + +# if defined _POSIX_MONOTONIC_CLOCK && _POSIX_MONOTONIC_CLOCK >= 0 +# if _POSIX_MONOTONIC_CLOCK == 0 + int e = sysconf (_SC_MONOTONIC_CLOCK); + if (e < 0) + puts ("CLOCK_MONOTONIC not supported"); + else if (e == 0) + { + puts ("sysconf (_SC_MONOTONIC_CLOCK) must not return 0"); + res = 1; + } + else +# endif + res |= run_test (CLOCK_MONOTONIC); +# else + puts ("_POSIX_MONOTONIC_CLOCK not defined"); +# endif + + return res; +#endif +} + +#define TIMEOUT 3 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond12.c b/test/nptl/tst-cond12.c new file mode 100644 index 000000000..b38d9d5ec --- /dev/null +++ b/test/nptl/tst-cond12.c @@ -0,0 +1,195 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/wait.h> + + +static char fname[] = "/tmp/tst-cond12-XXXXXX"; +static int fd; + + +static void prepare (void); +#define PREPARE(argc, argv) prepare () + +static int do_test (void); +#define TEST_FUNCTION do_test () + +#include "../test-skeleton.c" + + +static void +prepare (void) +{ + fd = mkstemp (fname); + if (fd == -1) + { + printf ("mkstemp failed: %m\n"); + exit (1); + } + add_temp_file (fname); + if (ftruncate (fd, 1000) < 0) + { + printf ("ftruncate failed: %m\n"); + exit (1); + } +} + + +static int +do_test (void) +{ + struct + { + pthread_mutex_t m; + pthread_cond_t c; + int var; + } *p = mmap (NULL, sizeof (*p), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); + if (p == MAP_FAILED) + { + printf ("initial mmap failed: %m\n"); + return 1; + } + + pthread_mutexattr_t ma; + if (pthread_mutexattr_init (&ma) != 0) + { + puts ("mutexattr_init failed"); + return 1; + } + if (pthread_mutexattr_setpshared (&ma, 1) != 0) + { + puts ("mutexattr_setpshared failed"); + return 1; + } + if (pthread_mutex_init (&p->m, &ma) != 0) + { + puts ("mutex_init failed"); + return 1; + } + if (pthread_mutexattr_destroy (&ma) != 0) + { + puts ("mutexattr_destroy failed"); + return 1; + } + + pthread_condattr_t ca; + if (pthread_condattr_init (&ca) != 0) + { + puts ("condattr_init failed"); + return 1; + } + if (pthread_condattr_setpshared (&ca, 1) != 0) + { + puts ("condattr_setpshared failed"); + return 1; + } + if (pthread_cond_init (&p->c, &ca) != 0) + { + puts ("mutex_init failed"); + return 1; + } + if (pthread_condattr_destroy (&ca) != 0) + { + puts ("condattr_destroy failed"); + return 1; + } + + if (pthread_mutex_lock (&p->m) != 0) + { + puts ("initial mutex_lock failed"); + return 1; + } + + p->var = 42; + + pid_t pid = fork (); + if (pid == -1) + { + printf ("fork failed: %m\n"); + return 1; + } + + if (pid == 0) + { + void *oldp = p; + p = mmap (NULL, sizeof (*p), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); + + if (p == oldp) + { + puts ("child: mapped to same address"); + kill (getppid (), SIGKILL); + exit (1); + } + + munmap (oldp, sizeof (*p)); + + if (pthread_mutex_lock (&p->m) != 0) + { + puts ("child: mutex_lock failed"); + kill (getppid (), SIGKILL); + exit (1); + } + + p->var = 0; + +#ifndef USE_COND_SIGNAL + if (pthread_cond_broadcast (&p->c) != 0) + { + puts ("child: cond_broadcast failed"); + kill (getppid (), SIGKILL); + exit (1); + } +#else + if (pthread_cond_signal (&p->c) != 0) + { + puts ("child: cond_signal failed"); + kill (getppid (), SIGKILL); + exit (1); + } +#endif + + if (pthread_mutex_unlock (&p->m) != 0) + { + puts ("child: mutex_unlock failed"); + kill (getppid (), SIGKILL); + exit (1); + } + + exit (0); + } + + do + pthread_cond_wait (&p->c, &p->m); + while (p->var != 0); + + if (TEMP_FAILURE_RETRY (waitpid (pid, NULL, 0)) != pid) + { + printf ("waitpid failed: %m\n"); + kill (pid, SIGKILL); + return 1; + } + + return 0; +} diff --git a/test/nptl/tst-cond13.c b/test/nptl/tst-cond13.c new file mode 100644 index 000000000..29d79b533 --- /dev/null +++ b/test/nptl/tst-cond13.c @@ -0,0 +1,2 @@ +#define USE_COND_SIGNAL 1 +#include "tst-cond12.c" diff --git a/test/nptl/tst-cond14.c b/test/nptl/tst-cond14.c new file mode 100644 index 000000000..837840582 --- /dev/null +++ b/test/nptl/tst-cond14.c @@ -0,0 +1,117 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + + +static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t mut = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +static pthread_mutex_t mut2 = PTHREAD_MUTEX_INITIALIZER; + +static void * +tf (void *p) +{ + if (pthread_mutex_lock (&mut) != 0) + { + printf ("%s: 1st mutex_lock failed\n", __func__); + exit (1); + } + if (pthread_mutex_lock (&mut) != 0) + { + printf ("%s: 2nd mutex_lock failed\n", __func__); + exit (1); + } + if (pthread_mutex_lock (&mut) != 0) + { + printf ("%s: 3rd mutex_lock failed\n", __func__); + exit (1); + } + + if (pthread_mutex_unlock (&mut2) != 0) + { + printf ("%s: mutex_unlock failed\n", __func__); + exit (1); + } + + if (pthread_cond_wait (&cond, &mut) != 0) + { + printf ("%s: cond_wait failed\n", __func__); + exit (1); + } + + puts ("child: done"); + + return NULL; +} + + +static int +do_test (void) +{ + if (pthread_mutex_lock (&mut2) != 0) + { + puts ("1st mutex_lock failed"); + return 1; + } + + puts ("parent: create child"); + + pthread_t th; + int err = pthread_create (&th, NULL, tf, NULL); + if (err != 0) + { + printf ("parent: cannot create thread: %s\n", strerror (err)); + return 1; + } + + /* We have to synchronize with the child. */ + if (pthread_mutex_lock (&mut2) != 0) + { + puts ("2nd mutex_lock failed"); + return 1; + } + + /* Give the child to reach to pthread_cond_wait. */ + sleep (1); + + if (pthread_cond_signal (&cond) != 0) + { + puts ("cond_signal failed"); + return 1; + } + + err = pthread_join (th, NULL); + if (err != 0) + { + printf ("parent: failed to join: %s\n", strerror (err)); + return 1; + } + + puts ("done"); + + return 0; +} + + +#define TEST_FUNCTION do_test () +#define TIMEOUT 3 +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond15.c b/test/nptl/tst-cond15.c new file mode 100644 index 000000000..0e8448c11 --- /dev/null +++ b/test/nptl/tst-cond15.c @@ -0,0 +1,159 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/time.h> + + +static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t mut = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +static pthread_mutex_t mut2 = PTHREAD_MUTEX_INITIALIZER; + +static void * +tf (void *p) +{ + if (pthread_mutex_lock (&mut) != 0) + { + printf ("%s: 1st mutex_lock failed\n", __func__); + exit (1); + } + if (pthread_mutex_lock (&mut) != 0) + { + printf ("%s: 2nd mutex_lock failed\n", __func__); + exit (1); + } + if (pthread_mutex_lock (&mut) != 0) + { + printf ("%s: 3rd mutex_lock failed\n", __func__); + exit (1); + } + + if (pthread_mutex_unlock (&mut2) != 0) + { + printf ("%s: mutex_unlock failed\n", __func__); + exit (1); + } + + struct timeval tv; + gettimeofday (&tv, NULL); + struct timespec ts; + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_sec += p == NULL ? 100 : 1; + + int err = pthread_cond_timedwait (&cond, &mut, &ts); + if ((err != 0 && p == NULL) || (err != ETIMEDOUT && p != NULL)) + { + printf ("%s: cond_wait failed\n", __func__); + exit (1); + } + + if (pthread_mutex_unlock (&mut) != 0) + { + printf ("%s: 1st mutex_unlock failed\n", __func__); + exit (1); + } + if (pthread_mutex_unlock (&mut) != 0) + { + printf ("%s: 2nd mutex_unlock failed\n", __func__); + exit (1); + } + if (pthread_mutex_unlock (&mut) != 0) + { + printf ("%s: 3rd mutex_unlock failed\n", __func__); + exit (1); + } + + puts ("child: done"); + + return NULL; +} + + +static int +do_test (void) +{ + if (pthread_mutex_lock (&mut2) != 0) + { + puts ("1st mutex_lock failed"); + return 1; + } + + puts ("parent: create 1st child"); + + pthread_t th; + int err = pthread_create (&th, NULL, tf, NULL); + if (err != 0) + { + printf ("parent: cannot 1st create thread: %s\n", strerror (err)); + return 1; + } + + /* We have to synchronize with the child. */ + if (pthread_mutex_lock (&mut2) != 0) + { + puts ("2nd mutex_lock failed"); + return 1; + } + + /* Give the child to reach to pthread_cond_wait. */ + sleep (1); + + if (pthread_cond_signal (&cond) != 0) + { + puts ("cond_signal failed"); + return 1; + } + + err = pthread_join (th, NULL); + if (err != 0) + { + printf ("parent: failed to join: %s\n", strerror (err)); + return 1; + } + + + puts ("parent: create 2nd child"); + + err = pthread_create (&th, NULL, tf, (void *) 1l); + if (err != 0) + { + printf ("parent: cannot 2nd create thread: %s\n", strerror (err)); + return 1; + } + + err = pthread_join (th, NULL); + if (err != 0) + { + printf ("parent: failed to join: %s\n", strerror (err)); + return 1; + } + + puts ("done"); + + return 0; +} + + +#define TEST_FUNCTION do_test () +#define TIMEOUT 6 +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond16.c b/test/nptl/tst-cond16.c new file mode 100644 index 000000000..44b98634b --- /dev/null +++ b/test/nptl/tst-cond16.c @@ -0,0 +1,104 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +pthread_cond_t cv = PTHREAD_COND_INITIALIZER; +pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; +bool n, exiting; +FILE *f; +int count; + +void * +tf (void *dummy) +{ + bool loop = true; + + while (loop) + { + pthread_mutex_lock (&lock); + while (n && !exiting) + pthread_cond_wait (&cv, &lock); + n = true; + pthread_mutex_unlock (&lock); + + fputs (".", f); + + pthread_mutex_lock (&lock); + n = false; + if (exiting) + loop = false; +#ifdef UNLOCK_AFTER_BROADCAST + pthread_cond_broadcast (&cv); + pthread_mutex_unlock (&lock); +#else + pthread_mutex_unlock (&lock); + pthread_cond_broadcast (&cv); +#endif + } + + return NULL; +} + +int +do_test (void) +{ + f = fopen ("/dev/null", "w"); + if (f == NULL) + { + printf ("couldn't open /dev/null, %m\n"); + return 1; + } + + count = sysconf (_SC_NPROCESSORS_ONLN); + if (count <= 0) + count = 1; + count *= 4; + + pthread_t th[count]; + int i, ret; + for (i = 0; i < count; ++i) + if ((ret = pthread_create (&th[i], NULL, tf, NULL)) != 0) + { + errno = ret; + printf ("pthread_create %d failed: %m\n", i); + return 1; + } + + struct timespec ts = { .tv_sec = 20, .tv_nsec = 0 }; + while (nanosleep (&ts, &ts) != 0); + + pthread_mutex_lock (&lock); + exiting = true; + pthread_mutex_unlock (&lock); + + for (i = 0; i < count; ++i) + pthread_join (th[i], NULL); + + fclose (f); + return 0; +} + +#define TEST_FUNCTION do_test () +#define TIMEOUT 40 +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond17.c b/test/nptl/tst-cond17.c new file mode 100644 index 000000000..0586fa59a --- /dev/null +++ b/test/nptl/tst-cond17.c @@ -0,0 +1,2 @@ +#define UNLOCK_AFTER_BROADCAST 1 +#include "tst-cond16.c" diff --git a/test/nptl/tst-cond18.c b/test/nptl/tst-cond18.c new file mode 100644 index 000000000..a1bb947ac --- /dev/null +++ b/test/nptl/tst-cond18.c @@ -0,0 +1,116 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <pthread.h> +#include <stdbool.h> +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> + +pthread_cond_t cv = PTHREAD_COND_INITIALIZER; +pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; +bool exiting; +int fd, count, spins, nn; + +void * +tf (void *id) +{ + pthread_mutex_lock (&lock); + + if ((long) id == 0) + { + while (!exiting) + { + if ((spins++ % 1000) == 0) + write (fd, ".", 1); + pthread_mutex_unlock (&lock); + + pthread_mutex_lock (&lock); + int njobs = rand () % (count + 1); + nn = njobs; + if ((rand () % 30) == 0) + pthread_cond_broadcast (&cv); + else + while (njobs--) + pthread_cond_signal (&cv); + } + + pthread_cond_broadcast (&cv); + } + else + { + while (!exiting) + { + while (!nn && !exiting) + pthread_cond_wait (&cv, &lock); + --nn; + pthread_mutex_unlock (&lock); + + pthread_mutex_lock (&lock); + } + } + + pthread_mutex_unlock (&lock); + return NULL; +} + +int +do_test (void) +{ + fd = open ("/dev/null", O_WRONLY); + if (fd < 0) + { + printf ("couldn't open /dev/null, %m\n"); + return 1; + } + + count = sysconf (_SC_NPROCESSORS_ONLN); + if (count <= 0) + count = 1; + count *= 8; + + pthread_t th[count + 1]; + int i, ret; + + for (i = 0; i <= count; ++i) + if ((ret = pthread_create (&th[i], NULL, tf, (void *) (long) i)) != 0) + { + errno = ret; + printf ("pthread_create %d failed: %m\n", i); + return 1; + } + + struct timespec ts = { .tv_sec = 20, .tv_nsec = 0 }; + while (nanosleep (&ts, &ts) != 0); + + pthread_mutex_lock (&lock); + exiting = true; + pthread_mutex_unlock (&lock); + + for (i = 0; i < count; ++i) + pthread_join (th[i], NULL); + + close (fd); + return 0; +} + +#define TEST_FUNCTION do_test () +#define TIMEOUT 40 +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond19.c b/test/nptl/tst-cond19.c new file mode 100644 index 000000000..200e0eaf0 --- /dev/null +++ b/test/nptl/tst-cond19.c @@ -0,0 +1,75 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> + + +static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; + + +static int +do_test (void) +{ + int result = 0; + struct timespec ts; + + if (clock_gettime (CLOCK_REALTIME, &ts) != 0) + { + puts ("clock_gettime failed"); + return 1; + } + + ts.tv_nsec = -1; + + int e = pthread_cond_timedwait (&cond, &mut, &ts); + if (e == 0) + { + puts ("first cond_timedwait did not fail"); + result = 1; + } + else if (e != EINVAL) + { + puts ("first cond_timedwait did not return EINVAL"); + result = 1; + } + + ts.tv_nsec = 2000000000; + + e = pthread_cond_timedwait (&cond, &mut, &ts); + if (e == 0) + { + puts ("second cond_timedwait did not fail"); + result = 1; + } + else if (e != EINVAL) + { + puts ("second cond_timedwait did not return EINVAL"); + result = 1; + } + + return result; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond2.c b/test/nptl/tst-cond2.c new file mode 100644 index 000000000..1da074cdd --- /dev/null +++ b/test/nptl/tst-cond2.c @@ -0,0 +1,162 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <error.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + + +static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; +static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; + +static pthread_barrier_t bar; + + +static void * +tf (void *a) +{ + int i = (long int) a; + int err; + + printf ("child %d: lock\n", i); + + err = pthread_mutex_lock (&mut); + if (err != 0) + error (EXIT_FAILURE, err, "locking in child failed"); + + printf ("child %d: sync\n", i); + + int e = pthread_barrier_wait (&bar); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child: barrier_wait failed"); + exit (1); + } + + printf ("child %d: wait\n", i); + + err = pthread_cond_wait (&cond, &mut); + if (err != 0) + error (EXIT_FAILURE, err, "child %d: failed to wait", i); + + printf ("child %d: woken up\n", i); + + err = pthread_mutex_unlock (&mut); + if (err != 0) + error (EXIT_FAILURE, err, "child %d: unlock[2] failed", i); + + printf ("child %d: done\n", i); + + return NULL; +} + + +#define N 10 + + +static int +do_test (void) +{ + pthread_t th[N]; + int i; + int err; + + printf ("&cond = %p\n&mut = %p\n", &cond, &mut); + + if (pthread_barrier_init (&bar, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + pthread_attr_t at; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + + for (i = 0; i < N; ++i) + { + printf ("create thread %d\n", i); + + err = pthread_create (&th[i], &at, tf, (void *) (long int) i); + if (err != 0) + error (EXIT_FAILURE, err, "cannot create thread %d", i); + + printf ("wait for child %d\n", i); + + /* Wait for the child to start up and get the mutex for the + conditional variable. */ + int e = pthread_barrier_wait (&bar); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + } + + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + + puts ("get lock outselves"); + + err = pthread_mutex_lock (&mut); + if (err != 0) + error (EXIT_FAILURE, err, "mut locking failed"); + + puts ("broadcast"); + + /* Wake up all threads. */ + err = pthread_cond_broadcast (&cond); + if (err != 0) + error (EXIT_FAILURE, err, "parent: broadcast failed"); + + err = pthread_mutex_unlock (&mut); + if (err != 0) + error (EXIT_FAILURE, err, "mut unlocking failed"); + + /* Join all threads. */ + for (i = 0; i < N; ++i) + { + printf ("join thread %d\n", i); + + err = pthread_join (th[i], NULL); + if (err != 0) + error (EXIT_FAILURE, err, "join of child %d failed", i); + } + + puts ("done"); + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond20.c b/test/nptl/tst-cond20.c new file mode 100644 index 000000000..c1341a07b --- /dev/null +++ b/test/nptl/tst-cond20.c @@ -0,0 +1,169 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#define N 10 +#define ROUNDS 1000 +static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +static pthread_cond_t cond2 = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; +static pthread_barrier_t b; +static int count; + +static void * +tf (void *p) +{ + int i; + for (i = 0; i < ROUNDS; ++i) + { + pthread_mutex_lock (&mut); + + if (++count == N) + pthread_cond_signal (&cond2); + +#ifdef TIMED + struct timeval tv; + gettimeofday (&tv, NULL); + struct timespec ts; + /* Wait three seconds. */ + ts.tv_sec = tv.tv_sec + 3; + ts.tv_nsec = tv.tv_usec * 1000; + pthread_cond_timedwait (&cond, &mut, &ts); +#else + pthread_cond_wait (&cond, &mut); +#endif + + pthread_mutex_unlock (&mut); + + int err = pthread_barrier_wait (&b); + if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child: barrier_wait failed"); + exit (1); + } + + err = pthread_barrier_wait (&b); + if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child: barrier_wait failed"); + exit (1); + } + } + + return NULL; +} + + +static int +do_test (void) +{ + if (pthread_barrier_init (&b, NULL, N + 1) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + pthread_mutex_lock (&mut); + + int i, j, err; + pthread_t th[N]; + for (i = 0; i < N; ++i) + if ((err = pthread_create (&th[i], NULL, tf, NULL)) != 0) + { + printf ("cannot create thread %d: %s\n", i, strerror (err)); + return 1; + } + + for (i = 0; i < ROUNDS; ++i) + { + pthread_cond_wait (&cond2, &mut); + + if (i & 1) + pthread_mutex_unlock (&mut); + + if (i & 2) + pthread_cond_broadcast (&cond); + else if (i & 4) + for (j = 0; j < N; ++j) + pthread_cond_signal (&cond); + else + { + for (j = 0; j < (i / 8) % N; ++j) + pthread_cond_signal (&cond); + pthread_cond_broadcast (&cond); + } + + if ((i & 1) == 0) + pthread_mutex_unlock (&mut); + + err = pthread_cond_destroy (&cond); + if (err) + { + printf ("pthread_cond_destroy failed: %s\n", strerror (err)); + return 1; + } + + /* Now clobber the cond variable which has been successfully + destroyed above. */ + memset (&cond, (char) i, sizeof (cond)); + + err = pthread_barrier_wait (&b); + if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("parent: barrier_wait failed"); + return 1; + } + + pthread_mutex_lock (&mut); + + err = pthread_barrier_wait (&b); + if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("parent: barrier_wait failed"); + return 1; + } + + count = 0; + err = pthread_cond_init (&cond, NULL); + if (err) + { + printf ("pthread_cond_init failed: %s\n", strerror (err)); + return 1; + } + } + + for (i = 0; i < N; ++i) + if ((err = pthread_join (th[i], NULL)) != 0) + { + printf ("failed to join thread %d: %s\n", i, strerror (err)); + return 1; + } + + puts ("done"); + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond21.c b/test/nptl/tst-cond21.c new file mode 100644 index 000000000..89cb771b5 --- /dev/null +++ b/test/nptl/tst-cond21.c @@ -0,0 +1,3 @@ +#include <sys/time.h> +#define TIMED 1 +#include "tst-cond20.c" diff --git a/test/nptl/tst-cond22.c b/test/nptl/tst-cond22.c new file mode 100644 index 000000000..bd978e50c --- /dev/null +++ b/test/nptl/tst-cond22.c @@ -0,0 +1,160 @@ +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + + +static pthread_barrier_t b; +static pthread_cond_t c = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; + + +static void +cl (void *arg) +{ + pthread_mutex_unlock (&m); +} + + +static void * +tf (void *arg) +{ + if (pthread_mutex_lock (&m) != 0) + { + printf ("%s: mutex_lock failed\n", __func__); + exit (1); + } + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("%s: barrier_wait failed\n", __func__); + exit (1); + } + pthread_cleanup_push (cl, NULL); + /* We have to loop here because the cancellation might come after + the cond_wait call left the cancelable area and is then waiting + on the mutex. In this case the beginning of the second cond_wait + call will cause the cancellation to happen. */ + do + if (pthread_cond_wait (&c, &m) != 0) + { + printf ("%s: cond_wait failed\n", __func__); + exit (1); + } + while (arg == NULL); + pthread_cleanup_pop (0); + if (pthread_mutex_unlock (&m) != 0) + { + printf ("%s: mutex_unlock failed\n", __func__); + exit (1); + } + return NULL; +} + + +static int +do_test (void) +{ + int status = 0; + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("1st create failed"); + return 1; + } + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("1st barrier_wait failed"); + return 1; + } + if (pthread_mutex_lock (&m) != 0) + { + puts ("1st mutex_lock failed"); + return 1; + } + if (pthread_cond_signal (&c) != 0) + { + puts ("1st cond_signal failed"); + return 1; + } + if (pthread_cancel (th) != 0) + { + puts ("cancel failed"); + return 1; + } + if (pthread_mutex_unlock (&m) != 0) + { + puts ("1st mutex_unlock failed"); + return 1; + } + void *res; + if (pthread_join (th, &res) != 0) + { + puts ("1st join failed"); + return 1; + } + if (res != PTHREAD_CANCELED) + { + puts ("first thread not canceled"); + status = 1; + } + + printf ("cond = { %d, %x, %lld, %lld, %lld, %p, %u, %u }\n", + c.__data.__lock, c.__data.__futex, c.__data.__total_seq, + c.__data.__wakeup_seq, c.__data.__woken_seq, c.__data.__mutex, + c.__data.__nwaiters, c.__data.__broadcast_seq); + + if (pthread_create (&th, NULL, tf, (void *) 1l) != 0) + { + puts ("2nd create failed"); + return 1; + } + e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("2nd barrier_wait failed"); + return 1; + } + if (pthread_mutex_lock (&m) != 0) + { + puts ("2nd mutex_lock failed"); + return 1; + } + if (pthread_cond_signal (&c) != 0) + { + puts ("2nd cond_signal failed"); + return 1; + } + if (pthread_mutex_unlock (&m) != 0) + { + puts ("2nd mutex_unlock failed"); + return 1; + } + if (pthread_join (th, &res) != 0) + { + puts ("2nd join failed"); + return 1; + } + if (res != NULL) + { + puts ("2nd thread canceled"); + status = 1; + } + + printf ("cond = { %d, %x, %lld, %lld, %lld, %p, %u, %u }\n", + c.__data.__lock, c.__data.__futex, c.__data.__total_seq, + c.__data.__wakeup_seq, c.__data.__woken_seq, c.__data.__mutex, + c.__data.__nwaiters, c.__data.__broadcast_seq); + + return status; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond23.c b/test/nptl/tst-cond23.c new file mode 100644 index 000000000..fb2936f00 --- /dev/null +++ b/test/nptl/tst-cond23.c @@ -0,0 +1,183 @@ +/* Copyright (C) 2008 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@redhat.com>, 2008. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <time.h> +#include <unistd.h> + + +#if defined _POSIX_CLOCK_SELECTION && _POSIX_CLOCK_SELECTION >= 0 +static int +check (pthread_condattr_t *condattr, int pshared, clockid_t cl) +{ + clockid_t cl2; + if (pthread_condattr_getclock (condattr, &cl2) != 0) + { + puts ("condattr_getclock failed"); + return 1; + } + if (cl != cl2) + { + printf ("condattr_getclock returned wrong value: %d, expected %d\n", + (int) cl2, (int) cl); + return 1; + } + + int p; + if (pthread_condattr_getpshared (condattr, &p) != 0) + { + puts ("condattr_getpshared failed"); + return 1; + } + else if (p != pshared) + { + printf ("condattr_getpshared returned wrong value: %d, expected %d\n", + p, pshared); + return 1; + } + + return 0; +} + +static int +run_test (clockid_t cl) +{ + pthread_condattr_t condattr; + + printf ("clock = %d\n", (int) cl); + + if (pthread_condattr_init (&condattr) != 0) + { + puts ("condattr_init failed"); + return 1; + } + + if (check (&condattr, PTHREAD_PROCESS_PRIVATE, CLOCK_REALTIME)) + return 1; + + if (pthread_condattr_setpshared (&condattr, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("1st condattr_setpshared failed"); + return 1; + } + + if (check (&condattr, PTHREAD_PROCESS_SHARED, CLOCK_REALTIME)) + return 1; + + if (pthread_condattr_setclock (&condattr, cl) != 0) + { + puts ("1st condattr_setclock failed"); + return 1; + } + + if (check (&condattr, PTHREAD_PROCESS_SHARED, cl)) + return 1; + + if (pthread_condattr_setpshared (&condattr, PTHREAD_PROCESS_PRIVATE) != 0) + { + puts ("2nd condattr_setpshared failed"); + return 1; + } + + if (check (&condattr, PTHREAD_PROCESS_PRIVATE, cl)) + return 1; + + if (pthread_condattr_setclock (&condattr, CLOCK_REALTIME) != 0) + { + puts ("2nd condattr_setclock failed"); + return 1; + } + + if (check (&condattr, PTHREAD_PROCESS_PRIVATE, CLOCK_REALTIME)) + return 1; + + if (pthread_condattr_setclock (&condattr, cl) != 0) + { + puts ("3rd condattr_setclock failed"); + return 1; + } + + if (check (&condattr, PTHREAD_PROCESS_PRIVATE, cl)) + return 1; + + if (pthread_condattr_setpshared (&condattr, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("3rd condattr_setpshared failed"); + return 1; + } + + if (check (&condattr, PTHREAD_PROCESS_SHARED, cl)) + return 1; + + if (pthread_condattr_setclock (&condattr, CLOCK_REALTIME) != 0) + { + puts ("4th condattr_setclock failed"); + return 1; + } + + if (check (&condattr, PTHREAD_PROCESS_SHARED, CLOCK_REALTIME)) + return 1; + + if (pthread_condattr_destroy (&condattr) != 0) + { + puts ("condattr_destroy failed"); + return 1; + } + + return 0; +} +#endif + + +static int +do_test (void) +{ +#if !defined _POSIX_CLOCK_SELECTION || _POSIX_CLOCK_SELECTION == -1 + + puts ("_POSIX_CLOCK_SELECTION not supported, test skipped"); + return 0; + +#else + + int res = run_test (CLOCK_REALTIME); + +# if defined _POSIX_MONOTONIC_CLOCK && _POSIX_MONOTONIC_CLOCK >= 0 +# if _POSIX_MONOTONIC_CLOCK == 0 + int e = sysconf (_SC_MONOTONIC_CLOCK); + if (e < 0) + puts ("CLOCK_MONOTONIC not supported"); + else if (e == 0) + { + puts ("sysconf (_SC_MONOTONIC_CLOCK) must not return 0"); + res = 1; + } + else +# endif + res |= run_test (CLOCK_MONOTONIC); +# else + puts ("_POSIX_MONOTONIC_CLOCK not defined"); +# endif + + return res; +#endif +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond3.c b/test/nptl/tst-cond3.c new file mode 100644 index 000000000..b18183121 --- /dev/null +++ b/test/nptl/tst-cond3.c @@ -0,0 +1,112 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + + +/* Note that this test requires more than the standard. It is + required that there are no spurious wakeups if only more readers + are added. This is a reasonable demand. */ + + +static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; + + +#define N 10 + + +static void * +tf (void *arg) +{ + int i = (long int) arg; + int err; + + /* Get the mutex. */ + err = pthread_mutex_lock (&mut); + if (err != 0) + { + printf ("child %d mutex_lock failed: %s\n", i, strerror (err)); + exit (1); + } + + /* This call should never return. */ + pthread_cond_wait (&cond, &mut); + + /* We should never get here. */ + exit (1); + + return NULL; +} + + +static int +do_test (void) +{ + int err; + int i; + + for (i = 0; i < N; ++i) + { + pthread_t th; + + if (i != 0) + { + /* Release the mutex. */ + err = pthread_mutex_unlock (&mut); + if (err != 0) + { + printf ("mutex_unlock %d failed: %s\n", i, strerror (err)); + return 1; + } + } + + err = pthread_create (&th, NULL, tf, (void *) (long int) i); + if (err != 0) + { + printf ("create %d failed: %s\n", i, strerror (err)); + return 1; + } + + /* Get the mutex. */ + err = pthread_mutex_lock (&mut); + if (err != 0) + { + printf ("mutex_lock %d failed: %s\n", i, strerror (err)); + return 1; + } + } + + /* Set an alarm for 1 second. The wrapper will expect this. */ + alarm (1); + + /* This call should never return. */ + pthread_cond_wait (&cond, &mut); + + puts ("cond_wait returned"); + return 1; +} + + +#define EXPECTED_SIGNAL SIGALRM +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond4.c b/test/nptl/tst-cond4.c new file mode 100644 index 000000000..47a7380de --- /dev/null +++ b/test/nptl/tst-cond4.c @@ -0,0 +1,263 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/wait.h> +#include <stdint.h> + + +int *condition; + +static int +do_test (void) +{ + size_t ps = sysconf (_SC_PAGESIZE); + char tmpfname[] = "/tmp/tst-cond4.XXXXXX"; + char data[ps]; + void *mem; + int fd; + pthread_mutexattr_t ma; + pthread_mutex_t *mut1; + pthread_mutex_t *mut2; + pthread_condattr_t ca; + pthread_cond_t *cond; + pid_t pid; + int result = 0; + int p; + + fd = mkstemp (tmpfname); + if (fd == -1) + { + printf ("cannot open temporary file: %m\n"); + return 1; + } + + /* Make sure it is always removed. */ + unlink (tmpfname); + + /* Create one page of data. */ + memset (data, '\0', ps); + + /* Write the data to the file. */ + if (write (fd, data, ps) != (ssize_t) ps) + { + puts ("short write"); + return 1; + } + + mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (mem == MAP_FAILED) + { + printf ("mmap failed: %m\n"); + return 1; + } + + mut1 = (pthread_mutex_t *) (((uintptr_t) mem + + __alignof (pthread_mutex_t)) + & ~(__alignof (pthread_mutex_t) - 1)); + mut2 = mut1 + 1; + + cond = (pthread_cond_t *) (((uintptr_t) (mut2 + 1) + + __alignof (pthread_cond_t)) + & ~(__alignof (pthread_cond_t) - 1)); + + condition = (int *) (((uintptr_t) (cond + 1) + __alignof (int)) + & ~(__alignof (int) - 1)); + + if (pthread_mutexattr_init (&ma) != 0) + { + puts ("mutexattr_init failed"); + return 1; + } + + if (pthread_mutexattr_getpshared (&ma, &p) != 0) + { + puts ("1st mutexattr_getpshared failed"); + return 1; + } + + if (p != PTHREAD_PROCESS_PRIVATE) + { + puts ("default pshared value wrong"); + return 1; + } + + if (pthread_mutexattr_setpshared (&ma, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("mutexattr_setpshared failed"); + return 1; + } + + if (pthread_mutexattr_getpshared (&ma, &p) != 0) + { + puts ("2nd mutexattr_getpshared failed"); + return 1; + } + + if (p != PTHREAD_PROCESS_SHARED) + { + puts ("pshared value after setpshared call wrong"); + return 1; + } + + if (pthread_mutex_init (mut1, &ma) != 0) + { + puts ("1st mutex_init failed"); + return 1; + } + + if (pthread_mutex_init (mut2, &ma) != 0) + { + puts ("2nd mutex_init failed"); + return 1; + } + + if (pthread_condattr_init (&ca) != 0) + { + puts ("condattr_init failed"); + return 1; + } + + if (pthread_condattr_getpshared (&ca, &p) != 0) + { + puts ("1st condattr_getpshared failed"); + return 1; + } + + if (p != PTHREAD_PROCESS_PRIVATE) + { + puts ("default value for pshared in condattr wrong"); + return 1; + } + + if (pthread_condattr_setpshared (&ca, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("condattr_setpshared failed"); + return 1; + } + + if (pthread_condattr_getpshared (&ca, &p) != 0) + { + puts ("2nd condattr_getpshared failed"); + return 1; + } + + if (p != PTHREAD_PROCESS_SHARED) + { + puts ("pshared condattr still not set"); + return 1; + } + + if (pthread_cond_init (cond, &ca) != 0) + { + puts ("cond_init failed"); + return 1; + } + + if (pthread_mutex_lock (mut1) != 0) + { + puts ("parent: 1st mutex_lock failed"); + return 1; + } + + puts ("going to fork now"); + pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + return 1; + } + else if (pid == 0) + { + if (pthread_mutex_lock (mut2) != 0) + { + puts ("child: mutex_lock failed"); + return 1; + } + + if (pthread_mutex_unlock (mut1) != 0) + { + puts ("child: 1st mutex_unlock failed"); + return 1; + } + + do + if (pthread_cond_wait (cond, mut2) != 0) + { + puts ("child: cond_wait failed"); + return 1; + } + while (*condition == 0); + + if (pthread_mutex_unlock (mut2) != 0) + { + puts ("child: 2nd mutex_unlock failed"); + return 1; + } + + puts ("child done"); + } + else + { + int status; + + if (pthread_mutex_lock (mut1) != 0) + { + puts ("parent: 2nd mutex_lock failed"); + return 1; + } + + if (pthread_mutex_lock (mut2) != 0) + { + puts ("parent: 3rd mutex_lock failed"); + return 1; + } + + if (pthread_cond_signal (cond) != 0) + { + puts ("parent: cond_signal failed"); + return 1; + } + + *condition = 1; + + if (pthread_mutex_unlock (mut2) != 0) + { + puts ("parent: mutex_unlock failed"); + return 1; + } + + puts ("waiting for child"); + + waitpid (pid, &status, 0); + result |= status; + + puts ("parent done"); + } + + return result; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond5.c b/test/nptl/tst-cond5.c new file mode 100644 index 000000000..7da5b4110 --- /dev/null +++ b/test/nptl/tst-cond5.c @@ -0,0 +1,105 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <sys/time.h> + + +static pthread_mutex_t mut; +static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; + + +static int +do_test (void) +{ + pthread_mutexattr_t ma; + int err; + struct timespec ts; + struct timeval tv; + + if (pthread_mutexattr_init (&ma) != 0) + { + puts ("mutexattr_init failed"); + exit (1); + } + + if (pthread_mutexattr_settype (&ma, PTHREAD_MUTEX_ERRORCHECK) != 0) + { + puts ("mutexattr_settype failed"); + exit (1); + } + + if (pthread_mutex_init (&mut, &ma) != 0) + { + puts ("mutex_init failed"); + exit (1); + } + + /* Get the mutex. */ + if (pthread_mutex_lock (&mut) != 0) + { + puts ("mutex_lock failed"); + exit (1); + } + + /* Waiting for the condition will fail. But we want the timeout here. */ + if (gettimeofday (&tv, NULL) != 0) + { + puts ("gettimeofday failed"); + exit (1); + } + + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_nsec += 500000000; + if (ts.tv_nsec >= 1000000000) + { + ts.tv_nsec -= 1000000000; + ++ts.tv_sec; + } + err = pthread_cond_timedwait (&cond, &mut, &ts); + if (err == 0) + { + /* This could in theory happen but here without any signal and + additional waiter it should not. */ + puts ("cond_timedwait succeeded"); + exit (1); + } + else if (err != ETIMEDOUT) + { + printf ("cond_timedwait returned with %s\n", strerror (err)); + exit (1); + } + + err = pthread_mutex_unlock (&mut); + if (err != 0) + { + printf ("mutex_unlock failed: %s\n", strerror (err)); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond6.c b/test/nptl/tst-cond6.c new file mode 100644 index 000000000..f28d4c157 --- /dev/null +++ b/test/nptl/tst-cond6.c @@ -0,0 +1,233 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/time.h> +#include <sys/wait.h> +#include <stdint.h> + + +int *condition; + +static int +do_test (void) +{ + size_t ps = sysconf (_SC_PAGESIZE); + char tmpfname[] = "/tmp/tst-cond6.XXXXXX"; + char data[ps]; + void *mem; + int fd; + pthread_mutexattr_t ma; + pthread_mutex_t *mut1; + pthread_mutex_t *mut2; + pthread_condattr_t ca; + pthread_cond_t *cond; + pid_t pid; + int result = 0; + + fd = mkstemp (tmpfname); + if (fd == -1) + { + printf ("cannot open temporary file: %m\n"); + exit (1); + } + + /* Make sure it is always removed. */ + unlink (tmpfname); + + /* Create one page of data. */ + memset (data, '\0', ps); + + /* Write the data to the file. */ + if (write (fd, data, ps) != (ssize_t) ps) + { + puts ("short write"); + exit (1); + } + + mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (mem == MAP_FAILED) + { + printf ("mmap failed: %m\n"); + exit (1); + } + + mut1 = (pthread_mutex_t *) (((uintptr_t) mem + + __alignof (pthread_mutex_t)) + & ~(__alignof (pthread_mutex_t) - 1)); + mut2 = mut1 + 1; + + cond = (pthread_cond_t *) (((uintptr_t) (mut2 + 1) + + __alignof (pthread_cond_t)) + & ~(__alignof (pthread_cond_t) - 1)); + + condition = (int *) (((uintptr_t) (cond + 1) + __alignof (int)) + & ~(__alignof (int) - 1)); + + if (pthread_mutexattr_init (&ma) != 0) + { + puts ("mutexattr_init failed"); + exit (1); + } + + if (pthread_mutexattr_setpshared (&ma, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("mutexattr_setpshared failed"); + exit (1); + } + + if (pthread_mutex_init (mut1, &ma) != 0) + { + puts ("1st mutex_init failed"); + exit (1); + } + + if (pthread_mutex_init (mut2, &ma) != 0) + { + puts ("2nd mutex_init failed"); + exit (1); + } + + if (pthread_condattr_init (&ca) != 0) + { + puts ("condattr_init failed"); + exit (1); + } + + if (pthread_condattr_setpshared (&ca, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("condattr_setpshared failed"); + exit (1); + } + + if (pthread_cond_init (cond, &ca) != 0) + { + puts ("cond_init failed"); + exit (1); + } + + if (pthread_mutex_lock (mut1) != 0) + { + puts ("parent: 1st mutex_lock failed"); + exit (1); + } + + puts ("going to fork now"); + pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + exit (1); + } + else if (pid == 0) + { + struct timespec ts; + struct timeval tv; + + if (pthread_mutex_lock (mut2) != 0) + { + puts ("child: mutex_lock failed"); + exit (1); + } + + if (pthread_mutex_unlock (mut1) != 0) + { + puts ("child: 1st mutex_unlock failed"); + exit (1); + } + + if (gettimeofday (&tv, NULL) != 0) + { + puts ("gettimeofday failed"); + exit (1); + } + + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_nsec += 500000000; + if (ts.tv_nsec >= 1000000000) + { + ts.tv_nsec -= 1000000000; + ++ts.tv_sec; + } + + do + if (pthread_cond_timedwait (cond, mut2, &ts) != 0) + { + puts ("child: cond_wait failed"); + exit (1); + } + while (*condition == 0); + + if (pthread_mutex_unlock (mut2) != 0) + { + puts ("child: 2nd mutex_unlock failed"); + exit (1); + } + + puts ("child done"); + } + else + { + int status; + + if (pthread_mutex_lock (mut1) != 0) + { + puts ("parent: 2nd mutex_lock failed"); + exit (1); + } + + if (pthread_mutex_lock (mut2) != 0) + { + puts ("parent: 3rd mutex_lock failed"); + exit (1); + } + + if (pthread_cond_signal (cond) != 0) + { + puts ("parent: cond_signal failed"); + exit (1); + } + + *condition = 1; + + if (pthread_mutex_unlock (mut2) != 0) + { + puts ("parent: mutex_unlock failed"); + exit (1); + } + + puts ("waiting for child"); + + waitpid (pid, &status, 0); + result |= status; + + puts ("parent done"); + } + + return result; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond7.c b/test/nptl/tst-cond7.c new file mode 100644 index 000000000..c48fda13c --- /dev/null +++ b/test/nptl/tst-cond7.c @@ -0,0 +1,167 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <sys/time.h> + + +typedef struct + { + pthread_cond_t cond; + pthread_mutex_t lock; + pthread_t h; + } T; + + +static volatile bool done; + + +static void * +tf (void *arg) +{ + puts ("child created"); + + if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) != 0 + || pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, NULL) != 0) + { + puts ("cannot set cancellation options"); + exit (1); + } + + T *t = (T *) arg; + + if (pthread_mutex_lock (&t->lock) != 0) + { + puts ("child: lock failed"); + exit (1); + } + + done = true; + + if (pthread_cond_signal (&t->cond) != 0) + { + puts ("child: cond_signal failed"); + exit (1); + } + + if (pthread_cond_wait (&t->cond, &t->lock) != 0) + { + puts ("child: cond_wait failed"); + exit (1); + } + + if (pthread_mutex_unlock (&t->lock) != 0) + { + puts ("child: unlock failed"); + exit (1); + } + + return NULL; +} + + +static int +do_test (void) +{ + int i; +#define N 100 + T *t[N]; + for (i = 0; i < N; ++i) + { + printf ("round %d\n", i); + + t[i] = (T *) malloc (sizeof (T)); + if (t[i] == NULL) + { + puts ("out of memory"); + exit (1); + } + + if (pthread_mutex_init (&t[i]->lock, NULL) != 0 + || pthread_cond_init (&t[i]->cond, NULL) != 0) + { + puts ("an _init function failed"); + exit (1); + } + + if (pthread_mutex_lock (&t[i]->lock) != 0) + { + puts ("initial mutex_lock failed"); + exit (1); + } + + done = false; + + if (pthread_create (&t[i]->h, NULL, tf, t[i]) != 0) + { + puts ("pthread_create failed"); + exit (1); + } + + do + if (pthread_cond_wait (&t[i]->cond, &t[i]->lock) != 0) + { + puts ("cond_wait failed"); + exit (1); + } + while (! done); + + /* Release the lock since the cancel handler will get it. */ + if (pthread_mutex_unlock (&t[i]->lock) != 0) + { + puts ("mutex_unlock failed"); + exit (1); + } + + if (pthread_cancel (t[i]->h) != 0) + { + puts ("cancel failed"); + exit (1); + } + + puts ("parent: joining now"); + + void *result; + if (pthread_join (t[i]->h, &result) != 0) + { + puts ("join failed"); + exit (1); + } + + if (result != PTHREAD_CANCELED) + { + puts ("result != PTHREAD_CANCELED"); + exit (1); + } + } + + for (i = 0; i < N; ++i) + free (t[i]); + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond8.c b/test/nptl/tst-cond8.c new file mode 100644 index 000000000..fb13fa46c --- /dev/null +++ b/test/nptl/tst-cond8.c @@ -0,0 +1,276 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <sys/time.h> + + +static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t mut = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; + +static pthread_barrier_t bar; + + +static void +ch (void *arg) +{ + int e = pthread_mutex_lock (&mut); + if (e == 0) + { + puts ("mutex not locked at all by cond_wait"); + exit (1); + } + + if (e != EDEADLK) + { + puts ("no deadlock error signaled"); + exit (1); + } + + if (pthread_mutex_unlock (&mut) != 0) + { + puts ("ch: cannot unlock mutex"); + exit (1); + } + + puts ("ch done"); +} + + +static void * +tf1 (void *p) +{ + int err; + + if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) != 0 + || pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, NULL) != 0) + { + puts ("cannot set cancellation options"); + exit (1); + } + + err = pthread_mutex_lock (&mut); + if (err != 0) + { + puts ("child: cannot get mutex"); + exit (1); + } + + err = pthread_barrier_wait (&bar); + if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("barrier_wait returned %d\n", err); + exit (1); + } + + puts ("child: got mutex; waiting"); + + pthread_cleanup_push (ch, NULL); + + pthread_cond_wait (&cond, &mut); + + pthread_cleanup_pop (0); + + puts ("child: cond_wait should not have returned"); + + return NULL; +} + + +static void * +tf2 (void *p) +{ + int err; + + if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL) != 0 + || pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, NULL) != 0) + { + puts ("cannot set cancellation options"); + exit (1); + } + + err = pthread_mutex_lock (&mut); + if (err != 0) + { + puts ("child: cannot get mutex"); + exit (1); + } + + err = pthread_barrier_wait (&bar); + if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD) + { + printf ("barrier_wait returned %d\n", err); + exit (1); + } + + puts ("child: got mutex; waiting"); + + pthread_cleanup_push (ch, NULL); + + /* Current time. */ + struct timeval tv; + (void) gettimeofday (&tv, NULL); + /* +1000 seconds in correct format. */ + struct timespec ts; + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_sec += 1000; + + pthread_cond_timedwait (&cond, &mut, &ts); + + pthread_cleanup_pop (0); + + puts ("child: cond_wait should not have returned"); + + return NULL; +} + + +static int +do_test (void) +{ + pthread_t th; + int err; + + printf ("&cond = %p\n&mut = %p\n", &cond, &mut); + + puts ("parent: get mutex"); + + err = pthread_barrier_init (&bar, NULL, 2); + if (err != 0) + { + puts ("parent: cannot init barrier"); + exit (1); + } + + puts ("parent: create child"); + + err = pthread_create (&th, NULL, tf1, NULL); + if (err != 0) + { + puts ("parent: cannot create thread"); + exit (1); + } + + puts ("parent: wait for child to lock mutex"); + + err = pthread_barrier_wait (&bar); + if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("parent: cannot wait for barrier"); + exit (1); + } + + err = pthread_mutex_lock (&mut); + if (err != 0) + { + puts ("parent: mutex_lock failed"); + exit (1); + } + + err = pthread_mutex_unlock (&mut); + if (err != 0) + { + puts ("parent: mutex_unlock failed"); + exit (1); + } + + if (pthread_cancel (th) != 0) + { + puts ("cannot cancel thread"); + exit (1); + } + + void *r; + err = pthread_join (th, &r); + if (err != 0) + { + puts ("parent: failed to join"); + exit (1); + } + + if (r != PTHREAD_CANCELED) + { + puts ("child hasn't been canceled"); + exit (1); + } + + + + puts ("parent: create 2nd child"); + + err = pthread_create (&th, NULL, tf2, NULL); + if (err != 0) + { + puts ("parent: cannot create thread"); + exit (1); + } + + puts ("parent: wait for child to lock mutex"); + + err = pthread_barrier_wait (&bar); + if (err != 0 && err != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("parent: cannot wait for barrier"); + exit (1); + } + + err = pthread_mutex_lock (&mut); + if (err != 0) + { + puts ("parent: mutex_lock failed"); + exit (1); + } + + err = pthread_mutex_unlock (&mut); + if (err != 0) + { + puts ("parent: mutex_unlock failed"); + exit (1); + } + + if (pthread_cancel (th) != 0) + { + puts ("cannot cancel thread"); + exit (1); + } + + err = pthread_join (th, &r); + if (err != 0) + { + puts ("parent: failed to join"); + exit (1); + } + + if (r != PTHREAD_CANCELED) + { + puts ("child hasn't been canceled"); + exit (1); + } + + puts ("done"); + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cond9.c b/test/nptl/tst-cond9.c new file mode 100644 index 000000000..dcb597ddf --- /dev/null +++ b/test/nptl/tst-cond9.c @@ -0,0 +1,149 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <sys/time.h> + + +static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t mut = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; + + +static void * +tf (void *arg) +{ + int err = pthread_cond_wait (&cond, &mut); + if (err == 0) + { + puts ("cond_wait did not fail"); + exit (1); + } + + if (err != EPERM) + { + printf ("cond_wait didn't return EPERM but %d\n", err); + exit (1); + } + + + /* Current time. */ + struct timeval tv; + (void) gettimeofday (&tv, NULL); + /* +1000 seconds in correct format. */ + struct timespec ts; + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_sec += 1000; + + err = pthread_cond_timedwait (&cond, &mut, &ts); + if (err == 0) + { + puts ("cond_timedwait did not fail"); + exit (1); + } + + if (err != EPERM) + { + printf ("cond_timedwait didn't return EPERM but %d\n", err); + exit (1); + } + + return (void *) 1l; +} + + +static int +do_test (void) +{ + pthread_t th; + int err; + + printf ("&cond = %p\n&mut = %p\n", &cond, &mut); + + err = pthread_cond_wait (&cond, &mut); + if (err == 0) + { + puts ("cond_wait did not fail"); + exit (1); + } + + if (err != EPERM) + { + printf ("cond_wait didn't return EPERM but %d\n", err); + exit (1); + } + + + /* Current time. */ + struct timeval tv; + (void) gettimeofday (&tv, NULL); + /* +1000 seconds in correct format. */ + struct timespec ts; + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_sec += 1000; + + err = pthread_cond_timedwait (&cond, &mut, &ts); + if (err == 0) + { + puts ("cond_timedwait did not fail"); + exit (1); + } + + if (err != EPERM) + { + printf ("cond_timedwait didn't return EPERM but %d\n", err); + exit (1); + } + + if (pthread_mutex_lock (&mut) != 0) + { + puts ("parent: mutex_lock failed"); + exit (1); + } + + puts ("creating thread"); + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("join failed"); + exit (1); + } + if (r != (void *) 1l) + { + puts ("thread has wrong return value"); + exit (1); + } + + puts ("done"); + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cpuclock1.c b/test/nptl/tst-cpuclock1.c new file mode 100644 index 000000000..9d68ec520 --- /dev/null +++ b/test/nptl/tst-cpuclock1.c @@ -0,0 +1,306 @@ +/* Test program for process CPU clocks. + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <unistd.h> +#include <fcntl.h> +#include <string.h> +#include <errno.h> +#include <signal.h> +#include <sys/wait.h> + +/* This function is intended to rack up both user and system time. */ +static void +chew_cpu (void) +{ + while (1) + { + static volatile char buf[4096]; + for (int i = 0; i < 100; ++i) + for (size_t j = 0; j < sizeof buf; ++j) + buf[j] = 0xaa; + int nullfd = open ("/dev/null", O_WRONLY); + for (int i = 0; i < 100; ++i) + for (size_t j = 0; j < sizeof buf; ++j) + buf[j] = 0xbb; + write (nullfd, (char *) buf, sizeof buf); + close (nullfd); + if (getppid () == 1) + _exit (2); + } +} + +static int +do_test (void) +{ + int result = 0; + clockid_t cl; + int e; + pid_t dead_child, child; + + /* Fork a child and let it die, to give us a PID known not be valid + (assuming PIDs don't wrap around during the test). */ + { + dead_child = fork (); + if (dead_child == 0) + _exit (0); + if (dead_child < 0) + { + perror ("fork"); + return 1; + } + int x; + if (wait (&x) != dead_child) + { + perror ("wait"); + return 2; + } + } + + /* POSIX says we should get ESRCH for this. */ + e = clock_getcpuclockid (dead_child, &cl); + if (e != ENOSYS && e != ESRCH && e != EPERM) + { + printf ("clock_getcpuclockid on dead PID %d => %s\n", + dead_child, strerror (e)); + result = 1; + } + + /* Now give us a live child eating up CPU time. */ + child = fork (); + if (child == 0) + { + chew_cpu (); + _exit (1); + } + if (child < 0) + { + perror ("fork"); + return 1; + } + + e = clock_getcpuclockid (child, &cl); + if (e == EPERM) + { + puts ("clock_getcpuclockid does not support other processes"); + goto done; + } + if (e != 0) + { + printf ("clock_getcpuclockid on live PID %d => %s\n", + child, strerror (e)); + result = 1; + goto done; + } + + const clockid_t child_clock = cl; + struct timespec res; + if (clock_getres (child_clock, &res) < 0) + { + printf ("clock_getres on live PID %d clock %lx => %s\n", + child, (unsigned long int) child_clock, strerror (errno)); + result = 1; + goto done; + } + printf ("live PID %d clock %lx resolution %lu.%.9lu\n", + child, (unsigned long int) child_clock, res.tv_sec, res.tv_nsec); + + struct timespec before, after; + if (clock_gettime (child_clock, &before) < 0) + { + printf ("clock_gettime on live PID %d clock %lx => %s\n", + child, (unsigned long int) child_clock, strerror (errno)); + result = 1; + goto done; + } + printf ("live PID %d before sleep => %lu.%.9lu\n", + child, before.tv_sec, before.tv_nsec); + + struct timespec sleeptime = { .tv_nsec = 500000000 }; + nanosleep (&sleeptime, NULL); + + if (clock_gettime (child_clock, &after) < 0) + { + printf ("clock_gettime on live PID %d clock %lx => %s\n", + child, (unsigned long int) child_clock, strerror (errno)); + result = 1; + goto done; + } + printf ("live PID %d after sleep => %lu.%.9lu\n", + child, after.tv_sec, after.tv_nsec); + + struct timespec diff = { .tv_sec = after.tv_sec - before.tv_sec, + .tv_nsec = after.tv_nsec - before.tv_nsec }; + if (diff.tv_nsec < 0) + { + --diff.tv_sec; + diff.tv_nsec += 1000000000; + } + if (diff.tv_sec != 0 + || diff.tv_nsec > 600000000 + || diff.tv_nsec < 100000000) + { + printf ("before - after %lu.%.9lu outside reasonable range\n", + diff.tv_sec, diff.tv_nsec); + result = 1; + } + + sleeptime.tv_nsec = 100000000; + e = clock_nanosleep (child_clock, 0, &sleeptime, NULL); + if (e == EINVAL || e == ENOTSUP || e == ENOSYS) + { + printf ("clock_nanosleep not supported for other process clock: %s\n", + strerror (e)); + } + else if (e != 0) + { + printf ("clock_nanosleep on other process clock: %s\n", strerror (e)); + result = 1; + } + else + { + struct timespec afterns; + if (clock_gettime (child_clock, &afterns) < 0) + { + printf ("clock_gettime on live PID %d clock %lx => %s\n", + child, (unsigned long int) child_clock, strerror (errno)); + result = 1; + } + else + { + struct timespec d = { .tv_sec = afterns.tv_sec - after.tv_sec, + .tv_nsec = afterns.tv_nsec - after.tv_nsec }; + if (d.tv_nsec < 0) + { + --d.tv_sec; + d.tv_nsec += 1000000000; + } + if (d.tv_sec > 0 + || d.tv_nsec < sleeptime.tv_nsec + || d.tv_nsec > sleeptime.tv_nsec * 2) + { + printf ("nanosleep time %lu.%.9lu outside reasonable range\n", + d.tv_sec, d.tv_nsec); + result = 1; + } + } + } + + if (kill (child, SIGKILL) != 0) + { + perror ("kill"); + result = 2; + goto done; + } + + /* Wait long enough to let the child finish dying. */ + + sleeptime.tv_nsec = 200000000; + nanosleep (&sleeptime, NULL); + + struct timespec dead; + if (clock_gettime (child_clock, &dead) < 0) + { + printf ("clock_gettime on dead PID %d clock %lx => %s\n", + child, (unsigned long int) child_clock, strerror (errno)); + result = 1; + goto done; + } + printf ("dead PID %d => %lu.%.9lu\n", + child, dead.tv_sec, dead.tv_nsec); + + diff.tv_sec = dead.tv_sec - after.tv_sec; + diff.tv_nsec = dead.tv_nsec - after.tv_nsec; + if (diff.tv_nsec < 0) + { + --diff.tv_sec; + diff.tv_nsec += 1000000000; + } + if (diff.tv_sec != 0 || diff.tv_nsec > 200000000) + { + printf ("dead - after %lu.%.9lu outside reasonable range\n", + diff.tv_sec, diff.tv_nsec); + result = 1; + } + + /* Now reap the child and verify that its clock is no longer valid. */ + { + int x; + if (waitpid (child, &x, 0) != child) + { + perror ("waitpid"); + result = 1; + } + } + + if (clock_gettime (child_clock, &dead) == 0) + { + printf ("clock_gettime on reaped PID %d clock %lx => %lu%.9lu\n", + child, (unsigned long int) child_clock, + dead.tv_sec, dead.tv_nsec); + result = 1; + } + else + { + if (errno != EINVAL) + result = 1; + printf ("clock_gettime on reaped PID %d clock %lx => %s\n", + child, (unsigned long int) child_clock, strerror (errno)); + } + + if (clock_getres (child_clock, &dead) == 0) + { + printf ("clock_getres on reaped PID %d clock %lx => %lu%.9lu\n", + child, (unsigned long int) child_clock, + dead.tv_sec, dead.tv_nsec); + result = 1; + } + else + { + if (errno != EINVAL) + result = 1; + printf ("clock_getres on reaped PID %d clock %lx => %s\n", + child, (unsigned long int) child_clock, strerror (errno)); + } + + return result; + + done: + { + if (kill (child, SIGKILL) != 0 && errno != ESRCH) + { + perror ("kill"); + return 2; + } + int x; + if (waitpid (child, &x, 0) != child && errno != ECHILD) + { + perror ("waitpid"); + return 2; + } + } + + return result; +} + + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cpuclock2.c b/test/nptl/tst-cpuclock2.c new file mode 100644 index 000000000..d08dc6211 --- /dev/null +++ b/test/nptl/tst-cpuclock2.c @@ -0,0 +1,331 @@ +/* Test program for process and thread CPU clocks. + Copyright (C) 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 + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <unistd.h> + +#if (_POSIX_THREADS - 0) <= 0 + +# define TEST_FUNCTION 0 + +#else + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <fcntl.h> +#include <string.h> +#include <errno.h> +#include <pthread.h> + +static pthread_barrier_t barrier; + +/* This function is intended to rack up both user and system time. */ +static void * +chew_cpu (void *arg) +{ + pthread_barrier_wait (&barrier); + + while (1) + { + static volatile char buf[4096]; + for (int i = 0; i < 100; ++i) + for (size_t j = 0; j < sizeof buf; ++j) + buf[j] = 0xaa; + int nullfd = open ("/dev/null", O_WRONLY); + for (int i = 0; i < 100; ++i) + for (size_t j = 0; j < sizeof buf; ++j) + buf[j] = 0xbb; + write (nullfd, (char *) buf, sizeof buf); + close (nullfd); + } + + return NULL; +} + +static unsigned long long int +tsdiff (const struct timespec *before, const struct timespec *after) +{ + struct timespec diff = { .tv_sec = after->tv_sec - before->tv_sec, + .tv_nsec = after->tv_nsec - before->tv_nsec }; + while (diff.tv_nsec < 0) + { + --diff.tv_sec; + diff.tv_nsec += 1000000000; + } + return diff.tv_sec * 1000000000ULL + diff.tv_nsec; +} + +static unsigned long long int +test_nanosleep (clockid_t clock, const char *which, + const struct timespec *before, int *bad) +{ + const struct timespec sleeptime = { .tv_nsec = 100000000 }; + int e = clock_nanosleep (clock, 0, &sleeptime, NULL); + if (e == EINVAL || e == ENOTSUP || e == ENOSYS) + { + printf ("clock_nanosleep not supported for %s CPU clock: %s\n", + which, strerror (e)); + return 0; + } + if (e != 0) + { + printf ("clock_nanosleep on %s CPU clock: %s\n", which, strerror (e)); + *bad = 1; + return 0; + } + + struct timespec after; + if (clock_gettime (clock, &after) < 0) + { + printf ("clock_gettime on %s CPU clock %lx => %s\n", + which, (unsigned long int) clock, strerror (errno)); + *bad = 1; + return 0; + } + + unsigned long long int diff = tsdiff (before, &after); + if (diff < sleeptime.tv_nsec || diff > sleeptime.tv_nsec * 2) + { + printf ("clock_nanosleep on %s slept %llu (outside reasonable range)\n", + which, diff); + *bad = 1; + return diff; + } + + struct timespec sleeptimeabs = sleeptime; + sleeptimeabs.tv_sec += after.tv_sec; + sleeptimeabs.tv_nsec += after.tv_nsec; + while (sleeptimeabs.tv_nsec > 1000000000) + { + ++sleeptimeabs.tv_sec; + sleeptimeabs.tv_nsec -= 1000000000; + } + e = clock_nanosleep (clock, TIMER_ABSTIME, &sleeptimeabs, NULL); + if (e != 0) + { + printf ("absolute clock_nanosleep on %s CPU clock: %s\n", + which, strerror (e)); + *bad = 1; + return diff; + } + + struct timespec afterabs; + if (clock_gettime (clock, &afterabs) < 0) + { + printf ("clock_gettime on %s CPU clock %lx => %s\n", + which, (unsigned long int) clock, strerror (errno)); + *bad = 1; + return diff; + } + + unsigned long long int sleepdiff = tsdiff (&sleeptimeabs, &afterabs); + if (sleepdiff > sleeptime.tv_nsec) + { + printf ("\ +absolute clock_nanosleep on %s %llu past target (outside reasonable range)\n", + which, sleepdiff); + *bad = 1; + } + + unsigned long long int diffabs = tsdiff (&after, &afterabs); + if (diffabs < sleeptime.tv_nsec || diffabs > sleeptime.tv_nsec * 2) + { + printf ("\ +absolute clock_nanosleep on %s slept %llu (outside reasonable range)\n", + which, diffabs); + *bad = 1; + } + + return diff + diffabs; +} + + + +static int +do_test (void) +{ + int result = 0; + clockid_t process_clock, th_clock, my_thread_clock; + int e; + pthread_t th; + + e = clock_getcpuclockid (0, &process_clock); + if (e != 0) + { + printf ("clock_getcpuclockid on self => %s\n", strerror (e)); + return 1; + } + + e = pthread_getcpuclockid (pthread_self (), &my_thread_clock); + if (e != 0) + { + printf ("pthread_getcpuclockid on self => %s\n", strerror (e)); + return 1; + } + + /* This is a kludge. This test fails if the semantics of thread and + process clocks are wrong. The old code using hp-timing without kernel + support has bogus semantics if there are context switches. We don't + fail to report failure when the proper functionality is not available + in the kernel. It so happens that Linux kernels without correct CPU + clock support also lack CPU timer support, so we use use that to guess + that we are using the bogus code and not test it. */ + timer_t t; + if (timer_create (my_thread_clock, NULL, &t) != 0) + { + printf ("timer_create: %m\n"); + puts ("No support for CPU clocks with good semantics, skipping test"); + return 0; + } + timer_delete (t); + + + pthread_barrier_init (&barrier, NULL, 2); + + e = pthread_create (&th, NULL, chew_cpu, NULL); + if (e != 0) + { + printf ("pthread_create: %s\n", strerror (e)); + return 1; + } + + e = pthread_getcpuclockid (th, &th_clock); + if (e == ENOENT || e == ENOSYS || e == ENOTSUP) + { + puts ("pthread_getcpuclockid does not support other threads"); + return 1; + } + + pthread_barrier_wait (&barrier); + + struct timespec res; + if (clock_getres (th_clock, &res) < 0) + { + printf ("clock_getres on thread clock %lx => %s\n", + (unsigned long int) th_clock, strerror (errno)); + result = 1; + return 1; + } + printf ("live thread clock %lx resolution %lu.%.9lu\n", + (unsigned long int) th_clock, res.tv_sec, res.tv_nsec); + + struct timespec process_before, process_after; + if (clock_gettime (process_clock, &process_before) < 0) + { + printf ("clock_gettime on process clock %lx => %s\n", + (unsigned long int) th_clock, strerror (errno)); + return 1; + } + + struct timespec before, after; + if (clock_gettime (th_clock, &before) < 0) + { + printf ("clock_gettime on live thread clock %lx => %s\n", + (unsigned long int) th_clock, strerror (errno)); + return 1; + } + printf ("live thread before sleep => %lu.%.9lu\n", + before.tv_sec, before.tv_nsec); + + struct timespec me_before, me_after; + if (clock_gettime (my_thread_clock, &me_before) < 0) + { + printf ("clock_gettime on live thread clock %lx => %s\n", + (unsigned long int) th_clock, strerror (errno)); + return 1; + } + printf ("self thread before sleep => %lu.%.9lu\n", + me_before.tv_sec, me_before.tv_nsec); + + struct timespec sleeptime = { .tv_nsec = 500000000 }; + nanosleep (&sleeptime, NULL); + + if (clock_gettime (th_clock, &after) < 0) + { + printf ("clock_gettime on live thread clock %lx => %s\n", + (unsigned long int) th_clock, strerror (errno)); + return 1; + } + printf ("live thread after sleep => %lu.%.9lu\n", + after.tv_sec, after.tv_nsec); + + if (clock_gettime (process_clock, &process_after) < 0) + { + printf ("clock_gettime on process clock %lx => %s\n", + (unsigned long int) th_clock, strerror (errno)); + return 1; + } + + if (clock_gettime (my_thread_clock, &me_after) < 0) + { + printf ("clock_gettime on live thread clock %lx => %s\n", + (unsigned long int) th_clock, strerror (errno)); + return 1; + } + printf ("self thread after sleep => %lu.%.9lu\n", + me_after.tv_sec, me_after.tv_nsec); + + unsigned long long int th_diff = tsdiff (&before, &after); + unsigned long long int pdiff = tsdiff (&process_before, &process_after); + unsigned long long int my_diff = tsdiff (&me_before, &me_after); + + if (th_diff < 100000000 || th_diff > 600000000) + { + printf ("thread before - after %llu outside reasonable range\n", + th_diff); + result = 1; + } + + if (my_diff > 100000000) + { + printf ("self thread before - after %llu outside reasonable range\n", + my_diff); + result = 1; + } + + if (pdiff < th_diff) + { + printf ("process before - after %llu outside reasonable range (%llu)\n", + pdiff, th_diff); + result = 1; + } + + process_after.tv_nsec += test_nanosleep (th_clock, "thread", + &after, &result); + process_after.tv_nsec += test_nanosleep (process_clock, "process", + &process_after, &result); + test_nanosleep (CLOCK_PROCESS_CPUTIME_ID, + "PROCESS_CPUTIME_ID", &process_after, &result); + + pthread_cancel (th); + + e = clock_nanosleep (CLOCK_THREAD_CPUTIME_ID, 0, &sleeptime, NULL); + if (e != EINVAL) + { + printf ("clock_nanosleep CLOCK_THREAD_CPUTIME_ID: %s\n", + strerror (e)); + result = 1; + } + + return result; +} +# define TIMEOUT 8 +# define TEST_FUNCTION do_test () +#endif + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-cputimer1.c b/test/nptl/tst-cputimer1.c new file mode 100644 index 000000000..8f5dd76cf --- /dev/null +++ b/test/nptl/tst-cputimer1.c @@ -0,0 +1,68 @@ +/* Tests for POSIX timer implementation using process CPU clock. */ + +#include <unistd.h> + +#if _POSIX_THREADS && defined _POSIX_CPUTIME + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <fcntl.h> +#include <time.h> +#include <pthread.h> + +#define TEST_CLOCK CLOCK_PROCESS_CPUTIME_ID +#define TEST_CLOCK_MISSING(clock) \ + (setup_test () ? "process CPU clock timer support" : NULL) + +/* This function is intended to rack up both user and system time. */ +static void * +chew_cpu (void *arg) +{ + while (1) + { + static volatile char buf[4096]; + for (int i = 0; i < 100; ++i) + for (size_t j = 0; j < sizeof buf; ++j) + buf[j] = 0xaa; + int nullfd = open ("/dev/null", O_WRONLY); + for (int i = 0; i < 100; ++i) + for (size_t j = 0; j < sizeof buf; ++j) + buf[j] = 0xbb; + write (nullfd, (char *) buf, sizeof buf); + close (nullfd); + } + + return NULL; +} + +static int +setup_test (void) +{ + /* Test timers on our own process CPU clock by having a worker thread + eating CPU. First make sure we can make such timers at all. */ + + timer_t t; + if (timer_create (TEST_CLOCK, NULL, &t) != 0) + { + printf ("timer_create: %m\n"); + return 1; + } + timer_delete (t); + + pthread_t th; + int e = pthread_create (&th, NULL, chew_cpu, NULL); + if (e != 0) + { + printf ("pthread_create: %s\n", strerror (e)); + exit (1); + } + + return 0; +} + +#else +# define TEST_CLOCK_MISSING(clock) "process clocks" +#endif + +#include "tst-timer4.c" diff --git a/test/nptl/tst-cputimer2.c b/test/nptl/tst-cputimer2.c new file mode 100644 index 000000000..397d7998c --- /dev/null +++ b/test/nptl/tst-cputimer2.c @@ -0,0 +1,83 @@ +/* Tests for POSIX timer implementation using thread CPU clock. */ + +#include <unistd.h> + +#if _POSIX_THREADS && defined _POSIX_CPUTIME + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <fcntl.h> +#include <time.h> +#include <pthread.h> + +static clockid_t worker_thread_clock; + +#define TEST_CLOCK worker_thread_clock +#define TEST_CLOCK_MISSING(clock) \ + (setup_test () ? "thread CPU clock timer support" : NULL) + +/* This function is intended to rack up both user and system time. */ +static void * +chew_cpu (void *arg) +{ + while (1) + { + static volatile char buf[4096]; + for (int i = 0; i < 100; ++i) + for (size_t j = 0; j < sizeof buf; ++j) + buf[j] = 0xaa; + int nullfd = open ("/dev/null", O_WRONLY); + for (int i = 0; i < 100; ++i) + for (size_t j = 0; j < sizeof buf; ++j) + buf[j] = 0xbb; + write (nullfd, (char *) buf, sizeof buf); + close (nullfd); + } + + return NULL; +} + +static int +setup_test (void) +{ + /* Test timers on a thread CPU clock by having a worker thread eating + CPU. First make sure we can make such timers at all. */ + + pthread_t th; + int e = pthread_create (&th, NULL, chew_cpu, NULL); + if (e != 0) + { + printf ("pthread_create: %s\n", strerror (e)); + exit (1); + } + + e = pthread_getcpuclockid (th, &worker_thread_clock); + if (e == EPERM || e == ENOENT || e == ENOTSUP) + { + puts ("pthread_getcpuclockid does not support other threads"); + return 1; + } + if (e != 0) + { + printf ("pthread_getcpuclockid: %s\n", strerror (e)); + exit (1); + } + + timer_t t; + if (timer_create (TEST_CLOCK, NULL, &t) != 0) + { + printf ("timer_create: %m\n"); + return 1; + } + timer_delete (t); + + return 0; +} + +#else +# define TEST_CLOCK_MISSING(clock) "process clocks" +#endif + +#include "tst-timer4.c" diff --git a/test/nptl/tst-cputimer3.c b/test/nptl/tst-cputimer3.c new file mode 100644 index 000000000..056766a37 --- /dev/null +++ b/test/nptl/tst-cputimer3.c @@ -0,0 +1,130 @@ +/* Tests for POSIX timer implementation using another process's CPU clock. */ + +#include <unistd.h> + +#if _POSIX_THREADS && defined _POSIX_CPUTIME + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <fcntl.h> +#include <time.h> +#include <signal.h> +#include <sys/wait.h> + +static clockid_t child_clock; + +#define TEST_CLOCK child_clock +#define TEST_CLOCK_MISSING(clock) \ + (setup_test () ? "other-process CPU clock timer support" : NULL) + +/* This function is intended to rack up both user and system time. */ +static void +chew_cpu (void) +{ + while (1) + { + static volatile char buf[4096]; + for (int i = 0; i < 100; ++i) + for (size_t j = 0; j < sizeof buf; ++j) + buf[j] = 0xaa; + int nullfd = open ("/dev/null", O_WRONLY); + for (int i = 0; i < 100; ++i) + for (size_t j = 0; j < sizeof buf; ++j) + buf[j] = 0xbb; + write (nullfd, (char *) buf, sizeof buf); + close (nullfd); + if (getppid () == 1) + _exit (2); + } +} + +static pid_t child; +static void +cleanup_child (void) +{ + if (child <= 0) + return; + if (kill (child, SIGKILL) < 0 && errno != ESRCH) + printf ("cannot kill child %d: %m\n", child); + else + { + int status; + errno = 0; + if (waitpid (child, &status, 0) != child) + printf ("waitpid %d: %m\n", child); + } +} +#define CLEANUP_HANDLER cleanup_child () + +static int +setup_test (void) +{ + /* Test timers on a process CPU clock by having a child process eating + CPU. First make sure we can make such timers at all. */ + + int pipefd[2]; + if (pipe (pipefd) < 0) + { + printf ("pipe: %m\n"); + exit (1); + } + + child = fork (); + + if (child == 0) + { + char c; + close (pipefd[1]); + if (read (pipefd[0], &c, 1) == 1) + chew_cpu (); + _exit (1); + } + + if (child < 0) + { + printf ("fork: %m\n"); + exit (1); + } + + atexit (&cleanup_child); + + close (pipefd[0]); + + int e = clock_getcpuclockid (child, &child_clock); + if (e == EPERM) + { + puts ("clock_getcpuclockid does not support other processes"); + return 1; + } + if (e != 0) + { + printf ("clock_getcpuclockid: %s\n", strerror (e)); + exit (1); + } + + timer_t t; + if (timer_create (TEST_CLOCK, NULL, &t) != 0) + { + printf ("timer_create: %m\n"); + return 1; + } + timer_delete (t); + + /* Get the child started chewing. */ + if (write (pipefd[1], "x", 1) != 1) + { + printf ("write to pipe: %m\n"); + return 1; + } + close (pipefd[1]); + + return 0; +} + +#else +# define TEST_CLOCK_MISSING(clock) "process clocks" +#endif + +#include "tst-timer4.c" diff --git a/test/nptl/tst-detach1.c b/test/nptl/tst-detach1.c new file mode 100644 index 000000000..90a69fffd --- /dev/null +++ b/test/nptl/tst-detach1.c @@ -0,0 +1,55 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static void * +tf (void *arg) +{ + return NULL; +} + + +static int +do_test (void) +{ + pthread_t th; + if (pthread_create (&th, NULL, tf, (void *) pthread_self ()) != 0) + { + puts ("create failed"); + exit (1); + } + + /* Give the child a chance to finish. */ + sleep (1); + + if (pthread_detach (th) != 0) + { + puts ("detach failed"); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-dlsym1.c b/test/nptl/tst-dlsym1.c new file mode 100644 index 000000000..3744570c7 --- /dev/null +++ b/test/nptl/tst-dlsym1.c @@ -0,0 +1,66 @@ +/* Test case by Hui Huang <hui.huang@sun.com>. */ +#include <dlfcn.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + + +static void * +start_routine (void *args) +{ + int i; + void **addrs = (void **) args; + for (i = 0; i < 10000; ++i) + addrs[i % 1024] = dlsym (NULL, "does_not_exist"); + + return addrs; +} + + +static int +do_test (void) +{ + pthread_t tid1, tid2, tid3; + + void *addrs1[1024]; + void *addrs2[1024]; + void *addrs3[1024]; + + if (pthread_create (&tid1, NULL, start_routine, addrs1) != 0) + { + puts ("1st create failed"); + exit (1); + } + if (pthread_create (&tid2, NULL, start_routine, addrs2) != 0) + { + puts ("2nd create failed"); + exit (1); + } + if (pthread_create (&tid3, NULL, start_routine, addrs3) != 0) + { + puts ("3rd create failed"); + exit (1); + } + + if (pthread_join (tid1, NULL) != 0) + { + puts ("1st join failed"); + exit (1); + } + if (pthread_join (tid2, NULL) != 0) + { + puts ("2nd join failed"); + exit (1); + } + if (pthread_join (tid3, NULL) != 0) + { + puts ("2rd join failed"); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-eintr1.c b/test/nptl/tst-eintr1.c new file mode 100644 index 000000000..ac381a88b --- /dev/null +++ b/test/nptl/tst-eintr1.c @@ -0,0 +1,104 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "eintr.c" + + +static void * +tf2 (void *arg) +{ + return arg; +} + + +static void * +tf1 (void *arg) +{ + while (1) + { + pthread_t th; + + int e = pthread_create (&th, NULL, tf2, NULL); + if (e != 0) + { + if (e == EINTR) + { + puts ("pthread_create returned EINTR"); + exit (1); + } + + char buf[100]; + printf ("tf1: pthread_create failed: %s\n", + strerror_r (e, buf, sizeof (buf))); + exit (1); + } + + e = pthread_join (th, NULL); + if (e != 0) + { + if (e == EINTR) + { + puts ("pthread_join returned EINTR"); + exit (1); + } + + char buf[100]; + printf ("tf1: pthread_join failed: %s\n", + strerror_r (e, buf, sizeof (buf))); + exit (1); + } + } +} + + +static int +do_test (void) +{ + setup_eintr (SIGUSR1, NULL); + + int i; + for (i = 0; i < 10; ++i) + { + pthread_t th; + int e = pthread_create (&th, NULL, tf1, NULL); + if (e != 0) + { + char buf[100]; + printf ("main: pthread_create failed: %s\n", + strerror_r (e, buf, sizeof (buf))); + exit (1); + } + } + + (void) tf1 (NULL); + /* NOTREACHED */ + + return 0; +} + +#define EXPECTED_SIGNAL SIGALRM +#define TIMEOUT 3 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-eintr2.c b/test/nptl/tst-eintr2.c new file mode 100644 index 000000000..f20c70922 --- /dev/null +++ b/test/nptl/tst-eintr2.c @@ -0,0 +1,117 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/time.h> + +#include "eintr.c" + + +static pthread_mutex_t m1 = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t m2 = PTHREAD_MUTEX_INITIALIZER; + + +static void * +tf1 (void *arg) +{ + struct timespec ts; + struct timeval tv; + + gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_sec += 10000; + + /* This call must never return. */ + int e = pthread_mutex_timedlock (&m1, &ts); + char buf[100]; + printf ("tf1: mutex_timedlock returned: %s\n", + strerror_r (e, buf, sizeof (buf))); + + exit (1); +} + + +static void * +tf2 (void *arg) +{ + while (1) + { + int e = pthread_mutex_lock (&m2); + if (e != 0) + { + puts ("tf2: mutex_lock failed"); + exit (1); + } + e = pthread_mutex_unlock (&m2); + if (e != 0) + { + puts ("tf2: mutex_unlock failed"); + exit (1); + } + struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 }; + nanosleep (&ts, NULL); + } +} + + +static int +do_test (void) +{ + if (pthread_mutex_lock (&m1) != 0) + { + puts ("mutex_lock failed"); + exit (1); + } + + setup_eintr (SIGUSR1, NULL); + + pthread_t th; + char buf[100]; + int e = pthread_create (&th, NULL, tf1, NULL); + if (e != 0) + { + printf ("main: 1st pthread_create failed: %s\n", + strerror_r (e, buf, sizeof (buf))); + exit (1); + } + + e = pthread_create (&th, NULL, tf2, NULL); + if (e != 0) + { + printf ("main: 2nd pthread_create failed: %s\n", + strerror_r (e, buf, sizeof (buf))); + exit (1); + } + + /* This call must never return. */ + e = pthread_mutex_lock (&m1); + printf ("main: mutex_lock returned: %s\n", + strerror_r (e, buf, sizeof (buf))); + + return 0; +} + +#define EXPECTED_SIGNAL SIGALRM +#define TIMEOUT 3 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-eintr3.c b/test/nptl/tst-eintr3.c new file mode 100644 index 000000000..31497603b --- /dev/null +++ b/test/nptl/tst-eintr3.c @@ -0,0 +1,71 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "eintr.c" + + +static void * +tf (void *arg) +{ + pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; + pthread_mutex_lock (&m); + /* This call must not return. */ + pthread_mutex_lock (&m); + + puts ("tf: mutex_lock returned"); + exit (1); +} + + +static int +do_test (void) +{ + pthread_t self = pthread_self (); + + setup_eintr (SIGUSR1, &self); + + pthread_t th; + char buf[100]; + int e = pthread_create (&th, NULL, tf, NULL); + if (e != 0) + { + printf ("main: pthread_create failed: %s\n", + strerror_r (e, buf, sizeof (buf))); + exit (1); + } + + /* This call must never return. */ + e = pthread_join (th, NULL); + + if (e == EINTR) + puts ("pthread_join returned with EINTR"); + + return 0; +} + +#define EXPECTED_SIGNAL SIGALRM +#define TIMEOUT 1 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-eintr4.c b/test/nptl/tst-eintr4.c new file mode 100644 index 000000000..f2290f9d0 --- /dev/null +++ b/test/nptl/tst-eintr4.c @@ -0,0 +1,55 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "eintr.c" + + +static int +do_test (void) +{ + pthread_t self = pthread_self (); + + setup_eintr (SIGUSR1, &self); + + pthread_barrier_t b; + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + /* This call must never return. */ + int e = pthread_barrier_wait (&b); + + if (e == EINTR) + puts ("pthread_join returned with EINTR"); + + return 0; +} + +#define EXPECTED_SIGNAL SIGALRM +#define TIMEOUT 1 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-eintr5.c b/test/nptl/tst-eintr5.c new file mode 100644 index 000000000..f7cb76274 --- /dev/null +++ b/test/nptl/tst-eintr5.c @@ -0,0 +1,80 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/time.h> + +#include "eintr.c" + + +static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; +static pthread_cond_t c = PTHREAD_COND_INITIALIZER; + + +static void * +tf (void *arg) +{ + struct timespec ts; + struct timeval tv; + + gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_sec += 10000; + + /* This call must never return. */ + int e = pthread_cond_timedwait (&c, &m, &ts); + char buf[100]; + printf ("tf: cond_timedwait returned: %s\n", + strerror_r (e, buf, sizeof (buf))); + + exit (1); +} + + +static int +do_test (void) +{ + setup_eintr (SIGUSR1, NULL); + + pthread_t th; + char buf[100]; + int e = pthread_create (&th, NULL, tf, NULL); + if (e != 0) + { + printf ("main: pthread_create failed: %s\n", + strerror_r (e, buf, sizeof (buf))); + exit (1); + } + + /* This call must never return. */ + e = pthread_cond_wait (&c, &m); + printf ("main: cond_wait returned: %s\n", + strerror_r (e, buf, sizeof (buf))); + + return 0; +} + +#define EXPECTED_SIGNAL SIGALRM +#define TIMEOUT 3 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-exec2.c b/test/nptl/tst-exec2.c new file mode 100644 index 000000000..061e3fc7c --- /dev/null +++ b/test/nptl/tst-exec2.c @@ -0,0 +1,153 @@ +/* Thread with running thread calls exec. + Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <paths.h> +#include <pthread.h> +#include <signal.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/wait.h> + + +static void * +tf (void *arg) +{ + pthread_t th = (pthread_t) arg; + + if (pthread_join (th, NULL) == 0) + { + puts ("thread in parent joined!?"); + exit (1); + } + + puts ("join in thread in parent returned!?"); + exit (1); +} + + +static int +do_test (void) +{ + int fd[2]; + if (pipe (fd) != 0) + { + puts ("pipe failed"); + exit (1); + } + + /* Not interested in knowing when the pipe is closed. */ + if (sigignore (SIGPIPE) != 0) + { + puts ("sigignore failed"); + exit (1); + } + + pid_t pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + exit (1); + } + + if (pid == 0) + { + /* Use the fd for stdout. This is kind of ugly because it + substitutes the fd of stdout but we know what we are doing + here... */ + if (dup2 (fd[1], STDOUT_FILENO) != STDOUT_FILENO) + { + puts ("dup2 failed"); + exit (1); + } + + close (fd[0]); + + pthread_t th; + if (pthread_create (&th, NULL, tf, (void *) pthread_self ()) != 0) + { + puts ("create failed"); + exit (1); + } + + execl (_PATH_BSHELL, _PATH_BSHELL, "-c", "echo $$", NULL); + + puts ("execl failed"); + exit (1); + } + + close (fd[1]); + + char buf[200]; + ssize_t n; + bool seen_pid = false; + while (TEMP_FAILURE_RETRY ((n = read (fd[0], buf, sizeof (buf)))) > 0) + { + /* We only expect to read the PID. */ + char *endp; + long int rpid = strtol (buf, &endp, 10); + + if (*endp != '\n') + { + printf ("didn't parse whole line: \"%s\"\n", buf); + exit (1); + } + if (endp == buf) + { + puts ("read empty line"); + exit (1); + } + + if (rpid != pid) + { + printf ("found \"%s\", expected PID %ld\n", buf, (long int) pid); + exit (1); + } + + if (seen_pid) + { + puts ("found more than one PID line"); + exit (1); + } + seen_pid = true; + } + + close (fd[0]); + + int status; + int err = waitpid (pid, &status, 0); + if (err != pid) + { + puts ("waitpid failed"); + exit (1); + } + + if (!seen_pid) + { + puts ("didn't get PID"); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-exec3.c b/test/nptl/tst-exec3.c new file mode 100644 index 000000000..be4098b32 --- /dev/null +++ b/test/nptl/tst-exec3.c @@ -0,0 +1,151 @@ +/* Thread calls exec. + Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <paths.h> +#include <pthread.h> +#include <signal.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/wait.h> + + +static void * +tf (void *arg) +{ + execl (_PATH_BSHELL, _PATH_BSHELL, "-c", "echo $$", NULL); + + puts ("execl failed"); + exit (1); +} + + +static int +do_test (void) +{ + int fd[2]; + if (pipe (fd) != 0) + { + puts ("pipe failed"); + exit (1); + } + + /* Not interested in knowing when the pipe is closed. */ + if (sigignore (SIGPIPE) != 0) + { + puts ("sigignore failed"); + exit (1); + } + + pid_t pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + exit (1); + } + + if (pid == 0) + { + /* Use the fd for stdout. This is kind of ugly because it + substitutes the fd of stdout but we know what we are doing + here... */ + if (dup2 (fd[1], STDOUT_FILENO) != STDOUT_FILENO) + { + puts ("dup2 failed"); + exit (1); + } + + close (fd[0]); + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + if (pthread_join (th, NULL) == 0) + { + puts ("join succeeded!?"); + exit (1); + } + + puts ("join returned!?"); + exit (1); + } + + close (fd[1]); + + char buf[200]; + ssize_t n; + bool seen_pid = false; + while (TEMP_FAILURE_RETRY ((n = read (fd[0], buf, sizeof (buf)))) > 0) + { + /* We only expect to read the PID. */ + char *endp; + long int rpid = strtol (buf, &endp, 10); + + if (*endp != '\n') + { + printf ("didn't parse whole line: \"%s\"\n", buf); + exit (1); + } + if (endp == buf) + { + puts ("read empty line"); + exit (1); + } + + if (rpid != pid) + { + printf ("found \"%s\", expected PID %ld\n", buf, (long int) pid); + exit (1); + } + + if (seen_pid) + { + puts ("found more than one PID line"); + exit (1); + } + seen_pid = true; + } + + close (fd[0]); + + int status; + int err = waitpid (pid, &status, 0); + if (err != pid) + { + puts ("waitpid failed"); + exit (1); + } + + if (!seen_pid) + { + puts ("didn't get PID"); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-exec4.c b/test/nptl/tst-exec4.c new file mode 100644 index 000000000..1a4b88c69 --- /dev/null +++ b/test/nptl/tst-exec4.c @@ -0,0 +1,115 @@ +/* Signal handler and mask set in thread which calls exec. + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static void * +tf (void *arg) +{ + /* Ignore SIGUSR1 and block SIGUSR2. */ + if (sigignore (SIGUSR1) != 0) + { + puts ("sigignore failed"); + exit (1); + } + + sigset_t ss; + sigemptyset (&ss); + sigaddset (&ss, SIGUSR2); + if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0) + { + puts ("1st run: sigmask failed"); + exit (1); + } + + char **oldargv = (char **) arg; + size_t n = 1; + while (oldargv[n] != NULL) + ++n; + + char **argv = (char **) alloca ((n + 1) * sizeof (char *)); + for (n = 0; oldargv[n + 1] != NULL; ++n) + argv[n] = oldargv[n + 1]; + argv[n++] = (char *) "-d"; + argv[n] = NULL; + + execv (argv[0], argv); + + puts ("execv failed"); + + exit (1); +} + + +static int +do_test (int argc, char *argv[]) +{ + if (argc == 1) + { + /* This is the second call. Perform the test. */ + struct sigaction sa; + + if (sigaction (SIGUSR1, NULL, &sa) != 0) + { + puts ("2nd run: sigaction failed"); + return 1; + } + if (sa.sa_handler != SIG_IGN) + { + puts ("SIGUSR1 not ignored"); + return 1; + } + + sigset_t ss; + if (pthread_sigmask (SIG_SETMASK, NULL, &ss) != 0) + { + puts ("2nd run: sigmask failed"); + return 1; + } + if (! sigismember (&ss, SIGUSR2)) + { + puts ("SIGUSR2 not blocked"); + return 1; + } + + return 0; + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, argv) != 0) + { + puts ("create failed"); + exit (1); + } + + /* This call should never return. */ + pthread_join (th, NULL); + + puts ("join returned"); + + return 1; +} + +#define TEST_FUNCTION do_test (argc, argv) +#include "../test-skeleton.c" diff --git a/test/nptl/tst-exit1.c b/test/nptl/tst-exit1.c new file mode 100644 index 000000000..7f0fe7954 --- /dev/null +++ b/test/nptl/tst-exit1.c @@ -0,0 +1,78 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +/* NOTE: this tests functionality beyond POSIX. POSIX does not allow + exit to be called more than once. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + +static pthread_barrier_t b; + + +static void * +tf (void *arg) +{ + int r = pthread_barrier_wait (&b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + exit (0); +} + + +static int +do_test (void) +{ + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + int r = pthread_barrier_wait (&b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + /* Do nothing. */ + if (pthread_join (th, NULL) == 0) + { + puts ("join succeeded!?"); + exit (1); + } + + puts ("join returned!?"); + exit (1); +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-exit2.c b/test/nptl/tst-exit2.c new file mode 100644 index 000000000..3f5ff27b0 --- /dev/null +++ b/test/nptl/tst-exit2.c @@ -0,0 +1,40 @@ +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> + + +static void * +tf (void *arg) +{ + while (1) + sleep (100); + + /* NOTREACHED */ + return NULL; +} + + +static int +do_test (void) +{ + pthread_t th; + + int e = pthread_create (&th, NULL, tf, NULL); + if (e != 0) + { + printf ("create failed: %s\n", strerror (e)); + return 1; + } + + /* Terminate only this thread. */ + pthread_exit (NULL); + + /* NOTREACHED */ + return 1; +} + +#define EXPECTED_SIGNAL SIGALRM +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-exit3.c b/test/nptl/tst-exit3.c new file mode 100644 index 000000000..da92c82c0 --- /dev/null +++ b/test/nptl/tst-exit3.c @@ -0,0 +1,81 @@ +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + + +static pthread_barrier_t b; + + +static void * +tf2 (void *arg) +{ + while (1) + sleep (100); + + /* NOTREACHED */ + return NULL; +} + + +static void * +tf (void *arg) +{ + pthread_t th; + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + e = pthread_create (&th, NULL, tf2, NULL); + if (e != 0) + { + printf ("create failed: %s\n", strerror (e)); + exit (1); + } + + /* Terminate only this thread. */ + return NULL; +} + + +static int +do_test (void) +{ + pthread_t th; + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + int e = pthread_create (&th, NULL, tf, NULL); + if (e != 0) + { + printf ("create failed: %s\n", strerror (e)); + exit (1); + } + + e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + /* Terminate only this thread. */ + pthread_exit (NULL); + + /* NOTREACHED */ + return 1; +} + +#define EXPECTED_SIGNAL SIGALRM +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-fini1.c b/test/nptl/tst-fini1.c new file mode 100644 index 000000000..b8c7a7306 --- /dev/null +++ b/test/nptl/tst-fini1.c @@ -0,0 +1,34 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <unistd.h> + +extern void m (void); + +int +main (void) +{ + alarm (5); + + m (); + + /* The destructor is supposed to run now. Make sure that if it is + not we will notice it by using 42 as the exit code. In case the + destructor is run it will terminate with status zero. */ + return 42; +} diff --git a/test/nptl/tst-fini1mod.c b/test/nptl/tst-fini1mod.c new file mode 100644 index 000000000..669c9af4c --- /dev/null +++ b/test/nptl/tst-fini1mod.c @@ -0,0 +1,71 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static void * +tf (void *arg) +{ + int fds[2]; + if (pipe (fds) != 0) + { + puts ("pipe failed"); + exit (1); + } + + char buf[10]; + read (fds[0], buf, sizeof (buf)); + + puts ("read returned"); + exit (1); +} + +static pthread_t th; + +static void +__attribute ((destructor)) +dest (void) +{ + if (pthread_cancel (th) != 0) + { + puts ("cancel failed"); + _exit (1); + } + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("join failed"); + _exit (1); + } + /* Exit successfully. */ + _exit (0); +} + +void +m (void) +{ + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + _exit (1); + } +} diff --git a/test/nptl/tst-flock1.c b/test/nptl/tst-flock1.c new file mode 100644 index 000000000..e271c8023 --- /dev/null +++ b/test/nptl/tst-flock1.c @@ -0,0 +1,92 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/file.h> + + +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + +static int fd; + + +static void * +tf (void *arg) +{ + if (flock (fd, LOCK_SH | LOCK_NB) != 0) + { + puts ("second flock failed"); + exit (1); + } + + pthread_mutex_unlock (&lock); + + return NULL; +} + + +static int +do_test (void) +{ + char tmp[] = "/tmp/tst-flock1-XXXXXX"; + + fd = mkstemp (tmp); + if (fd == -1) + { + puts ("mkstemp failed"); + exit (1); + } + + unlink (tmp); + + write (fd, "foobar xyzzy", 12); + + if (flock (fd, LOCK_EX | LOCK_NB) != 0) + { + puts ("first flock failed"); + exit (1); + } + + pthread_mutex_lock (&lock); + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("pthread_create failed"); + exit (1); + } + + pthread_mutex_lock (&lock); + + void *result; + if (pthread_join (th, &result) != 0) + { + puts ("pthread_join failed"); + exit (1); + } + + close (fd); + + return result != NULL; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-flock2.c b/test/nptl/tst-flock2.c new file mode 100644 index 000000000..941c52ffe --- /dev/null +++ b/test/nptl/tst-flock2.c @@ -0,0 +1,259 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/file.h> +#include <sys/mman.h> +#include <sys/wait.h> + + +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t lock2 = PTHREAD_MUTEX_INITIALIZER; +static int fd; + + +static void * +tf (void *arg) +{ + struct flock fl = + { + .l_type = F_WRLCK, + .l_start = 0, + .l_whence = SEEK_SET, + .l_len = 10 + }; + if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLKW, &fl)) != 0) + { + puts ("fourth fcntl failed"); + exit (1); + } + + pthread_mutex_unlock (&lock); + + pthread_mutex_lock (&lock2); + + return NULL; +} + + +static int +do_test (void) +{ + char tmp[] = "/tmp/tst-flock2-XXXXXX"; + + fd = mkstemp (tmp); + if (fd == -1) + { + puts ("mkstemp failed"); + return 1; + } + + unlink (tmp); + + int i; + for (i = 0; i < 20; ++i) + write (fd, "foobar xyzzy", 12); + + pthread_barrier_t *b; + b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE, + MAP_SHARED, fd, 0); + if (b == MAP_FAILED) + { + puts ("mmap failed"); + return 1; + } + + pthread_barrierattr_t ba; + if (pthread_barrierattr_init (&ba) != 0) + { + puts ("barrierattr_init failed"); + return 1; + } + + if (pthread_barrierattr_setpshared (&ba, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("barrierattr_setpshared failed"); + return 1; + } + + if (pthread_barrier_init (b, &ba, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + if (pthread_barrierattr_destroy (&ba) != 0) + { + puts ("barrierattr_destroy failed"); + return 1; + } + + struct flock fl = + { + .l_type = F_WRLCK, + .l_start = 0, + .l_whence = SEEK_SET, + .l_len = 10 + }; + if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLKW, &fl)) != 0) + { + puts ("first fcntl failed"); + return 1; + } + + pid_t pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + return 1; + } + + if (pid == 0) + { + /* Make sure the child does not stay around indefinitely. */ + alarm (10); + + /* Try to get the lock. */ + if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLK, &fl)) == 0) + { + puts ("child: second flock succeeded"); + return 1; + } + } + + pthread_barrier_wait (b); + + if (pid != 0) + { + fl.l_type = F_UNLCK; + if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLKW, &fl)) != 0) + { + puts ("third fcntl failed"); + return 1; + } + } + + pthread_barrier_wait (b); + + pthread_t th; + if (pid == 0) + { + if (pthread_mutex_lock (&lock) != 0) + { + puts ("1st locking of lock failed"); + return 1; + } + + if (pthread_mutex_lock (&lock2) != 0) + { + puts ("1st locking of lock2 failed"); + return 1; + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("pthread_create failed"); + return 1; + } + + if (pthread_mutex_lock (&lock) != 0) + { + puts ("2nd locking of lock failed"); + return 1; + } + + puts ("child locked file"); + } + + pthread_barrier_wait (b); + + if (pid != 0) + { + fl.l_type = F_WRLCK; + if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLK, &fl)) == 0) + { + puts ("fifth fcntl succeeded"); + return 1; + } + + puts ("file locked by child"); + } + + pthread_barrier_wait (b); + + if (pid == 0) + { + if (pthread_mutex_unlock (&lock2) != 0) + { + puts ("unlock of lock2 failed"); + return 1; + } + + if (pthread_join (th, NULL) != 0) + { + puts ("join failed"); + return 1; + } + + puts ("child's thread terminated"); + } + + pthread_barrier_wait (b); + + if (pid != 0) + { + fl.l_type = F_WRLCK; + if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLK, &fl)) == 0) + { + puts ("fifth fcntl succeeded"); + return 1; + } + + puts ("file still locked"); + } + + pthread_barrier_wait (b); + + if (pid == 0) + { + _exit (0); + } + + int status; + if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid) + { + puts ("waitpid failed"); + return 1; + } + puts ("child terminated"); + + if (TEMP_FAILURE_RETRY (fcntl (fd, F_SETLKW, &fl)) != 0) + { + puts ("sixth fcntl failed"); + return 1; + } + + return status; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-fork1.c b/test/nptl/tst-fork1.c new file mode 100644 index 000000000..0d8972831 --- /dev/null +++ b/test/nptl/tst-fork1.c @@ -0,0 +1,119 @@ +/* Copyright (C) 2002, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Roland McGrath <roland@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/wait.h> + +static void * +thread_function (void * arg) +{ + int i = (intptr_t) arg; + int status; + pid_t pid; + pid_t pid2; + + pid = fork (); + switch (pid) + { + case 0: + printf ("%ld for %d\n", (long int) getpid (), i); + struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 * i }; + nanosleep (&ts, NULL); + _exit (i); + break; + case -1: + printf ("fork: %m\n"); + return (void *) 1l; + break; + } + + pid2 = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)); + if (pid2 != pid) + { + printf ("waitpid returned %ld, expected %ld\n", + (long int) pid2, (long int) pid); + return (void *) 1l; + } + + printf ("%ld with %d, expected %d\n", + (long int) pid, WEXITSTATUS (status), i); + + return WEXITSTATUS (status) == i ? NULL : (void *) 1l; +} + +#define N 5 +static const int t[N] = { 7, 6, 5, 4, 3 }; + +int +main (void) +{ + pthread_t th[N]; + int i; + int result = 0; + pthread_attr_t at; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + + for (i = 0; i < N; ++i) + if (pthread_create (&th[i], NULL, thread_function, + (void *) (intptr_t) t[i]) != 0) + { + printf ("creation of thread %d failed\n", i); + exit (1); + } + + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + + for (i = 0; i < N; ++i) + { + void *v; + if (pthread_join (th[i], &v) != 0) + { + printf ("join of thread %d failed\n", i); + result = 1; + } + else if (v != NULL) + { + printf ("join %d successful, but child failed\n", i); + result = 1; + } + else + printf ("join %d successful\n", i); + } + + return result; +} diff --git a/test/nptl/tst-fork2.c b/test/nptl/tst-fork2.c new file mode 100644 index 000000000..d85ea21e1 --- /dev/null +++ b/test/nptl/tst-fork2.c @@ -0,0 +1,89 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Roland McGrath <roland@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/wait.h> + + +static pid_t initial_pid; + + +static void * +tf (void *arg) +{ + if (getppid () != initial_pid) + { + printf ("getppid in thread returned %ld, expected %ld\n", + (long int) getppid (), (long int) initial_pid); + return (void *) -1; + } + + return NULL; +} + + +int +main (void) +{ + initial_pid = getpid (); + + pid_t child = fork (); + if (child == 0) + { + if (getppid () != initial_pid) + { + printf ("first getppid returned %ld, expected %ld\n", + (long int) getppid (), (long int) initial_pid); + exit (1); + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("pthread_create failed"); + exit (1); + } + + void *result; + if (pthread_join (th, &result) != 0) + { + puts ("pthread_join failed"); + exit (1); + } + + exit (result == NULL ? 0 : 1); + } + else if (child == -1) + { + puts ("initial fork failed"); + return 1; + } + + int status; + if (TEMP_FAILURE_RETRY (waitpid (child, &status, 0)) != child) + { + printf ("waitpid failed: %m\n"); + return 1; + } + + return status; +} diff --git a/test/nptl/tst-fork3.c b/test/nptl/tst-fork3.c new file mode 100644 index 000000000..968d0ab98 --- /dev/null +++ b/test/nptl/tst-fork3.c @@ -0,0 +1,106 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Roland McGrath <roland@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/wait.h> + + +static pid_t initial_pid; + + +static void * +tf2 (void *arg) +{ + if (getppid () != initial_pid) + { + printf ("getppid in thread returned %ld, expected %ld\n", + (long int) getppid (), (long int) initial_pid); + return (void *) -1; + } + + return NULL; +} + + +static void * +tf1 (void *arg) +{ + pid_t child = fork (); + if (child == 0) + { + if (getppid () != initial_pid) + { + printf ("first getppid returned %ld, expected %ld\n", + (long int) getppid (), (long int) initial_pid); + exit (1); + } + + pthread_t th2; + if (pthread_create (&th2, NULL, tf2, NULL) != 0) + { + puts ("child: pthread_create failed"); + exit (1); + } + + void *result; + if (pthread_join (th2, &result) != 0) + { + puts ("pthread_join failed"); + exit (1); + } + + exit (result == NULL ? 0 : 1); + } + else if (child == -1) + { + puts ("initial fork failed"); + exit (1); + } + + int status; + if (TEMP_FAILURE_RETRY (waitpid (child, &status, 0)) != child) + { + printf ("waitpid failed: %m\n"); + exit (1); + } + + exit (status); +} + + +int +main (void) +{ + initial_pid = getpid (); + + pthread_t th1; + if (pthread_create (&th1, NULL, tf1, NULL) != 0) + { + puts ("parent: pthread_create failed"); + exit (1); + } + + /* This call should never return. */ + pthread_join (th1, NULL); + + return 1; +} diff --git a/test/nptl/tst-fork4.c b/test/nptl/tst-fork4.c new file mode 100644 index 000000000..ee87108a1 --- /dev/null +++ b/test/nptl/tst-fork4.c @@ -0,0 +1,64 @@ +/* Test of fork updating child universe's pthread structures. + Copyright (C) 2003 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <string.h> + + +static int +do_test (void) +{ + pthread_t me = pthread_self (); + + pid_t pid = fork (); + + if (pid < 0) + { + printf ("fork: %m\n"); + return 1; + } + + if (pid == 0) + { + int err = pthread_kill (me, SIGTERM); + printf ("pthread_kill returned: %s\n", strerror (err)); + return 3; + } + + int status; + errno = 0; + if (wait (&status) != pid) + printf ("wait failed: %m\n"); + else if (WIFSIGNALED (status) && WTERMSIG (status) == SIGTERM) + { + printf ("child correctly died with SIGTERM\n"); + return 0; + } + else + printf ("child died with bad status %#x\n", status); + + return 1; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-getpid1.c b/test/nptl/tst-getpid1.c new file mode 100644 index 000000000..4d25b0de7 --- /dev/null +++ b/test/nptl/tst-getpid1.c @@ -0,0 +1,122 @@ +#include <sched.h> +#include <signal.h> +#include <string.h> +#include <stdio.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <bits/stackinfo.h> + +#ifndef TEST_CLONE_FLAGS +#define TEST_CLONE_FLAGS 0 +#endif + +static int sig; + +static int +f (void *a) +{ + puts ("in f"); + union sigval sival; + sival.sival_int = getpid (); + printf ("pid = %d\n", sival.sival_int); + if (sigqueue (getppid (), sig, sival) != 0) + return 1; + return 0; +} + + +static int +do_test (void) +{ + int mypid = getpid (); + + sig = SIGRTMIN; + sigset_t ss; + sigemptyset (&ss); + sigaddset (&ss, sig); + if (sigprocmask (SIG_BLOCK, &ss, NULL) != 0) + { + printf ("sigprocmask failed: %m\n"); + return 1; + } + +#ifdef __ia64__ + extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base, + size_t __child_stack_size, int __flags, + void *__arg, ...); + char st[256 * 1024] __attribute__ ((aligned)); + pid_t p = __clone2 (f, st, sizeof (st), TEST_CLONE_FLAGS, 0); +#else + char st[128 * 1024] __attribute__ ((aligned)); +# if _STACK_GROWS_DOWN + pid_t p = clone (f, st + sizeof (st), TEST_CLONE_FLAGS, 0); +# elif _STACK_GROWS_UP + pid_t p = clone (f, st, TEST_CLONE_FLAGS, 0); +# else +# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP" +# endif +#endif + if (p == -1) + { + printf("clone failed: %m\n"); + return 1; + } + printf ("new thread: %d\n", (int) p); + + siginfo_t si; + do + if (sigwaitinfo (&ss, &si) < 0) + { + printf("sigwaitinfo failed: %m\n"); + kill (p, SIGKILL); + return 1; + } + while (si.si_signo != sig || si.si_code != SI_QUEUE); + + int e; + if (waitpid (p, &e, __WCLONE) != p) + { + puts ("waitpid failed"); + kill (p, SIGKILL); + return 1; + } + if (!WIFEXITED (e)) + { + if (WIFSIGNALED (e)) + printf ("died from signal %s\n", strsignal (WTERMSIG (e))); + else + puts ("did not terminate correctly"); + return 1; + } + if (WEXITSTATUS (e) != 0) + { + printf ("exit code %d\n", WEXITSTATUS (e)); + return 1; + } + + if (si.si_int != (int) p) + { + printf ("expected PID %d, got si_int %d\n", (int) p, si.si_int); + kill (p, SIGKILL); + return 1; + } + + if (si.si_pid != p) + { + printf ("expected PID %d, got si_pid %d\n", (int) p, (int) si.si_pid); + kill (p, SIGKILL); + return 1; + } + + if (getpid () != mypid) + { + puts ("my PID changed"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-getpid2.c b/test/nptl/tst-getpid2.c new file mode 100644 index 000000000..fc98cb60d --- /dev/null +++ b/test/nptl/tst-getpid2.c @@ -0,0 +1,2 @@ +#define TEST_CLONE_FLAGS CLONE_VM +#include "tst-getpid1.c" diff --git a/test/nptl/tst-getpid3.c b/test/nptl/tst-getpid3.c new file mode 100644 index 000000000..f1e77f6b1 --- /dev/null +++ b/test/nptl/tst-getpid3.c @@ -0,0 +1,114 @@ +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/wait.h> + + +static pid_t pid; + +static void * +pid_thread (void *arg) +{ + if (pid != getpid ()) + { + printf ("pid wrong in thread: should be %d, is %d\n", + (int) pid, (int) getpid ()); + return (void *) 1L; + } + + return NULL; +} + +static int +do_test (void) +{ + pid = getpid (); + + pthread_t thr; + int ret = pthread_create (&thr, NULL, pid_thread, NULL); + if (ret) + { + printf ("pthread_create failed: %d\n", ret); + return 1; + } + + void *thr_ret; + ret = pthread_join (thr, &thr_ret); + if (ret) + { + printf ("pthread_create failed: %d\n", ret); + return 1; + } + else if (thr_ret) + { + printf ("thread getpid failed\n"); + return 1; + } + + pid_t child = fork (); + if (child == -1) + { + printf ("fork failed: %m\n"); + return 1; + } + else if (child == 0) + { + if (pid == getpid ()) + { + puts ("pid did not change after fork"); + exit (1); + } + + pid = getpid (); + ret = pthread_create (&thr, NULL, pid_thread, NULL); + if (ret) + { + printf ("pthread_create failed: %d\n", ret); + return 1; + } + + ret = pthread_join (thr, &thr_ret); + if (ret) + { + printf ("pthread_create failed: %d\n", ret); + return 1; + } + else if (thr_ret) + { + printf ("thread getpid failed\n"); + return 1; + } + + return 0; + } + + int status; + if (TEMP_FAILURE_RETRY (waitpid (child, &status, 0)) != child) + { + puts ("waitpid failed"); + kill (child, SIGKILL); + return 1; + } + + if (!WIFEXITED (status)) + { + if (WIFSIGNALED (status)) + printf ("died from signal %s\n", strsignal (WTERMSIG (status))); + else + puts ("did not terminate correctly"); + return 1; + } + if (WEXITSTATUS (status) != 0) + { + printf ("exit code %d\n", WEXITSTATUS (status)); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-initializers1-c89.c b/test/nptl/tst-initializers1-c89.c new file mode 100644 index 000000000..7c27c1d54 --- /dev/null +++ b/test/nptl/tst-initializers1-c89.c @@ -0,0 +1 @@ +#include "tst-initializers1.c" diff --git a/test/nptl/tst-initializers1-c99.c b/test/nptl/tst-initializers1-c99.c new file mode 100644 index 000000000..7c27c1d54 --- /dev/null +++ b/test/nptl/tst-initializers1-c99.c @@ -0,0 +1 @@ +#include "tst-initializers1.c" diff --git a/test/nptl/tst-initializers1-gnu89.c b/test/nptl/tst-initializers1-gnu89.c new file mode 100644 index 000000000..7c27c1d54 --- /dev/null +++ b/test/nptl/tst-initializers1-gnu89.c @@ -0,0 +1 @@ +#include "tst-initializers1.c" diff --git a/test/nptl/tst-initializers1-gnu99.c b/test/nptl/tst-initializers1-gnu99.c new file mode 100644 index 000000000..7c27c1d54 --- /dev/null +++ b/test/nptl/tst-initializers1-gnu99.c @@ -0,0 +1 @@ +#include "tst-initializers1.c" diff --git a/test/nptl/tst-initializers1.c b/test/nptl/tst-initializers1.c new file mode 100644 index 000000000..1e353806b --- /dev/null +++ b/test/nptl/tst-initializers1.c @@ -0,0 +1,47 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> + +pthread_mutex_t mtx_normal = PTHREAD_MUTEX_INITIALIZER; +pthread_mutex_t mtx_recursive = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +pthread_mutex_t mtx_errorchk = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; +pthread_mutex_t mtx_adaptive = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; +pthread_rwlock_t rwl_normal = PTHREAD_RWLOCK_INITIALIZER; +pthread_rwlock_t rwl_writer + = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP; +pthread_cond_t cond = PTHREAD_COND_INITIALIZER; + +int +main (void) +{ + if (mtx_normal.__data.__kind != PTHREAD_MUTEX_TIMED_NP) + return 1; + if (mtx_recursive.__data.__kind != PTHREAD_MUTEX_RECURSIVE_NP) + return 1; + if (mtx_errorchk.__data.__kind != PTHREAD_MUTEX_ERRORCHECK_NP) + return 1; + if (mtx_adaptive.__data.__kind != PTHREAD_MUTEX_ADAPTIVE_NP) + return 1; + if (rwl_normal.__data.__flags != PTHREAD_RWLOCK_PREFER_READER_NP) + return 1; + if (rwl_writer.__data.__flags + != PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP) + return 1; + return 0; +} diff --git a/test/nptl/tst-join1.c b/test/nptl/tst-join1.c new file mode 100644 index 000000000..681245a1c --- /dev/null +++ b/test/nptl/tst-join1.c @@ -0,0 +1,82 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + + +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + + +static void * +tf (void *arg) +{ + pthread_t mh = (pthread_t) arg; + void *result; + + if (pthread_mutex_unlock (&lock) != 0) + { + puts ("unlock failed"); + exit (1); + } + + if (pthread_join (mh, &result) != 0) + { + puts ("join failed"); + exit (1); + } + + if (result != (void *) 42l) + { + printf ("result wrong: expected %p, got %p\n", (void *) 42, result); + exit (1); + } + + exit (0); +} + + +static int +do_test (void) +{ + pthread_t th; + + if (pthread_mutex_lock (&lock) != 0) + { + puts ("1st lock failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, (void *) pthread_self ()) != 0) + { + puts ("create failed"); + exit (1); + } + + if (pthread_mutex_lock (&lock) != 0) + { + puts ("2nd lock failed"); + exit (1); + } + + pthread_exit ((void *) 42); +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-join2.c b/test/nptl/tst-join2.c new file mode 100644 index 000000000..03203983c --- /dev/null +++ b/test/nptl/tst-join2.c @@ -0,0 +1,103 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + + +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + + +static void * +tf (void *arg) +{ + if (pthread_mutex_lock (&lock) != 0) + { + puts ("child: mutex_lock failed"); + return NULL; + } + + return (void *) 42l; +} + + +static int +do_test (void) +{ + pthread_t th; + + if (pthread_mutex_lock (&lock) != 0) + { + puts ("mutex_lock failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("mutex_create failed"); + exit (1); + } + + void *status; + int val = pthread_tryjoin_np (th, &status); + if (val == 0) + { + puts ("1st tryjoin succeeded"); + exit (1); + } + else if (val != EBUSY) + { + puts ("1st tryjoin didn't return EBUSY"); + exit (1); + } + + if (pthread_mutex_unlock (&lock) != 0) + { + puts ("mutex_unlock failed"); + exit (1); + } + + while ((val = pthread_tryjoin_np (th, &status)) != 0) + { + if (val != EBUSY) + { + printf ("tryjoin returned %s (%d), expected only 0 or EBUSY\n", + strerror (val), val); + exit (1); + } + + /* Delay minimally. */ + struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 }; + nanosleep (&ts, NULL); + } + + if (status != (void *) 42l) + { + printf ("return value %p, expected %p\n", status, (void *) 42l); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-join3.c b/test/nptl/tst-join3.c new file mode 100644 index 000000000..b25ffd8ba --- /dev/null +++ b/test/nptl/tst-join3.c @@ -0,0 +1,122 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/time.h> + + +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + + +static void * +tf (void *arg) +{ + if (pthread_mutex_lock (&lock) != 0) + { + puts ("child: mutex_lock failed"); + return NULL; + } + + return (void *) 42l; +} + + +static int +do_test (void) +{ + pthread_t th; + + if (pthread_mutex_lock (&lock) != 0) + { + puts ("mutex_lock failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("mutex_create failed"); + exit (1); + } + + void *status; + struct timespec ts; + struct timeval tv; + (void) gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_nsec += 200000000; + if (ts.tv_nsec >= 1000000000) + { + ts.tv_nsec -= 1000000000; + ++ts.tv_sec; + } + int val = pthread_timedjoin_np (th, &status, &ts); + if (val == 0) + { + puts ("1st timedjoin succeeded"); + exit (1); + } + else if (val != ETIMEDOUT) + { + puts ("1st timedjoin didn't return ETIMEDOUT"); + exit (1); + } + + if (pthread_mutex_unlock (&lock) != 0) + { + puts ("mutex_unlock failed"); + exit (1); + } + + while (1) + { + (void) gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_nsec += 200000000; + if (ts.tv_nsec >= 1000000000) + { + ts.tv_nsec -= 1000000000; + ++ts.tv_sec; + } + + val = pthread_timedjoin_np (th, &status, &ts); + if (val == 0) + break; + + if (val != ETIMEDOUT) + { + printf ("timedjoin returned %s (%d), expected only 0 or ETIMEDOUT\n", + strerror (val), val); + exit (1); + } + } + + if (status != (void *) 42l) + { + printf ("return value %p, expected %p\n", status, (void *) 42l); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-join4.c b/test/nptl/tst-join4.c new file mode 100644 index 000000000..96b650ddc --- /dev/null +++ b/test/nptl/tst-join4.c @@ -0,0 +1,124 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + + +static pthread_barrier_t bar; + + +static void * +tf (void *arg) +{ + if (pthread_barrier_wait (&bar) != 0) + { + puts ("tf: barrier_wait failed"); + exit (1); + } + + return (void *) 1l; +} + + +static int +do_test (void) +{ + if (pthread_barrier_init (&bar, NULL, 3) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + + pthread_t th[2]; + + if (pthread_create (&th[0], &a, tf, NULL) != 0) + { + puts ("1st create failed"); + exit (1); + } + + if (pthread_attr_setdetachstate (&a, PTHREAD_CREATE_DETACHED) != 0) + { + puts ("attr_setdetachstate failed"); + exit (1); + } + + if (pthread_create (&th[1], &a, tf, NULL) != 0) + { + puts ("1st create failed"); + exit (1); + } + + if (pthread_attr_destroy (&a) != 0) + { + puts ("attr_destroy failed"); + exit (1); + } + + if (pthread_detach (th[0]) != 0) + { + puts ("could not detach 1st thread"); + exit (1); + } + + int err = pthread_detach (th[0]); + if (err == 0) + { + puts ("second detach of 1st thread succeeded"); + exit (1); + } + if (err != EINVAL) + { + printf ("second detach of 1st thread returned %d, not EINVAL\n", err); + exit (1); + } + + err = pthread_detach (th[1]); + if (err == 0) + { + puts ("detach of 2nd thread succeeded"); + exit (1); + } + if (err != EINVAL) + { + printf ("detach of 2nd thread returned %d, not EINVAL\n", err); + exit (1); + } + + exit (0); +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-join5.c b/test/nptl/tst-join5.c new file mode 100644 index 000000000..feeee2ee3 --- /dev/null +++ b/test/nptl/tst-join5.c @@ -0,0 +1,142 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + + +static void * +tf1 (void *arg) +{ + pthread_join ((pthread_t) arg, NULL); + + puts ("1st join returned"); + + return (void *) 1l; +} + + +static void * +tf2 (void *arg) +{ + int a; + a = pthread_join ((pthread_t) arg, NULL); + + puts ("2nd join returned"); + printf("a = %i\n", a); + + return (void *) 1l; +} + + +static int +do_test (void) +{ + pthread_t th; + + int err = pthread_join (pthread_self (), NULL); + if (err == 0) + { + puts ("1st circular join succeeded"); + exit (1); + } + if (err != EDEADLK) + { + printf ("1st circular join %d, not EDEADLK\n", err); + exit (1); + } + + if (pthread_create (&th, NULL, tf1, (void *) pthread_self ()) != 0) + { + puts ("1st create failed"); + exit (1); + } + + if (pthread_cancel (th) != 0) + { + puts ("cannot cancel 1st thread"); + exit (1); + } + + void *r; + err = pthread_join (th, &r); + if (err != 0) + { + printf ("cannot join 1st thread: %d\n", err); + exit (1); + } + if (r != PTHREAD_CANCELED) + { + puts ("1st thread not canceled"); + exit (1); + } + + err = pthread_join (pthread_self (), NULL); + if (err == 0) + { + puts ("2nd circular join succeeded"); + exit (1); + } + if (err != EDEADLK) + { + printf ("2nd circular join %d, not EDEADLK\n", err); + exit (1); + } + + if (pthread_create (&th, NULL, tf2, (void *) pthread_self ()) != 0) + { + puts ("2nd create failed"); + exit (1); + } + + if (pthread_cancel (th) != 0) + { + puts ("cannot cancel 2nd thread"); + exit (1); + } + + if (pthread_join (th, &r) != 0) + { + puts ("cannot join 2nd thread"); + exit (1); + } + if (r != PTHREAD_CANCELED) + { + puts ("2nd thread not canceled"); + exit (1); + } + + err = pthread_join (pthread_self (), NULL); + if (err == 0) + { + puts ("2nd circular join succeeded"); + exit (1); + } + if (err != EDEADLK) + { + printf ("2nd circular join %d, not EDEADLK\n", err); + exit (1); + } + + exit (0); +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-join6.c b/test/nptl/tst-join6.c new file mode 100644 index 000000000..0c9e7c056 --- /dev/null +++ b/test/nptl/tst-join6.c @@ -0,0 +1,2 @@ +#define WAIT_IN_CHILD 1 +#include "tst-join5.c" diff --git a/test/nptl/tst-key1.c b/test/nptl/tst-key1.c new file mode 100644 index 000000000..ebda39533 --- /dev/null +++ b/test/nptl/tst-key1.c @@ -0,0 +1,88 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <limits.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +int +do_test (void) +{ + int max; +#ifdef PTHREAD_KEYS_MAX + max = PTHREAD_KEYS_MAX; +#else + max = _POSIX_THREAD_KEYS_MAX; +#endif + pthread_key_t *keys = alloca (max * sizeof (pthread_key_t)); + + int i; + for (i = 0; i < max; ++i) + if (pthread_key_create (&keys[i], NULL) != 0) + { + write (2, "key_create failed\n", 18); + _exit (1); + } + else + { + printf ("created key %d\n", i); + + if (pthread_setspecific (keys[i], (const void *) (i + 100l)) != 0) + { + write (2, "setspecific failed\n", 19); + _exit (1); + } + } + + for (i = 0; i < max; ++i) + { + if (pthread_getspecific (keys[i]) != (void *) (i + 100l)) + { + write (2, "getspecific failed\n", 19); + _exit (1); + } + + if (pthread_key_delete (keys[i]) != 0) + { + write (2, "key_delete failed\n", 18); + _exit (1); + } + } + + /* Now it must be once again possible to allocate keys. */ + if (pthread_key_create (&keys[0], NULL) != 0) + { + write (2, "2nd key_create failed\n", 22); + _exit (1); + } + + if (pthread_key_delete (keys[0]) != 0) + { + write (2, "2nd key_delete failed\n", 22); + _exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-key2.c b/test/nptl/tst-key2.c new file mode 100644 index 000000000..c32031e60 --- /dev/null +++ b/test/nptl/tst-key2.c @@ -0,0 +1,114 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <unistd.h> + +#define N 2 + + +static int cnt0; +static void +f0 (void *p) +{ + ++cnt0; +} + + +static int cnt1; +static void +f1 (void *p) +{ + ++cnt1; +} + + +static void (*fcts[N]) (void *) = +{ + f0, + f1 +}; + + +static void * +tf (void *arg) +{ + pthread_key_t *key = (pthread_key_t *) arg; + + if (pthread_setspecific (*key, (void *) -1l) != 0) + { + write (2, "setspecific failed\n", 19); + _exit (1); + } + + return NULL; +} + + +int +do_test (void) +{ + pthread_key_t keys[N]; + + int i; + for (i = 0; i < N; ++i) + if (pthread_key_create (&keys[i], fcts[i]) != 0) + { + write (2, "key_create failed\n", 18); + _exit (1); + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, &keys[1]) != 0) + { + write (2, "create failed\n", 14); + _exit (1); + } + + if (pthread_join (th, NULL) != 0) + { + write (2, "join failed\n", 12); + _exit (1); + } + + if (cnt0 != 0) + { + write (2, "cnt0 != 0\n", 10); + _exit (1); + } + + if (cnt1 != 1) + { + write (2, "cnt1 != 1\n", 10); + _exit (1); + } + + for (i = 0; i < N; ++i) + if (pthread_key_delete (keys[i]) != 0) + { + write (2, "key_delete failed\n", 18); + _exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-key3.c b/test/nptl/tst-key3.c new file mode 100644 index 000000000..f5426ce12 --- /dev/null +++ b/test/nptl/tst-key3.c @@ -0,0 +1,155 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <unistd.h> + +#define N 2 + + +static int cnt0; +static void +f0 (void *p) +{ + ++cnt0; +} + + +static int cnt1; +static void +f1 (void *p) +{ + ++cnt1; +} + + +static void (*fcts[N]) (void *) = +{ + f0, + f1 +}; + + +static pthread_barrier_t b; + + +static void * +tf (void *arg) +{ + pthread_key_t *key = (pthread_key_t *) arg; + + if (pthread_setspecific (*key, (void *) -1l) != 0) + { + write (2, "setspecific failed\n", 19); + _exit (1); + } + + pthread_barrier_wait (&b); + + const struct timespec t = { .tv_sec = 1000, .tv_nsec = 0 }; + while (1) + nanosleep (&t, NULL); + + /* NOTREACHED */ + return NULL; +} + + +int +do_test (void) +{ + pthread_key_t keys[N]; + + int i; + for (i = 0; i < N; ++i) + if (pthread_key_create (&keys[i], fcts[i]) != 0) + { + write (2, "key_create failed\n", 18); + _exit (1); + } + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + write (2, "barrier_init failed\n", 20); + _exit (1); + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, &keys[1]) != 0) + { + write (2, "create failed\n", 14); + _exit (1); + } + + pthread_barrier_wait (&b); + + if (pthread_cancel (th) != 0) + { + write (2, "cancel failed\n", 14); + _exit (1); + } + + void *status; + if (pthread_join (th, &status) != 0) + { + write (2, "join failed\n", 12); + _exit (1); + } + + if (status != PTHREAD_CANCELED) + { + write (2, "thread not canceled\n", 20); + _exit (1); + } + + /* Note that the TSD destructors not necessarily have to have + finished by the time pthread_join returns. At least according to + POSIX. We implement the stronger requirement that they indeed + have run and therefore these tests succeed. */ + if (cnt0 != 0) + { + write (2, "cnt0 != 0\n", 10); + _exit (1); + } + + if (cnt1 != 1) + { + write (2, "cnt1 != 1\n", 10); + _exit (1); + } + + for (i = 0; i < N; ++i) + if (pthread_key_delete (keys[i]) != 0) + { + write (2, "key_delete failed\n", 18); + _exit (1); + } + + if (pthread_barrier_destroy (&b) != 0) + { + write (2, "barrier_destroy failed\n", 23); + _exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-key4.c b/test/nptl/tst-key4.c new file mode 100644 index 000000000..af44c2234 --- /dev/null +++ b/test/nptl/tst-key4.c @@ -0,0 +1,136 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <limits.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +#ifdef PTHREAD_KEYS_MAX +const int max = PTHREAD_KEYS_MAX; +#else +const int max = _POSIX_THREAD_KEYS_MAX; +#endif +static pthread_key_t *keys; + + +static void * +tf1 (void *arg) +{ + int i; + for (i = 0; i < max; ++i) + if (pthread_setspecific (keys[i], (void *) (long int) (i + 1)) != 0) + { + puts ("setspecific failed"); + exit (1); + } + + return NULL; +} + + +static void * +tf2 (void *arg) +{ + int i; + for (i = 0; i < max; ++i) + if (pthread_getspecific (keys[i]) != NULL) + { + printf ("getspecific for key %d not NULL\n", i); + exit (1); + } + + return NULL; +} + + +static int +do_test (void) +{ + keys = alloca (max * sizeof (pthread_key_t)); + + int i; + for (i = 0; i < max; ++i) + if (pthread_key_create (&keys[i], NULL) != 0) + { + puts ("key_create failed"); + exit (1); + } + + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + + for (i = 0; i < 10; ++i) + { + int j; +#define N 2 + pthread_t th[N]; + for (j = 0; j < N; ++j) + if (pthread_create (&th[j], NULL, tf1, NULL) != 0) + { + puts ("1st create failed"); + exit (1); + } + + for (j = 0; j < N; ++j) + if (pthread_join (th[j], NULL) != 0) + { + puts ("1st join failed"); + exit (1); + } + + for (j = 0; j < N; ++j) + if (pthread_create (&th[j], NULL, tf2, NULL) != 0) + { + puts ("2nd create failed"); + exit (1); + } + + for (j = 0; j < N; ++j) + if (pthread_join (th[j], NULL) != 0) + { + puts ("2nd join failed"); + exit (1); + } + } + + if (pthread_attr_destroy (&a) != 0) + { + puts ("attr_destroy failed"); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-kill1.c b/test/nptl/tst-kill1.c new file mode 100644 index 000000000..f58016f97 --- /dev/null +++ b/test/nptl/tst-kill1.c @@ -0,0 +1,99 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> + + +static pthread_cond_t c = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; +static pthread_barrier_t b; + +static void * +tf (void *a) +{ + if (pthread_mutex_lock (&m) != 0) + { + puts ("child: mutex_lock failed"); + exit (1); + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child: barrier_wait failed"); + exit (1); + } + + /* This call should never return. */ + pthread_cond_wait (&c, &m); + + return NULL; +} + + +int +do_test (void) +{ + pthread_t th; + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + if (pthread_mutex_lock (&m) != 0) + { + puts ("mutex_lock failed"); + exit (1); + } + + /* Send the thread a signal which it doesn't catch and which will + cause the process to terminate. */ + if (pthread_kill (th, SIGUSR1) != 0) + { + puts ("kill failed"); + exit (1); + } + + /* This call should never return. */ + pthread_join (th, NULL); + + return 0; +} + + +#define EXPECTED_SIGNAL SIGUSR1 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-kill2.c b/test/nptl/tst-kill2.c new file mode 100644 index 000000000..0315a020f --- /dev/null +++ b/test/nptl/tst-kill2.c @@ -0,0 +1,138 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/time.h> + + +static pthread_cond_t c = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; +static pthread_barrier_t b; + +static void * +tf (void *a) +{ + /* Block SIGUSR1. */ + sigset_t ss; + + sigemptyset (&ss); + sigaddset (&ss, SIGUSR1); + if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0) + { + puts ("child: sigmask failed"); + exit (1); + } + + if (pthread_mutex_lock (&m) != 0) + { + puts ("child: mutex_lock failed"); + exit (1); + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child: barrier_wait failed"); + exit (1); + } + + /* Compute timeout. */ + struct timeval tv; + (void) gettimeofday (&tv, NULL); + struct timespec ts; + TIMEVAL_TO_TIMESPEC (&tv, &ts); + /* Timeout: 1sec. */ + ts.tv_sec += 1; + + /* This call should never return. */ + if (pthread_cond_timedwait (&c, &m, &ts) != ETIMEDOUT) + { + puts ("cond_timedwait didn't time out"); + exit (1); + } + + return NULL; +} + + +int +do_test (void) +{ + pthread_t th; + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + if (pthread_mutex_lock (&m) != 0) + { + puts ("mutex_lock failed"); + exit (1); + } + + /* Send the thread a signal which it has blocked. */ + if (pthread_kill (th, SIGUSR1) != 0) + { + puts ("kill failed"); + exit (1); + } + + if (pthread_mutex_unlock (&m) != 0) + { + puts ("mutex_unlock failed"); + exit (1); + } + + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("join failed"); + exit (1); + } + if (r != NULL) + { + puts ("return value wrong"); + exit (1); + } + + return 0; +} + + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-kill3.c b/test/nptl/tst-kill3.c new file mode 100644 index 000000000..fe9359b39 --- /dev/null +++ b/test/nptl/tst-kill3.c @@ -0,0 +1,158 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/time.h> + + +static pthread_cond_t c = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; +static pthread_barrier_t b; + + +static void +handler (int sig) +{ + write (1, "handler called\n", 15); + _exit (1); +} + + +static void * +tf (void *a) +{ + /* Block SIGUSR1. */ + sigset_t ss; + + sigemptyset (&ss); + sigaddset (&ss, SIGUSR1); + if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0) + { + puts ("child: sigmask failed"); + exit (1); + } + + if (pthread_mutex_lock (&m) != 0) + { + puts ("child: mutex_lock failed"); + exit (1); + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child: barrier_wait failed"); + exit (1); + } + + /* Compute timeout. */ + struct timeval tv; + (void) gettimeofday (&tv, NULL); + struct timespec ts; + TIMEVAL_TO_TIMESPEC (&tv, &ts); + /* Timeout: 1sec. */ + ts.tv_sec += 1; + + /* This call should never return. */ + if (pthread_cond_timedwait (&c, &m, &ts) != ETIMEDOUT) + { + puts ("cond_timedwait didn't time out"); + exit (1); + } + + return NULL; +} + + +int +do_test (void) +{ + pthread_t th; + + struct sigaction sa; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = handler; + if (sigaction (SIGUSR1, &sa, NULL) != 0) + { + puts ("sigaction failed"); + exit (1); + } + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + if (pthread_mutex_lock (&m) != 0) + { + puts ("mutex_lock failed"); + exit (1); + } + + /* Send the thread a signal which it has blocked. */ + if (pthread_kill (th, SIGUSR1) != 0) + { + puts ("kill failed"); + exit (1); + } + + if (pthread_mutex_unlock (&m) != 0) + { + puts ("mutex_unlock failed"); + exit (1); + } + + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("join failed"); + exit (1); + } + if (r != NULL) + { + puts ("return value wrong"); + exit (1); + } + + return 0; +} + + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-kill4.c b/test/nptl/tst-kill4.c new file mode 100644 index 000000000..4ede7ed5d --- /dev/null +++ b/test/nptl/tst-kill4.c @@ -0,0 +1,73 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static void * +tf (void *a) +{ + return NULL; +} + + +int +do_test (void) +{ + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + if (pthread_join (th, NULL) != 0) + { + puts ("join failed"); + exit (1); + } + + /* The following only works because we assume here something about + the implementation. Namely, that the memory allocated for the + thread descriptor is not going away, that the the TID field is + cleared and therefore the signal is sent to process 0, and that + we can savely assume there is no other process with this ID at + that time. */ + int e = pthread_kill (th, 0); + if (e == 0) + { + puts ("pthread_kill succeeded"); + exit (1); + } + if (e != ESRCH) + { + puts ("pthread_kill didn't return ESRCH"); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-kill5.c b/test/nptl/tst-kill5.c new file mode 100644 index 000000000..254015c36 --- /dev/null +++ b/test/nptl/tst-kill5.c @@ -0,0 +1,48 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> + + +int +do_test (void) +{ + /* XXX This test might require architecture and system specific changes. + There is no guarantee that this signal number is invalid. */ + int e = pthread_kill (pthread_self (), SIGRTMAX + 10); + if (e == 0) + { + puts ("kill didn't failed"); + exit (1); + } + if (e != EINVAL) + { + puts ("error not EINVAL"); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-kill6.c b/test/nptl/tst-kill6.c new file mode 100644 index 000000000..f530e4ed0 --- /dev/null +++ b/test/nptl/tst-kill6.c @@ -0,0 +1,161 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <semaphore.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static pthread_t receiver; +static sem_t sem; +static pthread_barrier_t b; + +static void +handler (int sig) +{ + if (sig != SIGUSR1) + { + write (STDOUT_FILENO, "wrong signal\n", 13); + _exit (1); + } + + if (pthread_self () != receiver) + { + write (STDOUT_FILENO, "not the intended receiver\n", 26); + _exit (1); + } + + if (sem_post (&sem) != 0) + { + write (STDOUT_FILENO, "sem_post failed\n", 16); + _exit (1); + } +} + + +static void * +tf (void *a) +{ + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child: barrier_wait failed"); + exit (1); + } + + return NULL; +} + + +int +do_test (void) +{ + struct sigaction sa; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + sa.sa_handler = handler; + if (sigaction (SIGUSR1, &sa, NULL) != 0) + { + puts ("sigaction failed"); + exit (1); + } + +#define N 20 + + if (pthread_barrier_init (&b, NULL, N + 1) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + + pthread_t th[N]; + int i; + for (i = 0; i < N; ++i) + if (pthread_create (&th[i], &a, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + if (pthread_attr_destroy (&a) != 0) + { + puts ("attr_destroy failed"); + exit (1); + } + + if (sem_init (&sem, 0, 0) != 0) + { + puts ("sem_init failed"); + exit (1); + } + + for (i = 0; i < N * 10; ++i) + { + receiver = th[i % N]; + + if (pthread_kill (receiver, SIGUSR1) != 0) + { + puts ("kill failed"); + exit (1); + } + + if (TEMP_FAILURE_RETRY (sem_wait (&sem)) != 0) + { + puts ("sem_wait failed"); + exit (1); + } + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + for (i = 0; i < N; ++i) + if (pthread_join (th[i], NULL) != 0) + { + puts ("join failed"); + exit (1); + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mqueue.h b/test/nptl/tst-mqueue.h new file mode 100644 index 000000000..1401c3e03 --- /dev/null +++ b/test/nptl/tst-mqueue.h @@ -0,0 +1,83 @@ +/* Common code for message queue passing tests. + Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@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, see + <http://www.gnu.org/licenses/>. */ + +#include <mqueue.h> +#include <search.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/uio.h> +#include <unistd.h> + +static int temp_mq_fd; + +/* Add temporary files in list. */ +static void +__attribute__ ((unused)) +add_temp_mq (const char *name) +{ + struct iovec iov[2]; + iov[0].iov_base = (char *) name; + iov[0].iov_len = strlen (name); + iov[1].iov_base = (char *) "\n"; + iov[1].iov_len = 1; + if (writev (temp_mq_fd, iov, 2) != iov[0].iov_len + 1) + printf ("Could not record temp mq filename %s\n", name); +} + +/* Delete all temporary message queues. */ +static void +do_cleanup (void) +{ + if (lseek (temp_mq_fd, 0, SEEK_SET) != 0) + return; + + FILE *f = fdopen (temp_mq_fd, "r"); + if (f == NULL) + return; + + char *line = NULL; + size_t n = 0; + ssize_t rets; + while ((rets = getline (&line, &n, f)) > 0) + { + if (line[rets - 1] != '\n') + continue; + + line[rets - 1] = '\0'; + mq_unlink (line); + } + fclose (f); +} + +static void +do_prepare (void) +{ + char name [] = "/tmp/tst-mqueueN.XXXXXX"; + temp_mq_fd = mkstemp (name); + if (temp_mq_fd == -1) + { + printf ("Could not create temporary file %s: %m\n", name); + exit (1); + } + unlink (name); +} + +#define PREPARE(argc, argv) do_prepare () +#define CLEANUP_HANDLER do_cleanup () diff --git a/test/nptl/tst-mqueue1.c b/test/nptl/tst-mqueue1.c new file mode 100644 index 000000000..5ec79cf3b --- /dev/null +++ b/test/nptl/tst-mqueue1.c @@ -0,0 +1,416 @@ +/* Test message queue passing. + Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <mqueue.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/wait.h> +#include <time.h> +#include <unistd.h> +#include "tst-mqueue.h" + +static int +intcmp (const void *a, const void *b) +{ + if (*(unsigned char *)a < *(unsigned char *)b) + return 1; + if (*(unsigned char *)a > *(unsigned char *)b) + return -1; + return 0; +} + +static int +check_attrs (struct mq_attr *attr, int nonblock, long cnt) +{ + int result = 0; + + if (attr->mq_maxmsg != 10 || attr->mq_msgsize != 1) + { + printf ("attributes don't match those passed to mq_open\n" + "mq_maxmsg %ld, mq_msgsize %ld\n", + attr->mq_maxmsg, attr->mq_msgsize); + result = 1; + } + + if ((attr->mq_flags & O_NONBLOCK) != nonblock) + { + printf ("mq_flags %lx != %x\n", (attr->mq_flags & O_NONBLOCK), nonblock); + result = 1; + } + + if (attr->mq_curmsgs != cnt) + { + printf ("mq_curmsgs %ld != %ld\n", attr->mq_curmsgs, cnt); + result = 1; + } + + return result; +} + +static int +do_one_test (mqd_t q, const char *name, int nonblock) +{ + int result = 0; + + char v [] + = { 0x32, 0x62, 0x22, 0x31, 0x11, 0x73, 0x61, 0x21, 0x72, 0x71, 0x81 }; + + struct mq_attr attr; + memset (&attr, 0xaa, sizeof (attr)); + if (mq_getattr (q, &attr) != 0) + { + printf ("mq_getattr failed: %m\n"); + result = 1; + } + else + result |= check_attrs (&attr, nonblock, 0); + + if (mq_receive (q, &v[0], 1, NULL) != -1) + { + puts ("mq_receive on O_WRONLY mqd_t unexpectedly succeeded"); + result = 1; + } + else if (errno != EBADF) + { + printf ("mq_receive on O_WRONLY mqd_t did not fail with EBADF: %m\n"); + result = 1; + } + + struct timespec ts; + if (clock_gettime (CLOCK_REALTIME, &ts) == 0) + --ts.tv_sec; + else + { + ts.tv_sec = time (NULL) - 1; + ts.tv_nsec = 0; + } + + int ret; + for (int i = 0; i < 10; ++i) + { + if (i & 1) + ret = mq_send (q, &v[i], 1, v[i] >> 4); + else + ret = mq_timedsend (q, &v[i], 1, v[i] >> 4, &ts); + + if (ret) + { + printf ("mq_%ssend failed: %m\n", (i & 1) ? "" : "timed"); + result = 1; + } + } + + ret = mq_timedsend (q, &v[10], 1, 8, &ts); + if (ret != -1) + { + puts ("mq_timedsend on full queue did not fail"); + result = 1; + } + else if (errno != (nonblock ? EAGAIN : ETIMEDOUT)) + { + printf ("mq_timedsend on full queue did not fail with %s: %m\n", + nonblock ? "EAGAIN" : "ETIMEDOUT"); + result = 1; + } + + if (nonblock) + { + ret = mq_send (q, &v[10], 1, 8); + if (ret != -1) + { + puts ("mq_send on full non-blocking queue did not fail"); + result = 1; + } + else if (errno != EAGAIN) + { + printf ("mq_send on full non-blocking queue did not fail" + "with EAGAIN: %m\n"); + result = 1; + } + } + + memset (&attr, 0xaa, sizeof (attr)); + if (mq_getattr (q, &attr) != 0) + { + printf ("mq_getattr failed: %m\n"); + result = 1; + } + else + result |= check_attrs (&attr, nonblock, 10); + + pid_t pid = fork (); + if (pid == -1) + { + printf ("fork failed: %m\n"); + result = 1; + } + else if (pid == 0) + { + result = 0; + + if (mq_close (q) != 0) + { + printf ("mq_close in child failed: %m\n"); + result = 1; + } + + q = mq_open (name, O_RDONLY | nonblock); + if (q == (mqd_t) -1) + { + printf ("mq_open in child failed: %m\n"); + exit (1); + } + + memset (&attr, 0xaa, sizeof (attr)); + if (mq_getattr (q, &attr) != 0) + { + printf ("mq_getattr failed: %m\n"); + result = 1; + } + else + result |= check_attrs (&attr, nonblock, 10); + + char vr[11] = { }; + unsigned int prio; + ssize_t rets; + + if (mq_send (q, &v[0], 1, 1) != -1) + { + puts ("mq_send on O_RDONLY mqd_t unexpectedly succeeded"); + result = 1; + } + else if (errno != EBADF) + { + printf ("mq_send on O_WRONLY mqd_t did not fail with EBADF: %m\n"); + result = 1; + } + + for (int i = 0; i < 10; ++i) + { + if (i & 1) + rets = mq_receive (q, &vr[i], 1, &prio); + else + rets = mq_timedreceive (q, &vr[i], 1, &prio, &ts); + + if (rets != 1) + { + if (rets == -1) + printf ("mq_%sreceive failed: %m\n", (i & 1) ? "" : "timed"); + else + printf ("mq_%sreceive returned %zd != 1\n", + (i & 1) ? "" : "timed", rets); + result = 1; + } + else if (prio != (unsigned int) vr[i] >> 4) + { + printf ("unexpected priority %x for value %02x\n", prio, + vr[i]); + result = 1; + } + } + + qsort (v, 10, 1, intcmp); + if (memcmp (v, vr, 10) != 0) + { + puts ("messages not received in expected order"); + result = 1; + } + + rets = mq_timedreceive (q, &vr[10], 1, &prio, &ts); + if (rets != -1) + { + puts ("mq_timedreceive on empty queue did not fail"); + result = 1; + } + else if (errno != (nonblock ? EAGAIN : ETIMEDOUT)) + { + printf ("mq_timedreceive on empty queue did not fail with %s: %m\n", + nonblock ? "EAGAIN" : "ETIMEDOUT"); + result = 1; + } + + if (nonblock) + { + ret = mq_receive (q, &vr[10], 1, &prio); + if (ret != -1) + { + puts ("mq_receive on empty non-blocking queue did not fail"); + result = 1; + } + else if (errno != EAGAIN) + { + printf ("mq_receive on empty non-blocking queue did not fail" + "with EAGAIN: %m\n"); + result = 1; + } + } + + memset (&attr, 0xaa, sizeof (attr)); + if (mq_getattr (q, &attr) != 0) + { + printf ("mq_getattr failed: %m\n"); + result = 1; + } + else + result |= check_attrs (&attr, nonblock, 0); + + if (mq_close (q) != 0) + { + printf ("mq_close in child failed: %m\n"); + result = 1; + } + + exit (result); + } + + int status; + if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid) + { + printf ("waitpid failed: %m\n"); + kill (pid, SIGKILL); + result = 1; + } + else if (!WIFEXITED (status) || WEXITSTATUS (status)) + { + printf ("child failed: %d\n", status); + result = 1; + } + + memset (&attr, 0xaa, sizeof (attr)); + if (mq_getattr (q, &attr) != 0) + { + printf ("mq_getattr failed: %m\n"); + result = 1; + } + else + result |= check_attrs (&attr, nonblock, 0); + + return result; +} + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ + int result = 0; + + char name[sizeof "/tst-mqueue1-" + sizeof (pid_t) * 3]; + snprintf (name, sizeof (name), "/tst-mqueue1-%u", getpid ()); + + struct mq_attr attr = { .mq_maxmsg = 10, .mq_msgsize = 1 }; + mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_WRONLY, 0600, &attr); + + if (q == (mqd_t) -1) + { + printf ("mq_open failed with: %m\n"); + return result; + } + else + add_temp_mq (name); + + result |= do_one_test (q, name, 0); + + mqd_t q2 = mq_open (name, O_WRONLY | O_NONBLOCK); + if (q2 == (mqd_t) -1) + { + printf ("mq_open failed with: %m\n"); + q2 = q; + result = 1; + } + else + { + if (mq_close (q) != 0) + { + printf ("mq_close in parent failed: %m\n"); + result = 1; + } + + q = q2; + result |= do_one_test (q, name, O_NONBLOCK); + + if (mq_getattr (q, &attr) != 0) + { + printf ("mq_getattr failed: %m\n"); + result = 1; + } + else + { + attr.mq_flags ^= O_NONBLOCK; + + struct mq_attr attr2; + memset (&attr2, 0x55, sizeof (attr2)); + if (mq_setattr (q, &attr, &attr2) != 0) + { + printf ("mq_setattr failed: %m\n"); + result = 1; + } + else if (attr.mq_flags != (attr2.mq_flags ^ O_NONBLOCK) + || attr.mq_maxmsg != attr2.mq_maxmsg + || attr.mq_msgsize != attr2.mq_msgsize + || attr.mq_curmsgs != 0 + || attr2.mq_curmsgs != 0) + { + puts ("mq_setattr returned unexpected values in *omqstat"); + result = 1; + } + else + { + result |= do_one_test (q, name, 0); + + if (mq_setattr (q, &attr2, NULL) != 0) + { + printf ("mq_setattr failed: %m\n"); + result = 1; + } + else + result |= do_one_test (q, name, O_NONBLOCK); + } + } + } + + if (mq_unlink (name) != 0) + { + printf ("mq_unlink failed: %m\n"); + result = 1; + } + + if (mq_close (q) != 0) + { + printf ("mq_close in parent failed: %m\n"); + result = 1; + } + + if (mq_close (q) != -1) + { + puts ("second mq_close did not fail"); + result = 1; + } + else if (errno != EBADF) + { + printf ("second mq_close did not fail with EBADF: %m\n"); + result = 1; + } + + return result; +} + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mqueue2.c b/test/nptl/tst-mqueue2.c new file mode 100644 index 000000000..9fbaedd90 --- /dev/null +++ b/test/nptl/tst-mqueue2.c @@ -0,0 +1,476 @@ +/* Test message queue passing. + Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <mqueue.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/time.h> +#include <sys/wait.h> +#include <time.h> +#include <unistd.h> +#include "tst-mqueue.h" + +static void +alrm_handler (int sig) +{ +} + +#define TIMEOUT 10 +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ + int result = 0; + + char name[sizeof "/tst-mqueue2-" + sizeof (pid_t) * 3]; + snprintf (name, sizeof (name), "/tst-mqueue2-%u", getpid ()); + + struct mq_attr attr = { .mq_maxmsg = 2, .mq_msgsize = 2 }; + mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr); + + if (q == (mqd_t) -1) + { + printf ("mq_open failed with: %m\n"); + return result; + } + else + add_temp_mq (name); + + mqd_t q2 = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr); + if (q2 != (mqd_t) -1) + { + puts ("mq_open with O_EXCL unexpectedly succeeded"); + result = 1; + } + else if (errno != EEXIST) + { + printf ("mq_open did not fail with EEXIST: %m\n"); + result = 1; + } + + char name2[sizeof "/tst-mqueue2-2-" + sizeof (pid_t) * 3]; + snprintf (name2, sizeof (name2), "/tst-mqueue2-2-%u", getpid ()); + + attr.mq_maxmsg = -2; + q2 = mq_open (name2, O_CREAT | O_EXCL | O_RDWR, 0600, &attr); + if (q2 != (mqd_t) -1) + { + puts ("mq_open with invalid mq_maxmsg unexpectedly succeeded"); + add_temp_mq (name2); + result = 1; + } + else if (errno != EINVAL) + { + printf ("mq_open with invalid mq_maxmsg did not fail with " + "EINVAL: %m\n"); + result = 1; + } + + attr.mq_maxmsg = 2; + attr.mq_msgsize = -56; + q2 = mq_open (name2, O_CREAT | O_EXCL | O_RDWR, 0600, &attr); + if (q2 != (mqd_t) -1) + { + puts ("mq_open with invalid mq_msgsize unexpectedly succeeded"); + add_temp_mq (name2); + result = 1; + } + else if (errno != EINVAL) + { + printf ("mq_open with invalid mq_msgsize did not fail with " + "EINVAL: %m\n"); + result = 1; + } + + char buf[3]; + struct timespec ts; + if (clock_gettime (CLOCK_REALTIME, &ts) == 0) + ts.tv_sec += 10; + else + { + ts.tv_sec = time (NULL) + 10; + ts.tv_nsec = 0; + } + + if (mq_timedreceive (q, buf, 1, NULL, &ts) == 0) + { + puts ("mq_timedreceive with too small msg_len did not fail"); + result = 1; + } + else if (errno != EMSGSIZE) + { + printf ("mq_timedreceive with too small msg_len did not fail with " + "EMSGSIZE: %m\n"); + result = 1; + } + + ts.tv_nsec = -1; + if (mq_timedreceive (q, buf, 2, NULL, &ts) == 0) + { + puts ("mq_timedreceive with negative tv_nsec did not fail"); + result = 1; + } + else if (errno != EINVAL) + { + printf ("mq_timedreceive with negative tv_nsec did not fail with " + "EINVAL: %m\n"); + result = 1; + } + + ts.tv_nsec = 1000000000; + if (mq_timedreceive (q, buf, 2, NULL, &ts) == 0) + { + puts ("mq_timedreceive with tv_nsec >= 1000000000 did not fail"); + result = 1; + } + else if (errno != EINVAL) + { + printf ("mq_timedreceive with tv_nsec >= 1000000000 did not fail with " + "EINVAL: %m\n"); + result = 1; + } + + struct sigaction sa = { .sa_handler = alrm_handler, .sa_flags = 0 }; + sigemptyset (&sa.sa_mask); + sigaction (SIGALRM, &sa, NULL); + + struct itimerval it = { .it_value = { .tv_sec = 1 } }; + setitimer (ITIMER_REAL, &it, NULL); + + if (mq_receive (q, buf, 2, NULL) == 0) + { + puts ("mq_receive on empty queue did not block"); + result = 1; + } + else if (errno != EINTR) + { + printf ("mq_receive on empty queue did not fail with EINTR: %m\n"); + result = 1; + } + + setitimer (ITIMER_REAL, &it, NULL); + + ts.tv_nsec = 0; + if (mq_timedreceive (q, buf, 2, NULL, &ts) == 0) + { + puts ("mq_timedreceive on empty queue did not block"); + result = 1; + } + else if (errno != EINTR) + { + printf ("mq_timedreceive on empty queue did not fail with EINTR: %m\n"); + result = 1; + } + + buf[0] = '6'; + buf[1] = '7'; + if (mq_send (q, buf, 2, 3) != 0 + || (buf[0] = '8', mq_send (q, buf, 1, 4) != 0)) + { + printf ("mq_send failed: %m\n"); + result = 1; + } + + memset (buf, ' ', sizeof (buf)); + + unsigned int prio; + ssize_t rets = mq_receive (q, buf, 3, &prio); + if (rets != 1) + { + if (rets == -1) + printf ("mq_receive failed: %m\n"); + else + printf ("mq_receive returned %zd != 1\n", rets); + result = 1; + } + else if (prio != 4 || memcmp (buf, "8 ", 3) != 0) + { + printf ("mq_receive prio %u (4) buf \"%c%c%c\" (\"8 \")\n", + prio, buf[0], buf[1], buf[2]); + result = 1; + } + + rets = mq_receive (q, buf, 2, NULL); + if (rets != 2) + { + if (rets == -1) + printf ("mq_receive failed: %m\n"); + else + printf ("mq_receive returned %zd != 2\n", rets); + result = 1; + } + else if (memcmp (buf, "67 ", 3) != 0) + { + printf ("mq_receive buf \"%c%c%c\" != \"67 \"\n", + buf[0], buf[1], buf[2]); + result = 1; + } + + buf[0] = '2'; + buf[1] = '1'; + if (clock_gettime (CLOCK_REALTIME, &ts) != 0) + ts.tv_sec = time (NULL); + ts.tv_nsec = -1000000001; + if ((mq_timedsend (q, buf, 2, 5, &ts) != 0 + && (errno != EINVAL || mq_send (q, buf, 2, 5) != 0)) + || (buf[0] = '3', ts.tv_nsec = -ts.tv_nsec, + (mq_timedsend (q, buf, 1, 4, &ts) != 0 + && (errno != EINVAL || mq_send (q, buf, 1, 4) != 0)))) + { + printf ("mq_timedsend failed: %m\n"); + result = 1; + } + + buf[0] = '-'; + ts.tv_nsec = 1000000001; + if (mq_timedsend (q, buf, 1, 6, &ts) == 0) + { + puts ("mq_timedsend with tv_nsec >= 1000000000 did not fail"); + result = 1; + } + else if (errno != EINVAL) + { + printf ("mq_timedsend with tv_nsec >= 1000000000 did not fail with " + "EINVAL: %m\n"); + result = 1; + } + + ts.tv_nsec = -2; + if (mq_timedsend (q, buf, 1, 6, &ts) == 0) + { + puts ("mq_timedsend with negative tv_nsec did not fail"); + result = 1; + } + else if (errno != EINVAL) + { + printf ("mq_timedsend with megatove tv_nsec did not fail with " + "EINVAL: %m\n"); + result = 1; + } + + setitimer (ITIMER_REAL, &it, NULL); + + if (mq_send (q, buf, 2, 8) == 0) + { + puts ("mq_send on full queue did not block"); + result = 1; + } + else if (errno != EINTR) + { + printf ("mq_send on full queue did not fail with EINTR: %m\n"); + result = 1; + } + + setitimer (ITIMER_REAL, &it, NULL); + + ts.tv_sec += 10; + ts.tv_nsec = 0; + if (mq_timedsend (q, buf, 2, 7, &ts) == 0) + { + puts ("mq_timedsend on full queue did not block"); + result = 1; + } + else if (errno != EINTR) + { + printf ("mq_timedsend on full queue did not fail with EINTR: %m\n"); + result = 1; + } + + memset (buf, ' ', sizeof (buf)); + + if (clock_gettime (CLOCK_REALTIME, &ts) != 0) + ts.tv_sec = time (NULL); + ts.tv_nsec = -1000000001; + rets = mq_timedreceive (q, buf, 2, &prio, &ts); + if (rets == -1 && errno == EINVAL) + rets = mq_receive (q, buf, 2, &prio); + if (rets != 2) + { + if (rets == -1) + printf ("mq_timedreceive failed: %m\n"); + else + printf ("mq_timedreceive returned %zd != 2\n", rets); + result = 1; + } + else if (prio != 5 || memcmp (buf, "21 ", 3) != 0) + { + printf ("mq_timedreceive prio %u (5) buf \"%c%c%c\" (\"21 \")\n", + prio, buf[0], buf[1], buf[2]); + result = 1; + } + + if (mq_receive (q, buf, 1, NULL) == 0) + { + puts ("mq_receive with too small msg_len did not fail"); + result = 1; + } + else if (errno != EMSGSIZE) + { + printf ("mq_receive with too small msg_len did not fail with " + "EMSGSIZE: %m\n"); + result = 1; + } + + ts.tv_nsec = -ts.tv_nsec; + rets = mq_timedreceive (q, buf, 2, NULL, &ts); + if (rets == -1 && errno == EINVAL) + rets = mq_receive (q, buf, 2, NULL); + if (rets != 1) + { + if (rets == -1) + printf ("mq_timedreceive failed: %m\n"); + else + printf ("mq_timedreceive returned %zd != 1\n", rets); + result = 1; + } + else if (memcmp (buf, "31 ", 3) != 0) + { + printf ("mq_timedreceive buf \"%c%c%c\" != \"31 \"\n", + buf[0], buf[1], buf[2]); + result = 1; + } + + if (mq_send (q, "", 0, 2) != 0) + { + printf ("mq_send with msg_len 0 failed: %m\n"); + result = 1; + } + + rets = mq_receive (q, buf, 2, &prio); + if (rets) + { + if (rets == -1) + printf ("mq_receive failed: %m\n"); + else + printf ("mq_receive returned %zd != 0\n", rets); + result = 1; + } + + long mq_prio_max = sysconf (_SC_MQ_PRIO_MAX); + if (mq_prio_max > 0 && (unsigned int) mq_prio_max == mq_prio_max) + { + if (mq_send (q, buf, 1, mq_prio_max) == 0) + { + puts ("mq_send with MQ_PRIO_MAX priority unpexpectedly succeeded"); + result = 1; + } + else if (errno != EINVAL) + { + printf ("mq_send with MQ_PRIO_MAX priority did not fail with " + "EINVAL: %m\n"); + result = 1; + } + + if (mq_send (q, buf, 1, mq_prio_max - 1) != 0) + { + printf ("mq_send with MQ_PRIO_MAX-1 priority failed: %m\n"); + result = 1; + } + } + + if (mq_unlink (name) != 0) + { + printf ("mq_unlink failed: %m\n"); + result = 1; + } + + q2 = mq_open (name, O_RDWR); + if (q2 != (mqd_t) -1) + { + printf ("mq_open of unlinked %s without O_CREAT unexpectedly" + "succeeded\n", name); + result = 1; + } + else if (errno != ENOENT) + { + printf ("mq_open of unlinked %s without O_CREAT did not fail with " + "ENOENT: %m\n", name); + result = 1; + } + + if (mq_close (q) != 0) + { + printf ("mq_close in parent failed: %m\n"); + result = 1; + } + + if (mq_receive (q, buf, 2, NULL) == 0) + { + puts ("mq_receive on invalid mqd_t did not fail"); + result = 1; + } + else if (errno != EBADF) + { + printf ("mq_receive on invalid mqd_t did not fail with EBADF: %m\n"); + result = 1; + } + + if (mq_send (q, buf, 1, 2) == 0) + { + puts ("mq_send on invalid mqd_t did not fail"); + result = 1; + } + else if (errno != EBADF) + { + printf ("mq_send on invalid mqd_t did not fail with EBADF: %m\n"); + result = 1; + } + + if (mq_getattr (q, &attr) == 0) + { + puts ("mq_getattr on invalid mqd_t did not fail"); + result = 1; + } + else if (errno != EBADF) + { + printf ("mq_getattr on invalid mqd_t did not fail with EBADF: %m\n"); + result = 1; + } + + memset (&attr, 0, sizeof (attr)); + if (mq_setattr (q, &attr, NULL) == 0) + { + puts ("mq_setattr on invalid mqd_t did not fail"); + result = 1; + } + else if (errno != EBADF) + { + printf ("mq_setattr on invalid mqd_t did not fail with EBADF: %m\n"); + result = 1; + } + + if (mq_unlink ("/tst-mqueue2-which-should-never-exist") != -1) + { + puts ("mq_unlink of non-existant message queue unexpectedly succeeded"); + result = 1; + } + else if (errno != ENOENT) + { + printf ("mq_unlink of non-existant message queue did not fail with " + "ENOENT: %m\n"); + result = 1; + } + return result; +} + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mqueue3.c b/test/nptl/tst-mqueue3.c new file mode 100644 index 000000000..5686f43f7 --- /dev/null +++ b/test/nptl/tst-mqueue3.c @@ -0,0 +1,243 @@ +/* Test SIGEV_THREAD handling for POSIX message queues. + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <mqueue.h> +#include <signal.h> +#include <stddef.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/mman.h> +#include <sys/wait.h> +#include <unistd.h> + +#if _POSIX_THREADS +# include <pthread.h> + +static pid_t pid; +static mqd_t m; +static const char message[] = "hello"; + +# define MAXMSG 10 +# define MSGSIZE 10 +# define UNIQUE 42 + + +static void +fct (union sigval s) +{ + /* Put the mq in non-blocking mode. */ + struct mq_attr attr; + if (mq_getattr (m, &attr) != 0) + { + printf ("%s: mq_getattr failed: %m\n", __FUNCTION__); + exit (1); + } + attr.mq_flags |= O_NONBLOCK; + if (mq_setattr (m, &attr, NULL) != 0) + { + printf ("%s: mq_setattr failed: %m\n", __FUNCTION__); + exit (1); + } + + /* Check the values. */ + if (attr.mq_maxmsg != MAXMSG) + { + printf ("%s: mq_maxmsg wrong: is %ld, expecte %d\n", + __FUNCTION__, attr.mq_maxmsg, MAXMSG); + exit (1); + } + if (attr.mq_msgsize != MAXMSG) + { + printf ("%s: mq_msgsize wrong: is %ld, expecte %d\n", + __FUNCTION__, attr.mq_msgsize, MSGSIZE); + exit (1); + } + + /* Read the message. */ + char buf[attr.mq_msgsize]; + ssize_t n = TEMP_FAILURE_RETRY (mq_receive (m, buf, attr.mq_msgsize, NULL)); + if (n != sizeof (message)) + { + printf ("%s: length of message wrong: is %zd, expected %zu\n", + __FUNCTION__, n, sizeof (message)); + exit (1); + } + if (memcmp (buf, message, sizeof (message)) != 0) + { + printf ("%s: message wrong: is \"%s\", expected \"%s\"\n", + __FUNCTION__, buf, message); + exit (1); + } + + exit (UNIQUE); +} + + +int +do_test (void) +{ + char tmpfname[] = "/tmp/tst-mqueue3-barrier.XXXXXX"; + int fd = mkstemp (tmpfname); + if (fd == -1) + { + printf ("cannot open temporary file: %m\n"); + return 1; + } + + /* Make sure it is always removed. */ + unlink (tmpfname); + + /* Create one page of data. */ + size_t ps = sysconf (_SC_PAGESIZE); + char data[ps]; + memset (data, '\0', ps); + + /* Write the data to the file. */ + if (write (fd, data, ps) != (ssize_t) ps) + { + puts ("short write"); + return 1; + } + + void *mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (mem == MAP_FAILED) + { + printf ("mmap failed: %m\n"); + return 1; + } + + pthread_barrier_t *b; + b = (pthread_barrier_t *) (((uintptr_t) mem + __alignof (pthread_barrier_t)) + & ~(__alignof (pthread_barrier_t) - 1)); + + pthread_barrierattr_t a; + if (pthread_barrierattr_init (&a) != 0) + { + puts ("barrierattr_init failed"); + return 1; + } + + if (pthread_barrierattr_setpshared (&a, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("barrierattr_setpshared failed, could not test"); + return 0; + } + + if (pthread_barrier_init (b, &a, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + if (pthread_barrierattr_destroy (&a) != 0) + { + puts ("barrierattr_destroy failed"); + return 1; + } + + /* Name for the message queue. */ + char mqname[sizeof ("/tst-mqueue3-") + 3 * sizeof (pid_t)]; + snprintf (mqname, sizeof (mqname) - 1, "/tst-mqueue3-%ld", + (long int) getpid ()); + + /* Create the message queue. */ + struct mq_attr attr = { .mq_maxmsg = MAXMSG, .mq_msgsize = MSGSIZE }; + m = mq_open (mqname, O_CREAT | O_EXCL | O_RDWR, 0600, &attr); + if (m == -1) + { + if (errno == ENOSYS) + { + puts ("not implemented"); + return 0; + } + + puts ("mq_open failed"); + return 1; + } + + /* Unlink the message queue right away. */ + if (mq_unlink (mqname) != 0) + { + puts ("mq_unlink failed"); + return 1; + } + + pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + return 1; + } + if (pid == 0) + { + /* Request notification via thread. */ + struct sigevent ev; + ev.sigev_notify = SIGEV_THREAD; + ev.sigev_notify_function = fct; + ev.sigev_value.sival_ptr = NULL; + ev.sigev_notify_attributes = NULL; + + /* Tell the kernel. */ + if (mq_notify (m,&ev) != 0) + { + puts ("mq_notify failed"); + exit (1); + } + + /* Tell the parent we are ready. */ + (void) pthread_barrier_wait (b); + + /* Make sure the process goes away eventually. */ + alarm (10); + + /* Do nothing forever. */ + while (1) + pause (); + } + + /* Wait for the child process to register to notification method. */ + (void) pthread_barrier_wait (b); + + /* Send the message. */ + if (mq_send (m, message, sizeof (message), 1) != 0) + { + kill (pid, SIGKILL); + puts ("mq_send failed"); + return 1; + } + + int r; + if (TEMP_FAILURE_RETRY (waitpid (pid, &r, 0)) != pid) + { + kill (pid, SIGKILL); + puts ("waitpid failed"); + return 1; + } + + return WIFEXITED (r) && WEXITSTATUS (r) == UNIQUE ? 0 : 1; +} +# define TEST_FUNCTION do_test () +#else +# define TEST_FUNCTION 0 +#endif + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mqueue4.c b/test/nptl/tst-mqueue4.c new file mode 100644 index 000000000..87ef0c3c0 --- /dev/null +++ b/test/nptl/tst-mqueue4.c @@ -0,0 +1,287 @@ +/* Test message queue passing. + Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <mqueue.h> +#include <limits.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/time.h> +#include <sys/wait.h> +#include <time.h> +#include <unistd.h> +#include "tst-mqueue.h" + +#define TIMEOUT 4 +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ + int result = 0; + + char name[sizeof "/tst-mqueue4-" + sizeof (pid_t) * 3 + NAME_MAX]; + char *p; + p = name + snprintf (name, sizeof (name), "/tst-mqueue4-%u", getpid ()); + struct mq_attr attr = { .mq_maxmsg = 2, .mq_msgsize = 2 }; + mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr); + + if (q == (mqd_t) -1) + { + printf ("mq_open failed with: %m\n"); + return result; + } + else + add_temp_mq (name); + + *p = '.'; + memset (p + 1, 'x', NAME_MAX + 1 - (p - name)); + name[NAME_MAX + 1] = '\0'; + + mqd_t q2 = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr); + if (q2 == (mqd_t) -1) + { + printf ("mq_open with NAME_MAX long name compoment failed with: %m\n"); + result = 1; + } + + if (mq_unlink (name) != 0) + { + printf ("mq_unlink failed: %m\n"); + result = 1; + } + + if (mq_close (q2) != 0) + { + printf ("mq_close failed: %m\n"); + result = 1; + } + + name[NAME_MAX + 1] = 'x'; + name[NAME_MAX + 2] = '\0'; + q2 = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr); + if (q2 != (mqd_t) -1) + { + puts ("mq_open with too long name component unexpectedly succeeded"); + mq_unlink (name); + mq_close (q2); + result = 1; + } + else if (errno != ENAMETOOLONG) + { + printf ("mq_open with too long name component did not fail with " + "ENAMETOOLONG: %m\n"); + result = 1; + } + + if (mq_unlink (name) == 0) + { + puts ("mq_unlink with too long name component unexpectedly succeeded"); + result = 1; + } + else if (errno != ENAMETOOLONG) + { + printf ("mq_unlink with too long name component did not fail with " + "ENAMETOOLONG: %m\n"); + result = 1; + } + + *p = '\0'; + attr.mq_maxmsg = 1; + attr.mq_msgsize = 3; + q2 = mq_open (name, O_CREAT | O_RDWR, 0600, &attr); + if (q2 == (mqd_t) -1) + { + printf ("mq_open without O_EXCL failed with %m\n"); + result = 1; + } + + char buf[3]; + strcpy (buf, "jk"); + if (mq_send (q, buf, 2, 4) != 0) + { + printf ("mq_send failed: %m\n"); + result = 1; + } + + if (mq_send (q, buf + 1, 1, 5) != 0) + { + printf ("mq_send failed: %m\n"); + result = 1; + } + + if (mq_getattr (q2, &attr) != 0) + { + printf ("mq_getattr failed: %m\n"); + result = 1; + } + + if ((attr.mq_flags & O_NONBLOCK) + || attr.mq_maxmsg != 2 + || attr.mq_msgsize != 2 + || attr.mq_curmsgs != 2) + { + printf ("mq_getattr returned unexpected { .mq_flags = %ld,\n" + ".mq_maxmsg = %ld, .mq_msgsize = %ld, .mq_curmsgs = %ld }\n", + attr.mq_flags, attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs); + result = 1; + } + + struct timespec ts; + if (clock_gettime (CLOCK_REALTIME, &ts) == 0) + ++ts.tv_sec; + else + { + ts.tv_sec = time (NULL) + 1; + ts.tv_nsec = 0; + } + + if (mq_timedsend (q2, buf, 1, 1, &ts) == 0) + { + puts ("mq_timedsend unexpectedly succeeded"); + result = 1; + } + else if (errno != ETIMEDOUT) + { + printf ("mq_timedsend did not fail with ETIMEDOUT: %m\n"); + result = 1; + } + + if (mq_close (q2) != 0) + { + printf ("mq_close failed: %m\n"); + result = 1; + } + + q2 = mq_open (name, O_RDONLY, 0600); + if (q2 == (mqd_t) -1) + { + printf ("mq_open without O_CREAT failed with %m\n"); + result = 1; + } + + mqd_t q3 = mq_open (name, O_RDONLY, 0600); + if (q3 == (mqd_t) -1) + { + printf ("mq_open without O_CREAT failed with %m\n"); + result = 1; + } + + memset (buf, ' ', sizeof (buf)); + + unsigned int prio; + ssize_t rets = mq_receive (q2, buf, 2, &prio); + if (rets != 1) + { + if (rets == -1) + printf ("mq_receive failed with: %m\n"); + else + printf ("mq_receive returned %zd != 1\n", rets); + result = 1; + } + else if (prio != 5 || memcmp (buf, "k ", 3) != 0) + { + printf ("mq_receive returned prio %u (2) buf \"%c%c%c\" (\"k \")\n", + prio, buf[0], buf[1], buf[2]); + result = 1; + } + + if (mq_getattr (q3, &attr) != 0) + { + printf ("mq_getattr failed: %m\n"); + result = 1; + } + + if ((attr.mq_flags & O_NONBLOCK) + || attr.mq_maxmsg != 2 + || attr.mq_msgsize != 2 + || attr.mq_curmsgs != 1) + { + printf ("mq_getattr returned unexpected { .mq_flags = %ld,\n" + ".mq_maxmsg = %ld, .mq_msgsize = %ld, .mq_curmsgs = %ld }\n", + attr.mq_flags, attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs); + result = 1; + } + + rets = mq_receive (q3, buf, 2, NULL); + if (rets != 2) + { + if (rets == -1) + printf ("mq_receive failed with: %m\n"); + else + printf ("mq_receive returned %zd != 2\n", rets); + result = 1; + } + else if (memcmp (buf, "jk ", 3) != 0) + { + printf ("mq_receive returned buf \"%c%c%c\" != \"jk \"\n", + buf[0], buf[1], buf[2]); + result = 1; + } + + if (clock_gettime (CLOCK_REALTIME, &ts) == 0) + ++ts.tv_sec; + else + { + ts.tv_sec = time (NULL) + 1; + ts.tv_nsec = 0; + } + + if (mq_timedreceive (q2, buf, 2, NULL, &ts) != -1) + { + puts ("mq_timedreceive on empty queue unexpectedly succeeded"); + result = 1; + } + else if (errno != ETIMEDOUT) + { + printf ("mq_timedreceive on empty queue did not fail with " + "ETIMEDOUT: %m\n"); + result = 1; + } + + if (mq_unlink (name) != 0) + { + printf ("mq_unlink failed: %m\n"); + result = 1; + } + + if (mq_close (q) != 0) + { + printf ("mq_close failed: %m\n"); + result = 1; + } + + if (mq_close (q2) != 0) + { + printf ("mq_close failed: %m\n"); + result = 1; + } + + if (mq_close (q3) != 0) + { + printf ("mq_close failed: %m\n"); + result = 1; + } + + return result; +} + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mqueue5.c b/test/nptl/tst-mqueue5.c new file mode 100644 index 000000000..58e2ebfb4 --- /dev/null +++ b/test/nptl/tst-mqueue5.c @@ -0,0 +1,1013 @@ +/* Test mq_notify. + Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <mqueue.h> +#include <limits.h> +#include <signal.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/mman.h> +#include <sys/time.h> +#include <sys/wait.h> +#include <time.h> +#include <unistd.h> +#include "tst-mqueue.h" + +#define TIMEOUT 3 + +#if _POSIX_THREADS +# include <pthread.h> + +volatile int rtmin_cnt; +volatile pid_t rtmin_pid; +volatile uid_t rtmin_uid; +volatile int rtmin_code; +volatile union sigval rtmin_sigval; + +static void +rtmin_handler (int sig, siginfo_t *info, void *ctx) +{ + if (sig != SIGRTMIN) + abort (); + ++rtmin_cnt; + rtmin_pid = info->si_pid; + rtmin_uid = info->si_uid; + rtmin_code = info->si_code; + rtmin_sigval = info->si_value; +} + +#define mqsend(q) (mqsend) (q, __LINE__) +static int +(mqsend) (mqd_t q, int line) +{ + char c; + if (mq_send (q, &c, 1, 1) != 0) + { + printf ("mq_send on line %d failed with: %m\n", line); + return 1; + } + return 0; +} + +#define mqrecv(q) (mqrecv) (q, __LINE__) +static int +(mqrecv) (mqd_t q, int line) +{ + char c; + ssize_t rets = TEMP_FAILURE_RETRY (mq_receive (q, &c, 1, NULL)); + if (rets != 1) + { + if (rets == -1) + printf ("mq_receive on line %d failed with: %m\n", line); + else + printf ("mq_receive on line %d returned %zd != 1\n", + line, rets); + return 1; + } + return 0; +} + +struct thr_data +{ + const char *name; + pthread_barrier_t *b3; + mqd_t q; +}; + +static void * +thr (void *arg) +{ + pthread_barrier_t *b3 = ((struct thr_data *)arg)->b3; + mqd_t q = ((struct thr_data *)arg)->q; + const char *name = ((struct thr_data *)arg)->name; + int result = 0; + + result |= mqrecv (q); + + (void) pthread_barrier_wait (b3); + + /* Child verifies SIGRTMIN has not been sent. */ + + (void) pthread_barrier_wait (b3); + + /* Parent calls mqsend (q), which should trigger notification. */ + + (void) pthread_barrier_wait (b3); + + if (rtmin_cnt != 2) + { + puts ("SIGRTMIN signal in child did not arrive"); + result = 1; + } + else if (rtmin_pid != getppid () + || rtmin_uid != getuid () + || rtmin_code != SI_MESGQ + || rtmin_sigval.sival_int != 0xdeadbeef) + { + printf ("unexpected siginfo_t fields: pid %u (%u), uid %u (%u), code %d (%d), si_int %d (%d)\n", + rtmin_pid, getppid (), rtmin_uid, getuid (), + rtmin_code, SI_MESGQ, rtmin_sigval.sival_int, 0xdeadbeef); + result = 1; + } + + struct sigevent ev; + memset (&ev, 0x82, sizeof (ev)); + ev.sigev_notify = SIGEV_NONE; + if (mq_notify (q, &ev) != 0) + { + printf ("mq_notify in thread (q, { SIGEV_NONE }) failed with: %m\n"); + result = 1; + } + + if (mq_notify (q, NULL) != 0) + { + printf ("mq_notify in thread (q, NULL) failed with: %m\n"); + result = 1; + } + + result |= mqrecv (q); + + (void) pthread_barrier_wait (b3); + + /* Child calls mq_notify (q, { SIGEV_SIGNAL }). */ + + (void) pthread_barrier_wait (b3); + + if (mq_notify (q, NULL) != 0) + { + printf ("second mq_notify in thread (q, NULL) failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b3); + + /* Parent calls mqsend (q), which should not trigger notification. */ + + (void) pthread_barrier_wait (b3); + + /* Child verifies SIGRTMIN has not been received. */ + /* Child calls mq_notify (q, { SIGEV_SIGNAL }). */ + + (void) pthread_barrier_wait (b3); + + mqd_t q4 = mq_open (name, O_RDONLY); + if (q4 == (mqd_t) -1) + { + printf ("mq_open in thread failed with: %m\n"); + result = 1; + } + + if (mq_notify (q4, NULL) != 0) + { + printf ("mq_notify in thread (q4, NULL) failed with: %m\n"); + result = 1; + } + + if (mq_close (q4) != 0) + { + printf ("mq_close in thread failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b3); + + /* Parent calls mqsend (q), which should not trigger notification. */ + + (void) pthread_barrier_wait (b3); + + /* Child verifies SIGRTMIN has not been received. */ + /* Child calls mq_notify (q, { SIGEV_SIGNAL }). */ + + (void) pthread_barrier_wait (b3); + + mqd_t q5 = mq_open (name, O_WRONLY); + if (q5 == (mqd_t) -1) + { + printf ("mq_open O_WRONLY in thread failed with: %m\n"); + result = 1; + } + + if (mq_notify (q5, NULL) != 0) + { + printf ("mq_notify in thread (q5, NULL) failed with: %m\n"); + result = 1; + } + + if (mq_close (q5) != 0) + { + printf ("mq_close in thread failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b3); + + /* Parent calls mqsend (q), which should not trigger notification. */ + + (void) pthread_barrier_wait (b3); + + /* Child verifies SIGRTMIN has not been received. */ + + return (void *) (long) result; +} + +static void +do_child (const char *name, pthread_barrier_t *b2, pthread_barrier_t *b3, + mqd_t q) +{ + int result = 0; + + struct sigevent ev; + memset (&ev, 0x55, sizeof (ev)); + ev.sigev_notify = SIGEV_SIGNAL; + ev.sigev_signo = SIGRTMIN; + ev.sigev_value.sival_ptr = &ev; + if (mq_notify (q, &ev) == 0) + { + puts ("first mq_notify in child (q, { SIGEV_SIGNAL }) unexpectedly succeeded"); + result = 1; + } + else if (errno != EBUSY) + { + printf ("first mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b2); + + /* Parent calls mqsend (q), which makes notification available. */ + + (void) pthread_barrier_wait (b2); + + rtmin_cnt = 0; + + if (mq_notify (q, &ev) != 0) + { + printf ("second mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n"); + result = 1; + } + + if (rtmin_cnt != 0) + { + puts ("SIGRTMIN signal in child caught too early"); + result = 1; + } + + (void) pthread_barrier_wait (b2); + + /* Parent unsuccessfully attempts to mq_notify. */ + /* Parent calls mqsend (q), which makes notification available + and triggers a signal in the child. */ + /* Parent successfully calls mq_notify SIGEV_SIGNAL. */ + + (void) pthread_barrier_wait (b2); + + if (rtmin_cnt != 1) + { + puts ("SIGRTMIN signal in child did not arrive"); + result = 1; + } + else if (rtmin_pid != getppid () + || rtmin_uid != getuid () + || rtmin_code != SI_MESGQ + || rtmin_sigval.sival_ptr != &ev) + { + printf ("unexpected siginfo_t fields: pid %u (%u), uid %u (%u), code %d (%d), si_ptr %p (%p)\n", + rtmin_pid, getppid (), rtmin_uid, getuid (), + rtmin_code, SI_MESGQ, rtmin_sigval.sival_ptr, &ev); + result = 1; + } + + result |= mqsend (q); + + (void) pthread_barrier_wait (b2); + + /* Parent verifies caught SIGRTMIN. */ + + mqd_t q2 = mq_open (name, O_RDWR); + if (q2 == (mqd_t) -1) + { + printf ("mq_open in child failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b2); + + /* Parent mq_open's another mqd_t for the same queue (q3). */ + + memset (&ev, 0x11, sizeof (ev)); + ev.sigev_notify = SIGEV_SIGNAL; + ev.sigev_signo = SIGRTMIN; + ev.sigev_value.sival_ptr = &ev; + if (mq_notify (q2, &ev) != 0) + { + printf ("mq_notify in child (q2, { SIGEV_SIGNAL }) failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b2); + + /* Parent unsuccessfully attempts to mq_notify { SIGEV_NONE } on q. */ + + (void) pthread_barrier_wait (b2); + + if (mq_close (q2) != 0) + { + printf ("mq_close failed: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b2); + + /* Parent successfully calls mq_notify { SIGEV_NONE } on q3. */ + + (void) pthread_barrier_wait (b2); + + memset (&ev, 0xbb, sizeof (ev)); + ev.sigev_notify = SIGEV_SIGNAL; + ev.sigev_signo = SIGRTMIN; + ev.sigev_value.sival_ptr = &b2; + if (mq_notify (q, &ev) == 0) + { + puts ("third mq_notify in child (q, { SIGEV_SIGNAL }) unexpectedly succeeded"); + result = 1; + } + else if (errno != EBUSY) + { + printf ("third mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b2); + + /* Parent calls mq_close on q3, which makes the queue available again for + notification. */ + + (void) pthread_barrier_wait (b2); + + memset (&ev, 0x13, sizeof (ev)); + ev.sigev_notify = SIGEV_NONE; + if (mq_notify (q, &ev) != 0) + { + printf ("mq_notify in child (q, { SIGEV_NONE }) failed with: %m\n"); + result = 1; + } + + if (mq_notify (q, NULL) != 0) + { + printf ("mq_notify in child (q, NULL) failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b2); + + struct thr_data thr_data = { .name = name, .b3 = b3, .q = q }; + pthread_t th; + int ret = pthread_create (&th, NULL, thr, &thr_data); + if (ret) + { + errno = ret; + printf ("pthread_created failed with: %m\n"); + result = 1; + } + + /* Wait till thr calls mq_receive on the empty queue q and blocks on it. */ + sleep (1); + + memset (&ev, 0x5f, sizeof (ev)); + ev.sigev_notify = SIGEV_SIGNAL; + ev.sigev_signo = SIGRTMIN; + ev.sigev_value.sival_int = 0xdeadbeef; + if (mq_notify (q, &ev) != 0) + { + printf ("fourth mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b2); + + /* Parent calls mqsend (q), which should wake up mqrecv (q) + in the thread but no notification should be sent. */ + + (void) pthread_barrier_wait (b3); + + if (rtmin_cnt != 1) + { + puts ("SIGRTMIN signal caught while thr was blocked on mq_receive"); + result = 1; + } + + (void) pthread_barrier_wait (b3); + + /* Parent calls mqsend (q), which should trigger notification. */ + + (void) pthread_barrier_wait (b3); + + /* Thread verifies SIGRTMIN has been received. */ + /* Thread calls mq_notify (q, { SIGEV_NONE }) to verify notification is now + available for registration. */ + /* Thread calls mq_notify (q, NULL). */ + + (void) pthread_barrier_wait (b3); + + memset (&ev, 0x6a, sizeof (ev)); + ev.sigev_notify = SIGEV_SIGNAL; + ev.sigev_signo = SIGRTMIN; + ev.sigev_value.sival_ptr = do_child; + if (mq_notify (q, &ev) != 0) + { + printf ("fifth mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b3); + + /* Thread calls mq_notify (q, NULL), which should unregister the above + notification. */ + + (void) pthread_barrier_wait (b3); + + /* Parent calls mqsend (q), which should not trigger notification. */ + + (void) pthread_barrier_wait (b3); + + if (rtmin_cnt != 2) + { + puts ("SIGRTMIN signal caught while notification has been disabled"); + result = 1; + } + + memset (&ev, 0x7b, sizeof (ev)); + ev.sigev_notify = SIGEV_SIGNAL; + ev.sigev_signo = SIGRTMIN; + ev.sigev_value.sival_ptr = thr; + if (mq_notify (q, &ev) != 0) + { + printf ("sixth mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b3); + + /* Thread opens a new O_RDONLY mqd_t (q4). */ + /* Thread calls mq_notify (q4, NULL), which should unregister the above + notification. */ + /* Thread calls mq_close (q4). */ + + (void) pthread_barrier_wait (b3); + + /* Parent calls mqsend (q), which should not trigger notification. */ + + (void) pthread_barrier_wait (b3); + + if (rtmin_cnt != 2) + { + puts ("SIGRTMIN signal caught while notification has been disabled"); + result = 1; + } + + memset (&ev, 0xe1, sizeof (ev)); + ev.sigev_notify = SIGEV_SIGNAL; + ev.sigev_signo = SIGRTMIN; + ev.sigev_value.sival_int = 127; + if (mq_notify (q, &ev) != 0) + { + printf ("seventh mq_notify in child (q, { SIGEV_SIGNAL }) failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b3); + + /* Thread opens a new O_WRONLY mqd_t (q5). */ + /* Thread calls mq_notify (q5, NULL), which should unregister the above + notification. */ + /* Thread calls mq_close (q5). */ + + (void) pthread_barrier_wait (b3); + + /* Parent calls mqsend (q), which should not trigger notification. */ + + (void) pthread_barrier_wait (b3); + + if (rtmin_cnt != 2) + { + puts ("SIGRTMIN signal caught while notification has been disabled"); + result = 1; + } + + void *thr_ret; + ret = pthread_join (th, &thr_ret); + if (ret) + { + errno = ret; + printf ("pthread_join failed: %m\n"); + result = 1; + } + else if (thr_ret) + result = 1; + + if (mq_close (q) != 0) + { + printf ("mq_close failed: %m\n"); + result = 1; + } + + exit (result); +} + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ + int result = 0; + + char tmpfname[] = "/tmp/tst-mqueue5-barrier.XXXXXX"; + int fd = mkstemp (tmpfname); + if (fd == -1) + { + printf ("cannot open temporary file: %m\n"); + return 1; + } + + /* Make sure it is always removed. */ + unlink (tmpfname); + + /* Create one page of data. */ + size_t ps = sysconf (_SC_PAGESIZE); + char data[ps]; + memset (data, '\0', ps); + + /* Write the data to the file. */ + if (write (fd, data, ps) != (ssize_t) ps) + { + puts ("short write"); + return 1; + } + + void *mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (mem == MAP_FAILED) + { + printf ("mmap failed: %m\n"); + return 1; + } + + pthread_barrier_t *b2; + b2 = (pthread_barrier_t *) (((uintptr_t) mem + __alignof (pthread_barrier_t)) + & ~(__alignof (pthread_barrier_t) - 1)); + + pthread_barrier_t *b3; + b3 = b2 + 1; + + pthread_barrierattr_t a; + if (pthread_barrierattr_init (&a) != 0) + { + puts ("barrierattr_init failed"); + return 1; + } + + if (pthread_barrierattr_setpshared (&a, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("barrierattr_setpshared failed, could not test"); + return 0; + } + + if (pthread_barrier_init (b2, &a, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + if (pthread_barrier_init (b3, &a, 3) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + if (pthread_barrierattr_destroy (&a) != 0) + { + puts ("barrierattr_destroy failed"); + return 1; + } + + char name[sizeof "/tst-mqueue5-" + sizeof (pid_t) * 3]; + snprintf (name, sizeof (name), "/tst-mqueue5-%u", getpid ()); + + struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = 1 }; + mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr); + + if (q == (mqd_t) -1) + { + printf ("mq_open failed with: %m\n"); + return result; + } + else + add_temp_mq (name); + + struct sigevent ev; + memset (&ev, 0xaa, sizeof (ev)); + ev.sigev_notify = SIGEV_NONE; + if (mq_notify (q, &ev) != 0) + { + printf ("mq_notify (q, { SIGEV_NONE }) failed with: %m\n"); + result = 1; + } + + if (mq_notify (q, &ev) == 0) + { + puts ("second mq_notify (q, { SIGEV_NONE }) unexpectedly succeeded"); + result = 1; + } + else if (errno != EBUSY) + { + printf ("second mq_notify (q, { SIGEV_NONE }) failed with: %m\n"); + result = 1; + } + + result |= mqsend (q); + + if (mq_notify (q, &ev) != 0) + { + printf ("third mq_notify (q, { SIGEV_NONE }) failed with: %m\n"); + result = 1; + } + + result |= mqrecv (q); + + if (mq_notify (q, NULL) != 0) + { + printf ("mq_notify (q, NULL) failed with: %m\n"); + result = 1; + } + + if (mq_notify (q, NULL) != 0) + { + /* Implementation-defined behaviour, so don't fail, + just inform. */ + printf ("second mq_notify (q, NULL) failed with: %m\n"); + } + + struct sigaction sa = { .sa_sigaction = rtmin_handler, + .sa_flags = SA_SIGINFO }; + sigemptyset (&sa.sa_mask); + sigaction (SIGRTMIN, &sa, NULL); + + memset (&ev, 0x55, sizeof (ev)); + ev.sigev_notify = SIGEV_SIGNAL; + ev.sigev_signo = SIGRTMIN; + ev.sigev_value.sival_int = 26; + if (mq_notify (q, &ev) != 0) + { + printf ("mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n"); + result = 1; + } + + ev.sigev_value.sival_ptr = &ev; + if (mq_notify (q, &ev) == 0) + { + puts ("second mq_notify (q, { SIGEV_SIGNAL }) unexpectedly succeeded"); + result = 1; + } + else if (errno != EBUSY) + { + printf ("second mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n"); + result = 1; + } + + if (rtmin_cnt != 0) + { + puts ("SIGRTMIN signal caught too early"); + result = 1; + } + + result |= mqsend (q); + + if (rtmin_cnt != 1) + { + puts ("SIGRTMIN signal did not arrive"); + result = 1; + } + else if (rtmin_pid != getpid () + || rtmin_uid != getuid () + || rtmin_code != SI_MESGQ + || rtmin_sigval.sival_int != 26) + { + printf ("unexpected siginfo_t fields: pid %u (%u), uid %u (%u), code %d (%d), si_int %d (26)\n", + rtmin_pid, getpid (), rtmin_uid, getuid (), + rtmin_code, SI_MESGQ, rtmin_sigval.sival_int); + result = 1; + } + + ev.sigev_value.sival_int = 75; + if (mq_notify (q, &ev) != 0) + { + printf ("third mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n"); + result = 1; + } + + result |= mqrecv (q); + + if (mq_notify (q, NULL) != 0) + { + printf ("mq_notify (q, NULL) failed with: %m\n"); + result = 1; + } + + memset (&ev, 0x33, sizeof (ev)); + ev.sigev_notify = SIGEV_NONE; + if (mq_notify (q, &ev) != 0) + { + printf ("fourth mq_notify (q, { SIGEV_NONE }) failed with: %m\n"); + result = 1; + } + + pid_t pid = fork (); + if (pid == -1) + { + printf ("fork () failed: %m\n"); + mq_unlink (name); + return 1; + } + + if (pid == 0) + do_child (name, b2, b3, q); + + /* Child unsuccessfully attempts to mq_notify. */ + + (void) pthread_barrier_wait (b2); + + result |= mqsend (q); + + (void) pthread_barrier_wait (b2); + + /* Child successfully calls mq_notify SIGEV_SIGNAL now. */ + + result |= mqrecv (q); + + (void) pthread_barrier_wait (b2); + + memset (&ev, 0xbb, sizeof (ev)); + ev.sigev_notify = SIGEV_SIGNAL; + ev.sigev_signo = SIGRTMIN; + ev.sigev_value.sival_int = 15; + if (mq_notify (q, &ev) == 0) + { + puts ("fourth mq_notify (q, { SIGEV_SIGNAL }) unexpectedly succeeded"); + result = 1; + } + else if (errno != EBUSY) + { + printf ("fourth mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n"); + result = 1; + } + + result |= mqsend (q); + + if (mq_notify (q, &ev) != 0) + { + printf ("fifth mq_notify (q, { SIGEV_SIGNAL }) failed with: %m\n"); + result = 1; + } + + if (rtmin_cnt != 1) + { + puts ("SIGRTMIN signal caught too early"); + result = 1; + } + + result |= mqrecv (q); + + (void) pthread_barrier_wait (b2); + + /* Child verifies caught SIGRTMIN signal. */ + /* Child calls mq_send (q) which triggers SIGRTMIN signal here. */ + + (void) pthread_barrier_wait (b2); + + /* Child mq_open's another mqd_t for the same queue (q2). */ + + if (rtmin_cnt != 2) + { + puts ("SIGRTMIN signal did not arrive"); + result = 1; + } + else if (rtmin_pid != pid + || rtmin_uid != getuid () + || rtmin_code != SI_MESGQ + || rtmin_sigval.sival_int != 15) + { + printf ("unexpected siginfo_t fields: pid %u (%u), uid %u (%u), code %d (%d), si_int %d (15)\n", + rtmin_pid, pid, rtmin_uid, getuid (), + rtmin_code, SI_MESGQ, rtmin_sigval.sival_int); + result = 1; + } + + result |= mqrecv (q); + + (void) pthread_barrier_wait (b2); + + /* Child successfully calls mq_notify { SIGEV_SIGNAL } on q2. */ + + (void) pthread_barrier_wait (b2); + + memset (&ev, 0xbb, sizeof (ev)); + ev.sigev_notify = SIGEV_NONE; + if (mq_notify (q, &ev) == 0) + { + puts ("fifth mq_notify (q, { SIGEV_NONE }) unexpectedly succeeded"); + result = 1; + } + else if (errno != EBUSY) + { + printf ("fifth mq_notify (q, { SIGEV_NONE }) failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b2); + + /* Child calls mq_close on q2, which makes the queue available again for + notification. */ + + mqd_t q3 = mq_open (name, O_RDWR); + if (q3 == (mqd_t) -1) + { + printf ("mq_open q3 in parent failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b2); + + memset (&ev, 0x12, sizeof (ev)); + ev.sigev_notify = SIGEV_NONE; + if (mq_notify (q3, &ev) != 0) + { + printf ("mq_notify (q3, { SIGEV_NONE }) failed with: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b2); + + /* Child unsuccessfully attempts to mq_notify { SIGEV_SIGNAL } on q. */ + + (void) pthread_barrier_wait (b2); + + if (mq_close (q3) != 0) + { + printf ("mq_close failed: %m\n"); + result = 1; + } + + (void) pthread_barrier_wait (b2); + + /* Child successfully calls mq_notify { SIGEV_NONE } on q. */ + /* Child successfully calls mq_notify NULL on q. */ + + (void) pthread_barrier_wait (b2); + + /* Child creates new thread. */ + /* Thread blocks on mqrecv (q). */ + /* Child sleeps for 1sec so that thread has time to reach that point. */ + /* Child successfully calls mq_notify { SIGEV_SIGNAL } on q. */ + + (void) pthread_barrier_wait (b2); + + result |= mqsend (q); + + (void) pthread_barrier_wait (b3); + + /* Child verifies SIGRTMIN has not been sent. */ + + (void) pthread_barrier_wait (b3); + + result |= mqsend (q); + + (void) pthread_barrier_wait (b3); + + /* Thread verifies SIGRTMIN has been caught. */ + /* Thread calls mq_notify (q, { SIGEV_NONE }) to verify notification is now + available for registration. */ + /* Thread calls mq_notify (q, NULL). */ + + (void) pthread_barrier_wait (b3); + + /* Child calls mq_notify (q, { SIGEV_SIGNAL }). */ + + (void) pthread_barrier_wait (b3); + + /* Thread calls mq_notify (q, NULL). */ + + (void) pthread_barrier_wait (b3); + + result |= mqsend (q); + result |= mqrecv (q); + + (void) pthread_barrier_wait (b3); + + /* Child verifies SIGRTMIN has not been sent. */ + /* Child calls mq_notify (q, { SIGEV_SIGNAL }). */ + + (void) pthread_barrier_wait (b3); + + /* Thread opens a new O_RDONLY mqd_t (q4). */ + /* Thread calls mq_notify (q4, NULL). */ + /* Thread calls mq_close (q4). */ + + (void) pthread_barrier_wait (b3); + + result |= mqsend (q); + result |= mqrecv (q); + + (void) pthread_barrier_wait (b3); + + /* Child verifies SIGRTMIN has not been sent. */ + /* Child calls mq_notify (q, { SIGEV_SIGNAL }). */ + + (void) pthread_barrier_wait (b3); + + /* Thread opens a new O_WRONLY mqd_t (q5). */ + /* Thread calls mq_notify (q5, NULL). */ + /* Thread calls mq_close (q5). */ + + (void) pthread_barrier_wait (b3); + + result |= mqsend (q); + result |= mqrecv (q); + + (void) pthread_barrier_wait (b3); + + /* Child verifies SIGRTMIN has not been sent. */ + + int status; + if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid) + { + puts ("waitpid failed"); + kill (pid, SIGKILL); + result = 1; + } + else if (!WIFEXITED (status) || WEXITSTATUS (status)) + { + printf ("child failed with status %d\n", status); + result = 1; + } + + if (mq_unlink (name) != 0) + { + printf ("mq_unlink failed: %m\n"); + result = 1; + } + + if (mq_close (q) != 0) + { + printf ("mq_close failed: %m\n"); + result = 1; + } + + if (mq_notify (q, NULL) == 0) + { + puts ("mq_notify on closed mqd_t unexpectedly succeeded"); + result = 1; + } + else if (errno != EBADF) + { + printf ("mq_notify on closed mqd_t did not fail with EBADF: %m\n"); + result = 1; + } + + memset (&ev, 0x55, sizeof (ev)); + ev.sigev_notify = SIGEV_NONE; + if (mq_notify (q, &ev) == 0) + { + puts ("mq_notify on closed mqd_t unexpectedly succeeded"); + result = 1; + } + else if (errno != EBADF) + { + printf ("mq_notify on closed mqd_t did not fail with EBADF: %m\n"); + result = 1; + } + + return result; +} +#else +# define TEST_FUNCTION 0 +#endif + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mqueue6.c b/test/nptl/tst-mqueue6.c new file mode 100644 index 000000000..8d84c1929 --- /dev/null +++ b/test/nptl/tst-mqueue6.c @@ -0,0 +1,304 @@ +/* Test mq_notify. + Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <mqueue.h> +#include <limits.h> +#include <signal.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/mman.h> +#include <sys/time.h> +#include <sys/wait.h> +#include <time.h> +#include <unistd.h> +#include "tst-mqueue.h" + +#if _POSIX_THREADS +# include <pthread.h> + +# define mqsend(q) (mqsend) (q, __LINE__) +static int +(mqsend) (mqd_t q, int line) +{ + char c; + if (mq_send (q, &c, 1, 1) != 0) + { + printf ("mq_send on line %d failed with: %m\n", line); + return 1; + } + return 0; +} + +# define mqrecv(q) (mqrecv) (q, __LINE__) +static int +(mqrecv) (mqd_t q, int line) +{ + char c; + ssize_t rets = TEMP_FAILURE_RETRY (mq_receive (q, &c, 1, NULL)); + if (rets != 1) + { + if (rets == -1) + printf ("mq_receive on line %d failed with: %m\n", line); + else + printf ("mq_receive on line %d returned %zd != 1\n", + line, rets); + return 1; + } + return 0; +} + +volatile int fct_cnt, fct_err; +size_t fct_guardsize; + +static void +fct (union sigval s) +{ + mqd_t q = *(mqd_t *) s.sival_ptr; + + pthread_attr_t nattr; + int ret = pthread_getattr_np (pthread_self (), &nattr); + if (ret) + { + errno = ret; + printf ("pthread_getattr_np failed: %m\n"); + fct_err = 1; + } + else + { + ret = pthread_attr_getguardsize (&nattr, &fct_guardsize); + if (ret) + { + errno = ret; + printf ("pthread_attr_getguardsize failed: %m\n"); + fct_err = 1; + } + if (pthread_attr_destroy (&nattr) != 0) + { + puts ("pthread_attr_destroy failed"); + fct_err = 1; + } + } + + ++fct_cnt; + fct_err |= mqsend (q); +} + +# define TEST_FUNCTION do_test () +static int +do_test (void) +{ + int result = 0; + + char name[sizeof "/tst-mqueue6-" + sizeof (pid_t) * 3]; + snprintf (name, sizeof (name), "/tst-mqueue6-%u", getpid ()); + + struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = 1 }; + mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr); + + if (q == (mqd_t) -1) + { + printf ("mq_open failed with: %m\n"); + return result; + } + else + add_temp_mq (name); + + pthread_attr_t nattr; + if (pthread_attr_init (&nattr) + || pthread_attr_setguardsize (&nattr, 0)) + { + puts ("pthread_attr_t setup failed"); + result = 1; + } + + fct_guardsize = 1; + + struct sigevent ev; + memset (&ev, 0xaa, sizeof (ev)); + ev.sigev_notify = SIGEV_THREAD; + ev.sigev_notify_function = fct; + ev.sigev_notify_attributes = &nattr; + ev.sigev_value.sival_ptr = &q; + if (mq_notify (q, &ev) != 0) + { + printf ("mq_notify (q, { SIGEV_THREAD }) failed with: %m\n"); + result = 1; + } + + size_t ps = sysconf (_SC_PAGESIZE); + if (pthread_attr_setguardsize (&nattr, 32 * ps)) + { + puts ("pthread_attr_t setup failed"); + result = 1; + } + + if (mq_notify (q, &ev) == 0) + { + puts ("second mq_notify (q, { SIGEV_NONE }) unexpectedly succeeded"); + result = 1; + } + else if (errno != EBUSY) + { + printf ("second mq_notify (q, { SIGEV_NONE }) failed with: %m\n"); + result = 1; + } + + if (fct_cnt != 0) + { + printf ("fct called too early (%d on %d)\n", fct_cnt, __LINE__); + result = 1; + } + + result |= mqsend (q); + + result |= mqrecv (q); + result |= mqrecv (q); + + if (fct_cnt != 1) + { + printf ("fct not called (%d on %d)\n", fct_cnt, __LINE__); + result = 1; + } + else if (fct_guardsize != 0) + { + printf ("fct_guardsize %zd != 0\n", fct_guardsize); + result = 1; + } + + if (mq_notify (q, &ev) != 0) + { + printf ("third mq_notify (q, { SIGEV_NONE }) failed with: %m\n"); + result = 1; + } + + if (mq_notify (q, NULL) != 0) + { + printf ("mq_notify (q, NULL) failed with: %m\n"); + result = 1; + } + + memset (&ev, 0x11, sizeof (ev)); + ev.sigev_notify = SIGEV_THREAD; + ev.sigev_notify_function = fct; + ev.sigev_notify_attributes = &nattr; + ev.sigev_value.sival_ptr = &q; + if (mq_notify (q, &ev) != 0) + { + printf ("mq_notify (q, { SIGEV_THREAD }) failed with: %m\n"); + result = 1; + } + + if (pthread_attr_setguardsize (&nattr, 0)) + { + puts ("pthread_attr_t setup failed"); + result = 1; + } + + if (mq_notify (q, &ev) == 0) + { + puts ("second mq_notify (q, { SIGEV_NONE }) unexpectedly succeeded"); + result = 1; + } + else if (errno != EBUSY) + { + printf ("second mq_notify (q, { SIGEV_NONE }) failed with: %m\n"); + result = 1; + } + + if (fct_cnt != 1) + { + printf ("fct called too early (%d on %d)\n", fct_cnt, __LINE__); + result = 1; + } + + result |= mqsend (q); + + result |= mqrecv (q); + result |= mqrecv (q); + + if (fct_cnt != 2) + { + printf ("fct not called (%d on %d)\n", fct_cnt, __LINE__); + result = 1; + } + else if (fct_guardsize != 32 * ps) + { + printf ("fct_guardsize %zd != %zd\n", fct_guardsize, 32 * ps); + result = 1; + } + + if (mq_notify (q, &ev) != 0) + { + printf ("third mq_notify (q, { SIGEV_NONE }) failed with: %m\n"); + result = 1; + } + + if (mq_notify (q, NULL) != 0) + { + printf ("mq_notify (q, NULL) failed with: %m\n"); + result = 1; + } + + if (pthread_attr_destroy (&nattr) != 0) + { + puts ("pthread_attr_destroy failed"); + result = 1; + } + + if (mq_unlink (name) != 0) + { + printf ("mq_unlink failed: %m\n"); + result = 1; + } + + if (mq_close (q) != 0) + { + printf ("mq_close failed: %m\n"); + result = 1; + } + + memset (&ev, 0x55, sizeof (ev)); + ev.sigev_notify = SIGEV_THREAD; + ev.sigev_notify_function = fct; + ev.sigev_notify_attributes = NULL; + ev.sigev_value.sival_int = 0; + if (mq_notify (q, &ev) == 0) + { + puts ("mq_notify on closed mqd_t unexpectedly succeeded"); + result = 1; + } + else if (errno != EBADF) + { + printf ("mq_notify on closed mqd_t did not fail with EBADF: %m\n"); + result = 1; + } + + if (fct_err) + result = 1; + return result; +} +#else +# define TEST_FUNCTION 0 +#endif + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mqueue7.c b/test/nptl/tst-mqueue7.c new file mode 100644 index 000000000..1892f951a --- /dev/null +++ b/test/nptl/tst-mqueue7.c @@ -0,0 +1,108 @@ +/* Test all open message queues descriptors are closed during exec*. + Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <mqueue.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/wait.h> +#include <time.h> +#include <unistd.h> + +#define OPT_AFTEREXEC 20000 + +static mqd_t after_exec = (mqd_t) -1; + +#define CMDLINE_OPTIONS \ + "a:" + +#define CMDLINE_PROCESS \ + case 'a': \ + after_exec = (mqd_t) strtoul (optarg, NULL, 0); \ + break; + +static int +do_after_exec (void) +{ + int result = 0; + + struct mq_attr attr; + if (mq_getattr (after_exec, &attr) == 0) + { + puts ("mq_getattr after exec unexpectedly succeeded"); + result = 1; + } + else if (errno != EBADF) + { + printf ("mq_getattr after exec did not fail with EBADF: %m\n"); + result = 1; + } + + return result; +} + +static int +do_test (int argc, char **argv) +{ + if (after_exec != (mqd_t) -1) + return do_after_exec (); + + char name[sizeof "/tst-mqueue7-" + sizeof (pid_t) * 3]; + snprintf (name, sizeof (name), "/tst-mqueue7-%u", getpid ()); + + struct mq_attr attr = { .mq_maxmsg = 10, .mq_msgsize = 1 }; + mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_WRONLY, 0600, &attr); + + if (q == (mqd_t) -1) + { + printf ("mq_open failed with: %m\n"); + return 0; + } + else if (mq_unlink (name) != 0) + { + printf ("mq_unlink failed with: %m\n"); + return 1; + } + + if (mq_getattr (q, &attr) != 0) + { + printf ("mq_getattr failed: %m\n"); + return 1; + } + + char after_exec_arg[sizeof "-a=0x" + sizeof (long) * 3]; + snprintf (after_exec_arg, sizeof (after_exec_arg), + "-a=0x%lx", (long) q); + + const char *newargv[argc + 2]; + for (int i = 1; i < argc; ++i) + newargv[i - 1] = argv[i]; + newargv[argc - 1] = "-d"; + newargv[argc] = after_exec_arg; + newargv[argc + 1] = NULL; + + /* Verify that exec* has the effect of mq_close (q). */ + execv (newargv[0], (char * const *) newargv); + printf ("execv failed: %m\n"); + return 1; +} + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mqueue8.c b/test/nptl/tst-mqueue8.c new file mode 100644 index 000000000..b80e4e5c3 --- /dev/null +++ b/test/nptl/tst-mqueue8.c @@ -0,0 +1,265 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <mqueue.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#if _POSIX_THREADS +# include <pthread.h> + +static pthread_barrier_t b; + +/* Cleanup handling test. */ +static int cl_called; + +static void +cl (void *arg) +{ + ++cl_called; +} + +#define TF_MQ_RECEIVE 0L +#define TF_MQ_TIMEDRECEIVE 1L +#define TF_MQ_SEND 2L +#define TF_MQ_TIMEDSEND 3L + +static const char *names[] + = { "mq_receive", "mq_timedreceive", "mq_send", "mq_timedsend" }; + +static mqd_t q; +static struct timespec never; + +static void * +tf (void *arg) +{ + int r = pthread_barrier_wait (&b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("tf: barrier_wait failed"); + exit (1); + } + + pthread_cleanup_push (cl, NULL); + + char c = ' '; + + switch ((long) arg) + { + case TF_MQ_SEND: + TEMP_FAILURE_RETRY (mq_send (q, &c, 1, 1)); + break; + case TF_MQ_TIMEDSEND: + TEMP_FAILURE_RETRY (mq_timedsend (q, &c, 1, 1, &never)); + break; + case TF_MQ_RECEIVE: + TEMP_FAILURE_RETRY (mq_receive (q, &c, 1, NULL)); + break; + case TF_MQ_TIMEDRECEIVE: + TEMP_FAILURE_RETRY (mq_timedreceive (q, &c, 1, NULL, &never)); + break; + } + + pthread_cleanup_pop (0); + + printf ("tf: %s returned\n", names[(long) arg]); + + exit (1); +} + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ + char name[sizeof "/tst-mqueue8-" + sizeof (pid_t) * 3]; + snprintf (name, sizeof (name), "/tst-mqueue8-%u", getpid ()); + + struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = 1 }; + q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr); + + if (q == (mqd_t) -1) + { + printf ("mq_open failed with: %m\n"); + return 0; + } + + if (mq_unlink (name) != 0) + { + printf ("mq_unlink failed with: %m\n"); + return 1; + } + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + if (clock_gettime (CLOCK_REALTIME, &never) == 0) + never.tv_sec += 100; + else + { + never.tv_sec = time (NULL) + 100; + never.tv_nsec = 0; + } + + int result = 0; + for (long l = TF_MQ_RECEIVE; l <= TF_MQ_TIMEDSEND; ++l) + { + cl_called = 0; + + pthread_t th; + if (pthread_create (&th, NULL, tf, (void *) l) != 0) + { + printf ("1st %s create failed\n", names[l]); + result = 1; + continue; + } + + int r = pthread_barrier_wait (&b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + result = 1; + continue; + } + + struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 }; + while (nanosleep (&ts, &ts) != 0) + continue; + + printf ("going to cancel %s in-time\n", names[l]); + if (pthread_cancel (th) != 0) + { + printf ("1st cancel of %s failed\n", names[l]); + result = 1; + continue; + } + + void *status; + if (pthread_join (th, &status) != 0) + { + printf ("1st join of %s failed\n", names[l]); + result = 1; + continue; + } + if (status != PTHREAD_CANCELED) + { + printf ("1st %s thread not canceled\n", names[l]); + result = 1; + continue; + } + + if (cl_called == 0) + { + printf ("%s cleanup handler not called\n", names[l]); + result = 1; + continue; + } + if (cl_called > 1) + { + printf ("%s cleanup handler called more than once\n", names[l]); + result = 1; + continue; + } + + printf ("in-time %s cancellation succeeded\n", names[l]); + + cl_called = 0; + + if (pthread_create (&th, NULL, tf, (void *) l) != 0) + { + printf ("2nd %s create failed\n", names[l]); + result = 1; + continue; + } + + printf ("going to cancel %s early\n", names[l]); + if (pthread_cancel (th) != 0) + { + printf ("2nd cancel of %s failed\n", names[l]); + result = 1; + continue; + } + + r = pthread_barrier_wait (&b); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + result = 1; + continue; + } + + if (pthread_join (th, &status) != 0) + { + printf ("2nd join of %s failed\n", names[l]); + result = 1; + continue; + } + if (status != PTHREAD_CANCELED) + { + printf ("2nd %s thread not canceled\n", names[l]); + result = 1; + continue; + } + + if (cl_called == 0) + { + printf ("%s cleanup handler not called\n", names[l]); + result = 1; + continue; + } + if (cl_called > 1) + { + printf ("%s cleanup handler called more than once\n", names[l]); + result = 1; + continue; + } + + printf ("early %s cancellation succeeded\n", names[l]); + + if (l == TF_MQ_TIMEDRECEIVE) + { + /* mq_receive and mq_timedreceive are tested on empty mq. + For mq_send and mq_timedsend we need to make it full. + If this fails, there is no point in doing further testing. */ + char c = ' '; + if (mq_send (q, &c, 1, 1) != 0) + { + printf ("mq_send failed: %m\n"); + result = 1; + break; + } + } + } + + if (mq_close (q) != 0) + { + printf ("mq_close failed: %m\n"); + result = 1; + } + + return result; +} +#else +# define TEST_FUNCTION 0 +#endif + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mqueue9.c b/test/nptl/tst-mqueue9.c new file mode 100644 index 000000000..7098b847e --- /dev/null +++ b/test/nptl/tst-mqueue9.c @@ -0,0 +1,91 @@ +/* Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <mqueue.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include "tst-mqueue.h" + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ + if (geteuid () != 0) + { + puts ("this test requires root"); + return 0; + } + + char name[sizeof "/tst-mqueue9-" + sizeof (pid_t) * 3]; + snprintf (name, sizeof (name), "/tst-mqueue9-%u", getpid ()); + + struct mq_attr attr = { .mq_maxmsg = 1, .mq_msgsize = 1 }; + mqd_t q = mq_open (name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr); + + if (q == (mqd_t) -1) + { + printf ("mq_open failed with: %m\n"); + return 0; + } + else + add_temp_mq (name); + + if (seteuid (1) != 0) + { + printf ("failed to seteuid (1): %m\n"); + mq_unlink (name); + return 0; + } + + int result = 0; + if (mq_unlink (name) == 0) + { + puts ("mq_unlink unexpectedly succeeded"); + result = 1; + } + else if (errno != EACCES) + { + printf ("mq_unlink did not fail with EACCES: %m\n"); + result = 1;; + } + + if (seteuid (0) != 0) + { + printf ("failed to seteuid (0): %m\n"); + result = 1; + } + + if (mq_unlink (name) != 0) + { + printf ("mq_unlink failed with: %m\n"); + result = 1; + } + + if (mq_close (q) != 0) + { + printf ("mq_close failed with: %m\n"); + result = 1; + } + + return result; +} + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mutex1.c b/test/nptl/tst-mutex1.c new file mode 100644 index 000000000..0f3a98c76 --- /dev/null +++ b/test/nptl/tst-mutex1.c @@ -0,0 +1,56 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> + + +static int +do_test (void) +{ + pthread_mutex_t m; + + if (pthread_mutex_init (&m, NULL) != 0) + { + puts ("mutex_init failed"); + return 1; + } + + if (pthread_mutex_lock (&m) != 0) + { + puts ("mutex_lock failed"); + return 1; + } + + if (pthread_mutex_unlock (&m) != 0) + { + puts ("mutex_unlock failed"); + return 1; + } + + if (pthread_mutex_destroy (&m) != 0) + { + puts ("mutex_destroy failed"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mutex2.c b/test/nptl/tst-mutex2.c new file mode 100644 index 000000000..707afe9fc --- /dev/null +++ b/test/nptl/tst-mutex2.c @@ -0,0 +1,222 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + + +static pthread_mutex_t m; +static pthread_barrier_t b; + + +static void * +tf (void *arg) +{ + int e = pthread_mutex_unlock (&m); + if (e == 0) + { + puts ("child: 1st mutex_unlock succeeded"); + exit (1); + } + else if (e != EPERM) + { + puts ("child: 1st mutex_unlock error != EPERM"); + exit (1); + } + + e = pthread_mutex_trylock (&m); + if (e == 0) + { + puts ("child: 1st trylock suceeded"); + exit (1); + } + if (e != EBUSY) + { + puts ("child: 1st trylock didn't return EBUSY"); + exit (1); + } + + e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child: 1st barrier_wait failed"); + exit (1); + } + + e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("child: 2nd barrier_wait failed"); + exit (1); + } + + e = pthread_mutex_unlock (&m); + if (e == 0) + { + puts ("child: 2nd mutex_unlock succeeded"); + exit (1); + } + else if (e != EPERM) + { + puts ("child: 2nd mutex_unlock error != EPERM"); + exit (1); + } + + if (pthread_mutex_trylock (&m) != 0) + { + puts ("child: 2nd trylock failed"); + exit (1); + } + + if (pthread_mutex_unlock (&m) != 0) + { + puts ("child: 3rd mutex_unlock failed"); + exit (1); + } + + return NULL; +} + + +static int +do_test (void) +{ + pthread_mutexattr_t a; + int e; + + if (pthread_mutexattr_init (&a) != 0) + { + puts ("mutexattr_init failed"); + exit (1); + } + + if (pthread_mutexattr_settype (&a, PTHREAD_MUTEX_ERRORCHECK) != 0) + { + puts ("mutexattr_settype failed"); + exit (1); + } + + if (pthread_mutex_init (&m, &a) != 0) + { + puts ("mutex_init failed"); + exit (1); + } + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + if ((e = pthread_mutex_unlock (&m)) == 0) + { + puts ("1st mutex_unlock succeeded"); + exit (1); + } + else if (e != EPERM) + { + puts ("1st mutex_unlock error != EPERM"); + exit (1); + } + + if (pthread_mutex_lock (&m) != 0) + { + puts ("mutex_lock failed"); + exit (1); + } + + if ((e = pthread_mutex_lock (&m)) == 0) + { + puts ("2nd mutex_lock succeeded"); + exit (1); + } + else if (e != EDEADLK) + { + puts ("2nd mutex_lock error != EDEADLK"); + exit (1); + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + exit (1); + } + + e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("1st barrier_wait failed"); + exit (1); + } + + if (pthread_mutex_unlock (&m) != 0) + { + puts ("2nd mutex_unlock failed"); + exit (1); + } + + if ((e = pthread_mutex_unlock (&m)) == 0) + { + puts ("3rd mutex_unlock succeeded"); + exit (1); + } + else if (e != EPERM) + { + puts ("3rd mutex_unlock error != EPERM"); + exit (1); + } + + e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("2nd barrier_wait failed"); + exit (1); + } + + if (pthread_join (th, NULL) != 0) + { + puts ("join failed"); + exit (1); + } + + if (pthread_mutex_destroy (&m) != 0) + { + puts ("mutex_destroy failed"); + exit (1); + } + + if (pthread_barrier_destroy (&b) != 0) + { + puts ("barrier_destroy failed"); + exit (1); + } + + if (pthread_mutexattr_destroy (&a) != 0) + { + puts ("mutexattr_destroy failed"); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mutex3.c b/test/nptl/tst-mutex3.c new file mode 100644 index 000000000..5e582858b --- /dev/null +++ b/test/nptl/tst-mutex3.c @@ -0,0 +1,224 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + + +static pthread_mutex_t m; +static pthread_barrier_t b; + + +static void * +tf (void *arg) +{ + int e = pthread_mutex_unlock (&m); + if (e == 0) + { + puts ("1st mutex_unlock in child succeeded"); + exit (1); + } + if (e != EPERM) + { + puts ("1st mutex_unlock in child didn't return EPERM"); + exit (1); + } + + e = pthread_mutex_trylock (&m); + if (e == 0) + { + puts ("mutex_trylock in second thread succeeded"); + exit (1); + } + if (e != EBUSY) + { + puts ("mutex_trylock returned wrong value"); + exit (1); + } + + e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + exit (1); + } + + e = pthread_mutex_unlock (&m); + if (e == 0) + { + puts ("2nd mutex_unlock in child succeeded"); + exit (1); + } + if (e != EPERM) + { + puts ("2nd mutex_unlock in child didn't return EPERM"); + exit (1); + } + + if (pthread_mutex_trylock (&m) != 0) + { + puts ("2nd mutex_trylock in second thread failed"); + exit (1); + } + + if (pthread_mutex_unlock (&m) != 0) + { + puts ("3rd mutex_unlock in second thread failed"); + exit (1); + } + + return NULL; +} + + +static int +do_test (void) +{ + pthread_mutexattr_t a; + + if (pthread_mutexattr_init (&a) != 0) + { + puts ("mutexattr_init failed"); + return 1; + } + + if (pthread_mutexattr_settype (&a, PTHREAD_MUTEX_RECURSIVE) != 0) + { + puts ("mutexattr_settype failed"); + return 1; + } + + if (pthread_mutex_init (&m, &a) != 0) + { + puts ("mutex_init failed"); + return 1; + } + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + if (pthread_mutex_lock (&m) != 0) + { + puts ("mutex_lock failed"); + return 1; + } + + if (pthread_mutex_lock (&m) != 0) + { + puts ("2nd mutex_lock failed"); + return 1; + } + + if (pthread_mutex_trylock (&m) != 0) + { + puts ("1st trylock failed"); + return 1; + } + + if (pthread_mutex_unlock (&m) != 0) + { + puts ("mutex_unlock failed"); + return 1; + } + + if (pthread_mutex_unlock (&m) != 0) + { + puts ("2nd mutex_unlock failed"); + return 1; + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + return 1; + } + + if (pthread_mutex_unlock (&m) != 0) + { + puts ("3rd mutex_unlock failed"); + return 1; + } + + e = pthread_mutex_unlock (&m); + if (e == 0) + { + puts ("4th mutex_unlock succeeded"); + return 1; + } + if (e != EPERM) + { + puts ("4th mutex_unlock didn't return EPERM"); + return 1; + } + + e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + return 1; + } + + if (pthread_join (th, NULL) != 0) + { + puts ("join failed"); + return 1; + } + + if (pthread_barrier_destroy (&b) != 0) + { + puts ("barrier_destroy failed"); + return 1; + } + + if (pthread_mutex_destroy (&m) != 0) + { + puts ("mutex_destroy failed"); + return 1; + } + + if (pthread_mutexattr_destroy (&a) != 0) + { + puts ("mutexattr_destroy failed"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mutex4.c b/test/nptl/tst-mutex4.c new file mode 100644 index 000000000..f66abc052 --- /dev/null +++ b/test/nptl/tst-mutex4.c @@ -0,0 +1,190 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/wait.h> + + +static int +do_test (void) +{ + size_t ps = sysconf (_SC_PAGESIZE); + char tmpfname[] = "/tmp/tst-mutex4.XXXXXX"; + char data[ps]; + void *mem; + int fd; + pthread_mutex_t *m; + pthread_mutexattr_t a; + pid_t pid; + char *p; + int err; + int s; + + fd = mkstemp (tmpfname); + if (fd == -1) + { + printf ("cannot open temporary file: %m\n"); + return 1; + } + + /* Make sure it is always removed. */ + unlink (tmpfname); + + /* Create one page of data. */ + memset (data, '\0', ps); + + /* Write the data to the file. */ + if (write (fd, data, ps) != (ssize_t) ps) + { + puts ("short write"); + return 1; + } + + mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (mem == MAP_FAILED) + { + printf ("mmap failed: %m\n"); + return 1; + } + + m = (pthread_mutex_t *) (((uintptr_t) mem + __alignof (pthread_mutex_t)) + & ~(__alignof (pthread_mutex_t) - 1)); + p = (char *) (m + 1); + + if (pthread_mutexattr_init (&a) != 0) + { + puts ("mutexattr_init failed"); + return 1; + } + + if (pthread_mutexattr_getpshared (&a, &s) != 0) + { + puts ("1st mutexattr_getpshared failed"); + return 1; + } + + if (s != PTHREAD_PROCESS_PRIVATE) + { + puts ("default pshared value wrong"); + return 1; + } + + if (pthread_mutexattr_setpshared (&a, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("mutexattr_setpshared failed"); + return 1; + } + + if (pthread_mutexattr_getpshared (&a, &s) != 0) + { + puts ("2nd mutexattr_getpshared failed"); + return 1; + } + + if (s != PTHREAD_PROCESS_SHARED) + { + puts ("pshared value after setpshared call wrong"); + return 1; + } + + if (pthread_mutex_init (m, &a) != 0) + { + puts ("mutex_init failed"); + return 1; + } + + if (pthread_mutex_lock (m) != 0) + { + puts ("mutex_lock failed"); + return 1; + } + + if (pthread_mutexattr_destroy (&a) != 0) + { + puts ("mutexattr_destroy failed"); + return 1; + } + + err = pthread_mutex_trylock (m); + if (err == 0) + { + puts ("mutex_trylock succeeded"); + return 1; + } + else if (err != EBUSY) + { + puts ("mutex_trylock didn't return EBUSY"); + return 1; + } + + *p = 0; + + puts ("going to fork now"); + pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + return 1; + } + else if (pid == 0) + { + /* Play some lock ping-pong. It's our turn to unlock first. */ + if ((*p)++ != 0) + { + puts ("child: *p != 0"); + return 1; + } + + if (pthread_mutex_unlock (m) != 0) + { + puts ("child: 1st mutex_unlock failed"); + return 1; + } + + puts ("child done"); + } + else + { + if (pthread_mutex_lock (m) != 0) + { + puts ("parent: 2nd mutex_lock failed"); + return 1; + } + + if (*p != 1) + { + puts ("*p != 1"); + return 1; + } + + puts ("parent done"); + } + + return 0; +} + +#define TIMEOUT 4 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mutex5.c b/test/nptl/tst-mutex5.c new file mode 100644 index 000000000..85dddef7e --- /dev/null +++ b/test/nptl/tst-mutex5.c @@ -0,0 +1,185 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <time.h> +#include <unistd.h> +#include <sys/time.h> + + +#ifndef TYPE +# define TYPE PTHREAD_MUTEX_NORMAL +#endif + + +static int +do_test (void) +{ + pthread_mutex_t m; + struct timespec ts; + struct timeval tv; + struct timeval tv2; + int err; + pthread_mutexattr_t a; + + if (pthread_mutexattr_init (&a) != 0) + { + puts ("mutexattr_init failed"); + return 1; + } + + if (pthread_mutexattr_settype (&a, TYPE) != 0) + { + puts ("mutexattr_settype failed"); + return 1; + } + + if (pthread_mutex_init (&m, &a) != 0) + { + puts ("mutex_init failed"); + return 1; + } + + if (pthread_mutexattr_destroy (&a) != 0) + { + puts ("mutexattr_destroy failed"); + return 1; + } + + if (pthread_mutex_lock (&m) != 0) + { + puts ("mutex_lock failed"); + return 1; + } + + if (pthread_mutex_trylock (&m) == 0) + { + puts ("mutex_trylock succeeded"); + return 1; + } + + gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + + ts.tv_sec += 2; /* Wait 2 seconds. */ + + err = pthread_mutex_timedlock (&m, &ts); + if (err == 0) + { + puts ("timedlock succeeded"); + return 1; + } + else if (err != ETIMEDOUT) + { + printf ("timedlock error != ETIMEDOUT: %d\n", err); + return 1; + } + else + { + int clk_tck = sysconf (_SC_CLK_TCK); + + gettimeofday (&tv2, NULL); + + tv2.tv_sec -= tv.tv_sec; + tv2.tv_usec -= tv.tv_usec; + if (tv2.tv_usec < 0) + { + tv2.tv_usec += 1000000; + tv2.tv_sec -= 1; + } + + /* Be a bit tolerant, add one CLK_TCK. */ + tv2.tv_usec += 1000000 / clk_tck; + if (tv2.tv_usec >= 1000000) + { + tv2.tv_usec -= 1000000; + ++tv2.tv_sec; + } + + if (tv2.tv_sec < 2) + { + printf ("premature timeout: %ld.%06ld difference\n", + tv2.tv_sec, tv2.tv_usec); + return 1; + } + } + + (void) gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + + ts.tv_sec += 2; /* Wait 2 seconds. */ + /* The following makes the ts value invalid. */ + ts.tv_nsec += 1000000000; + + err = pthread_mutex_timedlock (&m, &ts); + if (err == 0) + { + puts ("2nd timedlock succeeded"); + return 1; + } + else if (err != EINVAL) + { + printf ("2nd timedlock error != EINVAL: %d\n", err); + return 1; + } + + if (pthread_mutex_unlock (&m) != 0) + { + puts ("mutex_unlock failed"); + return 1; + } + + (void) gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + + ts.tv_sec += 2; /* Wait 2 seconds. */ + if (pthread_mutex_timedlock (&m, &ts) != 0) + { + puts ("3rd timedlock failed"); + } + + (void) gettimeofday (&tv2, NULL); + + /* Check that timedlock didn't delay. We use a limit of 0.1 secs. */ + timersub (&tv2, &tv, &tv2); + if (tv2.tv_sec > 0 || tv2.tv_usec > 100000) + { + puts ("3rd timedlock didn't return right away"); + return 1; + } + + if (pthread_mutex_unlock (&m) != 0) + { + puts ("final mutex_unlock failed"); + return 1; + } + + if (pthread_mutex_destroy (&m) != 0) + { + puts ("mutex_destroy failed"); + return 1; + } + + return 0; +} + +#define TIMEOUT 4 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mutex5a.c b/test/nptl/tst-mutex5a.c new file mode 100644 index 000000000..f91eec0d7 --- /dev/null +++ b/test/nptl/tst-mutex5a.c @@ -0,0 +1,2 @@ +#define TYPE PTHREAD_MUTEX_ADAPTIVE_NP +#include "tst-mutex5.c" diff --git a/test/nptl/tst-mutex6.c b/test/nptl/tst-mutex6.c new file mode 100644 index 000000000..0dcfc7725 --- /dev/null +++ b/test/nptl/tst-mutex6.c @@ -0,0 +1,54 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <unistd.h> + + +static int +do_test (void) +{ + pthread_mutex_t m; + + if (pthread_mutex_init (&m, NULL) != 0) + { + puts ("mutex_init failed"); + return 1; + } + + if (pthread_mutex_lock (&m) != 0) + { + puts ("1st mutex_lock failed"); + return 1; + } + + /* Set an alarm for 1 second. The wrapper will expect this. */ + alarm (1); + + /* This call should never return. */ + pthread_mutex_lock (&m); + + puts ("2nd mutex_lock returned"); + return 1; +} + +#define EXPECTED_SIGNAL SIGALRM +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mutex7.c b/test/nptl/tst-mutex7.c new file mode 100644 index 000000000..29a1423fd --- /dev/null +++ b/test/nptl/tst-mutex7.c @@ -0,0 +1,120 @@ +/* Copyright (C) 2002, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <time.h> + + +#ifndef INIT +# define INIT PTHREAD_MUTEX_INITIALIZER +#endif + + +static pthread_mutex_t lock = INIT; + + +#define ROUNDS 1000 +#define N 100 + + +static void * +tf (void *arg) +{ + int nr = (long int) arg; + int cnt; + struct timespec ts = { .tv_sec = 0, .tv_nsec = 11000 }; + + for (cnt = 0; cnt < ROUNDS; ++cnt) + { + if (pthread_mutex_lock (&lock) != 0) + { + printf ("thread %d: failed to get the lock\n", nr); + return (void *) 1l; + } + + if (pthread_mutex_unlock (&lock) != 0) + { + printf ("thread %d: failed to release the lock\n", nr); + return (void *) 1l; + } + + nanosleep (&ts, NULL); + } + + return NULL; +} + + +static int +do_test (void) +{ + pthread_attr_t at; + pthread_t th[N]; + int cnt; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + + if (pthread_mutex_lock (&lock) != 0) + { + puts ("locking in parent failed"); + return 1; + } + + for (cnt = 0; cnt < N; ++cnt) + if (pthread_create (&th[cnt], &at, tf, (void *) (long int) cnt) != 0) + { + printf ("creating thread %d failed\n", cnt); + return 1; + } + + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + + if (pthread_mutex_unlock (&lock) != 0) + { + puts ("unlocking in parent failed"); + return 1; + } + + for (cnt = 0; cnt < N; ++cnt) + if (pthread_join (th[cnt], NULL) != 0) + { + printf ("joining thread %d failed\n", cnt); + return 1; + } + + return 0; +} + +#define TIMEOUT 60 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mutex7a.c b/test/nptl/tst-mutex7a.c new file mode 100644 index 000000000..f08799ae7 --- /dev/null +++ b/test/nptl/tst-mutex7a.c @@ -0,0 +1,2 @@ +#define INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP +#include "tst-mutex7.c" diff --git a/test/nptl/tst-mutex8.c b/test/nptl/tst-mutex8.c new file mode 100644 index 000000000..a949be340 --- /dev/null +++ b/test/nptl/tst-mutex8.c @@ -0,0 +1,366 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +/* This test checks behavior not required by POSIX. */ +#include <errno.h> +#include <pthread.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> + + +static pthread_mutex_t *m; +static pthread_barrier_t b; +static pthread_cond_t c; +static bool done; + + +static void +cl (void *arg) +{ + if (pthread_mutex_unlock (m) != 0) + { + puts ("cl: mutex_unlocked failed"); + exit (1); + } +} + + +static void * +tf (void *arg) +{ + if (pthread_mutex_lock (m) != 0) + { + puts ("tf: mutex_lock failed"); + return (void *) 1l; + } + + int e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + return (void *) 1l; + } + + if (arg == NULL) + do + if (pthread_cond_wait (&c, m) != 0) + { + puts ("tf: cond_wait failed"); + return (void *) 1l; + } + while (! done); + else + do + { + pthread_cleanup_push (cl, NULL); + + if (pthread_cond_wait (&c, m) != 0) + { + puts ("tf: cond_wait failed"); + return (void *) 1l; + } + + pthread_cleanup_pop (0); + } + while (! done); + + if (pthread_mutex_unlock (m) != 0) + { + puts ("tf: mutex_unlock failed"); + return (void *) 1l; + } + + return NULL; +} + + +static int +check_type (const char *mas, pthread_mutexattr_t *ma) +{ + if (pthread_mutex_init (m, ma) != 0) + { + printf ("1st mutex_init failed for %s\n", mas); + return 1; + } + + if (pthread_mutex_destroy (m) != 0) + { + printf ("immediate mutex_destroy failed for %s\n", mas); + return 1; + } + + if (pthread_mutex_init (m, ma) != 0) + { + printf ("2nd mutex_init failed for %s\n", mas); + return 1; + } + + if (pthread_mutex_lock (m) != 0) + { + printf ("1st mutex_lock failed for %s\n", mas); + return 1; + } + + int e = pthread_mutex_destroy (m); + if (e == 0) + { + printf ("mutex_destroy of self-locked mutex succeeded for %s\n", mas); + return 1; + } + if (e != EBUSY) + { + printf ("mutex_destroy of self-locked mutex did not return EBUSY %s\n", + mas); + return 1; + } + + if (pthread_mutex_unlock (m) != 0) + { + printf ("1st mutex_unlock failed for %s\n", mas); + return 1; + } + + if (pthread_mutex_trylock (m) != 0) + { + printf ("mutex_trylock failed for %s\n", mas); + return 1; + } + + e = pthread_mutex_destroy (m); + if (e == 0) + { + printf ("mutex_destroy of self-trylocked mutex succeeded for %s\n", mas); + return 1; + } + if (e != EBUSY) + { + printf ("\ +mutex_destroy of self-trylocked mutex did not return EBUSY %s\n", + mas); + return 1; + } + + if (pthread_mutex_unlock (m) != 0) + { + printf ("2nd mutex_unlock failed for %s\n", mas); + return 1; + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("1st create failed"); + return 1; + } + done = false; + + e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("1st barrier_wait failed"); + return 1; + } + + if (pthread_mutex_lock (m) != 0) + { + printf ("2nd mutex_lock failed for %s\n", mas); + return 1; + } + + if (pthread_mutex_unlock (m) != 0) + { + printf ("3rd mutex_unlock failed for %s\n", mas); + return 1; + } + + e = pthread_mutex_destroy (m); + if (e == 0) + { + printf ("mutex_destroy of condvar-used mutex succeeded for %s\n", mas); + return 1; + } + if (e != EBUSY) + { + printf ("\ +mutex_destroy of condvar-used mutex did not return EBUSY for %s\n", mas); + return 1; + } + + done = true; + if (pthread_cond_signal (&c) != 0) + { + puts ("cond_signal failed"); + return 1; + } + + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("join failed"); + return 1; + } + if (r != NULL) + { + puts ("thread didn't return NULL"); + return 1; + } + + if (pthread_mutex_destroy (m) != 0) + { + printf ("mutex_destroy after condvar-use failed for %s\n", mas); + return 1; + } + + if (pthread_mutex_init (m, ma) != 0) + { + printf ("3rd mutex_init failed for %s\n", mas); + return 1; + } + + if (pthread_create (&th, NULL, tf, (void *) 1) != 0) + { + puts ("2nd create failed"); + return 1; + } + done = false; + + e = pthread_barrier_wait (&b); + if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("2nd barrier_wait failed"); + return 1; + } + + if (pthread_mutex_lock (m) != 0) + { + printf ("3rd mutex_lock failed for %s\n", mas); + return 1; + } + + if (pthread_mutex_unlock (m) != 0) + { + printf ("4th mutex_unlock failed for %s\n", mas); + return 1; + } + + e = pthread_mutex_destroy (m); + if (e == 0) + { + printf ("2nd mutex_destroy of condvar-used mutex succeeded for %s\n", + mas); + return 1; + } + if (e != EBUSY) + { + printf ("\ +2nd mutex_destroy of condvar-used mutex did not return EBUSY for %s\n", + mas); + return 1; + } + + if (pthread_cancel (th) != 0) + { + puts ("cond_cancel failed"); + return 1; + } + + if (pthread_join (th, &r) != 0) + { + puts ("join failed"); + return 1; + } + if (r != PTHREAD_CANCELED) + { + puts ("thread not canceled"); + return 1; + } + + if (pthread_mutex_destroy (m) != 0) + { + printf ("mutex_destroy after condvar-canceled failed for %s\n", mas); + return 1; + } + + return 0; +} + + +static int +do_test (void) +{ + pthread_mutex_t mm; + m = &mm; + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + if (pthread_cond_init (&c, NULL) != 0) + { + puts ("cond_init failed"); + return 1; + } + + puts ("check normal mutex"); + int res = check_type ("normal", NULL); + + pthread_mutexattr_t ma; + if (pthread_mutexattr_init (&ma) != 0) + { + puts ("1st mutexattr_init failed"); + return 1; + } + if (pthread_mutexattr_settype (&ma, PTHREAD_MUTEX_RECURSIVE) != 0) + { + puts ("1st mutexattr_settype failed"); + return 1; + } + puts ("check recursive mutex"); + res |= check_type ("recursive", &ma); + if (pthread_mutexattr_destroy (&ma) != 0) + { + puts ("1st mutexattr_destroy failed"); + return 1; + } + + if (pthread_mutexattr_init (&ma) != 0) + { + puts ("2nd mutexattr_init failed"); + return 1; + } + if (pthread_mutexattr_settype (&ma, PTHREAD_MUTEX_ERRORCHECK) != 0) + { + puts ("2nd mutexattr_settype failed"); + return 1; + } + puts ("check error-checking mutex"); + res |= check_type ("error-checking", &ma); + if (pthread_mutexattr_destroy (&ma) != 0) + { + puts ("2nd mutexattr_destroy failed"); + return 1; + } + + return res; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-mutex9.c b/test/nptl/tst-mutex9.c new file mode 100644 index 000000000..a4bb3aaaf --- /dev/null +++ b/test/nptl/tst-mutex9.c @@ -0,0 +1,190 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/wait.h> +#include <stdint.h> +#include <stdlib.h> +#include <sys/time.h> + +int gettimeofday(struct timeval *tv, struct timezone *tz); + + +static int +do_test (void) +{ + size_t ps = sysconf (_SC_PAGESIZE); + char tmpfname[] = "/tmp/tst-mutex9.XXXXXX"; + char data[ps]; + void *mem; + int fd; + pthread_mutex_t *m; + pthread_mutexattr_t a; + pid_t pid; + char *p; + + fd = mkstemp (tmpfname); + if (fd == -1) + { + printf ("cannot open temporary file: %m\n"); + return 1; + } + + /* Make sure it is always removed. */ + unlink (tmpfname); + + /* Create one page of data. */ + memset (data, '\0', ps); + + /* Write the data to the file. */ + if (write (fd, data, ps) != (ssize_t) ps) + { + puts ("short write"); + return 1; + } + + mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (mem == MAP_FAILED) + { + printf ("mmap failed: %m\n"); + return 1; + } + + m = (pthread_mutex_t *) (((uintptr_t) mem + __alignof (pthread_mutex_t)) + & ~(__alignof (pthread_mutex_t) - 1)); + p = (char *) (m + 1); + + if (pthread_mutexattr_init (&a) != 0) + { + puts ("mutexattr_init failed"); + return 1; + } + + if (pthread_mutexattr_setpshared (&a, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("mutexattr_setpshared failed"); + return 1; + } + + if (pthread_mutexattr_settype (&a, PTHREAD_MUTEX_RECURSIVE) != 0) + { + puts ("mutexattr_settype failed"); + return 1; + } + + if (pthread_mutex_init (m, &a) != 0) + { + puts ("mutex_init failed"); + return 1; + } + + if (pthread_mutex_lock (m) != 0) + { + puts ("mutex_lock failed"); + return 1; + } + + if (pthread_mutexattr_destroy (&a) != 0) + { + puts ("mutexattr_destroy failed"); + return 1; + } + + puts ("going to fork now"); + pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + return 1; + } + else if (pid == 0) + { + if (pthread_mutex_trylock (m) == 0) + { + puts ("child: mutex_trylock succeeded"); + exit (1); + } + + if (pthread_mutex_unlock (m) == 0) + { + puts ("child: mutex_unlock succeeded"); + exit (1); + } + + struct timeval tv; + gettimeofday (&tv, NULL); + struct timespec ts; + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_nsec += 500000000; + if (ts.tv_nsec >= 1000000000) + { + ++ts.tv_sec; + ts.tv_nsec -= 1000000000; + } + + int e = pthread_mutex_timedlock (m, &ts); + if (e == 0) + { + puts ("child: mutex_timedlock succeeded"); + exit (1); + } + if (e != ETIMEDOUT) + { + puts ("child: mutex_timedlock didn't time out"); + exit (1); + } + + alarm (1); + + pthread_mutex_lock (m); + + puts ("child: mutex_lock returned"); + + exit (0); + } + + sleep (2); + + int status; + if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid) + { + puts ("waitpid failed"); + return 1; + } + if (! WIFSIGNALED (status)) + { + puts ("child not killed by signal"); + return 1; + } + if (WTERMSIG (status) != SIGALRM) + { + puts ("child not killed by SIGALRM"); + return 1; + } + + return 0; +} + +#define TIMEOUT 3 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-oddstacklimit.c b/test/nptl/tst-oddstacklimit.c new file mode 100644 index 000000000..9fbef1889 --- /dev/null +++ b/test/nptl/tst-oddstacklimit.c @@ -0,0 +1 @@ +#include "tst-basic1.c" diff --git a/test/nptl/tst-once1.c b/test/nptl/tst-once1.c new file mode 100644 index 000000000..308a45586 --- /dev/null +++ b/test/nptl/tst-once1.c @@ -0,0 +1,50 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> + + +static pthread_once_t once = PTHREAD_ONCE_INIT; + +static int global; + +static void +once_handler (void) +{ + ++global; +} + + +static int +do_test (void) +{ + pthread_once (&once, once_handler); + pthread_once (&once, once_handler); + + if (global != 1) + { + printf ("global = %d, expected 1\n", global); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-once2.c b/test/nptl/tst-once2.c new file mode 100644 index 000000000..6e2f3db1f --- /dev/null +++ b/test/nptl/tst-once2.c @@ -0,0 +1,103 @@ +/* Copyright (C) 2002, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> + + +#define N 100 + +static pthread_once_t once = PTHREAD_ONCE_INIT; + +static int global; + +static void +once_handler (void) +{ + struct timespec ts; + + ++global; + + ts.tv_sec = 2; + ts.tv_nsec = 0; + nanosleep (&ts, NULL); +} + + +static void * +tf (void *arg) +{ + pthread_once (&once, once_handler); + + if (global != 1) + { + printf ("thread %ld: global == %d\n", (long int) arg, global); + exit (1); + } + + return NULL; +} + + +static int +do_test (void) +{ + pthread_attr_t at; + pthread_t th[N]; + int cnt; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setstacksize (&at, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + + for (cnt = 0; cnt < N; ++cnt) + if (pthread_create (&th[cnt], &at, tf, (void *) (long int) cnt) != 0) + { + printf ("creation of thread %d failed\n", cnt); + return 1; + } + + if (pthread_attr_destroy (&at) != 0) + { + puts ("attr_destroy failed"); + return 1; + } + + for (cnt = 0; cnt < N; ++cnt) + if (pthread_join (th[cnt], NULL) != 0) + { + printf ("join of thread %d failed\n", cnt); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#define TIMEOUT 4 +#include "../test-skeleton.c" diff --git a/test/nptl/tst-once3.c b/test/nptl/tst-once3.c new file mode 100644 index 000000000..c869ca890 --- /dev/null +++ b/test/nptl/tst-once3.c @@ -0,0 +1,161 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> + + +#define N 100 + +static pthread_once_t once = PTHREAD_ONCE_INIT; + +static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; + +static pthread_barrier_t bar; + +static int global; +static int cl_called; + +static void +once_handler1 (void) +{ + if (pthread_mutex_lock (&mut) != 0) + { + puts ("once_handler1: mutex_lock failed"); + exit (1); + } + puts ("once_handler1: locked"); + + int r = pthread_barrier_wait (&bar); + if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("once_handler1: barrier_wait failed"); + exit (1); + } + + pthread_cond_wait (&cond, &mut); + + /* We should never get here. */ + exit (42); +} + +static void +once_handler2 (void) +{ + global = 1; +} + + +static void +cl (void *arg) +{ + cl_called = 1; +} + + +static void * +tf (void *arg) +{ + pthread_cleanup_push (cl, NULL) + + pthread_once (&once, once_handler1); + + pthread_cleanup_pop (0); + + /* We should never get here. */ + puts ("pthread_once in tf returned"); + exit (1); +} + + +static int +do_test (void) +{ + pthread_t th; + + if (pthread_barrier_init (&bar, NULL, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("first create failed"); + return 1; + } + + int r = pthread_barrier_wait (&bar); + if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + return 1; + } + + if (pthread_mutex_lock (&mut) != 0) + { + puts ("mutex_lock failed"); + return 1; + } + /* We unlock the mutex so that we catch the case where the pthread_cond_wait + call incorrectly resumes and tries to get the mutex. */ + if (pthread_mutex_unlock (&mut) != 0) + { + puts ("mutex_unlock failed"); + return 1; + } + + /* Cancel the thread. */ + puts ("going to cancel"); + if (pthread_cancel (th) != 0) + { + puts ("cancel failed"); + return 1; + } + + void *result; + pthread_join (th, &result); + if (result != PTHREAD_CANCELED) + { + puts ("join didn't return PTHREAD_CANCELED"); + return 1; + } + + if (cl_called != 1) + { + puts ("cleanup handler not called"); + return 1; + } + + pthread_once (&once, once_handler2); + + if (global != 1) + { + puts ("global still 0"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#define TIMEOUT 4 +#include "../test-skeleton.c" diff --git a/test/nptl/tst-once4.c b/test/nptl/tst-once4.c new file mode 100644 index 000000000..a80b83099 --- /dev/null +++ b/test/nptl/tst-once4.c @@ -0,0 +1,201 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <unistd.h> + + +static pthread_once_t once = PTHREAD_ONCE_INIT; + +static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; + +static pthread_barrier_t bar; + +static int global; +static int cl_called; + +static void +once_handler1 (void) +{ + if (pthread_mutex_lock (&mut) != 0) + { + puts ("once_handler1: mutex_lock failed"); + exit (1); + } + + int r = pthread_barrier_wait (&bar); + if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("once_handler1: barrier_wait failed"); + exit (1); + } + + pthread_cond_wait (&cond, &mut); + + /* We should never get here. */ +} + + +static void +once_handler2 (void) +{ + global = 1; +} + + +static void +cl (void *arg) +{ + ++cl_called; +} + + +static void * +tf1 (void *arg) +{ + pthread_cleanup_push (cl, NULL); + + pthread_once (&once, once_handler1); + + pthread_cleanup_pop (0); + + /* We should never get here. */ + puts ("pthread_once in tf returned"); + exit (1); +} + + +static void * +tf2 (void *arg) +{ + pthread_cleanup_push (cl, NULL); + + int r = pthread_barrier_wait (&bar); + if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("once_handler2: barrier_wait failed"); + exit (1); + } + + pthread_cleanup_pop (0); + + pthread_once (&once, once_handler2); + + return NULL; +} + + +static int +do_test (void) +{ + pthread_t th[2]; + + if (pthread_barrier_init (&bar, NULL, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + if (pthread_create (&th[0], NULL, tf1, NULL) != 0) + { + puts ("first create failed"); + return 1; + } + + int r = pthread_barrier_wait (&bar); + if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("first barrier_wait failed"); + return 1; + } + + if (pthread_mutex_lock (&mut) != 0) + { + puts ("mutex_lock failed"); + return 1; + } + /* We unlock the mutex so that we catch the case where the pthread_cond_wait + call incorrectly resumes and tries to get the mutex. */ + if (pthread_mutex_unlock (&mut) != 0) + { + puts ("mutex_unlock failed"); + return 1; + } + + if (pthread_create (&th[1], NULL, tf2, NULL) != 0) + { + puts ("second create failed"); + return 1; + } + + r = pthread_barrier_wait (&bar); + if (r != 0 && r!= PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("second barrier_wait failed"); + return 1; + } + + /* Give the second thread a chance to reach the pthread_once call. */ + sleep (2); + + /* Cancel the thread. */ + if (pthread_cancel (th[0]) != 0) + { + puts ("cancel failed"); + return 1; + } + + void *result; + pthread_join (th[0], &result); + if (result != PTHREAD_CANCELED) + { + puts ("first join didn't return PTHREAD_CANCELED"); + return 1; + } + + puts ("joined first thread"); + + pthread_join (th[1], &result); + if (result != NULL) + { + puts ("second join didn't return PTHREAD_CANCELED"); + return 1; + } + + if (global != 1) + { + puts ("global still 0"); + return 1; + } + + if (cl_called != 1) + { + printf ("cl_called = %d\n", cl_called); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#define TIMEOUT 4 +#include "../test-skeleton.c" diff --git a/test/nptl/tst-oncex3.c b/test/nptl/tst-oncex3.c new file mode 100644 index 000000000..08225b88d --- /dev/null +++ b/test/nptl/tst-oncex3.c @@ -0,0 +1 @@ +#include "tst-once3.c" diff --git a/test/nptl/tst-oncex4.c b/test/nptl/tst-oncex4.c new file mode 100644 index 000000000..9b4d98f3f --- /dev/null +++ b/test/nptl/tst-oncex4.c @@ -0,0 +1 @@ +#include "tst-once4.c" diff --git a/test/nptl/tst-popen1.c b/test/nptl/tst-popen1.c new file mode 100644 index 000000000..0c779fc99 --- /dev/null +++ b/test/nptl/tst-popen1.c @@ -0,0 +1,59 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <error.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +static void * +dummy (void *x) +{ + return NULL; +} + +static char buf[sizeof "something\n"]; + +static int +do_test (void) +{ + FILE *f; + pthread_t p; + int err; + + f = popen ("echo something", "r"); + if (f == NULL) + error (EXIT_FAILURE, errno, "popen failed"); + if (fgets (buf, sizeof (buf), f) == NULL) + error (EXIT_FAILURE, 0, "fgets failed"); + if (strcmp (buf, "something\n")) + error (EXIT_FAILURE, 0, "read wrong data"); + if (pclose (f)) + error (EXIT_FAILURE, errno, "pclose returned non-zero"); + if ((err = pthread_create (&p, NULL, dummy, NULL))) + error (EXIT_FAILURE, err, "pthread_create failed"); + if ((err = pthread_join (p, NULL))) + error (EXIT_FAILURE, err, "pthread_join failed"); + exit (0); +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-raise1.c b/test/nptl/tst-raise1.c new file mode 100644 index 000000000..45c62e19e --- /dev/null +++ b/test/nptl/tst-raise1.c @@ -0,0 +1,61 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.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: %m\n"); + exit (1); + } + if (raise (SIGUSR1) < 0) + { + printf ("first raise failed: %m\n"); + exit (1); + } + if (raise (SIGUSR1) < 0) + { + printf ("second raise failed: %m\n"); + exit (1); + } + if (count != 2) + { + printf ("signal handler not called 2 times\n"); + exit (1); + } + exit (0); +} diff --git a/test/nptl/tst-rwlock1.c b/test/nptl/tst-rwlock1.c new file mode 100644 index 000000000..a5e8d6326 --- /dev/null +++ b/test/nptl/tst-rwlock1.c @@ -0,0 +1,116 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> + + +static int +do_test (void) +{ + pthread_rwlock_t r; + + if (pthread_rwlock_init (&r, NULL) != 0) + { + puts ("rwlock_init failed"); + return 1; + } + puts ("rwlock_init succeeded"); + + if (pthread_rwlock_rdlock (&r) != 0) + { + puts ("1st rwlock_rdlock failed"); + return 1; + } + puts ("1st rwlock_rdlock succeeded"); + + if (pthread_rwlock_rdlock (&r) != 0) + { + puts ("2nd rwlock_rdlock failed"); + return 1; + } + puts ("2nd rwlock_rdlock succeeded"); + + if (pthread_rwlock_unlock (&r) != 0) + { + puts ("1st rwlock_unlock failed"); + return 1; + } + puts ("1st rwlock_unlock succeeded"); + + if (pthread_rwlock_unlock (&r) != 0) + { + puts ("2nd rwlock_unlock failed"); + return 1; + } + puts ("2nd rwlock_unlock succeeded"); + + if (pthread_rwlock_wrlock (&r) != 0) + { + puts ("1st rwlock_wrlock failed"); + return 1; + } + puts ("1st rwlock_wrlock succeeded"); + + if (pthread_rwlock_unlock (&r) != 0) + { + puts ("3rd rwlock_unlock failed"); + return 1; + } + puts ("3rd rwlock_unlock succeeded"); + + if (pthread_rwlock_wrlock (&r) != 0) + { + puts ("2nd rwlock_wrlock failed"); + return 1; + } + puts ("2nd rwlock_wrlock succeeded"); + + if (pthread_rwlock_unlock (&r) != 0) + { + puts ("4th rwlock_unlock failed"); + return 1; + } + puts ("4th rwlock_unlock succeeded"); + + if (pthread_rwlock_rdlock (&r) != 0) + { + puts ("3rd rwlock_rdlock failed"); + return 1; + } + puts ("3rd rwlock_rdlock succeeded"); + + if (pthread_rwlock_unlock (&r) != 0) + { + puts ("5th rwlock_unlock failed"); + return 1; + } + puts ("5th rwlock_unlock succeeded"); + + if (pthread_rwlock_destroy (&r) != 0) + { + puts ("rwlock_destroy failed"); + return 1; + } + puts ("rwlock_destroy succeeded"); + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-rwlock10.c b/test/nptl/tst-rwlock10.c new file mode 100644 index 000000000..e22b1e07f --- /dev/null +++ b/test/nptl/tst-rwlock10.c @@ -0,0 +1,20 @@ +/* Test program for timedout read/write lock functions. + Copyright (C) 2003 Free Software Foundation, Inc. + 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; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#define INIT PTHREAD_RWLOCK_INITIALIZER +#include "tst-rwlock8.c" diff --git a/test/nptl/tst-rwlock11.c b/test/nptl/tst-rwlock11.c new file mode 100644 index 000000000..93a1b0cce --- /dev/null +++ b/test/nptl/tst-rwlock11.c @@ -0,0 +1,20 @@ +/* Test program for timedout read/write lock functions. + Copyright (C) 2003 Free Software Foundation, Inc. + 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; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#define INIT PTHREAD_RWLOCK_INITIALIZER +#include "tst-rwlock9.c" diff --git a/test/nptl/tst-rwlock12.c b/test/nptl/tst-rwlock12.c new file mode 100644 index 000000000..c0e5cee92 --- /dev/null +++ b/test/nptl/tst-rwlock12.c @@ -0,0 +1,207 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/wait.h> + + +static int +do_test (void) +{ + size_t ps = sysconf (_SC_PAGESIZE); + char tmpfname[] = "/tmp/tst-rwlock12.XXXXXX"; + char data[ps]; + void *mem; + int fd; + pthread_mutex_t *m; + pthread_mutexattr_t ma; + pthread_rwlock_t *r; + pthread_rwlockattr_t ra; + pid_t pid; + int status = 0; + + fd = mkstemp (tmpfname); + if (fd == -1) + { + printf ("cannot open temporary file: %m\n"); + return 1; + } + + /* Make sure it is always removed. */ + unlink (tmpfname); + + /* Create one page of data. */ + memset (data, '\0', ps); + + /* Write the data to the file. */ + if (write (fd, data, ps) != (ssize_t) ps) + { + puts ("short write"); + return 1; + } + + mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (mem == MAP_FAILED) + { + printf ("mmap failed: %m\n"); + return 1; + } + + r = (pthread_rwlock_t *) (((uintptr_t) mem + __alignof (pthread_rwlock_t)) + & ~(__alignof (pthread_rwlock_t) - 1)); + /* The following assumes alignment for a mutex is at least as high + as that for a rwlock. Which is true in our case. */ + m = (pthread_mutex_t *) (r + 1); + + if (pthread_rwlockattr_init (&ra) != 0) + { + puts ("rwlockattr_init failed"); + return 1; + } + + if (pthread_rwlockattr_setpshared (&ra, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("rwlockattr_setpshared failed"); + return 1; + } + + if (pthread_rwlock_init (r, &ra) != 0) + { + puts ("rwlock_init failed"); + return 1; + } + + if (pthread_mutexattr_init (&ma) != 0) + { + puts ("rwlockattr_init failed"); + return 1; + } + + if (pthread_mutexattr_setpshared (&ma, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("mutexattr_setpshared failed"); + return 1; + } + + if (pthread_mutex_init (m, &ma) != 0) + { + puts ("mutex_init failed"); + return 1; + } + + /* Lock the mutex. */ + if (pthread_mutex_lock (m) != 0) + { + puts ("mutex_lock failed"); + return 1; + } + + puts ("going to fork now"); + pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + return 1; + } + else if (pid == 0) + { + /* Lock the mutex. */ + if (pthread_mutex_lock (m) != 0) + { + puts ("child: mutex_lock failed"); + return 1; + } + + /* Try to get the rwlock. */ + if (pthread_rwlock_trywrlock (r) == 0) + { + puts ("rwlock_trywrlock succeeded"); + return 1; + } + + /* Try again. */ + struct timespec ts = { .tv_sec = 0, .tv_nsec = 500000000 }; + int e = pthread_rwlock_timedwrlock (r, &ts); + if (e == 0) + { + puts ("rwlock_timedwrlock succeeded"); + return 1; + } + if (e != ETIMEDOUT) + { + puts ("rwlock_timedwrlock didn't return ETIMEDOUT"); + status = 1; + } + + if (pthread_rwlock_tryrdlock (r) == 0) + { + puts ("rwlock_tryrdlock succeeded"); + return 1; + } + + e = pthread_rwlock_timedrdlock (r, &ts); + if (e == 0) + { + puts ("rwlock_timedrdlock succeeded"); + return 1; + } + if (e != ETIMEDOUT) + { + puts ("rwlock_timedrdlock didn't return ETIMEDOUT"); + status = 1; + } + } + else + { + /* Lock the rwlock for writing. */ + if (pthread_rwlock_wrlock (r) != 0) + { + puts ("rwlock_wrlock failed"); + kill (pid, SIGTERM); + return 1; + } + + /* Allow the child to run. */ + if (pthread_mutex_unlock (m) != 0) + { + puts ("mutex_unlock failed"); + kill (pid, SIGTERM); + return 1; + } + + /* Just wait for the child. */ + if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid) + { + puts ("waitpid failed"); + kill (pid, SIGTERM); + return 1; + } + } + + return status; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-rwlock13.c b/test/nptl/tst-rwlock13.c new file mode 100644 index 000000000..8fb2a7d2b --- /dev/null +++ b/test/nptl/tst-rwlock13.c @@ -0,0 +1,70 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <string.h> + + +static int +do_test (void) +{ + pthread_rwlock_t r; + int ret; + + memset (&r, 0xaa, sizeof (r)); + if ((ret = pthread_rwlock_init (&r, NULL)) != 0) + { + printf ("rwlock_init failed: %d\n", ret); + return 1; + } + + if ((ret = pthread_rwlock_rdlock (&r)) != 0) + { + printf ("rwlock_rdlock failed: %d\n", ret); + return 1; + } + + if ((ret = pthread_rwlock_unlock (&r)) != 0) + { + printf ("rwlock_unlock failed: %d\n", ret); + return 1; + } + + if ((ret = pthread_rwlock_wrlock (&r)) != 0) + { + printf ("rwlock_wrlock failed: %d\n", ret); + return 1; + } + + if ((ret = pthread_rwlock_unlock (&r)) != 0) + { + printf ("second rwlock_unlock failed: %d\n", ret); + return 1; + } + + if ((ret = pthread_rwlock_destroy (&r)) != 0) + { + printf ("second rwlock_destroy failed: %d\n", ret); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-rwlock14.c b/test/nptl/tst-rwlock14.c new file mode 100644 index 000000000..953d80282 --- /dev/null +++ b/test/nptl/tst-rwlock14.c @@ -0,0 +1,168 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> + + +static pthread_barrier_t b; +static pthread_rwlock_t r = PTHREAD_RWLOCK_INITIALIZER; + + +static void * +tf (void *arg) +{ + /* Lock the read-write lock. */ + if (pthread_rwlock_wrlock (&r) != 0) + { + puts ("tf: cannot lock rwlock"); + exit (EXIT_FAILURE); + } + + pthread_t mt = *(pthread_t *) arg; + + pthread_barrier_wait (&b); + + /* This call will never return. */ + pthread_join (mt, NULL); + + return NULL; +} + + +static int +do_test (void) +{ + int result = 0; + struct timespec ts; + + if (clock_gettime (CLOCK_REALTIME, &ts) != 0) + { + puts ("clock_gettime failed"); + return 1; + } + + if (pthread_barrier_init (&b, NULL, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + pthread_t me = pthread_self (); + pthread_t th; + if (pthread_create (&th, NULL, tf, &me) != 0) + { + puts ("create failed"); + return 1; + } + + /* Wait until the rwlock is locked. */ + pthread_barrier_wait (&b); + + ts.tv_nsec = -1; + + int e = pthread_rwlock_timedrdlock (&r, &ts); + if (e == 0) + { + puts ("first rwlock_timedrdlock did not fail"); + result = 1; + } + else if (e != EINVAL) + { + puts ("first rwlock_timedrdlock did not return EINVAL"); + result = 1; + } + + e = pthread_rwlock_timedwrlock (&r, &ts); + if (e == 0) + { + puts ("first rwlock_timedwrlock did not fail"); + result = 1; + } + else if (e != EINVAL) + { + puts ("first rwlock_timedwrlock did not return EINVAL"); + result = 1; + } + + ts.tv_nsec = 1000000000; + + e = pthread_rwlock_timedrdlock (&r, &ts); + if (e == 0) + { + puts ("second rwlock_timedrdlock did not fail"); + result = 1; + } + else if (e != EINVAL) + { + puts ("second rwlock_timedrdlock did not return EINVAL"); + result = 1; + } + + e = pthread_rwlock_timedrdlock (&r, &ts); + if (e == 0) + { + puts ("second rwlock_timedrdlock did not fail"); + result = 1; + } + else if (e != EINVAL) + { + puts ("second rwlock_timedrdlock did not return EINVAL"); + result = 1; + } + + ts.tv_nsec = 0x100001000LL; + if (ts.tv_nsec != 0x100001000LL) + ts.tv_nsec = 2000000000; + + e = pthread_rwlock_timedrdlock (&r, &ts); + if (e == 0) + { + puts ("third rwlock_timedrdlock did not fail"); + result = 1; + } + else if (e != EINVAL) + { + puts ("third rwlock_timedrdlock did not return EINVAL"); + result = 1; + } + + e = pthread_rwlock_timedrdlock (&r, &ts); + if (e == 0) + { + puts ("third rwlock_timedrdlock did not fail"); + result = 1; + } + else if (e != EINVAL) + { + puts ("third rwlock_timedrdlock did not return EINVAL"); + result = 1; + } + + if (result == 0) + puts ("no bugs"); + + return result; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-rwlock2.c b/test/nptl/tst-rwlock2.c new file mode 100644 index 000000000..a74ce864c --- /dev/null +++ b/test/nptl/tst-rwlock2.c @@ -0,0 +1,142 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> + + +static int +do_test (void) +{ + pthread_rwlock_t r; + int e; + + if (pthread_rwlock_init (&r, NULL) != 0) + { + puts ("rwlock_init failed"); + return 1; + } + puts ("rwlock_init succeeded"); + + if (pthread_rwlock_wrlock (&r) != 0) + { + puts ("1st rwlock_wrlock failed"); + return 1; + } + puts ("1st rwlock_wrlock succeeded"); + + e = pthread_rwlock_tryrdlock (&r); + if (e == 0) + { + puts ("rwlock_tryrdlock on rwlock with writer succeeded"); + return 1; + } + if (e != EBUSY) + { + puts ("rwlock_tryrdlock on rwlock with writer return value != EBUSY"); + return 1; + } + puts ("rwlock_tryrdlock on rwlock with writer failed with EBUSY"); + + e = pthread_rwlock_trywrlock (&r); + if (e == 0) + { + puts ("rwlock_trywrlock on rwlock with writer succeeded"); + return 1; + } + if (e != EBUSY) + { + puts ("rwlock_trywrlock on rwlock with writer return value != EBUSY"); + return 1; + } + puts ("rwlock_trywrlock on rwlock with writer failed with EBUSY"); + + if (pthread_rwlock_unlock (&r) != 0) + { + puts ("1st rwlock_unlock failed"); + return 1; + } + puts ("1st rwlock_unlock succeeded"); + + if (pthread_rwlock_tryrdlock (&r) != 0) + { + puts ("rwlock_tryrdlock on unlocked rwlock failed"); + return 1; + } + puts ("rwlock_tryrdlock on unlocked rwlock succeeded"); + + e = pthread_rwlock_trywrlock (&r); + if (e == 0) + { + puts ("rwlock_trywrlock on rwlock with reader succeeded"); + return 1; + } + if (e != EBUSY) + { + puts ("rwlock_trywrlock on rwlock with reader return value != EBUSY"); + return 1; + } + puts ("rwlock_trywrlock on rwlock with reader failed with EBUSY"); + + if (pthread_rwlock_unlock (&r) != 0) + { + puts ("2nd rwlock_unlock failed"); + return 1; + } + puts ("2nd rwlock_unlock succeeded"); + + if (pthread_rwlock_trywrlock (&r) != 0) + { + puts ("rwlock_trywrlock on unlocked rwlock failed"); + return 1; + } + puts ("rwlock_trywrlock on unlocked rwlock succeeded"); + + e = pthread_rwlock_tryrdlock (&r); + if (e == 0) + { + puts ("rwlock_tryrdlock on rwlock with writer succeeded"); + return 1; + } + if (e != EBUSY) + { + puts ("rwlock_tryrdlock on rwlock with writer return value != EBUSY"); + return 1; + } + puts ("rwlock_tryrdlock on rwlock with writer failed with EBUSY"); + + if (pthread_rwlock_unlock (&r) != 0) + { + puts ("3rd rwlock_unlock failed"); + return 1; + } + puts ("3rd rwlock_unlock succeeded"); + + if (pthread_rwlock_destroy (&r) != 0) + { + puts ("rwlock_destroy failed"); + return 1; + } + puts ("rwlock_destroy succeeded"); + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-rwlock2a.c b/test/nptl/tst-rwlock2a.c new file mode 100644 index 000000000..615de5c01 --- /dev/null +++ b/test/nptl/tst-rwlock2a.c @@ -0,0 +1,2 @@ +#define TYPE PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP +#include "tst-rwlock2.c" diff --git a/test/nptl/tst-rwlock3.c b/test/nptl/tst-rwlock3.c new file mode 100644 index 000000000..1cb533896 --- /dev/null +++ b/test/nptl/tst-rwlock3.c @@ -0,0 +1,92 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +/* This test case checks more than standard compliance. An + implementation may provide this service but it is not required to + do so. */ + +#include <errno.h> +#include <pthread.h> +#include <stdio.h> + + +static int +do_test (void) +{ + pthread_rwlock_t r; + int e; + + if (pthread_rwlock_init (&r, NULL) != 0) + { + puts ("rwlock_init failed"); + return 1; + } + puts ("rwlock_init succeeded"); + + if (pthread_rwlock_trywrlock (&r) != 0) + { + puts ("rwlock_trywrlock on unlocked rwlock failed"); + return 1; + } + puts ("rwlock_trywrlock on unlocked rwlock succeeded"); + + e = pthread_rwlock_rdlock (&r); + if (e == 0) + { + puts ("rwlock_rdlock on rwlock with writer succeeded"); + return 1; + } + if (e != EDEADLK) + { + puts ("rwlock_rdlock on rwlock with writer failed != EDEADLK"); + return 1; + } + puts ("rwlock_rdlock on rwlock with writer failed with EDEADLK"); + + e = pthread_rwlock_wrlock (&r); + if (e == 0) + { + puts ("rwlock_wrlock on rwlock with writer succeeded"); + return 1; + } + if (e != EDEADLK) + { + puts ("rwlock_wrlock on rwlock with writer failed != EDEADLK"); + return 1; + } + puts ("rwlock_wrlock on rwlock with writer failed with EDEADLK"); + + if (pthread_rwlock_unlock (&r) != 0) + { + puts ("rwlock_unlock failed"); + return 1; + } + puts ("rwlock_unlock succeeded"); + + if (pthread_rwlock_destroy (&r) != 0) + { + puts ("rwlock_destroy failed"); + return 1; + } + puts ("rwlock_destroy succeeded"); + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-rwlock4.c b/test/nptl/tst-rwlock4.c new file mode 100644 index 000000000..0bbf083e7 --- /dev/null +++ b/test/nptl/tst-rwlock4.c @@ -0,0 +1,189 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/wait.h> + + +static int +do_test (void) +{ + size_t ps = sysconf (_SC_PAGESIZE); + char tmpfname[] = "/tmp/tst-rwlock4.XXXXXX"; + char data[ps]; + void *mem; + int fd; + pthread_rwlock_t *r; + pthread_rwlockattr_t a; + pid_t pid; + char *p; + int err; + int s; + + fd = mkstemp (tmpfname); + if (fd == -1) + { + printf ("cannot open temporary file: %m\n"); + return 1; + } + + /* Make sure it is always removed. */ + unlink (tmpfname); + + /* Create one page of data. */ + memset (data, '\0', ps); + + /* Write the data to the file. */ + if (write (fd, data, ps) != (ssize_t) ps) + { + puts ("short write"); + return 1; + } + + mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (mem == MAP_FAILED) + { + printf ("mmap failed: %m\n"); + return 1; + } + + r = (pthread_rwlock_t *) (((uintptr_t) mem + __alignof (pthread_rwlock_t)) + & ~(__alignof (pthread_rwlock_t) - 1)); + p = (char *) (r + 1); + + if (pthread_rwlockattr_init (&a) != 0) + { + puts ("rwlockattr_init failed"); + return 1; + } + + if (pthread_rwlockattr_getpshared (&a, &s) != 0) + { + puts ("1st rwlockattr_getpshared failed"); + return 1; + } + + if (s != PTHREAD_PROCESS_PRIVATE) + { + puts ("default pshared value wrong"); + return 1; + } + + if (pthread_rwlockattr_setpshared (&a, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("rwlockattr_setpshared failed"); + return 1; + } + + if (pthread_rwlockattr_getpshared (&a, &s) != 0) + { + puts ("2nd rwlockattr_getpshared failed"); + return 1; + } + + if (s != PTHREAD_PROCESS_SHARED) + { + puts ("pshared value after setpshared call wrong"); + return 1; + } + + if (pthread_rwlock_init (r, &a) != 0) + { + puts ("rwlock_init failed"); + return 1; + } + + if (pthread_rwlock_rdlock (r) != 0) + { + puts ("rwlock_rdlock failed"); + return 1; + } + + if (pthread_rwlockattr_destroy (&a) != 0) + { + puts ("rwlockattr_destroy failed"); + return 1; + } + + err = pthread_rwlock_trywrlock (r); + if (err == 0) + { + puts ("rwlock_trywrlock succeeded"); + return 1; + } + else if (err != EBUSY) + { + puts ("rwlock_trywrlock didn't return EBUSY"); + return 1; + } + + *p = 0; + + puts ("going to fork now"); + pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + return 1; + } + else if (pid == 0) + { + /* Play some lock ping-pong. It's our turn to unlock first. */ + if ((*p)++ != 0) + { + puts ("child: *p != 0"); + return 1; + } + + if (pthread_rwlock_unlock (r) != 0) + { + puts ("child: 1st rwlock_unlock failed"); + return 1; + } + + puts ("child done"); + } + else + { + if (pthread_rwlock_wrlock (r) != 0) + { + puts ("parent: rwlock_wrlock failed"); + return 1; + } + + if (*p != 1) + { + puts ("*p != 1"); + return 1; + } + + puts ("parent done"); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-rwlock5.c b/test/nptl/tst-rwlock5.c new file mode 100644 index 000000000..4914afdca --- /dev/null +++ b/test/nptl/tst-rwlock5.c @@ -0,0 +1,86 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; +static pthread_rwlock_t r; + + +static void * +tf (void *arg) +{ + if (pthread_rwlock_wrlock (&r) == 0) + { + puts ("child: rwlock_wrlock succeeded"); + exit (1); + } + + puts ("child: rwlock_wrlock returned"); + + exit (1); +} + + +static int +do_test (void) +{ + pthread_t th; + + if (pthread_rwlock_init (&r, NULL) != 0) + { + puts ("rwlock_init failed"); + return 1; + } + + if (pthread_rwlock_wrlock (&r) != 0) + { + puts ("rwlock_wrlock failed"); + return 1; + } + + if (pthread_mutex_lock (&m) != 0) + { + puts ("mutex_lock failed"); + return 1; + } + + /* Set an alarm for 1 second. The wrapper will expect this. */ + alarm (1); + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + /* This call should never return. */ + pthread_mutex_lock (&m); + + puts ("2nd mutex_lock returned"); + return 1; +} + +#define EXPECTED_SIGNAL SIGALRM +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-rwlock6.c b/test/nptl/tst-rwlock6.c new file mode 100644 index 000000000..78d07167a --- /dev/null +++ b/test/nptl/tst-rwlock6.c @@ -0,0 +1,225 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/time.h> + + +static int kind[] = + { + PTHREAD_RWLOCK_PREFER_READER_NP, + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, + PTHREAD_RWLOCK_PREFER_WRITER_NP, + }; + + +static void * +tf (void *arg) +{ + pthread_rwlock_t *r = arg; + + /* Timeout: 0.3 secs. */ + struct timeval tv; + (void) gettimeofday (&tv, NULL); + + struct timespec ts; + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_nsec += 300000000; + if (ts.tv_nsec >= 1000000000) + { + ts.tv_nsec -= 1000000000; + ++ts.tv_sec; + } + + puts ("child calling timedrdlock"); + + int err = pthread_rwlock_timedrdlock (r, &ts); + if (err == 0) + { + puts ("rwlock_timedrdlock returned"); + pthread_exit ((void *) 1l); + } + + if (err != ETIMEDOUT) + { + printf ("err = %s (%d), expected %s (%d)\n", + strerror (err), err, strerror (ETIMEDOUT), ETIMEDOUT); + pthread_exit ((void *) 1l); + } + + puts ("1st child timedrdlock done"); + + struct timeval tv2; + (void) gettimeofday (&tv2, NULL); + + timersub (&tv2, &tv, &tv); + + if (tv.tv_usec < 200000) + { + puts ("timeout too short"); + pthread_exit ((void *) 1l); + } + + (void) gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_sec += 10; + /* Note that the following operation makes ts invalid. */ + ts.tv_nsec += 1000000000; + + err = pthread_rwlock_timedrdlock (r, &ts); + if (err == 0) + { + puts ("2nd timedrdlock succeeded"); + pthread_exit ((void *) 1l); + } + if (err != EINVAL) + { + puts ("2nd timedrdlock did not return EINVAL"); + pthread_exit ((void *) 1l); + } + + puts ("2nd child timedrdlock done"); + + return NULL; +} + + +static int +do_test (void) +{ + size_t cnt; + for (cnt = 0; cnt < sizeof (kind) / sizeof (kind[0]); ++cnt) + { + pthread_rwlock_t r; + pthread_rwlockattr_t a; + + if (pthread_rwlockattr_init (&a) != 0) + { + printf ("round %Zu: rwlockattr_t failed\n", cnt); + exit (1); + } + + if (pthread_rwlockattr_setkind_np (&a, kind[cnt]) != 0) + { + printf ("round %Zu: rwlockattr_setkind failed\n", cnt); + exit (1); + } + + if (pthread_rwlock_init (&r, &a) != 0) + { + printf ("round %Zu: rwlock_init failed\n", cnt); + exit (1); + } + + if (pthread_rwlockattr_destroy (&a) != 0) + { + printf ("round %Zu: rwlockattr_destroy failed\n", cnt); + exit (1); + } + + struct timeval tv; + (void) gettimeofday (&tv, NULL); + + struct timespec ts; + TIMEVAL_TO_TIMESPEC (&tv, &ts); + + ++ts.tv_sec; + + /* Get a write lock. */ + int e = pthread_rwlock_timedwrlock (&r, &ts); + if (e != 0) + { + printf ("round %Zu: rwlock_timedwrlock failed (%d)\n", cnt, e); + exit (1); + } + + puts ("1st timedwrlock done"); + + (void) gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ++ts.tv_sec; + e = pthread_rwlock_timedrdlock (&r, &ts); + if (e == 0) + { + puts ("timedrdlock succeeded"); + exit (1); + } + if (e != EDEADLK) + { + puts ("timedrdlock did not return EDEADLK"); + exit (1); + } + + puts ("1st timedrdlock done"); + + (void) gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ++ts.tv_sec; + e = pthread_rwlock_timedwrlock (&r, &ts); + if (e == 0) + { + puts ("2nd timedwrlock succeeded"); + exit (1); + } + if (e != EDEADLK) + { + puts ("2nd timedwrlock did not return EDEADLK"); + exit (1); + } + + puts ("2nd timedwrlock done"); + + pthread_t th; + if (pthread_create (&th, NULL, tf, &r) != 0) + { + printf ("round %Zu: create failed\n", cnt); + exit (1); + } + + puts ("started thread"); + + void *status; + if (pthread_join (th, &status) != 0) + { + printf ("round %Zu: join failed\n", cnt); + exit (1); + } + if (status != NULL) + { + printf ("failure in round %Zu\n", cnt); + exit (1); + } + + puts ("joined thread"); + + if (pthread_rwlock_destroy (&r) != 0) + { + printf ("round %Zu: rwlock_destroy failed\n", cnt); + exit (1); + } + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-rwlock7.c b/test/nptl/tst-rwlock7.c new file mode 100644 index 000000000..5189a4781 --- /dev/null +++ b/test/nptl/tst-rwlock7.c @@ -0,0 +1,178 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <sys/time.h> + + +static int kind[] = + { + PTHREAD_RWLOCK_PREFER_READER_NP, + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP, + PTHREAD_RWLOCK_PREFER_WRITER_NP, + }; + + +static void * +tf (void *arg) +{ + pthread_rwlock_t *r = arg; + + /* Timeout: 0.3 secs. */ + struct timeval tv; + (void) gettimeofday (&tv, NULL); + + struct timespec ts; + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_nsec += 300000000; + if (ts.tv_nsec >= 1000000000) + { + ts.tv_nsec -= 1000000000; + ++ts.tv_sec; + } + + int err = pthread_rwlock_timedwrlock (r, &ts); + if (err == 0) + { + puts ("rwlock_timedwrlock returned"); + pthread_exit ((void *) 1l); + } + + if (err != ETIMEDOUT) + { + printf ("err = %s (%d), expected %s (%d)\n", + strerror (err), err, strerror (ETIMEDOUT), ETIMEDOUT); + pthread_exit ((void *) 1l); + } + + struct timeval tv2; + (void) gettimeofday (&tv2, NULL); + + timersub (&tv2, &tv, &tv); + + if (tv.tv_usec < 200000) + { + puts ("timeout too short"); + pthread_exit ((void *) 1l); + } + + (void) gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_sec += 10; + /* Note that the following operation makes ts invalid. */ + ts.tv_nsec += 1000000000; + + err = pthread_rwlock_timedwrlock (r, &ts); + if (err == 0) + { + puts ("2nd timedwrlock succeeded"); + pthread_exit ((void *) 1l); + } + if (err != EINVAL) + { + puts ("2nd timedwrlock did not return EINVAL"); + pthread_exit ((void *) 1l); + } + + return NULL; +} + + +static int +do_test (void) +{ + size_t cnt; + for (cnt = 0; cnt < sizeof (kind) / sizeof (kind[0]); ++cnt) + { + pthread_rwlock_t r; + pthread_rwlockattr_t a; + + if (pthread_rwlockattr_init (&a) != 0) + { + printf ("round %Zu: rwlockattr_t failed\n", cnt); + exit (1); + } + + if (pthread_rwlockattr_setkind_np (&a, kind[cnt]) != 0) + { + printf ("round %Zu: rwlockattr_setkind failed\n", cnt); + exit (1); + } + + if (pthread_rwlock_init (&r, &a) != 0) + { + printf ("round %Zu: rwlock_init failed\n", cnt); + exit (1); + } + + if (pthread_rwlockattr_destroy (&a) != 0) + { + printf ("round %Zu: rwlockattr_destroy failed\n", cnt); + exit (1); + } + + struct timeval tv; + (void) gettimeofday (&tv, NULL); + + struct timespec ts; + TIMEVAL_TO_TIMESPEC (&tv, &ts); + + ++ts.tv_sec; + + /* Get a read lock. */ + if (pthread_rwlock_timedrdlock (&r, &ts) != 0) + { + printf ("round %Zu: rwlock_timedrdlock failed\n", cnt); + exit (1); + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, &r) != 0) + { + printf ("round %Zu: create failed\n", cnt); + exit (1); + } + + void *status; + if (pthread_join (th, &status) != 0) + { + printf ("round %Zu: join failed\n", cnt); + exit (1); + } + if (status != NULL) + { + printf ("failure in round %Zu\n", cnt); + exit (1); + } + + if (pthread_rwlock_destroy (&r) != 0) + { + printf ("round %Zu: rwlock_destroy failed\n", cnt); + exit (1); + } + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-rwlock8.c b/test/nptl/tst-rwlock8.c new file mode 100644 index 000000000..b67e55a17 --- /dev/null +++ b/test/nptl/tst-rwlock8.c @@ -0,0 +1,163 @@ +/* Test program for timedout read/write lock functions. + Copyright (C) 2000, 2003 Free Software Foundation, Inc. + 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; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <error.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <unistd.h> + + +#define NWRITERS 15 +#define WRITETRIES 10 +#define NREADERS 15 +#define READTRIES 15 + +#define DELAY 1000000 + +#ifndef INIT +# define INIT PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP +#endif + +static pthread_rwlock_t lock = INIT; + + +static void * +writer_thread (void *nr) +{ + struct timespec delay; + int n; + + delay.tv_sec = 0; + delay.tv_nsec = DELAY; + + for (n = 0; n < WRITETRIES; ++n) + { + printf ("writer thread %ld tries again\n", (long int) nr); + + if (pthread_rwlock_wrlock (&lock) != 0) + { + puts ("wrlock failed"); + exit (1); + } + + printf ("writer thread %ld succeeded\n", (long int) nr); + + nanosleep (&delay, NULL); + + if (pthread_rwlock_unlock (&lock) != 0) + { + puts ("unlock for writer failed"); + exit (1); + } + + printf ("writer thread %ld released\n", (long int) nr); + } + + return NULL; +} + + +static void * +reader_thread (void *nr) +{ + struct timespec delay; + int n; + + delay.tv_sec = 0; + delay.tv_nsec = DELAY; + + for (n = 0; n < READTRIES; ++n) + { + printf ("reader thread %ld tries again\n", (long int) nr); + + if (pthread_rwlock_rdlock (&lock) != 0) + { + puts ("rdlock failed"); + exit (1); + } + + printf ("reader thread %ld succeeded\n", (long int) nr); + + nanosleep (&delay, NULL); + + if (pthread_rwlock_unlock (&lock) != 0) + { + puts ("unlock for reader failed"); + exit (1); + } + + printf ("reader thread %ld released\n", (long int) nr); + } + + return NULL; +} + + +static int +do_test (void) +{ + pthread_t thwr[NWRITERS]; + pthread_t thrd[NREADERS]; + int n; + void *res; + + /* Make standard error the same as standard output. */ + dup2 (1, 2); + + /* Make sure we see all message, even those on stdout. */ + setvbuf (stdout, NULL, _IONBF, 0); + + for (n = 0; n < NWRITERS; ++n) + if (pthread_create (&thwr[n], NULL, writer_thread, + (void *) (long int) n) != 0) + { + puts ("writer create failed"); + exit (1); + } + + for (n = 0; n < NREADERS; ++n) + if (pthread_create (&thrd[n], NULL, reader_thread, + (void *) (long int) n) != 0) + { + puts ("reader create failed"); + exit (1); + } + + /* Wait for all the threads. */ + for (n = 0; n < NWRITERS; ++n) + if (pthread_join (thwr[n], &res) != 0) + { + puts ("writer join failed"); + exit (1); + } + for (n = 0; n < NREADERS; ++n) + if (pthread_join (thrd[n], &res) != 0) + { + puts ("reader join failed"); + exit (1); + } + + return 0; +} + +#define TIMEOUT 30 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-rwlock9.c b/test/nptl/tst-rwlock9.c new file mode 100644 index 000000000..e9f015120 --- /dev/null +++ b/test/nptl/tst-rwlock9.c @@ -0,0 +1,202 @@ +/* Test program for timedout read/write lock functions. + Copyright (C) 2000, 2003 Free Software Foundation, Inc. + 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; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <error.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <unistd.h> +#include <sys/time.h> + + +#define NWRITERS 15 +#define WRITETRIES 10 +#define NREADERS 15 +#define READTRIES 15 + +#define TIMEOUT 1000000 +#define DELAY 1000000 + +#ifndef INIT +# define INIT PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP +#endif + +static pthread_rwlock_t lock = INIT; + + +static void * +writer_thread (void *nr) +{ + struct timespec ts; + struct timespec delay; + int n; + + delay.tv_sec = 0; + delay.tv_nsec = DELAY; + + for (n = 0; n < WRITETRIES; ++n) + { + int e; + do + { + struct timeval tv; + (void) gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + + ts.tv_nsec += 2 * TIMEOUT; + if (ts.tv_nsec >= 1000000000) + { + ts.tv_nsec -= 1000000000; + ++ts.tv_sec; + } + + printf ("writer thread %ld tries again\n", (long int) nr); + + e = pthread_rwlock_timedwrlock (&lock, &ts); + if (e != 0 && e != ETIMEDOUT) + { + puts ("timedwrlock failed"); + exit (1); + } + } + while (e == ETIMEDOUT); + + printf ("writer thread %ld succeeded\n", (long int) nr); + + nanosleep (&delay, NULL); + + if (pthread_rwlock_unlock (&lock) != 0) + { + puts ("unlock for writer failed"); + exit (1); + } + + printf ("writer thread %ld released\n", (long int) nr); + } + + return NULL; +} + + +static void * +reader_thread (void *nr) +{ + struct timespec ts; + struct timespec delay; + int n; + + delay.tv_sec = 0; + delay.tv_nsec = DELAY; + + for (n = 0; n < READTRIES; ++n) + { + int e; + do + { + struct timeval tv; + (void) gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + + ts.tv_nsec += TIMEOUT; + if (ts.tv_nsec >= 1000000000) + { + ts.tv_nsec -= 1000000000; + ++ts.tv_sec; + } + + printf ("reader thread %ld tries again\n", (long int) nr); + + e = pthread_rwlock_timedrdlock (&lock, &ts); + if (e != 0 && e != ETIMEDOUT) + { + puts ("timedrdlock failed"); + exit (1); + } + } + while (e == ETIMEDOUT); + + printf ("reader thread %ld succeeded\n", (long int) nr); + + nanosleep (&delay, NULL); + + if (pthread_rwlock_unlock (&lock) != 0) + { + puts ("unlock for reader failed"); + exit (1); + } + + printf ("reader thread %ld released\n", (long int) nr); + } + + return NULL; +} + + +static int +do_test (void) +{ + pthread_t thwr[NWRITERS]; + pthread_t thrd[NREADERS]; + int n; + void *res; + + /* Make standard error the same as standard output. */ + dup2 (1, 2); + + /* Make sure we see all message, even those on stdout. */ + setvbuf (stdout, NULL, _IONBF, 0); + + for (n = 0; n < NWRITERS; ++n) + if (pthread_create (&thwr[n], NULL, writer_thread, + (void *) (long int) n) != 0) + { + puts ("writer create failed"); + exit (1); + } + + for (n = 0; n < NREADERS; ++n) + if (pthread_create (&thrd[n], NULL, reader_thread, + (void *) (long int) n) != 0) + { + puts ("reader create failed"); + exit (1); + } + + /* Wait for all the threads. */ + for (n = 0; n < NWRITERS; ++n) + if (pthread_join (thwr[n], &res) != 0) + { + puts ("writer join failed"); + exit (1); + } + for (n = 0; n < NREADERS; ++n) + if (pthread_join (thrd[n], &res) != 0) + { + puts ("reader join failed"); + exit (1); + } + + return 0; +} + +#undef TIMEOUT +#define TIMEOUT 30 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-sched1.c b/test/nptl/tst-sched1.c new file mode 100644 index 000000000..be3f1b84e --- /dev/null +++ b/test/nptl/tst-sched1.c @@ -0,0 +1,97 @@ +/* Copyright (C) 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <unistd.h> +#include <sys/types.h> + + +static int global; + +static void * +tf (void *a) +{ + global = 1; + + return 0; +} + + +int +do_test (void) +{ + pthread_t th; + pthread_attr_t at; + + if (pthread_attr_init (&at) != 0) + { + puts ("attr_init failed"); + return 1; + } + + if (pthread_attr_setschedpolicy (&at, SCHED_OTHER) != 0) + { + puts ("attr_setschedpolicy failed"); + return 1; + } + + struct sched_param pa; + if (sched_getparam (getpid (), &pa) != 0) + { + puts ("sched_getschedparam failed"); + return 1; + } + + if (pthread_attr_setschedparam (&at, &pa) != 0) + { + puts ("attr_setschedparam failed"); + return 1; + } + + if (pthread_attr_setinheritsched (&at, PTHREAD_EXPLICIT_SCHED) != 0) + { + puts ("attr_setinheritsched failed"); + return 1; + } + + if (pthread_create (&th, &at, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + int e = pthread_join (th, NULL); + if (e != 0) + { + printf ("join failed: %d\n", e); + return 1; + } + + if (global == 0) + { + puts ("thread didn't run"); + return 1; + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-sem1.c b/test/nptl/tst-sem1.c new file mode 100644 index 000000000..5e55dd38d --- /dev/null +++ b/test/nptl/tst-sem1.c @@ -0,0 +1,88 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <semaphore.h> +#include <stdio.h> +#include <unistd.h> + + +static int +do_test (void) +{ + sem_t s; + + if (sem_init (&s, 0, 1) == -1) + { + puts ("init failed"); + return 1; + } + + if (TEMP_FAILURE_RETRY (sem_wait (&s)) == -1) + { + puts ("1st wait failed"); + return 1; + } + + if (sem_post (&s) == -1) + { + puts ("1st post failed"); + return 1; + } + + if (TEMP_FAILURE_RETRY (sem_trywait (&s)) == -1) + { + puts ("1st trywait failed"); + return 1; + } + + errno = 0; + if (TEMP_FAILURE_RETRY (sem_trywait (&s)) != -1) + { + puts ("2nd trywait succeeded"); + return 1; + } + else if (errno != EAGAIN) + { + puts ("2nd trywait did not set errno to EAGAIN"); + return 1; + } + + if (sem_post (&s) == -1) + { + puts ("2nd post failed"); + return 1; + } + + if (TEMP_FAILURE_RETRY (sem_wait (&s)) == -1) + { + puts ("2nd wait failed"); + return 1; + } + + if (sem_destroy (&s) == -1) + { + puts ("destroy failed"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-sem10.c b/test/nptl/tst-sem10.c new file mode 100644 index 000000000..ae6218a60 --- /dev/null +++ b/test/nptl/tst-sem10.c @@ -0,0 +1,87 @@ +/* Copyright (C) 2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@redhat.com>, 2007. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <semaphore.h> +#include <stdio.h> +#include <time.h> +#include <unistd.h> +#include <sys/time.h> + + +static int +do_test (void) +{ + sem_t s; + if (sem_init (&s, 0, 0) == -1) + { + puts ("sem_init failed"); + return 1; + } + + struct timeval tv; + if (gettimeofday (&tv, NULL) != 0) + { + puts ("gettimeofday failed"); + return 1; + } + + struct timespec ts; + TIMEVAL_TO_TIMESPEC (&tv, &ts); + + /* Set ts to yesterday. */ + ts.tv_sec -= 86400; + + int type_before; + if (pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &type_before) != 0) + { + puts ("first pthread_setcanceltype failed"); + return 1; + } + + errno = 0; + if (TEMP_FAILURE_RETRY (sem_timedwait (&s, &ts)) != -1) + { + puts ("sem_timedwait succeeded"); + return 1; + } + if (errno != ETIMEDOUT) + { + printf ("sem_timedwait return errno = %d instead of ETIMEDOUT\n", + errno); + return 1; + } + + int type_after; + if (pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, &type_after) != 0) + { + puts ("second pthread_setcanceltype failed"); + return 1; + } + if (type_after != PTHREAD_CANCEL_DEFERRED) + { + puts ("sem_timedwait changed cancellation type"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-sem11.c b/test/nptl/tst-sem11.c new file mode 100644 index 000000000..6633ddd1f --- /dev/null +++ b/test/nptl/tst-sem11.c @@ -0,0 +1,76 @@ +#include <semaphore.h> +#include <stdio.h> +#include <unistd.h> +#include <pthread.h> +#include <internaltypes.h> + +#ifndef SEM_WAIT +# define SEM_WAIT(s) sem_wait (s) +#endif + +static void * +tf (void *arg) +{ +#ifdef PREPARE + PREPARE +#endif + SEM_WAIT (arg); + return NULL; +} + +int +main (void) +{ + int tries = 5; + pthread_t th; + sem_t s; + again: + if (sem_init (&s, 0, 0) != 0) + { + puts ("sem_init failed"); + return 1; + } + + struct new_sem *is = (struct new_sem *) &s; + + if (is->nwaiters != 0) + { + puts ("nwaiters not initialized"); + return 1; + } + + if (pthread_create (&th, NULL, tf, &s) != 0) + { + puts ("pthread_create failed"); + return 1; + } + + sleep (1); + + if (pthread_cancel (th) != 0) + { + puts ("pthread_cancel failed"); + return 1; + } + + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("pthread_join failed"); + return 1; + } + if (r != PTHREAD_CANCELED && --tries > 0) + { + /* Maybe we get the scheduling right the next time. */ + sem_destroy (&s); + goto again; + } + + if (is->nwaiters != 0) + { + puts ("nwaiters not reset"); + return 1; + } + + return 0; +} diff --git a/test/nptl/tst-sem12.c b/test/nptl/tst-sem12.c new file mode 100644 index 000000000..71d02b70e --- /dev/null +++ b/test/nptl/tst-sem12.c @@ -0,0 +1,14 @@ +#include <time.h> +#include <sys/time.h> + + +#define PREPARE \ + struct timespec ts; \ + struct timeval tv; \ + gettimeofday (&tv, NULL); \ + TIMEVAL_TO_TIMESPEC (&tv, &ts); \ + ts.tv_sec += 60; + +#define SEM_WAIT(s) sem_timedwait (s, &ts) + +#include "tst-sem11.c" diff --git a/test/nptl/tst-sem2.c b/test/nptl/tst-sem2.c new file mode 100644 index 000000000..edc553c7b --- /dev/null +++ b/test/nptl/tst-sem2.c @@ -0,0 +1,53 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <semaphore.h> +#include <signal.h> +#include <stdio.h> +#include <unistd.h> + + +static int +do_test (void) +{ + sem_t s; + + if (sem_init (&s, 0, 0) == -1) + { + puts ("init failed"); + return 1; + } + + /* Set an alarm for 1 second. The wrapper will expect this. */ + alarm (1); + + if (TEMP_FAILURE_RETRY (sem_wait (&s)) == -1) + { + puts ("wait failed"); + return 1; + } + + /* We should never get here. */ + puts ("wait succeeded"); + return 1; +} + +#define EXPECTED_SIGNAL SIGALRM +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-sem3.c b/test/nptl/tst-sem3.c new file mode 100644 index 000000000..7b75e29e2 --- /dev/null +++ b/test/nptl/tst-sem3.c @@ -0,0 +1,144 @@ +/* Copyright (C) 2002-2014 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <semaphore.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/wait.h> + + +int +do_test (void) +{ + size_t ps = sysconf (_SC_PAGESIZE); + char tmpfname[] = "/tmp/tst-sem3.XXXXXX"; + char data[ps]; + void *mem; + int fd; + sem_t *s; + pid_t pid; + char *p; + + fd = mkstemp (tmpfname); + if (fd == -1) + { + printf ("cannot open temporary file: %m\n"); + return 1; + } + + /* Make sure it is always removed. */ + unlink (tmpfname); + + /* Create one page of data. */ + memset (data, '\0', ps); + + /* Write the data to the file. */ + if (write (fd, data, ps) != (ssize_t) ps) + { + puts ("short write"); + return 1; + } + + mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (mem == MAP_FAILED) + { + printf ("mmap failed: %m\n"); + return 1; + } + + s = (sem_t *) (((uintptr_t) mem + __alignof (sem_t)) + & ~(__alignof (sem_t) - 1)); + p = (char *) (s + 1); + + if (sem_init (s, 1, 1) == -1) + { + puts ("init failed"); + return 1; + } + + if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1) + { + puts ("1st wait failed"); + return 1; + } + + errno = 0; + if (TEMP_FAILURE_RETRY (sem_trywait (s)) != -1) + { + puts ("trywait succeeded"); + return 1; + } + else if (errno != EAGAIN) + { + puts ("trywait didn't return EAGAIN"); + return 1; + } + + *p = 0; + + puts ("going to fork now"); + pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + return 1; + } + else if (pid == 0) + { + /* Play some lock ping-pong. It's our turn to unlock first. */ + if ((*p)++ != 0) + { + puts ("child: *p != 0"); + return 1; + } + + if (sem_post (s) == -1) + { + puts ("child: 1st post failed"); + return 1; + } + + puts ("child done"); + } + else + { + if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1) + { + printf ("parent: 2nd wait failed: %m\n"); + return 1; + } + + if (*p != 1) + { + puts ("*p != 1"); + return 1; + } + + puts ("parent done"); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-sem4.c b/test/nptl/tst-sem4.c new file mode 100644 index 000000000..72ed97d37 --- /dev/null +++ b/test/nptl/tst-sem4.c @@ -0,0 +1,149 @@ +/* Copyright (C) 2002-2014 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <semaphore.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static void +remove_sem (int status, void *arg) +{ + sem_unlink (arg); +} + + +int +do_test (void) +{ + sem_t *s; + sem_t *s2; + pid_t pid; + int val; + + s = sem_open ("/glibc-tst-sem4", O_CREAT, 0600, 1); + if (s == SEM_FAILED) + { + if (errno == ENOSYS) + { + puts ("sem_open not supported. Oh well."); + return 0; + } + + /* Maybe the shm filesystem has strict permissions. */ + if (errno == EACCES) + { + puts ("sem_open not allowed. Oh well."); + return 0; + } + + printf ("sem_open: %m\n"); + return 1; + } + + on_exit (remove_sem, (void *) "/glibc-tst-sem4"); + + /* We have the semaphore object. Now try again with O_EXCL, this + should fail. */ + s2 = sem_open ("/glibc-tst-sem4", O_CREAT | O_EXCL, 0600, 1); + if (s2 != SEM_FAILED) + { + puts ("2nd sem_open didn't fail"); + return 1; + } + if (errno != EEXIST) + { + puts ("2nd sem_open returned wrong error"); + return 1; + } + + /* Check the value. */ + if (sem_getvalue (s, &val) == -1) + { + puts ("getvalue failed"); + return 1; + } + if (val != 1) + { + printf ("initial value wrong: got %d, expected 1\n", val); + return 1; + } + + if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1) + { + puts ("1st sem_wait failed"); + return 1; + } + + pid = fork (); + if (pid == -1) + { + printf ("fork failed: %m\n"); + return 1; + } + + if (pid == 0) + { + /* Child. */ + + /* Check the value. */ + if (sem_getvalue (s, &val) == -1) + { + puts ("child: getvalue failed"); + return 1; + } + if (val != 0) + { + printf ("child: value wrong: got %d, expect 0\n", val); + return 1; + } + + if (sem_post (s) == -1) + { + puts ("child: post failed"); + return 1; + } + } + else + { + if (TEMP_FAILURE_RETRY (sem_wait (s)) == -1) + { + puts ("2nd sem_wait failed"); + return 1; + } + + if (sem_getvalue (s, &val) == -1) + { + puts ("parent: 2nd getvalue failed"); + return 1; + } + if (val != 0) + { + printf ("parent: value wrong: got %d, expected 0\n", val); + return 1; + } + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-sem5.c b/test/nptl/tst-sem5.c new file mode 100644 index 000000000..f0b905c33 --- /dev/null +++ b/test/nptl/tst-sem5.c @@ -0,0 +1,79 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <semaphore.h> +#include <stdio.h> +#include <time.h> +#include <unistd.h> +#include <sys/time.h> + + +static int +do_test (void) +{ + sem_t s; + struct timespec ts; + struct timeval tv; + + if (sem_init (&s, 0, 1) == -1) + { + puts ("sem_init failed"); + return 1; + } + + if (TEMP_FAILURE_RETRY (sem_wait (&s)) == -1) + { + puts ("sem_wait failed"); + return 1; + } + + if (gettimeofday (&tv, NULL) != 0) + { + puts ("gettimeofday failed"); + return 1; + } + + TIMEVAL_TO_TIMESPEC (&tv, &ts); + + /* We wait for half a second. */ + ts.tv_nsec += 500000000; + if (ts.tv_nsec >= 1000000000) + { + ++ts.tv_sec; + ts.tv_nsec -= 1000000000; + } + + errno = 0; + if (TEMP_FAILURE_RETRY (sem_timedwait (&s, &ts)) != -1) + { + puts ("sem_timedwait succeeded"); + return 1; + } + if (errno != ETIMEDOUT) + { + printf ("sem_timedwait return errno = %d instead of ETIMEDOUT\n", + errno); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-sem6.c b/test/nptl/tst-sem6.c new file mode 100644 index 000000000..16adb95ef --- /dev/null +++ b/test/nptl/tst-sem6.c @@ -0,0 +1,80 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <semaphore.h> +#include <signal.h> +#include <stdio.h> +#include <unistd.h> + + +static void +handler (int sig) +{ + struct sigaction sa; + + sa.sa_handler = SIG_DFL; + sa.sa_flags = 0; + sigemptyset (&sa.sa_mask); + + sigaction (SIGALRM, &sa, NULL); + + /* Rearm the timer. */ + alarm (1); +} + + +static int +do_test (void) +{ + sem_t s; + struct sigaction sa; + + sa.sa_handler = handler; + sa.sa_flags = 0; + sigemptyset (&sa.sa_mask); + + sigaction (SIGALRM, &sa, NULL); + + if (sem_init (&s, 0, 0) == -1) + { + puts ("init failed"); + return 1; + } + + /* Set an alarm for 1 second. The wrapper will expect this. */ + alarm (1); + + int res = sem_wait (&s); + if (res == 0) + { + puts ("wait succeeded"); + return 1; + } + if (res != -1 || errno != EINTR) + { + puts ("wait didn't fail with EINTR"); + return 1; + } + + return 0; +} + +#define TIMEOUT 3 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-sem7.c b/test/nptl/tst-sem7.c new file mode 100644 index 000000000..34ddb4058 --- /dev/null +++ b/test/nptl/tst-sem7.c @@ -0,0 +1,108 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <semaphore.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static void +remove_sem (int status, void *arg) +{ + sem_unlink (arg); +} + + +int +main (void) +{ + sem_t *s; + sem_t *s2; + sem_t *s3; + + s = sem_open ("/glibc-tst-sem7", O_CREAT, 0600, 1); + if (s == SEM_FAILED) + { + if (errno == ENOSYS) + { + puts ("sem_open not supported. Oh well."); + return 0; + } + + /* Maybe the shm filesystem has strict permissions. */ + if (errno == EACCES) + { + puts ("sem_open not allowed. Oh well."); + return 0; + } + + printf ("sem_open: %m\n"); + return 1; + } + + on_exit (remove_sem, (void *) "/glibc-tst-sem7"); + + /* We have the semaphore object. Now try again. We should get the + same address. */ + s2 = sem_open ("/glibc-tst-sem7", O_CREAT, 0600, 1); + if (s2 == SEM_FAILED) + { + puts ("2nd sem_open failed"); + return 1; + } + if (s != s2) + { + puts ("2nd sem_open didn't return the same address"); + return 1; + } + + /* And again, this time without O_CREAT. */ + s3 = sem_open ("/glibc-tst-sem7", 0); + if (s3 == SEM_FAILED) + { + puts ("3rd sem_open failed"); + return 1; + } + if (s != s3) + { + puts ("3rd sem_open didn't return the same address"); + return 1; + } + + /* Now close the handle. Three times. */ + if (sem_close (s2) != 0) + { + puts ("1st sem_close failed"); + return 1; + } + if (sem_close (s) != 0) + { + puts ("2nd sem_close failed"); + return 1; + } + if (sem_close (s3) != 0) + { + puts ("3rd sem_close failed"); + return 1; + } + + return 0; +} diff --git a/test/nptl/tst-sem8.c b/test/nptl/tst-sem8.c new file mode 100644 index 000000000..286590fd6 --- /dev/null +++ b/test/nptl/tst-sem8.c @@ -0,0 +1,73 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <semaphore.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static void +remove_sem (int status, void *arg) +{ + sem_unlink (arg); +} + + +int +main (void) +{ + sem_t *s; + int i; + + on_exit (remove_sem, (void *) "/glibc-tst-sem8"); + + for (i = 0; i < 3; ++i) + { + s = sem_open ("/glibc-tst-sem8", O_CREAT, 0600, 1); + if (s == SEM_FAILED) + { + if (errno == ENOSYS) + { + puts ("sem_open not supported. Oh well."); + return 0; + } + + /* Maybe the shm filesystem has strict permissions. */ + if (errno == EACCES) + { + puts ("sem_open not allowed. Oh well."); + return 0; + } + + printf ("sem_open: %m\n"); + return 1; + } + + /* Now close the handle. */ + if (sem_close (s) != 0) + { + puts ("sem_close failed"); + return 1; + } + } + + return 0; +} diff --git a/test/nptl/tst-sem9.c b/test/nptl/tst-sem9.c new file mode 100644 index 000000000..bdb594b09 --- /dev/null +++ b/test/nptl/tst-sem9.c @@ -0,0 +1,80 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <fcntl.h> +#include <semaphore.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static void +remove_sem (int status, void *arg) +{ + sem_unlink (arg); +} + + +int +main (void) +{ + sem_t *s; + int i; + + on_exit (remove_sem, (void *) "/glibc-tst-sem9"); + + for (i = 0; i < 3; ++i) + { + s = sem_open ("/glibc-tst-sem9", O_CREAT, 0600, 1); + if (s == SEM_FAILED) + { + if (errno == ENOSYS) + { + puts ("sem_open not supported. Oh well."); + return 0; + } + + /* Maybe the shm filesystem has strict permissions. */ + if (errno == EACCES) + { + puts ("sem_open not allowed. Oh well."); + return 0; + } + + printf ("sem_open: %m\n"); + return 1; + } + + /* Now close the handle. */ + if (sem_close (s) != 0) + { + puts ("sem_close failed"); + return 1; + } + + /* And remove it. */ + if (sem_unlink ("/glibc-tst-sem9") != 0) + { + puts ("sem_unlink failed"); + return 1; + } + } + + return 0; +} diff --git a/test/nptl/tst-signal1.c b/test/nptl/tst-signal1.c new file mode 100644 index 000000000..0f952fd24 --- /dev/null +++ b/test/nptl/tst-signal1.c @@ -0,0 +1,188 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/wait.h> + + +static sigset_t ss; +static pthread_barrier_t *b; + + +static void * +tf (void *arg) +{ + sigdelset (&ss, SIGINT); + + if (pthread_sigmask (SIG_SETMASK, &ss, NULL) != 0) + { + puts ("2nd pthread_sigmask failed"); + exit (1); + } + + pthread_barrier_wait (b); + + int sig; + int res = sigwait (&ss, &sig); + if (res == 0) + { + printf ("sigwait returned successfully with signal %d\n", sig); + exit (1); + } + + printf ("sigwait returned with %s (%d)\n", strerror (res), res); + + return NULL; +} + + +static void +receiver (void) +{ + pthread_t th; + + /* Make sure the process doesn't run forever. */ + alarm (10); + + sigfillset (&ss); + + if (pthread_sigmask (SIG_SETMASK, &ss, NULL) != 0) + { + puts ("1st pthread_sigmask failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("pthread_create failed"); + exit (1); + } + + if (pthread_join (th, NULL) == 0) + { + puts ("thread joined?!"); + exit (1); + } + + _exit (0); +} + + +static int +do_test (void) +{ + char tmp[] = "/tmp/tst-signal1-XXXXXX"; + + int fd = mkstemp (tmp); + if (fd == -1) + { + puts ("mkstemp failed"); + exit (1); + } + + unlink (tmp); + + int i; + for (i = 0; i < 20; ++i) + write (fd, "foobar xyzzy", 12); + + b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE, + MAP_SHARED, fd, 0); + if (b == MAP_FAILED) + { + puts ("mmap failed"); + exit (1); + } + + pthread_barrierattr_t ba; + if (pthread_barrierattr_init (&ba) != 0) + { + puts ("barrierattr_init failed"); + exit (1); + } + + if (pthread_barrierattr_setpshared (&ba, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("barrierattr_setpshared failed"); + exit (1); + } + + if (pthread_barrier_init (b, &ba, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + if (pthread_barrierattr_destroy (&ba) != 0) + { + puts ("barrierattr_destroy failed"); + exit (1); + } + + pid_t pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + exit (1); + } + + if (pid == 0) + receiver (); + + pthread_barrier_wait (b); + + /* Wait a bit more. */ + struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 }; + nanosleep (&ts, NULL); + + /* Send the signal. */ + puts ("sending the signal now"); + kill (pid, SIGINT); + + /* Wait for the process to terminate. */ + int status; + if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid) + { + puts ("wrong child reported terminated"); + exit (1); + } + + if (!WIFSIGNALED (status)) + { + puts ("child wasn't signalled"); + exit (1); + } + + if (WTERMSIG (status) != SIGINT) + { + puts ("child not terminated with SIGINT"); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-signal2.c b/test/nptl/tst-signal2.c new file mode 100644 index 000000000..37d5611e4 --- /dev/null +++ b/test/nptl/tst-signal2.c @@ -0,0 +1,197 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/wait.h> +#include <string.h> + + +static sigset_t ss; +static pthread_barrier_t *b; + + +static void * +tf (void *arg) +{ + pthread_barrier_wait (b); + + puts ("child: calling sigwait now"); + + int sig; + int err; + err = sigwait (&ss, &sig); + if (err != 0) + { + printf ("sigwait returned unsuccessfully: %s (%d)\n", + strerror (err), err); + _exit (1); + } + + puts ("sigwait returned"); + + if (sig != SIGINT) + { + printf ("caught signal %d, expected %d (SIGINT)\n", sig, SIGINT); + _exit (1); + } + + puts ("child thread terminating now"); + + return NULL; +} + + +static void +receiver (void) +{ + pthread_t th; + + /* Make sure the process doesn't run forever. */ + alarm (10); + + sigfillset (&ss); + + if (pthread_sigmask (SIG_SETMASK, &ss, NULL) != 0) + { + puts ("1st pthread_sigmask failed"); + _exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("pthread_create failed"); + _exit (1); + } + + if (pthread_join (th, NULL) != 0) + { + puts ("thread didn't join"); + _exit (1); + } + + puts ("join succeeded"); + + _exit (0); +} + + +static int +do_test (void) +{ + char tmp[] = "/tmp/tst-signal1-XXXXXX"; + + int fd = mkstemp (tmp); + if (fd == -1) + { + puts ("mkstemp failed"); + exit (1); + } + + unlink (tmp); + + int i; + for (i = 0; i < 20; ++i) + write (fd, "foobar xyzzy", 12); + + b = mmap (NULL, sizeof (pthread_barrier_t), PROT_READ | PROT_WRITE, + MAP_SHARED, fd, 0); + if (b == MAP_FAILED) + { + puts ("mmap failed"); + exit (1); + } + + pthread_barrierattr_t ba; + if (pthread_barrierattr_init (&ba) != 0) + { + puts ("barrierattr_init failed"); + exit (1); + } + + if (pthread_barrierattr_setpshared (&ba, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("barrierattr_setpshared failed"); + exit (1); + } + + if (pthread_barrier_init (b, &ba, 2) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + if (pthread_barrierattr_destroy (&ba) != 0) + { + puts ("barrierattr_destroy failed"); + exit (1); + } + + pid_t pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + exit (1); + } + + if (pid == 0) + receiver (); + + pthread_barrier_wait (b); + + /* Wait a bit more. */ + struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 }; + nanosleep (&ts, NULL); + + /* Send the signal. */ + puts ("sending the signal now"); + kill (pid, SIGINT); + + /* Wait for the process to terminate. */ + int status; + if (TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)) != pid) + { + puts ("wrong child reported terminated"); + exit (1); + } + + if (!WIFEXITED (status)) + { + if (WIFSIGNALED (status)) + printf ("child exited with signal %d\n", WTERMSIG (status)); + else + puts ("child didn't exit normally"); + exit (1); + } + + if (WEXITSTATUS (status) != 0) + { + printf ("exit status %d != 0\n", WEXITSTATUS (status)); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-signal3.c b/test/nptl/tst-signal3.c new file mode 100644 index 000000000..fbd9ace8e --- /dev/null +++ b/test/nptl/tst-signal3.c @@ -0,0 +1,260 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <semaphore.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +/* Number of different signalss to use. Also is the number of + threads. */ +#define N 10 +/* Maximum number of threads in flight at any one time. */ +#define INFLIGHT 5 +/* Number of signals sent in total. */ +#define ROUNDS 10000 + + +static int received[N][N]; +static int nsig[N]; +static pthread_t th[N]; +static sem_t sem; +static pthread_mutex_t lock[N]; +static pthread_t th_main; +static int sig0; + +static void +handler (int sig) +{ + int i; + for (i = 0; i < N; ++i) + if (pthread_equal (pthread_self (), th[i])) + break; + + if (i == N) + { + if (pthread_equal (pthread_self (), th_main)) + puts ("signal received by main thread"); + else + printf ("signal received by unknown thread (%lx)\n", + (unsigned long int) pthread_self ()); + exit (1); + } + + ++received[i][sig - sig0]; + + sem_post (&sem); +} + + +static void * +tf (void *arg) +{ + int idx = (long int) arg; + + sigset_t ss; + sigemptyset (&ss); + + int i; + for (i = 0; i <= idx; ++i) + sigaddset (&ss, sig0 + i); + + if (pthread_sigmask (SIG_UNBLOCK, &ss, NULL) != 0) + { + printf ("thread %d: pthread_sigmask failed\n", i); + exit (1); + } + + pthread_mutex_lock (&lock[idx]); + + return NULL; +} + + +static int +do_test (void) +{ + /* Block all signals. */ + sigset_t ss; + sigfillset (&ss); + + th_main = pthread_self (); + + sig0 = SIGRTMIN; + + if (pthread_sigmask (SIG_SETMASK, &ss, NULL) != 0) + { + puts ("1st pthread_sigmask failed"); + exit (1); + } + + /* Install the handler. */ + int i; + for (i = 0; i < N; ++i) + { + struct sigaction sa = + { + .sa_handler = handler, + .sa_flags = 0 + }; + sigfillset (&sa.sa_mask); + + if (sigaction (sig0 + i, &sa, NULL) != 0) + { + printf ("sigaction for signal %d failed\n", i); + exit (1); + } + } + + if (sem_init (&sem, 0, INFLIGHT) != 0) + { + puts ("sem_init failed"); + exit (1); + } + + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + + for (i = 0; i < N; ++i) + { + if (pthread_mutex_init (&lock[i], NULL) != 0) + { + printf ("mutex_init[%d] failed\n", i); + } + + if (pthread_mutex_lock (&lock[i]) != 0) + { + printf ("mutex_lock[%d] failed\n", i); + } + + if (pthread_create (&th[i], &a, tf, (void *) (long int) i) != 0) + { + printf ("create of thread %d failed\n", i); + exit (1); + } + } + + if (pthread_attr_destroy (&a) != 0) + { + puts ("attr_destroy failed"); + exit (1); + } + + int result = 0; + unsigned int r = 42; + pid_t pid = getpid (); + + for (i = 0; i < ROUNDS; ++i) + { + if (TEMP_FAILURE_RETRY (sem_wait (&sem)) != 0) + { + printf ("sem_wait round %d failed: %m\n", i); + exit (1); + } + + int s = rand_r (&r) % N; + + kill (pid, sig0 + s); + } + + void *status; + for (i = 0; i < N; ++i) + { + if (pthread_mutex_unlock (&lock[i]) != 0) + { + printf ("unlock %d failed\n", i); + exit (1); + } + + if (pthread_join (th[i], &status) != 0) + { + printf ("join %d failed\n", i); + result = 1; + } + else if (status != NULL) + { + printf ("%d: result != NULL\n", i); + result = 1; + } + } + + int total = 0; + for (i = 0; i < N; ++i) + { + int j; + + for (j = 0; j <= i; ++j) + total += received[i][j]; + + for (j = i + 1; j < N; ++j) + if (received[i][j] != 0) + { + printf ("thread %d received signal SIGRTMIN+%d\n", i, j); + result = 1; + } + } + + if (total != ROUNDS) + { + printf ("total number of handled signals is %d, expected %d\n", + total, ROUNDS); + result = 1; + } + + printf ("A total of %d signals sent and received\n", total); + for (i = 0; i < N; ++i) + { + printf ("thread %2d:", i); + + int j; + for (j = 0; j <= i; ++j) + { + printf (" %5d", received[i][j]); + nsig[j] += received[i][j]; + } + + putchar ('\n'); + + } + + printf ("\nTotal :"); + for (i = 0; i < N; ++i) + printf (" %5d", nsig[i]); + putchar ('\n'); + + return result; +} + +#define TIMEOUT 10 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-signal4.c b/test/nptl/tst-signal4.c new file mode 100644 index 000000000..f249b7b75 --- /dev/null +++ b/test/nptl/tst-signal4.c @@ -0,0 +1,59 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> + +static int +do_test (void) +{ + sigset_t ss; + + sigemptyset (&ss); + + int i; + for (i = 0; i < 10000; ++i) + { + long int r = random (); + + if (r != SIG_BLOCK && r != SIG_SETMASK && r != SIG_UNBLOCK) + { + int e = pthread_sigmask (r, &ss, NULL); + + if (e == 0) + { + printf ("pthread_sigmask succeeded for how = %ld\n", r); + exit (1); + } + + if (e != EINVAL) + { + puts ("pthread_sigmask didn't return EINVAL"); + exit (1); + } + } + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-signal5.c b/test/nptl/tst-signal5.c new file mode 100644 index 000000000..5c0ac0c17 --- /dev/null +++ b/test/nptl/tst-signal5.c @@ -0,0 +1,110 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/wait.h> + + +static sigset_t ss; + + +static void * +tf (void *arg) +{ + sigset_t ss2; + if (pthread_sigmask (SIG_SETMASK, NULL, &ss2) != 0) + { + puts ("child: sigmask failed"); + exit (1); + } + + int i; + for (i = 1; i < 32; ++i) + if (sigismember (&ss, i) && ! sigismember (&ss2, i)) + { + printf ("signal %d set in parent mask, but not in child\n", i); + exit (1); + } + else if (! sigismember (&ss, i) && sigismember (&ss2, i)) + { + printf ("signal %d set in child mask, but not in parent\n", i); + exit (1); + } + + return NULL; +} + + +static int +do_test (void) +{ + sigemptyset (&ss); + sigaddset (&ss, SIGUSR1); + if (pthread_sigmask (SIG_SETMASK, &ss, NULL) != 0) + { + puts ("1st sigmask failed"); + exit (1); + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("1st create failed"); + exit (1); + } + + void *r; + if (pthread_join (th, &r) != 0) + { + puts ("1st join failed"); + exit (1); + } + + sigemptyset (&ss); + sigaddset (&ss, SIGUSR2); + sigaddset (&ss, SIGFPE); + if (pthread_sigmask (SIG_SETMASK, &ss, NULL) != 0) + { + puts ("2nd sigmask failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("2nd create failed"); + exit (1); + } + + if (pthread_join (th, &r) != 0) + { + puts ("2nd join failed"); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-signal6.c b/test/nptl/tst-signal6.c new file mode 100644 index 000000000..31827b7c2 --- /dev/null +++ b/test/nptl/tst-signal6.c @@ -0,0 +1,191 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <signal.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +#define N 2 +static pthread_barrier_t bar; +static struct +{ + void *p; + pthread_t s; +} ti[N]; +static int sig1; + + +static void +handler (int sig) +{ + pthread_t self = pthread_self (); + size_t i; + + for (i = 0; i < N; ++i) + if (ti[i].s == self) + { + if ((uintptr_t) ti[i].p <= (uintptr_t) &self + && (uintptr_t) ti[i].p + 2 * MINSIGSTKSZ > (uintptr_t) &self) + { + puts ("alt stack not used"); + exit (1); + } + + printf ("thread %zu used alt stack for signal %d\n", i, sig); + + return; + } + + puts ("handler: thread not found"); + exit (1); +} + + +static void * +tf (void *arg) +{ + size_t nr = (uintptr_t) arg; + if (nr >= N) + { + puts ("wrong nr parameter"); + exit (1); + } + + sigset_t ss; + sigemptyset (&ss); + size_t i; + for (i = 0; i < N; ++i) + if (i != nr) + if (sigaddset (&ss, sig1 + i) != 0) + { + puts ("tf: sigaddset failed"); + exit (1); + } + if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0) + { + puts ("tf: sigmask failed"); + exit (1); + } + + void *p = malloc (2 * MINSIGSTKSZ); + if (p == NULL) + { + puts ("tf: malloc failed"); + exit (1); + } + + stack_t s; + s.ss_sp = p; + s.ss_size = 2 * MINSIGSTKSZ; + s.ss_flags = 0; + if (sigaltstack (&s, NULL) != 0) + { + puts ("tf: sigaltstack failed"); + exit (1); + } + + ti[nr].p = p; + ti[nr].s = pthread_self (); + + pthread_barrier_wait (&bar); + + pthread_barrier_wait (&bar); + + return NULL; +} + + +static int +do_test (void) +{ + sig1 = SIGRTMIN; + if (sig1 + N > SIGRTMAX) + { + puts ("too few RT signals"); + return 0; + } + + struct sigaction sa; + sa.sa_handler = handler; + sa.sa_flags = 0; + sigemptyset (&sa.sa_mask); + + if (sigaction (sig1, &sa, NULL) != 0 + || sigaction (sig1 + 1, &sa, NULL) != 0 + || sigaction (sig1 + 2, &sa, NULL) != 0) + { + puts ("sigaction failed"); + return 1; + } + + if (pthread_barrier_init (&bar, NULL, 1 + N) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + pthread_t th[N]; + size_t i; + for (i = 0; i < N; ++i) + if (pthread_create (&th[i], NULL, tf, (void *) (long int) i) != 0) + { + puts ("create failed"); + return 1; + } + + /* Block the three signals. */ + sigset_t ss; + sigemptyset (&ss); + for (i = 0; i <= N; ++i) + sigaddset (&ss, sig1 + i); + if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0) + { + puts ("main: sigmask failed"); + return 1; + } + + pthread_barrier_wait (&bar); + + /* Send some signals. */ + pid_t me = getpid (); + kill (me, sig1 + N); + for (i = 0; i < N; ++i) + kill (me, sig1 + i); + kill (me, sig1 + N); + + /* Give the signals a chance to be worked on. */ + sleep (1); + + pthread_barrier_wait (&bar); + + for (i = 0; i < N; ++i) + if (pthread_join (th[i], NULL) != 0) + { + puts ("join failed"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-signal7.c b/test/nptl/tst-signal7.c new file mode 100644 index 000000000..629f377ae --- /dev/null +++ b/test/nptl/tst-signal7.c @@ -0,0 +1,58 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthreadP.h> +#include <signal.h> +#include <stdio.h> + + +static int +do_test (void) +{ + int result = 0; + + errno = 0; + if (sigaction (SIGCANCEL, NULL, NULL) == 0) + { + puts ("sigaction(SIGCANCEL) did not fail"); + result = 1; + } + else if (errno != EINVAL) + { + puts ("sigaction(SIGCANCEL) did not set errno to EINVAL"); + result = 1; + } + + errno = 0; + if (sigaction (SIGSETXID, NULL, NULL) == 0) + { + puts ("sigaction(SIGSETXID) did not fail"); + result = 1; + } + else if (errno != EINVAL) + { + puts ("sigaction(SIGSETXID) did not set errno to EINVAL"); + result = 1; + } + + return result; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-spin1.c b/test/nptl/tst-spin1.c new file mode 100644 index 000000000..b55c9584a --- /dev/null +++ b/test/nptl/tst-spin1.c @@ -0,0 +1,56 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> + + +static int +do_test (void) +{ + pthread_spinlock_t s; + + if (pthread_spin_init (&s, PTHREAD_PROCESS_PRIVATE) != 0) + { + puts ("spin_init failed"); + return 1; + } + + if (pthread_spin_lock (&s) != 0) + { + puts ("spin_lock failed"); + return 1; + } + + if (pthread_spin_unlock (&s) != 0) + { + puts ("spin_unlock failed"); + return 1; + } + + if (pthread_spin_destroy (&s) != 0) + { + puts ("spin_destroy failed"); + return 1; + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-spin2.c b/test/nptl/tst-spin2.c new file mode 100644 index 000000000..6119a3b23 --- /dev/null +++ b/test/nptl/tst-spin2.c @@ -0,0 +1,158 @@ +/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/wait.h> + + +static int +do_test (void) +{ + size_t ps = sysconf (_SC_PAGESIZE); + char tmpfname[] = "/tmp/tst-spin2.XXXXXX"; + char data[ps]; + void *mem; + int fd; + pthread_spinlock_t *s; + pid_t pid; + char *p; + int err; + + fd = mkstemp (tmpfname); + if (fd == -1) + { + printf ("cannot open temporary file: %m\n"); + return 1; + } + + /* Make sure it is always removed. */ + unlink (tmpfname); + + /* Create one page of data. */ + memset (data, '\0', ps); + + /* Write the data to the file. */ + if (write (fd, data, ps) != (ssize_t) ps) + { + puts ("short write"); + return 1; + } + + mem = mmap (NULL, ps, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if (mem == MAP_FAILED) + { + printf ("mmap failed: %m\n"); + return 1; + } + + s = (pthread_spinlock_t *) (((uintptr_t) mem + + __alignof (pthread_spinlock_t)) + & ~(__alignof (pthread_spinlock_t) - 1)); + p = (char *) (s + 1); + + if (pthread_spin_init (s, PTHREAD_PROCESS_SHARED) != 0) + { + puts ("spin_init failed"); + return 1; + } + + if (pthread_spin_lock (s) != 0) + { + puts ("spin_lock failed"); + return 1; + } + + err = pthread_spin_trylock (s); + if (err == 0) + { + puts ("1st spin_trylock succeeded"); + return 1; + } + else if (err != EBUSY) + { + puts ("1st spin_trylock didn't return EBUSY"); + return 1; + } + + err = pthread_spin_unlock (s); + if (err != 0) + { + puts ("parent: spin_unlock failed"); + return 1; + } + + err = pthread_spin_trylock (s); + if (err != 0) + { + puts ("2nd spin_trylock failed"); + return 1; + } + + *p = 0; + + puts ("going to fork now"); + pid = fork (); + if (pid == -1) + { + puts ("fork failed"); + return 1; + } + else if (pid == 0) + { + /* Play some lock ping-pong. It's our turn to unlock first. */ + if ((*p)++ != 0) + { + puts ("child: *p != 0"); + return 1; + } + + if (pthread_spin_unlock (s) != 0) + { + puts ("child: 1st spin_unlock failed"); + return 1; + } + + puts ("child done"); + } + else + { + if (pthread_spin_lock (s) != 0) + { + puts ("parent: 2nd spin_lock failed"); + return 1; + } + + puts ("waiting for child"); + + waitpid (pid, NULL, 0); + + puts ("parent done"); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-spin3.c b/test/nptl/tst-spin3.c new file mode 100644 index 000000000..b54d42c33 --- /dev/null +++ b/test/nptl/tst-spin3.c @@ -0,0 +1,54 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <unistd.h> + + +static int +do_test (void) +{ + pthread_spinlock_t s; + + if (pthread_spin_init (&s, PTHREAD_PROCESS_PRIVATE) != 0) + { + puts ("spin_init failed"); + return 1; + } + + if (pthread_spin_lock (&s) != 0) + { + puts ("1st spin_lock failed"); + return 1; + } + + /* Set an alarm for 1 second. The wrapper will expect this. */ + alarm (1); + + /* This call should never return. */ + pthread_spin_lock (&s); + + puts ("2nd spin_lock returned"); + return 1; +} + +#define EXPECTED_SIGNAL SIGALRM +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-stack-align.h b/test/nptl/tst-stack-align.h new file mode 100644 index 000000000..9a59d7137 --- /dev/null +++ b/test/nptl/tst-stack-align.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2003 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, see + <http://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <stdint.h> + +#define TEST_STACK_ALIGN() \ + ({ \ + double _d = 12.0; \ + long double _ld = 15.0; \ + int _ret = 0; \ + printf ("double: %g %p %zu\n", _d, &_d, __alignof (double)); \ + if ((((uintptr_t) &_d) & (__alignof (double) - 1)) != 0) \ + _ret = 1; \ + \ + printf ("ldouble: %Lg %p %zu\n", _ld, &_ld, __alignof (long double)); \ + if ((((uintptr_t) &_ld) & (__alignof (long double) - 1)) != 0) \ + _ret = 1; \ + _ret; \ + }) diff --git a/test/nptl/tst-stack1.c b/test/nptl/tst-stack1.c new file mode 100644 index 000000000..288024a1d --- /dev/null +++ b/test/nptl/tst-stack1.c @@ -0,0 +1,145 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <limits.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/param.h> +#include <unistd.h> + + +static void *stack; +static size_t size; + + +static void * +tf (void *a) +{ + int result = 0; + + puts ("child start"); + + pthread_attr_t attr; + if (pthread_getattr_np (pthread_self (), &attr) != 0) + { + puts ("getattr_np failed"); + exit (1); + } + + size_t test_size; + void *test_stack; + if (pthread_attr_getstack (&attr, &test_stack, &test_size) != 0) + { + puts ("attr_getstack failed"); + exit (1); + } + + if (test_size != size) + { + printf ("child: reported size differs: is %zu, expected %zu\n", + test_size, size); + result = 1; + } + + if (test_stack != stack) + { + printf ("child: reported stack address differs: is %p, expected %p\n", + test_stack, stack); + result = 1; + } + + puts ("child OK"); + + return result ? (void *) 1l : NULL; +} + + +int +do_test (void) +{ + int result = 0; + + size = MAX (4 * getpagesize (), PTHREAD_STACK_MIN); + if (posix_memalign (&stack, getpagesize (), size) != 0) + { + puts ("out of memory while allocating the stack memory"); + exit (1); + } + + pthread_attr_t attr; + if (pthread_attr_init (&attr) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + puts ("attr_setstack"); + if (pthread_attr_setstack (&attr, stack, size) != 0) + { + puts ("attr_setstack failed"); + exit (1); + } + + size_t test_size; + void *test_stack; + puts ("attr_getstack"); + if (pthread_attr_getstack (&attr, &test_stack, &test_size) != 0) + { + puts ("attr_getstack failed"); + exit (1); + } + + if (test_size != size) + { + printf ("reported size differs: is %zu, expected %zu\n", + test_size, size); + result = 1; + } + + if (test_stack != stack) + { + printf ("reported stack address differs: is %p, expected %p\n", + test_stack, stack); + result = 1; + } + + puts ("create"); + + pthread_t th; + if (pthread_create (&th, &attr, tf, NULL) != 0) + { + puts ("failed to create thread"); + exit (1); + } + + void *status; + if (pthread_join (th, &status) != 0) + { + puts ("join failed"); + exit (1); + } + + result |= status != NULL; + + return result; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-stack2.c b/test/nptl/tst-stack2.c new file mode 100644 index 000000000..7b1e2f6a6 --- /dev/null +++ b/test/nptl/tst-stack2.c @@ -0,0 +1,79 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +/* Test whether it is possible to create a thread with PTHREAD_STACK_MIN + stack size. */ + +#include <pthread.h> +#include <stdlib.h> +#include <stdio.h> +#include <limits.h> + +static int seen; + +static void * +tf (void *p) +{ + ++seen; + return NULL; +} + +static int +do_test (void) +{ + pthread_attr_t attr; + pthread_attr_init (&attr); + + int result = 0; + int res = pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN); + if (res) + { + printf ("pthread_attr_setstacksize failed %d\n", res); + result = 1; + } + + /* Create the thread. */ + pthread_t th; + res = pthread_create (&th, &attr, tf, NULL); + if (res) + { + printf ("pthread_create failed %d\n", res); + result = 1; + } + else + { + res = pthread_join (th, NULL); + if (res) + { + printf ("pthread_join failed %d\n", res); + result = 1; + } + } + + if (seen != 1) + { + printf ("seen %d != 1\n", seen); + result = 1; + } + + return result; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-stdio1.c b/test/nptl/tst-stdio1.c new file mode 100644 index 000000000..2396e0185 --- /dev/null +++ b/test/nptl/tst-stdio1.c @@ -0,0 +1,56 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <unistd.h> + + +static void *tf (void *a) +{ + flockfile (stdout); + /* This call should never return. */ + return a; +} + + +int +do_test (void) +{ + pthread_t th; + + flockfile (stdout); + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + write (2, "create failed\n", 14); + _exit (1); + } + + pthread_join (th, NULL); + + puts ("join returned"); + + return 0; +} + + +#define EXPECTED_SIGNAL SIGALRM +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-stdio2.c b/test/nptl/tst-stdio2.c new file mode 100644 index 000000000..4ac778cc0 --- /dev/null +++ b/test/nptl/tst-stdio2.c @@ -0,0 +1,81 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static void *tf (void *a) +{ + puts ("start tf"); + + /* Multiple locking, implicitly or explicitly, must be possible. */ + flockfile (stdout); + + puts ("after first flockfile"); + + flockfile (stdout); + + puts ("foo"); + + funlockfile (stdout); + + puts ("after first funlockfile"); + + funlockfile (stdout); + + puts ("all done"); + + return a; +} + + +int +do_test (void) +{ + pthread_t th; + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + write (2, "create failed\n", 14); + _exit (1); + } + + void *result; + if (pthread_join (th, &result) != 0) + { + puts ("join failed"); + exit (1); + } + else if (result != NULL) + { + printf ("wrong return value: %p, expected %p\n", result, NULL); + exit (1); + } + + puts ("join returned succsefully"); + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-sysconf.c b/test/nptl/tst-sysconf.c new file mode 100644 index 000000000..da493ef43 --- /dev/null +++ b/test/nptl/tst-sysconf.c @@ -0,0 +1,47 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <unistd.h> + + +static int +do_test (void) +{ + puts ("We expect no limits"); + /* We have no fixed limit on the number of threads. Make sure the + headers tell the right story. */ +#ifdef PTHREAD_THREADS_MAX + printf ("Header report maximum number of threads = %lu\n", + (unsigned long int) PTHREAD_THREADS_MAX); + return 1; +#else + long int r = sysconf (_SC_THREAD_THREADS_MAX); + if (r != -1) + { + printf ("sysconf(_SC_THREAD_THREADS_MAX) return %ld\n", r); + return 1; + } +#endif + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-timer2.c b/test/nptl/tst-timer2.c new file mode 100644 index 000000000..60026c1ef --- /dev/null +++ b/test/nptl/tst-timer2.c @@ -0,0 +1,65 @@ +/* Test for crashing bugs when trying to create too many timers. */ + +#include <stdio.h> +#include <time.h> +#include <signal.h> +#include <sys/time.h> +#include <sys/resource.h> +#include <unistd.h> + +#if _POSIX_THREADS +# include <pthread.h> + +void +thread (union sigval arg) +{ + puts ("Timeout"); +} + +int +do_test (void) +{ + int i, res; + timer_t timerId; + struct itimerspec itval; + struct sigevent sigev; + + itval.it_interval.tv_sec = 2; + itval.it_interval.tv_nsec = 0; + itval.it_value.tv_sec = 2; + itval.it_value.tv_nsec = 0; + + sigev.sigev_notify = SIGEV_THREAD; + sigev.sigev_signo = SIGRTMIN; + sigev.sigev_notify_function = thread; + sigev.sigev_notify_attributes = 0; + sigev.sigev_value.sival_ptr = (void *) &timerId; + + for (i = 0; i < 100; i++) + { + printf ("cnt = %d\n", i); + + if (timer_create (CLOCK_REALTIME, &sigev, &timerId) < 0) + { + perror ("timer_create"); + continue; + } + + res = timer_settime (timerId, 0, &itval, NULL); + if (res < 0) + perror ("timer_settime"); + + res = timer_delete (timerId); + if (res < 0) + perror ("timer_delete"); + } + + return 0; +} + +# define TEST_FUNCTION do_test () +#else +# define TEST_FUNCTION 0 +#endif + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-timer3.c b/test/nptl/tst-timer3.c new file mode 100644 index 000000000..8113f6690 --- /dev/null +++ b/test/nptl/tst-timer3.c @@ -0,0 +1,86 @@ +/* Test for bogus per-thread deletion of timers. */ + +#include <stdio.h> +#include <error.h> +#include <time.h> +#include <signal.h> +#include <stdint.h> +#include <string.h> +#include <sys/time.h> +#include <sys/resource.h> +#include <unistd.h> +#if _POSIX_THREADS +# include <pthread.h> + + +/* Creating timers in another thread should work too. */ +static void * +do_timer_create (void *arg) +{ + struct sigevent *const sigev = arg; + timer_t *const timerId = sigev->sigev_value.sival_ptr; + if (timer_create (CLOCK_REALTIME, sigev, timerId) < 0) + { + printf ("timer_create: %m\n"); + return NULL; + } + return timerId; +} + + +static int +do_test (void) +{ + int i, res; + timer_t timerId; + struct itimerspec itval; + struct sigevent sigev; + + itval.it_interval.tv_sec = 2; + itval.it_interval.tv_nsec = 0; + itval.it_value.tv_sec = 2; + itval.it_value.tv_nsec = 0; + + sigev.sigev_notify = SIGEV_SIGNAL; + sigev.sigev_signo = SIGALRM; + sigev.sigev_value.sival_ptr = (void *) &timerId; + + for (i = 0; i < 100; i++) + { + printf ("cnt = %d\n", i); + + pthread_t thr; + res = pthread_create (&thr, NULL, &do_timer_create, &sigev); + if (res) + { + printf ("pthread_create: %s\n", strerror (res)); + continue; + } + void *val; + res = pthread_join (thr, &val); + if (res) + { + printf ("pthread_join: %s\n", strerror (res)); + continue; + } + if (val == NULL) + continue; + + res = timer_settime (timerId, 0, &itval, NULL); + if (res < 0) + printf ("timer_settime: %m\n"); + + res = timer_delete (timerId); + if (res < 0) + printf ("timer_delete: %m\n"); + } + + return 0; +} + +# define TEST_FUNCTION do_test () +#else +# define TEST_FUNCTION 0 +#endif + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-timer4.c b/test/nptl/tst-timer4.c new file mode 100644 index 000000000..fafb5651b --- /dev/null +++ b/test/nptl/tst-timer4.c @@ -0,0 +1,647 @@ +/* Tests for POSIX timer implementation. + Copyright (C) 2004 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek <jakub@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; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <signal.h> +#include <stdio.h> +#include <string.h> +#include <time.h> +#include <unistd.h> +#if _POSIX_THREADS +# include <pthread.h> + +# ifndef TEST_CLOCK +# define TEST_CLOCK CLOCK_REALTIME +# endif + +pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; +pthread_cond_t cond = PTHREAD_COND_INITIALIZER; + +timer_t timer_none, timer_sig1, timer_sig2, timer_thr1, timer_thr2; + +int thr1_cnt, thr1_err; +union sigval thr1_sigval; +struct timespec thr1_ts; + +static void +thr1 (union sigval sigval) +{ + pthread_mutex_lock (&lock); + thr1_err = clock_gettime (TEST_CLOCK, &thr1_ts); + if (thr1_cnt >= 5) + { + struct itimerspec it = { }; + thr1_err |= timer_settime (timer_thr1, 0, &it, NULL); + } + thr1_sigval = sigval; + ++thr1_cnt; + pthread_cond_signal (&cond); + pthread_mutex_unlock (&lock); +} + +int thr2_cnt, thr2_err; +union sigval thr2_sigval; +size_t thr2_guardsize; +struct timespec thr2_ts; + +static void +thr2 (union sigval sigval) +{ + pthread_attr_t nattr; + int err = 0; + size_t guardsize = -1; + int ret = pthread_getattr_np (pthread_self (), &nattr); + if (ret) + { + errno = ret; + printf ("*** pthread_getattr_np failed: %m\n"); + err = 1; + } + else + { + ret = pthread_attr_getguardsize (&nattr, &guardsize); + if (ret) + { + errno = ret; + printf ("*** pthread_attr_getguardsize failed: %m\n"); + err = 1; + } + if (pthread_attr_destroy (&nattr) != 0) + { + puts ("*** pthread_attr_destroy failed"); + err = 1; + } + } + pthread_mutex_lock (&lock); + thr2_err = clock_gettime (TEST_CLOCK, &thr2_ts) | err; + if (thr2_cnt >= 5) + { + struct itimerspec it = { }; + thr2_err |= timer_settime (timer_thr2, 0, &it, NULL); + } + thr2_sigval = sigval; + ++thr2_cnt; + thr2_guardsize = guardsize; + pthread_cond_signal (&cond); + pthread_mutex_unlock (&lock); +} + +volatile int sig1_cnt, sig1_err; +volatile union sigval sig1_sigval; +struct timespec sig1_ts; + +static void +sig1_handler (int sig, siginfo_t *info, void *ctx) +{ + int err = 0; + if (sig != SIGRTMIN) err |= 1 << 0; + if (info->si_signo != SIGRTMIN) err |= 1 << 1; + if (info->si_code != SI_TIMER) err |= 1 << 2; + if (clock_gettime (TEST_CLOCK, &sig1_ts) != 0) + err |= 1 << 3; + if (sig1_cnt >= 5) + { + struct itimerspec it = { }; + if (timer_settime (timer_sig1, 0, &it, NULL)) + err |= 1 << 4; + } + sig1_err |= err; + sig1_sigval = info->si_value; + ++sig1_cnt; +} + +volatile int sig2_cnt, sig2_err; +volatile union sigval sig2_sigval; +struct timespec sig2_ts; + +static void +sig2_handler (int sig, siginfo_t *info, void *ctx) +{ + int err = 0; + if (sig != SIGRTMIN + 1) err |= 1 << 0; + if (info->si_signo != SIGRTMIN + 1) err |= 1 << 1; + if (info->si_code != SI_TIMER) err |= 1 << 2; + if (clock_gettime (TEST_CLOCK, &sig2_ts) != 0) + err |= 1 << 3; + if (sig2_cnt >= 5) + { + struct itimerspec it = { }; + if (timer_settime (timer_sig2, 0, &it, NULL)) + err |= 1 << 4; + } + sig2_err |= err; + sig2_sigval = info->si_value; + ++sig2_cnt; +} + +/* Check if end is later or equal to start + nsec. */ +static int +check_ts (const char *name, const struct timespec *start, + const struct timespec *end, long msec) +{ + struct timespec ts = *start; + + ts.tv_sec += msec / 1000000; + ts.tv_nsec += (msec % 1000000) * 1000; + if (ts.tv_nsec >= 1000000000) + { + ++ts.tv_sec; + ts.tv_nsec -= 1000000000; + } + if (end->tv_sec < ts.tv_sec + || (end->tv_sec == ts.tv_sec && end->tv_nsec < ts.tv_nsec)) + { + printf ("\ +*** timer %s invoked too soon: %ld.%09ld instead of expected %ld.%09ld\n", + name, (long) end->tv_sec, end->tv_nsec, + (long) ts.tv_sec, ts.tv_nsec); + return 1; + } + else + return 0; +} + +#define TIMEOUT 15 +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ + int result = 0; + +#ifdef TEST_CLOCK_MISSING + const char *missing = TEST_CLOCK_MISSING (TEST_CLOCK); + if (missing != NULL) + { + printf ("%s missing, skipping test\n", missing); + return 0; + } +#endif + + struct timespec ts; + if (clock_gettime (TEST_CLOCK, &ts) != 0) + { + printf ("*** clock_gettime failed: %m\n"); + result = 1; + } + else + printf ("clock_gettime returned timespec = { %ld, %ld }\n", + (long) ts.tv_sec, ts.tv_nsec); + + if (clock_getres (TEST_CLOCK, &ts) != 0) + { + printf ("*** clock_getres failed: %m\n"); + result = 1; + } + else + printf ("clock_getres returned timespec = { %ld, %ld }\n", + (long) ts.tv_sec, ts.tv_nsec); + + struct sigevent ev; + memset (&ev, 0x11, sizeof (ev)); + ev.sigev_notify = SIGEV_NONE; + if (timer_create (TEST_CLOCK, &ev, &timer_none) != 0) + { + printf ("*** timer_create for timer_none failed: %m\n"); + return 1; + } + + struct sigaction sa = { .sa_sigaction = sig1_handler, + .sa_flags = SA_SIGINFO }; + sigemptyset (&sa.sa_mask); + sigaction (SIGRTMIN, &sa, NULL); + sa.sa_sigaction = sig2_handler; + sigaction (SIGRTMIN + 1, &sa, NULL); + + memset (&ev, 0x22, sizeof (ev)); + ev.sigev_notify = SIGEV_SIGNAL; + ev.sigev_signo = SIGRTMIN; + ev.sigev_value.sival_ptr = &ev; + if (timer_create (TEST_CLOCK, &ev, &timer_sig1) != 0) + { + printf ("*** timer_create for timer_sig1 failed: %m\n"); + return 1; + } + + memset (&ev, 0x33, sizeof (ev)); + ev.sigev_notify = SIGEV_SIGNAL; + ev.sigev_signo = SIGRTMIN + 1; + ev.sigev_value.sival_int = 163; + if (timer_create (TEST_CLOCK, &ev, &timer_sig2) != 0) + { + printf ("*** timer_create for timer_sig2 failed: %m\n"); + return 1; + } + + memset (&ev, 0x44, sizeof (ev)); + ev.sigev_notify = SIGEV_THREAD; + ev.sigev_notify_function = thr1; + ev.sigev_notify_attributes = NULL; + ev.sigev_value.sival_ptr = &ev; + if (timer_create (TEST_CLOCK, &ev, &timer_thr1) != 0) + { + printf ("*** timer_create for timer_thr1 failed: %m\n"); + return 1; + } + + pthread_attr_t nattr; + if (pthread_attr_init (&nattr) + || pthread_attr_setguardsize (&nattr, 0)) + { + puts ("*** pthread_attr_t setup failed"); + result = 1; + } + + memset (&ev, 0x55, sizeof (ev)); + ev.sigev_notify = SIGEV_THREAD; + ev.sigev_notify_function = thr2; + ev.sigev_notify_attributes = &nattr; + ev.sigev_value.sival_int = 111; + if (timer_create (TEST_CLOCK, &ev, &timer_thr2) != 0) + { + printf ("*** timer_create for timer_thr2 failed: %m\n"); + return 1; + } + + int ret = timer_getoverrun (timer_thr1); + if (ret != 0) + { + if (ret == -1) + printf ("*** timer_getoverrun failed: %m\n"); + else + printf ("*** timer_getoverrun returned %d != 0\n", ret); + result = 1; + } + + struct itimerspec it; + it.it_value.tv_sec = 0; + it.it_value.tv_nsec = -26; + it.it_interval.tv_sec = 0; + it.it_interval.tv_nsec = 0; + if (timer_settime (timer_sig1, 0, &it, NULL) == 0) + { + puts ("*** timer_settime with negative tv_nsec unexpectedly succeeded"); + result = 1; + } + else if (errno != EINVAL) + { + printf ("*** timer_settime with negative tv_nsec did not fail with " + "EINVAL: %m\n"); + result = 1; + } + + it.it_value.tv_nsec = 100000; + it.it_interval.tv_nsec = 1000000000; + if (timer_settime (timer_sig2, 0, &it, NULL) == 0) + { + puts ("\ +*** timer_settime with tv_nsec 1000000000 unexpectedly succeeded"); + result = 1; + } + else if (errno != EINVAL) + { + printf ("*** timer_settime with tv_nsec 1000000000 did not fail with " + "EINVAL: %m\n"); + result = 1; + } + +#if 0 + it.it_value.tv_nsec = 0; + it.it_interval.tv_nsec = -26; + if (timer_settime (timer_thr1, 0, &it, NULL) != 0) + { + printf ("\ +!!! timer_settime with it_value 0 it_interval invalid failed: %m\n"); + /* FIXME: is this mandated by POSIX? + result = 1; */ + } + + it.it_interval.tv_nsec = 3000000000; + if (timer_settime (timer_thr2, 0, &it, NULL) != 0) + { + printf ("\ +!!! timer_settime with it_value 0 it_interval invalid failed: %m\n"); + /* FIXME: is this mandated by POSIX? + result = 1; */ + } +#endif + + struct timespec startts; + if (clock_gettime (TEST_CLOCK, &startts) != 0) + { + printf ("*** clock_gettime failed: %m\n"); + result = 1; + } + + it.it_value.tv_nsec = 100000000; + it.it_interval.tv_nsec = 0; + if (timer_settime (timer_none, 0, &it, NULL) != 0) + { + printf ("*** timer_settime timer_none failed: %m\n"); + result = 1; + } + + it.it_value.tv_nsec = 200000000; + if (timer_settime (timer_thr1, 0, &it, NULL) != 0) + { + printf ("*** timer_settime timer_thr1 failed: %m\n"); + result = 1; + } + + it.it_value.tv_nsec = 300000000; + if (timer_settime (timer_thr2, 0, &it, NULL) != 0) + { + printf ("*** timer_settime timer_thr2 failed: %m\n"); + result = 1; + } + + it.it_value.tv_nsec = 400000000; + if (timer_settime (timer_sig1, 0, &it, NULL) != 0) + { + printf ("*** timer_settime timer_sig1 failed: %m\n"); + result = 1; + } + + it.it_value.tv_nsec = 500000000; + if (TEMP_FAILURE_RETRY (timer_settime (timer_sig2, 0, &it, NULL)) != 0) + { + printf ("*** timer_settime timer_sig2 failed: %m\n"); + result = 1; + } + + pthread_mutex_lock (&lock); + while (thr1_cnt == 0 || thr2_cnt == 0) + pthread_cond_wait (&cond, &lock); + pthread_mutex_unlock (&lock); + + while (sig1_cnt == 0 || sig2_cnt == 0) + { + ts.tv_sec = 0; + ts.tv_nsec = 100000000; + nanosleep (&ts, NULL); + } + + pthread_mutex_lock (&lock); + + if (thr1_cnt != 1) + { + printf ("*** thr1 not called exactly once, but %d times\n", thr1_cnt); + result = 1; + } + else if (thr1_err) + { + puts ("*** an error occurred in thr1"); + result = 1; + } + else if (thr1_sigval.sival_ptr != &ev) + { + printf ("*** thr1_sigval.sival_ptr %p != %p\n", + thr1_sigval.sival_ptr, &ev); + result = 1; + } + else if (check_ts ("thr1", &startts, &thr1_ts, 200000)) + result = 1; + + if (thr2_cnt != 1) + { + printf ("*** thr2 not called exactly once, but %d times\n", thr2_cnt); + result = 1; + } + else if (thr2_err) + { + puts ("*** an error occurred in thr2"); + result = 1; + } + else if (thr2_sigval.sival_int != 111) + { + printf ("*** thr2_sigval.sival_ptr %d != 111\n", thr2_sigval.sival_int); + result = 1; + } + else if (check_ts ("thr2", &startts, &thr2_ts, 300000)) + result = 1; + else if (thr2_guardsize != 0) + { + printf ("*** thr2 guardsize %zd != 0\n", thr2_guardsize); + result = 1; + } + + pthread_mutex_unlock (&lock); + + if (sig1_cnt != 1) + { + printf ("*** sig1 not called exactly once, but %d times\n", sig1_cnt); + result = 1; + } + else if (sig1_err) + { + printf ("*** errors occurred in sig1 handler %x\n", sig1_err); + result = 1; + } + else if (sig1_sigval.sival_ptr != &ev) + { + printf ("*** sig1_sigval.sival_ptr %p != %p\n", + sig1_sigval.sival_ptr, &ev); + result = 1; + } + else if (check_ts ("sig1", &startts, &sig1_ts, 400000)) + result = 1; + + if (sig2_cnt != 1) + { + printf ("*** sig2 not called exactly once, but %d times\n", sig2_cnt); + result = 1; + } + else if (sig2_err) + { + printf ("*** errors occurred in sig2 handler %x\n", sig2_err); + result = 1; + } + else if (sig2_sigval.sival_int != 163) + { + printf ("*** sig2_sigval.sival_ptr %d != 163\n", sig2_sigval.sival_int); + result = 1; + } + else if (check_ts ("sig2", &startts, &sig2_ts, 500000)) + result = 1; + + if (timer_gettime (timer_none, &it) != 0) + { + printf ("*** timer_gettime timer_none failed: %m\n"); + result = 1; + } + else if (it.it_value.tv_sec || it.it_value.tv_nsec + || it.it_interval.tv_sec || it.it_interval.tv_nsec) + { + printf ("\ +*** timer_gettime timer_none returned { %ld.%09ld, %ld.%09ld }\n", + (long) it.it_value.tv_sec, it.it_value.tv_nsec, + (long) it.it_interval.tv_sec, it.it_interval.tv_nsec); + result = 1; + } + + if (clock_gettime (TEST_CLOCK, &startts) != 0) + { + printf ("*** clock_gettime failed: %m\n"); + result = 1; + } + + it.it_value.tv_sec = 1; + it.it_value.tv_nsec = 0; + it.it_interval.tv_sec = 0; + it.it_interval.tv_nsec = 100000000; + if (timer_settime (timer_none, 0, &it, NULL) != 0) + { + printf ("*** timer_settime timer_none failed: %m\n"); + result = 1; + } + + it.it_value.tv_nsec = 100000000; + it.it_interval.tv_nsec = 200000000; + if (timer_settime (timer_thr1, 0, &it, NULL) != 0) + { + printf ("*** timer_settime timer_thr1 failed: %m\n"); + result = 1; + } + + it.it_value.tv_nsec = 200000000; + it.it_interval.tv_nsec = 300000000; + if (timer_settime (timer_thr2, 0, &it, NULL) != 0) + { + printf ("*** timer_settime timer_thr2 failed: %m\n"); + result = 1; + } + + it.it_value.tv_nsec = 300000000; + it.it_interval.tv_nsec = 400000000; + if (timer_settime (timer_sig1, 0, &it, NULL) != 0) + { + printf ("*** timer_settime timer_sig1 failed: %m\n"); + result = 1; + } + + it.it_value.tv_nsec = 400000000; + it.it_interval.tv_nsec = 500000000; + if (TEMP_FAILURE_RETRY (timer_settime (timer_sig2, 0, &it, NULL)) != 0) + { + printf ("*** timer_settime timer_sig2 failed: %m\n"); + result = 1; + } + + pthread_mutex_lock (&lock); + while (thr1_cnt < 6 || thr2_cnt < 6) + pthread_cond_wait (&cond, &lock); + pthread_mutex_unlock (&lock); + + while (sig1_cnt < 6 || sig2_cnt < 6) + { + ts.tv_sec = 0; + ts.tv_nsec = 100000000; + nanosleep (&ts, NULL); + } + + pthread_mutex_lock (&lock); + + if (thr1_err) + { + puts ("*** an error occurred in thr1"); + result = 1; + } + else if (check_ts ("thr1", &startts, &thr1_ts, 1100000 + 4 * 200000)) + result = 1; + + if (thr2_err) + { + puts ("*** an error occurred in thr2"); + result = 1; + } + else if (check_ts ("thr2", &startts, &thr2_ts, 1200000 + 4 * 300000)) + result = 1; + else if (thr2_guardsize != 0) + { + printf ("*** thr2 guardsize %zd != 0\n", thr2_guardsize); + result = 1; + } + + pthread_mutex_unlock (&lock); + + if (sig1_err) + { + printf ("*** errors occurred in sig1 handler %x\n", sig1_err); + result = 1; + } + else if (check_ts ("sig1", &startts, &sig1_ts, 1300000 + 4 * 400000)) + result = 1; + + if (sig2_err) + { + printf ("*** errors occurred in sig2 handler %x\n", sig2_err); + result = 1; + } + else if (check_ts ("sig2", &startts, &sig2_ts, 1400000 + 4 * 500000)) + result = 1; + + if (timer_gettime (timer_none, &it) != 0) + { + printf ("*** timer_gettime timer_none failed: %m\n"); + result = 1; + } + else if (it.it_interval.tv_sec || it.it_interval.tv_nsec != 100000000) + { + printf ("\ +!!! second timer_gettime timer_none returned it_interval %ld.%09ld\n", + (long) it.it_interval.tv_sec, it.it_interval.tv_nsec); + /* FIXME: For now disabled. + result = 1; */ + } + + if (timer_delete (timer_none) != 0) + { + printf ("*** timer_delete for timer_none failed: %m\n"); + result = 1; + } + + if (timer_delete (timer_sig1) != 0) + { + printf ("*** timer_delete for timer_sig1 failed: %m\n"); + result = 1; + } + + if (timer_delete (timer_sig2) != 0) + { + printf ("*** timer_delete for timer_sig2 failed: %m\n"); + result = 1; + } + + if (timer_delete (timer_thr1) != 0) + { + printf ("*** timer_delete for timer_thr1 failed: %m\n"); + result = 1; + } + + if (timer_delete (timer_thr2) != 0) + { + printf ("*** timer_delete for timer_thr2 failed: %m\n"); + result = 1; + } + return result; +} +#else +# define TEST_FUNCTION 0 +#endif + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-timer5.c b/test/nptl/tst-timer5.c new file mode 100644 index 000000000..6466c8efc --- /dev/null +++ b/test/nptl/tst-timer5.c @@ -0,0 +1,38 @@ +/* Timer test using the monotonic clock. */ + +#include <time.h> +#include <unistd.h> + +#if defined CLOCK_MONOTONIC && defined _POSIX_MONOTONIC_CLOCK + +# define TEST_CLOCK CLOCK_MONOTONIC +# define TEST_CLOCK_MISSING(clock) \ + (setup_test () ? "CLOCK_MONOTONIC" : NULL) + +# include <stdio.h> + +static int +setup_test (void) +{ + if (sysconf (_SC_MONOTONIC_CLOCK) <= 0) + return 1; + + /* The user-level timers implementation doesn't support CLOCK_MONOTONIC, + even though sysconf claims it will. */ + timer_t t; + if (timer_create (TEST_CLOCK, NULL, &t) != 0) + { + printf ("timer_create: %m\n"); + return 1; + } + timer_delete (t); + + return 0; +} + +# include "tst-timer4.c" + +#else +# define TEST_FUNCTION 0 +# include "../test-skeleton.c" +#endif diff --git a/test/nptl/tst-tls1.c b/test/nptl/tst-tls1.c new file mode 100644 index 000000000..a7cf8f408 --- /dev/null +++ b/test/nptl/tst-tls1.c @@ -0,0 +1,121 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <tls.h> + +#if HAVE___THREAD +struct test_s +{ + int a; + int b; +}; + +#define INIT_A 1 +#define INIT_B 42 +/* Deliberately not static. */ +__thread struct test_s s __attribute__ ((tls_model ("initial-exec"))) = +{ + .a = INIT_A, + .b = INIT_B +}; + + +static void * +tf (void *arg) +{ + if (s.a != INIT_A || s.b != INIT_B) + { + puts ("initial value of s in child thread wrong"); + exit (1); + } + + ++s.a; + + return NULL; +} +#endif + + +int +do_test (void) +{ +#if !HAVE___THREAD + + puts ("No __thread support in compiler, test skipped."); + + return 0; +#else + + if (s.a != INIT_A || s.b != INIT_B) + { + puts ("initial value of s in main thread wrong"); + exit (1); + } + + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + +#define N 10 + int i; + for (i = 0; i < N; ++i) + { +#define M 10 + pthread_t th[M]; + int j; + for (j = 0; j < M; ++j, ++s.a) + if (pthread_create (&th[j], &a, tf, NULL) != 0) + { + puts ("pthread_create failed"); + exit (1); + } + + for (j = 0; j < M; ++j) + if (pthread_join (th[j], NULL) != 0) + { + puts ("pthread_join failed"); + exit (1); + } + } + + if (pthread_attr_destroy (&a) != 0) + { + puts ("attr_destroy failed"); + exit (1); + } + + return 0; +#endif +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-tls2.c b/test/nptl/tst-tls2.c new file mode 100644 index 000000000..f60f4a5e3 --- /dev/null +++ b/test/nptl/tst-tls2.c @@ -0,0 +1,215 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <semaphore.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <tls.h> + +#if HAVE___THREAD + +#define N 10 +static pthread_t th[N]; + + +#define CB(n) \ +static void \ +cb##n (void) \ +{ \ + if (th[n] != pthread_self ()) \ + { \ + write (STDOUT_FILENO, "wrong callback\n", 15); \ + _exit (1); \ + } \ +} +CB (0) +CB (1) +CB (2) +CB (3) +CB (4) +CB (5) +CB (6) +CB (7) +CB (8) +CB (9) +static void (*cbs[]) (void) = +{ + cb0, cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9 +}; + + +static __thread void (*fp) (void) __attribute__ ((tls_model ("local-exec"))); + + +static sem_t s; + + +#define THE_SIG SIGUSR1 +static void +handler (int sig) +{ + if (sig != THE_SIG) + { + write (STDOUT_FILENO, "wrong signal\n", 13); + _exit (1); + } + + fp (); + + if (sem_post (&s) != 0) + { + write (STDOUT_FILENO, "sem_post failed\n", 16); + _exit (1); + } +} + + +static pthread_barrier_t b; + +#define TOTAL_SIGS 1000 +static int nsigs; + + +static void * +tf (void *arg) +{ + fp = arg; + + pthread_barrier_wait (&b); + + pthread_barrier_wait (&b); + + if (nsigs != TOTAL_SIGS) + { + puts ("barrier_wait prematurely returns"); + exit (1); + } + + return NULL; +} +#endif + +int +do_test (void) +{ +#if !HAVE___THREAD + + puts ("No __thread support in compiler, test skipped."); + + return 0; +#else + + if (pthread_barrier_init (&b, NULL, N + 1) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + if (sem_init (&s, 0, 0) != 0) + { + puts ("sem_init failed"); + exit (1); + } + + struct sigaction sa; + sa.sa_handler = handler; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + if (sigaction (THE_SIG, &sa, NULL) != 0) + { + puts ("sigaction failed"); + exit (1); + } + + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + + int i; + for (i = 0; i < N; ++i) + if (pthread_create (&th[i], &a, tf, cbs[i]) != 0) + { + puts ("pthread_create failed"); + exit (1); + } + + if (pthread_attr_destroy (&a) != 0) + { + puts ("attr_destroy failed"); + exit (1); + } + + pthread_barrier_wait (&b); + + sigset_t ss; + sigemptyset (&ss); + sigaddset (&ss, THE_SIG); + if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0) + { + puts ("pthread_sigmask failed"); + exit (1); + } + + /* Start sending signals. */ + for (i = 0; i < TOTAL_SIGS; ++i) + { + if (kill (getpid (), THE_SIG) != 0) + { + puts ("kill failed"); + exit (1); + } + + if (TEMP_FAILURE_RETRY (sem_wait (&s)) != 0) + { + puts ("sem_wait failed"); + exit (1); + } + + ++nsigs; + } + + pthread_barrier_wait (&b); + + for (i = 0; i < N; ++i) + if (pthread_join (th[i], NULL) != 0) + { + puts ("join failed"); + exit (1); + } + + return 0; +#endif +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-tls3.c b/test/nptl/tst-tls3.c new file mode 100644 index 000000000..0d4e5140c --- /dev/null +++ b/test/nptl/tst-tls3.c @@ -0,0 +1,224 @@ +/* Copyright (C) 2003, 2004 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, see + <http://www.gnu.org/licenses/>. */ + +#include <dlfcn.h> +#include <errno.h> +#include <pthread.h> +#include <signal.h> +#include <semaphore.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <pthreaddef.h> +#include <tls.h> + +#define THE_SIG SIGUSR1 + + +#define N 10 +static pthread_t th[N]; + + +#define CB(n) \ +static void \ +cb##n (void) \ +{ \ + if (th[n] != pthread_self ()) \ + { \ + write (STDOUT_FILENO, "wrong callback\n", 15); \ + _exit (1); \ + } \ +} +CB (0) +CB (1) +CB (2) +CB (3) +CB (4) +CB (5) +CB (6) +CB (7) +CB (8) +CB (9) +static void (*cbs[]) (void) = +{ + cb0, cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, cb9 +}; + + +sem_t s; + + +pthread_barrier_t b; + +#define TOTAL_SIGS 1000 +int nsigs; + + +int +do_test (void) +{ +#if !HAVE___THREAD + + puts ("No __thread support in compiler, test skipped."); + + return 0; +#else + + if ((uintptr_t) pthread_self () & (TCB_ALIGNMENT - 1)) + { + puts ("initial thread's struct pthread not aligned enough"); + exit (1); + } + + if (pthread_barrier_init (&b, NULL, N + 1) != 0) + { + puts ("barrier_init failed"); + exit (1); + } + + if (sem_init (&s, 0, 0) != 0) + { + puts ("sem_init failed"); + exit (1); + } + + void *h = dlopen ("tst-tls3mod.so", RTLD_LAZY); + if (h == NULL) + { + puts ("dlopen failed"); + exit (1); + } + + void *(*tf) (void *) = dlsym (h, "tf"); + if (tf == NULL) + { + puts ("dlsym for tf failed"); + exit (1); + } + + void (*setup_tf) (pthread_barrier_t*, int*, sem_t*) = dlsym(h, "setup_tf"); + if (setup_tf == NULL) + { + puts ("dlsym for setup_tf failed"); + exit(1); + } + + setup_tf (&b, &nsigs, &s); + + struct sigaction sa; + sa.sa_handler = dlsym (h, "handler"); + if (sa.sa_handler == NULL) + { + puts ("dlsym for handler failed"); + exit (1); + } + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + if (sigaction (THE_SIG, &sa, NULL) != 0) + { + puts ("sigaction failed"); + exit (1); + } + + pthread_attr_t a; + + if (pthread_attr_init (&a) != 0) + { + puts ("attr_init failed"); + exit (1); + } + + if (pthread_attr_setstacksize (&a, 1 * 1024 * 1024) != 0) + { + puts ("attr_setstacksize failed"); + return 1; + } + + int r; + for (r = 0; r < 10; ++r) + { + int i; + for (i = 0; i < N; ++i) + if (pthread_create (&th[i], &a, tf, cbs[i]) != 0) + { + puts ("pthread_create failed"); + exit (1); + } + + nsigs = 0; + + pthread_barrier_wait (&b); + + sigset_t ss; + sigemptyset (&ss); + sigaddset (&ss, THE_SIG); + if (pthread_sigmask (SIG_BLOCK, &ss, NULL) != 0) + { + puts ("pthread_sigmask failed"); + exit (1); + } + + /* Start sending signals. */ + for (i = 0; i < TOTAL_SIGS; ++i) + { + if (kill (getpid (), THE_SIG) != 0) + { + puts ("kill failed"); + exit (1); + } + + if (TEMP_FAILURE_RETRY (sem_wait (&s)) != 0) + { + puts ("sem_wait failed"); + exit (1); + } + + ++nsigs; + } + + pthread_barrier_wait (&b); + + if (pthread_sigmask (SIG_UNBLOCK, &ss, NULL) != 0) + { + puts ("pthread_sigmask failed"); + exit (1); + } + + for (i = 0; i < N; ++i) + if (pthread_join (th[i], NULL) != 0) + { + puts ("join failed"); + exit (1); + } + } + + if (pthread_attr_destroy (&a) != 0) + { + puts ("attr_destroy failed"); + exit (1); + } + + return 0; +#endif +} + + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-tls3mod.c b/test/nptl/tst-tls3mod.c new file mode 100644 index 000000000..0fd326162 --- /dev/null +++ b/test/nptl/tst-tls3mod.c @@ -0,0 +1,105 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <semaphore.h> +#include <signal.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <pthreaddef.h> +#include <tls.h> + +#if HAVE___THREAD + +static pthread_barrier_t* b = NULL; + +#define TOTAL_SIGS 1000 +static int* nsigs = NULL; + +static sem_t* s = NULL; + +static __thread void (*fp) (void); + + +#define THE_SIG SIGUSR1 +void +handler (int sig) +{ + if (sig != THE_SIG) + { + write (STDOUT_FILENO, "wrong signal\n", 13); + _exit (1); + } + + fp (); + + if (sem_post (s) != 0) + { + write (STDOUT_FILENO, "sem_post failed\n", 16); + _exit (1); + } +} + +void +setup_tf (pthread_barrier_t* t_b, int* t_nsigs, sem_t* t_s) +{ + b = t_b; + nsigs = t_nsigs; + s = t_s; +} + +void * +tf (void *arg) +{ + if (!b || !s || !nsigs) + { + puts ("need to call setup_tf first"); + exit (1); + } + + if ((uintptr_t) pthread_self () & (TCB_ALIGNMENT - 1)) + { + puts ("thread's struct pthread not aligned enough"); + exit (1); + } + + if (fp != NULL) + { + printf("fp=%p\n", (void *)&fp); + puts ("fp not initially NULL"); + exit (1); + } + + fp = arg; + + pthread_barrier_wait (b); + + pthread_barrier_wait (b); + + if (*nsigs != TOTAL_SIGS) + { + puts ("barrier_wait prematurely returns"); + exit (1); + } + + return NULL; +} + +#endif diff --git a/test/nptl/tst-tls4.c b/test/nptl/tst-tls4.c new file mode 100644 index 000000000..378b13aae --- /dev/null +++ b/test/nptl/tst-tls4.c @@ -0,0 +1,190 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <dlfcn.h> +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <tls.h> + +#if HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE + +#define N 3 + +void (*test1) (void), (*test2) (void); + +pthread_barrier_t b2, b3; + +static void * +tf (void *arg) +{ + int i; + + for (i = 0; i <= (uintptr_t) arg; ++i) + { + int r = pthread_barrier_wait (&b3); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("tf: barrier_wait failed"); + exit (1); + } + } + + test1 (); + + for (i = 0; i < 3; ++i) + { + int r = pthread_barrier_wait (&b3); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("tf: barrier_wait failed"); + exit (1); + } + } + + test2 (); + + for (i = 0; i < 3 - (uintptr_t) arg; ++i) + { + int r = pthread_barrier_wait (&b3); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("tf: barrier_wait failed"); + exit (1); + } + } + + return NULL; +} + +static void * +tf2 (void *arg) +{ + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("tf2: barrier_wait failed"); + exit (1); + } + + int i; + for (i = 0; i < N; ++i) + tf (arg); + return NULL; +} + +int +do_test (void) +{ + pthread_t th[2]; + const char *modules[N] + = { "tst-tls4moda.so", "tst-tls4moda.so", "tst-tls4modb.so" }; + + if (pthread_barrier_init (&b2, NULL, 2) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + if (pthread_barrier_init (&b3, NULL, 3) != 0) + { + puts ("barrier_init failed"); + return 1; + } + + if (pthread_create (&th[0], NULL, tf2, (void *) (uintptr_t) 1)) + { + puts ("pthread_create failed"); + return 1; + } + + int r = pthread_barrier_wait (&b2); + if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD) + { + puts ("barrier_wait failed"); + return 1; + } + + int i; + for (i = 0; i < N; ++i) + { + void *h = dlopen (modules[i], RTLD_LAZY); + if (h == NULL) + { + printf ("dlopen failed %s\n", dlerror ()); + return 1; + } + + test1 = dlsym (h, "test1"); + if (test1 == NULL) + { + printf ("dlsym for test1 failed %s\n", dlerror ()); + return 1; + } + + test2 = dlsym (h, "test2"); + if (test2 == NULL) + { + printf ("dlsym for test2 failed %s\n", dlerror ()); + return 1; + } + + if (pthread_create (&th[1], NULL, tf, (void *) (uintptr_t) 2)) + { + puts ("pthread_create failed"); + return 1; + } + + tf ((void *) (uintptr_t) 0); + + if (pthread_join (th[1], NULL) != 0) + { + puts ("join failed"); + return 1; + } + + if (dlclose (h)) + { + puts ("dlclose failed"); + return 1; + } + + printf ("test %d with %s succeeded\n", i, modules[i]); + } + + if (pthread_join (th[0], NULL) != 0) + { + puts ("join failed"); + return 1; + } + + return 0; +} + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () + +#else + +#define TEST_FUNCTION 0 + +#endif + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-tls4moda.c b/test/nptl/tst-tls4moda.c new file mode 100644 index 000000000..9a59cf7a2 --- /dev/null +++ b/test/nptl/tst-tls4moda.c @@ -0,0 +1,55 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <tls.h> + +#if HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE + +static __thread unsigned char foo [32] + __attribute__ ((tls_model ("initial-exec"), aligned (sizeof (void *)))); + +void +test1 (void) +{ + size_t s; + + for (s = 0; s < sizeof (foo); ++s) + { + if (foo [s]) + abort (); + foo [s] = s; + } +} + +void +test2 (void) +{ + size_t s; + + for (s = 0; s < sizeof (foo); ++s) + { + if (foo [s] != s) + abort (); + foo [s] = sizeof (foo) - s; + } +} + +#endif diff --git a/test/nptl/tst-tls4modb.c b/test/nptl/tst-tls4modb.c new file mode 100644 index 000000000..66044b2ed --- /dev/null +++ b/test/nptl/tst-tls4modb.c @@ -0,0 +1,64 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <tls.h> + +#if HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE + +static int i; +int bar; + +static __thread void *foo [32 / sizeof (void *)] + __attribute__ ((tls_model ("initial-exec"), aligned (sizeof (void *)))) + = { &i, &bar }; + +void +test1 (void) +{ + size_t s; + + if (foo [0] != &i || foo [1] != &bar) + abort (); + + foo [0] = NULL; + foo [1] = NULL; + for (s = 0; s < sizeof (foo) / sizeof (void *); ++s) + { + if (foo [s]) + abort (); + foo [s] = &foo[s]; + } +} + +void +test2 (void) +{ + size_t s; + + for (s = 0; s < sizeof (foo) / sizeof (void *); ++s) + { + if (foo [s] != &foo [s]) + abort (); + foo [s] = &foo [s ^ 1]; + } +} + +#endif diff --git a/test/nptl/tst-tls5.c b/test/nptl/tst-tls5.c new file mode 100644 index 000000000..c8afe6a87 --- /dev/null +++ b/test/nptl/tst-tls5.c @@ -0,0 +1,118 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +/* Check alignment, overlapping and layout of TLS variables. */ +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <pthread.h> +#include <sys/param.h> + +#include "tst-tls5.h" + +#ifdef TLS_REGISTER + +struct tls_obj tls_registry[64]; + +static int +tls_addr_cmp (const void *a, const void *b) +{ + if (((struct tls_obj *)a)->addr < ((struct tls_obj *)b)->addr) + return -1; + if (((struct tls_obj *)a)->addr > ((struct tls_obj *)b)->addr) + return 1; + return 0; +} + +static int +do_test (void) +{ + size_t cnt, i; + int res = 0; + uintptr_t min_addr = ~(uintptr_t) 0, max_addr = 0; + + for (cnt = 0; tls_registry[cnt].name; ++cnt); + tls_registry[cnt].name = NULL; + tls_registry[cnt].addr = (uintptr_t) pthread_self (); + tls_registry[cnt].size = sizeof (struct pthread); + tls_registry[cnt++].align = __alignof__ (struct pthread); + + qsort (tls_registry, cnt, sizeof (struct tls_obj), tls_addr_cmp); + + for (i = 0; i < cnt; ++i) + { + printf ("%s%s = %p, size %zd, align %zd", + tls_registry[i].name ? "&" : "", + tls_registry[i].name ?: "pthread_self ()", + (void *) tls_registry[i].addr, + tls_registry[i].size, tls_registry[i].align); + if (tls_registry[i].addr & (tls_registry[i].align - 1)) + { + fputs (", WRONG ALIGNMENT", stdout); + res = 1; + } + if (i > 0 + && (tls_registry[i - 1].addr + tls_registry[i - 1].size + > tls_registry[i].addr)) + { + fputs (", ADDRESS OVERLAP", stdout); + res = 1; + } + puts (""); + if (tls_registry[i].name) + { + min_addr = MIN (tls_registry[i].addr, min_addr); + max_addr = MAX (tls_registry[i].addr + tls_registry[i].size, + max_addr); + } + } + + if (cnt > 1) + { +#if defined(TLS_TCB_AT_TP) + if (tls_registry[cnt - 1].name) + { + puts ("pthread_self () not larger than all TLS addresses"); + res = 1; + } + else + max_addr = MAX (tls_registry[cnt - 1].addr, max_addr); +#elif defined(TLS_DTV_AT_TP) + if (tls_registry[0].name) + { + puts ("pthread_self () not smaller than all TLS addresses"); + res = 1; + } +#else + abort (); +#endif + printf ("Initial TLS used block size %zd\n", + (size_t) (max_addr - min_addr)); + } + return res; +} + +#define TEST_FUNCTION do_test () + +#else + +#define TEST_FUNCTION 0 + +#endif + +#include "../test-skeleton.c" diff --git a/test/nptl/tst-tls5.h b/test/nptl/tst-tls5.h new file mode 100644 index 000000000..b7c14eb82 --- /dev/null +++ b/test/nptl/tst-tls5.h @@ -0,0 +1,28 @@ +#include <stdint.h> +#include <stdlib.h> +#include <tls.h> + +#if USE_TLS && HAVE___THREAD + +struct tls_obj +{ + const char *name; + uintptr_t addr; + size_t size; + size_t align; +}; +extern struct tls_obj tls_registry[]; + +#define TLS_REGISTER(x) \ +static void __attribute__((constructor)) \ +tls_register_##x (void) \ +{ \ + size_t i; \ + for (i = 0; tls_registry[i].name; ++i); \ + tls_registry[i].name = #x; \ + tls_registry[i].addr = (uintptr_t) &x; \ + tls_registry[i].size = sizeof (x); \ + tls_registry[i].align = __alignof__ (x); \ +} + +#endif diff --git a/test/nptl/tst-tls5mod.c b/test/nptl/tst-tls5mod.c new file mode 100644 index 000000000..4616a20e9 --- /dev/null +++ b/test/nptl/tst-tls5mod.c @@ -0,0 +1,6 @@ +#include "tst-tls5.h" + +#ifdef TLS_REGISTER +/* Ensure tls_registry is exported from the binary. */ +void *tst_tls5mod attribute_hidden = tls_registry; +#endif diff --git a/test/nptl/tst-tls5moda.c b/test/nptl/tst-tls5moda.c new file mode 100644 index 000000000..4644d763a --- /dev/null +++ b/test/nptl/tst-tls5moda.c @@ -0,0 +1,6 @@ +#include "tst-tls5.h" + +#ifdef TLS_REGISTER +static __thread char a [32] __attribute__ ((aligned (64))); +TLS_REGISTER (a) +#endif diff --git a/test/nptl/tst-tls5modb.c b/test/nptl/tst-tls5modb.c new file mode 100644 index 000000000..09b439670 --- /dev/null +++ b/test/nptl/tst-tls5modb.c @@ -0,0 +1,6 @@ +#include "tst-tls5.h" + +#ifdef TLS_REGISTER +static __thread int b; +TLS_REGISTER (b) +#endif diff --git a/test/nptl/tst-tls5modc.c b/test/nptl/tst-tls5modc.c new file mode 100644 index 000000000..bbd89633d --- /dev/null +++ b/test/nptl/tst-tls5modc.c @@ -0,0 +1,6 @@ +#include "tst-tls5.h" + +#ifdef TLS_REGISTER +static __thread int c; +TLS_REGISTER (c) +#endif diff --git a/test/nptl/tst-tls5modd.c b/test/nptl/tst-tls5modd.c new file mode 100644 index 000000000..8b54d168c --- /dev/null +++ b/test/nptl/tst-tls5modd.c @@ -0,0 +1,6 @@ +#include "tst-tls5.h" + +#ifdef TLS_REGISTER +static __thread int d; +TLS_REGISTER (d) +#endif diff --git a/test/nptl/tst-tls5mode.c b/test/nptl/tst-tls5mode.c new file mode 100644 index 000000000..d30b06752 --- /dev/null +++ b/test/nptl/tst-tls5mode.c @@ -0,0 +1,8 @@ +#include "tst-tls5.h" + +#ifdef TLS_REGISTER +static __thread int e1 = 24; +static __thread char e2 [32] __attribute__ ((aligned (64))); +TLS_REGISTER (e1) +TLS_REGISTER (e2) +#endif diff --git a/test/nptl/tst-tls5modf.c b/test/nptl/tst-tls5modf.c new file mode 100644 index 000000000..52dcb9495 --- /dev/null +++ b/test/nptl/tst-tls5modf.c @@ -0,0 +1,9 @@ +#include "tst-tls5.h" + +#ifdef TLS_REGISTER +char tst_tls5modf[60] attribute_hidden = { 26 }; +static __thread int f1 = 24; +static __thread char f2 [32] __attribute__ ((aligned (64))); +TLS_REGISTER (f1) +TLS_REGISTER (f2) +#endif diff --git a/test/nptl/tst-tsd1.c b/test/nptl/tst-tsd1.c new file mode 100644 index 000000000..af46d685b --- /dev/null +++ b/test/nptl/tst-tsd1.c @@ -0,0 +1,117 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <string.h> + + +static int +do_test (void) +{ + pthread_key_t key1; + pthread_key_t key2; + void *value; + int result = 0; + int err; + + err = pthread_key_create (&key1, NULL); + if (err != 0) + { + printf ("1st key_create failed: %s\n", strerror (err)); + return 1; + } + + /* Initial value must be NULL. */ + value = pthread_getspecific (key1); + if (value != NULL) + { + puts ("1st getspecific != NULL"); + result = 1; + } + + err = pthread_setspecific (key1, (void *) -2l); + if (err != 0) + { + printf ("1st setspecific failed: %s\n", strerror (err)); + return 1; + } + + value = pthread_getspecific (key1); + if (value == NULL) + { + puts ("2nd getspecific == NULL\n"); + result = 1; + } + else if (value != (void *) -2l) + { + puts ("2nd getspecific != -2l\n"); + result = 1; + } + + err = pthread_setspecific (key1, (void *) -3l); + if (err != 0) + { + printf ("2nd setspecific failed: %s\n", strerror (err)); + return 1; + } + + value = pthread_getspecific (key1); + if (value == NULL) + { + puts ("3rd getspecific == NULL\n"); + result = 1; + } + else if (value != (void *) -3l) + { + puts ("3rd getspecific != -2l\n"); + result = 1; + } + + err = pthread_key_delete (key1); + if (err != 0) + { + printf ("key_delete failed: %s\n", strerror (err)); + result = 1; + } + + + err = pthread_key_create (&key2, NULL); + if (err != 0) + { + printf ("2nd key_create failed: %s\n", strerror (err)); + return 1; + } + + if (key1 != key2) + puts ("key1 != key2; no more tests performed"); + else + { + value = pthread_getspecific (key2); + if (value != NULL) + { + puts ("4th getspecific != NULL"); + result = 1; + } + } + + return result; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-tsd2.c b/test/nptl/tst-tsd2.c new file mode 100644 index 000000000..71e793fd4 --- /dev/null +++ b/test/nptl/tst-tsd2.c @@ -0,0 +1,96 @@ +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <string.h> + + +static int result; + + +static void +destr (void *arg) +{ + if (arg != (void *) -2l) + result = 2; + else + result = 0; +} + + +static void * +tf (void *arg) +{ + pthread_key_t key = (pthread_key_t) (long int) arg; + int err; + + err = pthread_setspecific (key, (void *) -2l); + if (err != 0) + result = 3; + + return NULL; +} + + +static int +do_test (void) +{ + pthread_key_t key; + pthread_t th; + int err; + + err = pthread_key_create (&key, destr); + if (err != 0) + { + printf ("key_create failed: %s\n", strerror (err)); + return 1; + } + + result = 1; + + err = pthread_create (&th, NULL, tf, (void *) (long int) key); + if (err != 0) + { + printf ("create failed: %s\n", strerror (err)); + return 1; + } + + /* Wait for the thread to terminate. */ + err = pthread_join (th, NULL); + if (err != 0) + { + printf ("join failed: %s\n", strerror (err)); + return 1; + } + + if (result == 1) + puts ("destructor not called"); + else if (result == 2) + puts ("destructor got passed a wrong value"); + else if (result == 3) + puts ("setspecific in child failed"); + else if (result != 0) + puts ("result != 0"); + + return result; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-tsd3.c b/test/nptl/tst-tsd3.c new file mode 100644 index 000000000..4dc46f2a8 --- /dev/null +++ b/test/nptl/tst-tsd3.c @@ -0,0 +1,128 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <limits.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static pthread_key_t key1; +static pthread_key_t key2; + + +static int left; + + +static void +destr1 (void *arg) +{ + if (--left > 0) + { + puts ("set key2"); + + if (pthread_setspecific (key2, (void *) 1l) != 0) + { + puts ("destr1: setspecific failed"); + exit (1); + } + } +} + + +static void +destr2 (void *arg) +{ + if (--left > 0) + { + puts ("set key1"); + + if (pthread_setspecific (key1, (void *) 1l) != 0) + { + puts ("destr2: setspecific failed"); + exit (1); + } + } +} + + +static void * +tf (void *arg) +{ + /* Let the destructors work. */ + left = 7; + + if (pthread_setspecific (key1, (void *) 1l) != 0 + || pthread_setspecific (key2, (void *) 1l) != 0) + { + puts ("tf: setspecific failed"); + exit (1); + } + + return NULL; +} + + +static int +do_test (void) +{ + /* Allocate two keys, both with destructors. */ + if (pthread_key_create (&key1, destr1) != 0 + || pthread_key_create (&key2, destr2) != 0) + { + puts ("key_create failed"); + return 1; + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + if (pthread_join (th, NULL) != 0) + { + puts ("join failed"); + return 1; + } + + if (left != 0) + { + printf ("left == %d\n", left); + return 1; + } + + if (pthread_getspecific (key1) != NULL) + { + puts ("key1 data != NULL"); + return 1; + } + if (pthread_getspecific (key2) != NULL) + { + puts ("key2 data != NULL"); + return 1; + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-tsd4.c b/test/nptl/tst-tsd4.c new file mode 100644 index 000000000..cf58d8581 --- /dev/null +++ b/test/nptl/tst-tsd4.c @@ -0,0 +1,102 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <limits.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + + +static pthread_key_t key; + + +static int rounds; + + +static void +destr (void *arg) +{ + ++rounds; + + if (pthread_setspecific (key, (void *) 1l) != 0) + { + puts ("destr: setspecific failed"); + exit (1); + } +} + + +static void * +tf (void *arg) +{ + if (pthread_setspecific (key, (void *) 1l) != 0) + { + puts ("tf: setspecific failed"); + exit (1); + } + + return NULL; +} + + +/* This test check non-standard behavior. The standard does not + require that the implementation has to stop calling TSD destructors + when they are set over and over again. But NPTL does. */ +static int +do_test (void) +{ + /* Allocate two keys, both with destructors. */ + if (pthread_key_create (&key, destr) != 0) + { + puts ("key_create failed"); + return 1; + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + if (pthread_join (th, NULL) != 0) + { + puts ("join failed"); + return 1; + } + + if (rounds < PTHREAD_DESTRUCTOR_ITERATIONS) + { + printf ("rounds == %d, PTHREAD_DESTRUCTOR_ITERATIONS = %d\n", + rounds, PTHREAD_DESTRUCTOR_ITERATIONS); + return 1; + } + + if (pthread_getspecific (key) != NULL) + { + puts ("key data != NULL"); + return 1; + } + + return 0; +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-tsd5.c b/test/nptl/tst-tsd5.c new file mode 100644 index 000000000..8fc7b35ef --- /dev/null +++ b/test/nptl/tst-tsd5.c @@ -0,0 +1,80 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> + + +static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; + + +static void +cl (void *p) +{ + pthread_mutex_unlock (&m); +} + + +static void * +tf (void *arg) +{ + if (pthread_mutex_lock (&m) != 0) + { + puts ("2nd mutex_lock failed"); + exit (1); + } + + exit (0); +} + + +static int +do_test (void) +{ + pthread_key_t k; + if (pthread_key_create (&k, cl) != 0) + { + puts ("key_create failed"); + return 1; + } + if (pthread_setspecific (k, (void *) 1) != 0) + { + puts ("setspecific failed"); + return 1; + } + + if (pthread_mutex_lock (&m) != 0) + { + puts ("1st mutex_lock failed"); + return 1; + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("create failed"); + return 1; + } + + pthread_exit (NULL); +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-tsd6.c b/test/nptl/tst-tsd6.c new file mode 100644 index 000000000..debb1dd36 --- /dev/null +++ b/test/nptl/tst-tsd6.c @@ -0,0 +1,89 @@ +#include <errno.h> +#include <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/wait.h> + +#define NKEYS 100 +static pthread_key_t keys[NKEYS]; +static pthread_barrier_t b; + + +static void * +tf (void *arg) +{ + void *res = NULL; + for (int i = 0; i < NKEYS; ++i) + { + void *p = pthread_getspecific (keys[i]); + pthread_setspecific (keys[i], (void *) 7); + if (p != NULL) + res = p; + } + if (arg != NULL) + { + pthread_barrier_wait (arg); + pthread_barrier_wait (arg); + } + return res; +} + + +static int +do_test (void) +{ + pthread_barrier_init (&b, NULL, 2); + + for (int i = 0; i < NKEYS; ++i) + if (pthread_key_create (&keys[i], NULL) != 0) + { + puts ("cannot create keys"); + return 1; + } + + pthread_t th; + if (pthread_create (&th, NULL, tf, &b) != 0) + { + puts ("cannot create thread in parent"); + return 1; + } + + pthread_barrier_wait (&b); + + pid_t pid = fork (); + if (pid == 0) + { + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("cannot create thread in child"); + exit (1); + } + + void *res; + pthread_join (th, &res); + + exit (res != NULL); + } + else if (pid == -1) + { + puts ("cannot create child process"); + return 1; + } + + int s; + if (TEMP_FAILURE_RETRY (waitpid (pid, &s, 0)) != pid) + { + puts ("failing to wait for child process"); + return 1; + } + + pthread_barrier_wait (&b); + pthread_join (th, NULL); + + return !WIFEXITED (s) ? 2 : WEXITSTATUS (s); +} + + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-typesizes.c b/test/nptl/tst-typesizes.c new file mode 100644 index 000000000..59e948527 --- /dev/null +++ b/test/nptl/tst-typesizes.c @@ -0,0 +1,95 @@ +/* Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@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, see + <http://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <pthreadP.h> +#include <semaphore.h> + +static const struct +{ + const char *name; + size_t expected; + size_t is; +} types[] = + { +#define T(t, c) \ + { #t, c, sizeof (t) } + T (pthread_attr_t, __SIZEOF_PTHREAD_ATTR_T), + T (pthread_mutex_t, __SIZEOF_PTHREAD_MUTEX_T), + T (pthread_mutexattr_t, __SIZEOF_PTHREAD_MUTEXATTR_T), + T (pthread_cond_t, __SIZEOF_PTHREAD_COND_T), + T (pthread_condattr_t, __SIZEOF_PTHREAD_CONDATTR_T), + T (pthread_rwlock_t, __SIZEOF_PTHREAD_RWLOCK_T), + T (pthread_rwlockattr_t, __SIZEOF_PTHREAD_RWLOCKATTR_T), + T (pthread_barrier_t, __SIZEOF_PTHREAD_BARRIER_T), + T (pthread_barrierattr_t, __SIZEOF_PTHREAD_BARRIERATTR_T) + }; + +static int +do_test (void) +{ + int result = 0; + +#define TEST_TYPE(name) \ + printf ("%s: ", #name); \ + if (sizeof (name) != sizeof (((name *) 0)->__size)) \ + { \ + printf ("expected %zu, is %zu\n", \ + sizeof (((name *) 0)->__size), sizeof (name)); \ + result = 1; \ + } \ + else \ + puts ("OK") + + TEST_TYPE (pthread_mutex_t); + TEST_TYPE (pthread_cond_t); + TEST_TYPE (pthread_rwlock_t); + +#define TEST_TYPE2(name, internal) \ + printf ("%s: ", #name); \ + if (sizeof (((name *) 0)->__size) < sizeof (internal)) \ + { \ + printf ("expected %zu, is %zu\n", \ + sizeof (((name *) 0)->__size), sizeof (internal)); \ + result = 1; \ + } \ + else \ + puts ("OK") + + TEST_TYPE2 (pthread_attr_t, struct pthread_attr); + TEST_TYPE2 (pthread_mutexattr_t, struct pthread_mutexattr); + TEST_TYPE2 (pthread_condattr_t, struct pthread_condattr); + TEST_TYPE2 (pthread_rwlockattr_t, struct pthread_rwlockattr); + TEST_TYPE2 (pthread_barrier_t, struct pthread_barrier); + TEST_TYPE2 (pthread_barrierattr_t, struct pthread_barrierattr); + TEST_TYPE2 (sem_t, struct new_sem); + TEST_TYPE2 (sem_t, struct old_sem); + + for (size_t i = 0; i < sizeof (types) / sizeof (types[0]); ++i) + if (types[i].expected != types[i].is) + { + printf ("%s: expected %zu, is %zu\n", + types[i].name, types[i].expected, types[i].is); + result = 1; + } + + return result; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-umask1.c b/test/nptl/tst-umask1.c new file mode 100644 index 000000000..65b4df35b --- /dev/null +++ b/test/nptl/tst-umask1.c @@ -0,0 +1,136 @@ +/* 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, see + <http://www.gnu.org/licenses/>. */ + +#include <fcntl.h> +#include <pthread.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/stat.h> + + +static struct +{ + int (*fp) (const char *, mode_t); + const char *name; + bool is_fd; +} fcts[] = +{ + { creat, "creat", true }, + { mkdir, "mkdir", false }, + { mkfifo, "mkfifo", false }, +}; +#define nfcts (sizeof (fcts) / sizeof (fcts[0])) + + +static int +work (const char *fname, int mask) +{ + int result = 0; + size_t i; + for (i = 0; i < nfcts; ++i) + { + remove (fname); + int fd = fcts[i].fp (fname, 0777); + if (fd == -1) + { + printf ("cannot %s %s: %m\n", fcts[i].name, fname); + exit (1); + } + if (fcts[i].is_fd) + close (fd); + struct stat st; + if (stat (fname, &st) == -1) + { + printf ("cannot stat %s after %s: %m\n", fname, fcts[i].name); + exit (1); + } + + if ((st.st_mode & mask) != 0) + { + printf ("mask not successful after %s: %x still set\n", + fcts[i].name, (unsigned int) (st.st_mode & mask)); + result = 1; + } + } + + return result; +} + + +static pthread_barrier_t bar; + + +static void * +tf (void *arg) +{ + pthread_barrier_wait (&bar); + + int result = work (arg, 022); + + pthread_barrier_wait (&bar); + + pthread_barrier_wait (&bar); + + return (work (arg, 0) | result) ? (void *) -1l : NULL; +} + + +static int +do_test (const char *fname) +{ + int result = 0; + + umask (0); + result |= work (fname, 0); + + pthread_barrier_init (&bar, NULL, 2); + + pthread_t th; + if (pthread_create (&th, NULL, tf, (void *) fname) != 0) + { + puts ("cannot create thread"); + exit (1); + } + + umask (022); + result |= work (fname, 022); + + pthread_barrier_wait (&bar); + + pthread_barrier_wait (&bar); + + umask (0); + + pthread_barrier_wait (&bar); + + void *res; + if (pthread_join (th, &res) != 0) + { + puts ("join failed"); + exit (1); + } + + remove (fname); + + return result || res != NULL; +} + +#define TEST_FUNCTION do_test (argc < 2 ? "/tmp/tst-umask.tmp" : argv[1]) +#include "../test-skeleton.c" diff --git a/test/nptl/tst-unload.c b/test/nptl/tst-unload.c new file mode 100644 index 000000000..74a714ecb --- /dev/null +++ b/test/nptl/tst-unload.c @@ -0,0 +1,46 @@ +/* Tests for non-unloading of libpthread. + Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc. + 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; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +static int +do_test (void) +{ + void *p = dlopen ("libpthread.so.1", RTLD_LAZY); + + if (p == NULL) + { + puts ("failed to load libpthread.so.1"); + return 1; + } + + if (dlclose (p) != 0) + { + puts ("dlclose (libpthread.so.1) failed"); + return 1; + } + + puts ("seems to work"); + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-vfork1.c b/test/nptl/tst-vfork1.c new file mode 100644 index 000000000..b3c9d207d --- /dev/null +++ b/test/nptl/tst-vfork1.c @@ -0,0 +1,149 @@ +/* Test for vfork functions. + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/wait.h> + +/* This test relies on non-POSIX functionality since the child + processes call write and getpid. */ +static int +do_test (void) +{ + int result = 0; + int fd[2]; + + if (pipe (fd) == -1) + { + puts ("pipe failed"); + return 1; + } + + /* First vfork() without previous getpid(). */ + pid_t p1; + if ((p1 = vfork ()) == 0) + { + pid_t p = getpid (); + _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p)); + } + else if (p1 == -1) + { + puts ("1st vfork failed"); + result = 1; + } + + pid_t p2 = 0; + if (TEMP_FAILURE_RETRY (read (fd[0], &p2, sizeof (pid_t))) != sizeof (pid_t)) + { + puts ("1st read failed"); + result = 1; + } + int r; + if (TEMP_FAILURE_RETRY (waitpid (p1, &r, 0)) != p1) + { + puts ("1st waitpid failed"); + result = 1; + } + else if (r != 0) + { + puts ("write in 1st child failed"); + result = 1; + } + + /* Main process' ID. */ + pid_t p0 = getpid (); + + /* vfork() again, but after a getpid() in the main process. */ + pid_t p3; + if ((p3 = vfork ()) == 0) + { + pid_t p = getpid (); + _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p)); + } + else if (p1 == -1) + { + puts ("2nd vfork failed"); + result = 1; + } + + pid_t p4; + if (TEMP_FAILURE_RETRY (read (fd[0], &p4, sizeof (pid_t))) != sizeof (pid_t)) + { + puts ("2nd read failed"); + result = 1; + } + if (TEMP_FAILURE_RETRY (waitpid (p3, &r, 0)) != p3) + { + puts ("2nd waitpid failed"); + result = 1; + } + else if (r != 0) + { + puts ("write in 2nd child failed"); + result = 1; + } + + /* And getpid in the main process again. */ + pid_t p5 = getpid (); + + /* Analysis of the results. */ + if (p0 != p5) + { + printf ("p0(%ld) != p5(%ld)\n", (long int) p0, (long int) p5); + result = 1; + } + + if (p0 == p1) + { + printf ("p0(%ld) == p1(%ld)\n", (long int) p0, (long int) p1); + result = 1; + } + + if (p1 != p2) + { + printf ("p1(%ld) != p2(%ld)\n", (long int) p1, (long int) p2); + result = 1; + } + + if (p0 == p3) + { + printf ("p0(%ld) == p3(%ld)\n", (long int) p0, (long int) p3); + result = 1; + } + + if (p3 != p4) + { + printf ("p3(%ld) != p4(%ld)\n", (long int) p3, (long int) p4); + result = 1; + } + + close (fd[0]); + close (fd[1]); + + if (result == 0) + puts ("All OK"); + + return result; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-vfork1x.c b/test/nptl/tst-vfork1x.c new file mode 100644 index 000000000..b3c9d207d --- /dev/null +++ b/test/nptl/tst-vfork1x.c @@ -0,0 +1,149 @@ +/* Test for vfork functions. + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/wait.h> + +/* This test relies on non-POSIX functionality since the child + processes call write and getpid. */ +static int +do_test (void) +{ + int result = 0; + int fd[2]; + + if (pipe (fd) == -1) + { + puts ("pipe failed"); + return 1; + } + + /* First vfork() without previous getpid(). */ + pid_t p1; + if ((p1 = vfork ()) == 0) + { + pid_t p = getpid (); + _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p)); + } + else if (p1 == -1) + { + puts ("1st vfork failed"); + result = 1; + } + + pid_t p2 = 0; + if (TEMP_FAILURE_RETRY (read (fd[0], &p2, sizeof (pid_t))) != sizeof (pid_t)) + { + puts ("1st read failed"); + result = 1; + } + int r; + if (TEMP_FAILURE_RETRY (waitpid (p1, &r, 0)) != p1) + { + puts ("1st waitpid failed"); + result = 1; + } + else if (r != 0) + { + puts ("write in 1st child failed"); + result = 1; + } + + /* Main process' ID. */ + pid_t p0 = getpid (); + + /* vfork() again, but after a getpid() in the main process. */ + pid_t p3; + if ((p3 = vfork ()) == 0) + { + pid_t p = getpid (); + _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p)); + } + else if (p1 == -1) + { + puts ("2nd vfork failed"); + result = 1; + } + + pid_t p4; + if (TEMP_FAILURE_RETRY (read (fd[0], &p4, sizeof (pid_t))) != sizeof (pid_t)) + { + puts ("2nd read failed"); + result = 1; + } + if (TEMP_FAILURE_RETRY (waitpid (p3, &r, 0)) != p3) + { + puts ("2nd waitpid failed"); + result = 1; + } + else if (r != 0) + { + puts ("write in 2nd child failed"); + result = 1; + } + + /* And getpid in the main process again. */ + pid_t p5 = getpid (); + + /* Analysis of the results. */ + if (p0 != p5) + { + printf ("p0(%ld) != p5(%ld)\n", (long int) p0, (long int) p5); + result = 1; + } + + if (p0 == p1) + { + printf ("p0(%ld) == p1(%ld)\n", (long int) p0, (long int) p1); + result = 1; + } + + if (p1 != p2) + { + printf ("p1(%ld) != p2(%ld)\n", (long int) p1, (long int) p2); + result = 1; + } + + if (p0 == p3) + { + printf ("p0(%ld) == p3(%ld)\n", (long int) p0, (long int) p3); + result = 1; + } + + if (p3 != p4) + { + printf ("p3(%ld) != p4(%ld)\n", (long int) p3, (long int) p4); + result = 1; + } + + close (fd[0]); + close (fd[1]); + + if (result == 0) + puts ("All OK"); + + return result; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-vfork2.c b/test/nptl/tst-vfork2.c new file mode 100644 index 000000000..6b2d98bac --- /dev/null +++ b/test/nptl/tst-vfork2.c @@ -0,0 +1,198 @@ +/* Test for vfork functions. + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <unistd.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/wait.h> + +int raise_fail; + +static void +alrm (int sig) +{ + if (raise (SIGUSR1) < 0) + raise_fail = 1; +} + +/* This test relies on non-POSIX functionality since the child + processes call write, nanosleep and getpid. */ +static int +do_test (void) +{ + int result = 0; + int fd[2]; + + signal (SIGUSR1, SIG_IGN); + + struct sigaction sa; + sa.sa_handler = alrm; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + if (sigaction (SIGALRM, &sa, NULL) < 0) + { + puts ("couldn't set up SIGALRM handler"); + return 1; + } + + if (pipe (fd) == -1) + { + puts ("pipe failed"); + return 1; + } + + struct itimerval it; + it.it_value.tv_sec = 0; + it.it_value.tv_usec = 200 * 1000; + it.it_interval = it.it_value; + if (setitimer (ITIMER_REAL, &it, NULL) < 0) + { + puts ("couldn't set up timer"); + return 1; + } + + /* First vfork() without previous getpid(). */ + pid_t p1; + if ((p1 = vfork ()) == 0) + { + pid_t p = getpid (); + + struct timespec ts; + ts.tv_sec = 1; + ts.tv_nsec = 0; + TEMP_FAILURE_RETRY (nanosleep (&ts, &ts)); + _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p)); + } + else if (p1 == -1) + { + puts ("1st vfork failed"); + result = 1; + } + + memset (&it, 0, sizeof (it)); + setitimer (ITIMER_REAL, &it, NULL); + + pid_t p2 = 0; + if (TEMP_FAILURE_RETRY (read (fd[0], &p2, sizeof (pid_t))) != sizeof (pid_t)) + { + puts ("1st read failed"); + result = 1; + } + int r; + if (TEMP_FAILURE_RETRY (waitpid (p1, &r, 0)) != p1) + { + puts ("1st waitpid failed"); + result = 1; + } + else if (r != 0) + { + puts ("write in 1st child failed"); + result = 1; + } + + /* Main process' ID. */ + pid_t p0 = getpid (); + + /* vfork() again, but after a getpid() in the main process. */ + pid_t p3; + if ((p3 = vfork ()) == 0) + { + pid_t p = getpid (); + _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p)); + } + else if (p1 == -1) + { + puts ("2nd vfork failed"); + result = 1; + } + + pid_t p4; + if (TEMP_FAILURE_RETRY (read (fd[0], &p4, sizeof (pid_t))) != sizeof (pid_t)) + { + puts ("2nd read failed"); + result = 1; + } + if (TEMP_FAILURE_RETRY (waitpid (p3, &r, 0)) != p3) + { + puts ("2nd waitpid failed"); + result = 1; + } + else if (r != 0) + { + puts ("write in 2nd child failed"); + result = 1; + } + + /* And getpid in the main process again. */ + pid_t p5 = getpid (); + + /* Analysis of the results. */ + if (p0 != p5) + { + printf ("p0(%ld) != p5(%ld)\n", (long int) p0, (long int) p5); + result = 1; + } + + if (p0 == p1) + { + printf ("p0(%ld) == p1(%ld)\n", (long int) p0, (long int) p1); + result = 1; + } + + if (p1 != p2) + { + printf ("p1(%ld) != p2(%ld)\n", (long int) p1, (long int) p2); + result = 1; + } + + if (p0 == p3) + { + printf ("p0(%ld) == p3(%ld)\n", (long int) p0, (long int) p3); + result = 1; + } + + if (p3 != p4) + { + printf ("p3(%ld) != p4(%ld)\n", (long int) p3, (long int) p4); + result = 1; + } + + close (fd[0]); + close (fd[1]); + + if (raise_fail) + { + puts ("raise failed"); + result = 1; + } + + if (result == 0) + puts ("All OK"); + + return result; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/nptl/tst-vfork2x.c b/test/nptl/tst-vfork2x.c new file mode 100644 index 000000000..6b2d98bac --- /dev/null +++ b/test/nptl/tst-vfork2x.c @@ -0,0 +1,198 @@ +/* Test for vfork functions. + 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <signal.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <unistd.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/wait.h> + +int raise_fail; + +static void +alrm (int sig) +{ + if (raise (SIGUSR1) < 0) + raise_fail = 1; +} + +/* This test relies on non-POSIX functionality since the child + processes call write, nanosleep and getpid. */ +static int +do_test (void) +{ + int result = 0; + int fd[2]; + + signal (SIGUSR1, SIG_IGN); + + struct sigaction sa; + sa.sa_handler = alrm; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + if (sigaction (SIGALRM, &sa, NULL) < 0) + { + puts ("couldn't set up SIGALRM handler"); + return 1; + } + + if (pipe (fd) == -1) + { + puts ("pipe failed"); + return 1; + } + + struct itimerval it; + it.it_value.tv_sec = 0; + it.it_value.tv_usec = 200 * 1000; + it.it_interval = it.it_value; + if (setitimer (ITIMER_REAL, &it, NULL) < 0) + { + puts ("couldn't set up timer"); + return 1; + } + + /* First vfork() without previous getpid(). */ + pid_t p1; + if ((p1 = vfork ()) == 0) + { + pid_t p = getpid (); + + struct timespec ts; + ts.tv_sec = 1; + ts.tv_nsec = 0; + TEMP_FAILURE_RETRY (nanosleep (&ts, &ts)); + _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p)); + } + else if (p1 == -1) + { + puts ("1st vfork failed"); + result = 1; + } + + memset (&it, 0, sizeof (it)); + setitimer (ITIMER_REAL, &it, NULL); + + pid_t p2 = 0; + if (TEMP_FAILURE_RETRY (read (fd[0], &p2, sizeof (pid_t))) != sizeof (pid_t)) + { + puts ("1st read failed"); + result = 1; + } + int r; + if (TEMP_FAILURE_RETRY (waitpid (p1, &r, 0)) != p1) + { + puts ("1st waitpid failed"); + result = 1; + } + else if (r != 0) + { + puts ("write in 1st child failed"); + result = 1; + } + + /* Main process' ID. */ + pid_t p0 = getpid (); + + /* vfork() again, but after a getpid() in the main process. */ + pid_t p3; + if ((p3 = vfork ()) == 0) + { + pid_t p = getpid (); + _exit (TEMP_FAILURE_RETRY (write (fd[1], &p, sizeof (p))) != sizeof (p)); + } + else if (p1 == -1) + { + puts ("2nd vfork failed"); + result = 1; + } + + pid_t p4; + if (TEMP_FAILURE_RETRY (read (fd[0], &p4, sizeof (pid_t))) != sizeof (pid_t)) + { + puts ("2nd read failed"); + result = 1; + } + if (TEMP_FAILURE_RETRY (waitpid (p3, &r, 0)) != p3) + { + puts ("2nd waitpid failed"); + result = 1; + } + else if (r != 0) + { + puts ("write in 2nd child failed"); + result = 1; + } + + /* And getpid in the main process again. */ + pid_t p5 = getpid (); + + /* Analysis of the results. */ + if (p0 != p5) + { + printf ("p0(%ld) != p5(%ld)\n", (long int) p0, (long int) p5); + result = 1; + } + + if (p0 == p1) + { + printf ("p0(%ld) == p1(%ld)\n", (long int) p0, (long int) p1); + result = 1; + } + + if (p1 != p2) + { + printf ("p1(%ld) != p2(%ld)\n", (long int) p1, (long int) p2); + result = 1; + } + + if (p0 == p3) + { + printf ("p0(%ld) == p3(%ld)\n", (long int) p0, (long int) p3); + result = 1; + } + + if (p3 != p4) + { + printf ("p3(%ld) != p4(%ld)\n", (long int) p3, (long int) p4); + result = 1; + } + + close (fd[0]); + close (fd[1]); + + if (raise_fail) + { + puts ("raise failed"); + result = 1; + } + + if (result == 0) + puts ("All OK"); + + return result; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/plt/check-plt.sh b/test/plt/check-plt.sh new file mode 100755 index 000000000..bedc8fd35 --- /dev/null +++ b/test/plt/check-plt.sh @@ -0,0 +1,38 @@ +#!/bin/sh +allowed=" +calloc +free +malloc +memalign +realloc +" + +${OBJDUMP:-objdump} -d ${top_builddir:-../..}/lib/libc.so.? | \ +gawk -v allowed="${allowed}" ' +BEGIN { + COUNT = split(" " allowed, ALLOWED); +} + +# Strip away the noise. The name will be like: +# <brk>: +# <foo@plt> +function symstrip(name) { + return gensub(/.*<([^>@]*).*/, "\\1", "", name); +} + +{ +# Match the start of the symbol disassembly +# 00009720 <brk>: +if ($2 ~ />:$/) { + f = symstrip($2); + +} else if ($NF ~ /@plt>/) { + rf = symstrip($NF); + for (a in ALLOWED) { + a = ALLOWED[a]; + if (a == rf) + next; + } + print "Func " f " references " rf; +} +}' | sort -u diff --git a/test/pthread/Makefile b/test/pthread/Makefile index ef924ad1a..97ebee894 100644 --- a/test/pthread/Makefile +++ b/test/pthread/Makefile @@ -1,8 +1,8 @@ # uClibc pthread tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -EXTRA_LDFLAGS := -lpthread - -LDFLAGS_cancellation-points := -lrt diff --git a/test/pthread/Makefile.in b/test/pthread/Makefile.in new file mode 100644 index 000000000..c50748d69 --- /dev/null +++ b/test/pthread/Makefile.in @@ -0,0 +1,8 @@ +# uClibc pthread tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +TESTS_DISABLED += cancellation-points + +EXTRA_LDFLAGS := -lpthread + +LDFLAGS_cancellation-points := -lrt diff --git a/test/pthread/cancellation-points.c b/test/pthread/cancellation-points.c index 3fe49fcaa..5453060f7 100644 --- a/test/pthread/cancellation-points.c +++ b/test/pthread/cancellation-points.c @@ -29,12 +29,12 @@ /* take care of optional things ... */ #define STUB(func, args) static void func args { sleep(0); } -#if !defined(__UCLIBC__) || defined(__UCLIBC_AIO__) +#if defined(__UCLIBC_AIO__) # include <aio.h> #else STUB(aio_suspend, (void *p, int n, const void *p2)) #endif -#if !defined(__UCLIBC__) || defined(__UCLIBC_STROPTS__) +#if defined(__UCLIBC_STROPTS__) # include <stropts.h> #else STUB(getmsg, (int f, void *p, void *p2, void *p3)) @@ -141,7 +141,9 @@ MAKE_CANCEL_THREAD_FUNC_EX(sem_wait, (&sem), help_sem_setup()) MAKE_CANCEL_THREAD_FUNC(send, (-1, NULL, 0, 0)) MAKE_CANCEL_THREAD_FUNC(sendmsg, (-1, NULL, 0)) MAKE_CANCEL_THREAD_FUNC(sendto, (-1, NULL, 0, 0, NULL, 0)) +#ifdef __UCLIBC_SUSV4_LEGACY__ MAKE_CANCEL_THREAD_FUNC(sigpause, (0)) +#endif MAKE_CANCEL_THREAD_FUNC(sigsuspend, (NULL)) MAKE_CANCEL_THREAD_FUNC(sigtimedwait, (NULL, NULL, NULL)) MAKE_CANCEL_THREAD_FUNC(sigwait, (NULL, NULL)) @@ -149,7 +151,9 @@ MAKE_CANCEL_THREAD_FUNC(sigwaitinfo, (NULL, NULL)) MAKE_CANCEL_THREAD_FUNC(sleep, (0)) MAKE_CANCEL_THREAD_FUNC(system, ("")) MAKE_CANCEL_THREAD_FUNC(tcdrain, (-1)) +#ifdef __UCLIBC_SUSV3_LEGACY__ MAKE_CANCEL_THREAD_FUNC(usleep, (0)) +#endif MAKE_CANCEL_THREAD_FUNC(wait, (NULL)) MAKE_CANCEL_THREAD_FUNC(waitid, (0, 0, NULL, 0)) MAKE_CANCEL_THREAD_FUNC(waitpid, (-1, NULL, 0)) @@ -264,7 +268,9 @@ int main(int argc, char *argv[]) ret += TEST_FUNC(sleep); ret += TEST_FUNC(system); ret += TEST_FUNC(tcdrain); +#ifdef __UCLIBC_SUSV3_LEGACY__ ret += TEST_FUNC(usleep); +#endif ret += TEST_FUNC(wait); ret += TEST_FUNC(waitid); ret += TEST_FUNC(waitpid); diff --git a/test/pthread/ex6.c b/test/pthread/ex6.c index bb96ca5fa..ffb628771 100644 --- a/test/pthread/ex6.c +++ b/test/pthread/ex6.c @@ -2,7 +2,7 @@ #include <stdio.h> #include <string.h> #include <pthread.h> -#include <unistd.h> +#include <time.h> static void * test_thread (void *v_param) @@ -14,6 +14,9 @@ int main (void) { unsigned long count; + struct timespec ts; + ts.tv_sec = 0; + ts.tv_nsec = 10 * 1000; setvbuf (stdout, NULL, _IONBF, 0); @@ -35,7 +38,7 @@ main (void) } /* pthread_detach (thread); */ pthread_join (thread, NULL); - usleep (10); + nanosleep (&ts, NULL); } return 0; } diff --git a/test/pthread/ex7.c b/test/pthread/ex7.c index 49af18d96..8eeb9a2e5 100644 --- a/test/pthread/ex7.c +++ b/test/pthread/ex7.c @@ -8,7 +8,7 @@ #include <string.h> #include <pthread.h> #include <sys/time.h> -#include <unistd.h> +#include <time.h> /* Our event variable using a condition variable contruct. */ typedef struct { @@ -63,6 +63,9 @@ int main (void) { unsigned long count; + struct timespec ts; + ts.tv_sec = 0; + ts.tv_nsec = 10 * 1000; setvbuf (stdout, NULL, _IONBF, 0); @@ -96,7 +99,7 @@ main (void) printf ("count = %lu\n", count); } - usleep (10); + nanosleep (&ts, NULL); } return 0; diff --git a/test/pthread/tst-join2.c b/test/pthread/tst-join2.c new file mode 100644 index 000000000..2cfab8b0e --- /dev/null +++ b/test/pthread/tst-join2.c @@ -0,0 +1,104 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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 <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + + +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + + +static void * +tf (void *arg) +{ + if (pthread_mutex_lock (&lock) != 0) + { + puts ("child: mutex_lock failed"); + return NULL; + } + + return (void *) 42l; +} + + +static int +do_test (void) +{ + pthread_t th; + + if (pthread_mutex_lock (&lock) != 0) + { + puts ("mutex_lock failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("mutex_create failed"); + exit (1); + } + + void *status; + int val = pthread_tryjoin_np (th, &status); + if (val == 0) + { + puts ("1st tryjoin succeeded"); + exit (1); + } + else if (val != EBUSY) + { + puts ("1st tryjoin didn't return EBUSY"); + exit (1); + } + + if (pthread_mutex_unlock (&lock) != 0) + { + puts ("mutex_unlock failed"); + exit (1); + } + + while ((val = pthread_tryjoin_np (th, &status)) != 0) + { + if (val != EBUSY) + { + printf ("tryjoin returned %s (%d), expected only 0 or EBUSY\n", + strerror (val), val); + exit (1); + } + + /* Delay minimally. */ + struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 }; + nanosleep (&ts, NULL); + } + + if (status != (void *) 42l) + { + printf ("return value %p, expected %p\n", status, (void *) 42l); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/pthread/tst-join3.c b/test/pthread/tst-join3.c new file mode 100644 index 000000000..df1135fb5 --- /dev/null +++ b/test/pthread/tst-join3.c @@ -0,0 +1,123 @@ +/* Copyright (C) 2002 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. + + 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 <pthread.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/time.h> + + +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + + +static void * +tf (void *arg) +{ + if (pthread_mutex_lock (&lock) != 0) + { + puts ("child: mutex_lock failed"); + return NULL; + } + + return (void *) 42l; +} + + +static int +do_test (void) +{ + pthread_t th; + + if (pthread_mutex_lock (&lock) != 0) + { + puts ("mutex_lock failed"); + exit (1); + } + + if (pthread_create (&th, NULL, tf, NULL) != 0) + { + puts ("mutex_create failed"); + exit (1); + } + + void *status; + struct timespec ts; + struct timeval tv; + (void) gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_nsec += 200000000; + if (ts.tv_nsec >= 1000000000) + { + ts.tv_nsec -= 1000000000; + ++ts.tv_sec; + } + int val = pthread_timedjoin_np (th, &status, &ts); + if (val == 0) + { + puts ("1st timedjoin succeeded"); + exit (1); + } + else if (val != ETIMEDOUT) + { + puts ("1st timedjoin didn't return ETIMEDOUT"); + exit (1); + } + + if (pthread_mutex_unlock (&lock) != 0) + { + puts ("mutex_unlock failed"); + exit (1); + } + + while (1) + { + (void) gettimeofday (&tv, NULL); + TIMEVAL_TO_TIMESPEC (&tv, &ts); + ts.tv_nsec += 200000000; + if (ts.tv_nsec >= 1000000000) + { + ts.tv_nsec -= 1000000000; + ++ts.tv_sec; + } + + val = pthread_timedjoin_np (th, &status, &ts); + if (val == 0) + break; + + if (val != ETIMEDOUT) + { + printf ("timedjoin returned %s (%d), expected only 0 or ETIMEDOUT\n", + strerror (val), val); + exit (1); + } + } + + if (status != (void *) 42l) + { + printf ("return value %p, expected %p\n", status, (void *) 42l); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/pwd_grp/Makefile b/test/pwd_grp/Makefile index e6362d352..fa2aacb8e 100644 --- a/test/pwd_grp/Makefile +++ b/test/pwd_grp/Makefile @@ -1,10 +1,8 @@ # uClibc pwd_grp tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -DODIFF_test_pwd := 1 -DODIFF_test_grp := 1 -DODIFF_pwcat := 1 -DODIFF_grcat := 1 -DODIFF_getgroups := 1 diff --git a/test/pwd_grp/Makefile.in b/test/pwd_grp/Makefile.in new file mode 100644 index 000000000..d561f3dcc --- /dev/null +++ b/test/pwd_grp/Makefile.in @@ -0,0 +1,8 @@ +# uClibc pwd_grp tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +DODIFF_test_pwd := 1 +DODIFF_test_grp := 1 +DODIFF_pwcat := 1 +DODIFF_grcat := 1 +DODIFF_getgroups := 1 diff --git a/test/pwd_grp/getgroups.c b/test/pwd_grp/getgroups.c index 0c093081a..c34355215 100644 --- a/test/pwd_grp/getgroups.c +++ b/test/pwd_grp/getgroups.c @@ -13,7 +13,6 @@ #include <sys/types.h> #include <pwd.h> #include <grp.h> -#include <err.h> /* The number of errors encountered so far. */ static int problems = 0; @@ -25,7 +24,7 @@ static void print_group(gid_t gid) grp = getgrgid(gid); if (grp == NULL) { - warn("cannot find name for group ID %u", gid); + fprintf(stderr, "cannot find name for group ID %u\n", gid); problems++; } @@ -46,14 +45,16 @@ static int xgetgroups(gid_t gid, int *n_groups, gid_t ** groups) /* Add 1 just in case max_n_groups is zero. */ g = (gid_t *) malloc(max_n_groups * sizeof(gid_t) + 1); - if (g == NULL) - err(EXIT_FAILURE, "out of memory"); + if (g == NULL) { + fprintf(stderr, "out of memory\n"); + exit(EXIT_FAILURE); + } ng = getgroups(max_n_groups, g); if (ng < 0) { - warn("cannot get supplemental group list"); + fprintf(stderr, "cannot get supplemental group list\n"); ++fail; - free(groups); + free(g); } if (!fail) { *n_groups = ng; diff --git a/test/regex/Makefile b/test/regex/Makefile index 7c55c3c0e..eea0c491b 100644 --- a/test/regex/Makefile +++ b/test/regex/Makefile @@ -1,17 +1,8 @@ # uClibc regex tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -#TESTS_DISABLED := testregexi testregexn - +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -CFLAGS_tst-regex2 := -std=c99 - -OPTS_testregex := < basic.dat -OPTS_testregexc := < categorize.dat -OPTS_testregexf := < forcedassoc.dat -OPTS_testregexi := -c < interpretation.dat -OPTS_testregexl := < leftassoc.dat -OPTS_testregexn := -c < nullsubexpr.dat -OPTS_testregexp := < repetition.dat -OPTS_testregexr := < rightassoc.dat diff --git a/test/regex/Makefile.in b/test/regex/Makefile.in new file mode 100644 index 000000000..ef1e3034f --- /dev/null +++ b/test/regex/Makefile.in @@ -0,0 +1,6 @@ +# triggers gcc ICE with gcc 5.3.0 +ifeq ($(TARGET_lm32),y) +TESTS_DISABLED := testregex +endif + +CFLAGS_tst-regex2 = -fPIC diff --git a/test/regex/testregex.c b/test/regex/testregex.c index 3992c2647..993ac2687 100644 --- a/test/regex/testregex.c +++ b/test/regex/testregex.c @@ -298,7 +298,7 @@ H("</HTML>\n"); #define streq(a,b) (*(a)==*(b)&&!strcmp(a,b)) #endif -#define HUNG 2 +#define HUNG 5 #define NOTEST (~0) #ifndef REG_TEST_DEFAULT @@ -1111,7 +1111,7 @@ catchfree(regex_t* preg, int flags, int* tabs, char* spec, char* re, char* s, ch } int -main(int argc, char** argv) +old_main(int unused_param_argc, char** argv) { int flags; int cflags; @@ -2103,7 +2103,7 @@ main(int argc, char** argv) printf(" %-.*s", subunitlen, subunit); printf(", %d test%s", testno, testno == 1 ? "" : "s"); if (state.ignored) - printf(", %d ignored mismatche%s", state.ignored, state.ignored == 1 ? "" : "s"); + printf(", %d ignored mismatch%s", state.ignored, state.ignored == 1 ? "" : "es"); if (state.warnings) printf(", %d warning%s", state.warnings, state.warnings == 1 ? "" : "s"); if (state.unspecified) @@ -2117,3 +2117,29 @@ main(int argc, char** argv) } return 0; } + +int main(int argc, char **argv) +{ + static char *param[][4] = { + { NULL, "basic.dat" , NULL }, + { NULL, "categorize.dat" , NULL }, + { NULL, "forcedassoc.dat" , NULL }, + { NULL, "-c", "interpretation.dat", NULL }, + { NULL, "leftassoc.dat" , NULL }, + { NULL, "-c", "nullsubexpr.dat" , NULL }, + { NULL, "repetition.dat" , NULL }, + { NULL, "rightassoc.dat" , NULL }, + }; + int r, i; + + if (argv[1]) + return old_main(argc, argv); + + r = 0; + for (i = 0; i < sizeof(param) / sizeof(param[0]); i++) { + param[i][0] = argv[0]; + printf("Testing %s\n", param[i][1][0] != '-' ? param[i][1] : param[i][2]); + r |= old_main(3 /* not used */, param[i]); + } + return r; +} diff --git a/test/regex/testregexc.c b/test/regex/testregexc.c deleted file mode 100644 index 46b3ee848..000000000 --- a/test/regex/testregexc.c +++ /dev/null @@ -1 +0,0 @@ -#include "testregex.c" diff --git a/test/regex/testregexf.c b/test/regex/testregexf.c deleted file mode 100644 index 46b3ee848..000000000 --- a/test/regex/testregexf.c +++ /dev/null @@ -1 +0,0 @@ -#include "testregex.c" diff --git a/test/regex/testregexi.c b/test/regex/testregexi.c deleted file mode 100644 index 46b3ee848..000000000 --- a/test/regex/testregexi.c +++ /dev/null @@ -1 +0,0 @@ -#include "testregex.c" diff --git a/test/regex/testregexl.c b/test/regex/testregexl.c deleted file mode 100644 index 46b3ee848..000000000 --- a/test/regex/testregexl.c +++ /dev/null @@ -1 +0,0 @@ -#include "testregex.c" diff --git a/test/regex/testregexn.c b/test/regex/testregexn.c deleted file mode 100644 index 46b3ee848..000000000 --- a/test/regex/testregexn.c +++ /dev/null @@ -1 +0,0 @@ -#include "testregex.c" diff --git a/test/regex/testregexp.c b/test/regex/testregexp.c deleted file mode 100644 index 46b3ee848..000000000 --- a/test/regex/testregexp.c +++ /dev/null @@ -1 +0,0 @@ -#include "testregex.c" diff --git a/test/regex/testregexr.c b/test/regex/testregexr.c deleted file mode 100644 index 46b3ee848..000000000 --- a/test/regex/testregexr.c +++ /dev/null @@ -1 +0,0 @@ -#include "testregex.c" diff --git a/test/regex/tst-regex2.c b/test/regex/tst-regex2.c index 94be59d85..bb47d6467 100644 --- a/test/regex/tst-regex2.c +++ b/test/regex/tst-regex2.c @@ -1,3 +1,5 @@ +#define _GNU_SOURCE 1 + #include <fcntl.h> #include <locale.h> #include <regex.h> @@ -5,240 +7,244 @@ #include <stdlib.h> #include <string.h> #include <sys/stat.h> +#include <sys/time.h> #include <time.h> #include <unistd.h> #include <errno.h> -#undef _POSIX_CPUTIME -#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0 -static clockid_t cl; -static int use_clock; -#endif - static int -do_test (void) +do_test(void) { -#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0 -# if _POSIX_CPUTIME == 0 - if (sysconf (_SC_CPUTIME) < 0) - use_clock = 0; - else -# endif - /* See whether we can use the CPU clock. */ - use_clock = clock_getcpuclockid (0, &cl) == 0; -#endif - - static const char *pat[] = { - ".?.?.?.?.?.?.?Log\\.13", - "(.?)(.?)(.?)(.?)(.?)(.?)(.?)Log\\.13", - "((((((((((.?))))))))))((((((((((.?))))))))))((((((((((.?))))))))))" - "((((((((((.?))))))))))((((((((((.?))))))))))((((((((((.?))))))))))" - "((((((((((.?))))))))))Log\\.13" }; - - int fd = open (".regex.ChangeLog.14", O_RDONLY); - if (fd < 0) - { - printf ("Couldn't open .regex.ChangeLog.14: %s\n", strerror(errno)); - return 1; - } - - struct stat64 st; - if (fstat64 (fd, &st) < 0) - { - printf ("Couldn't fstat ChangeLog.14: %s\n", strerror(errno)); - return 1; - } - - char *buf = malloc (st.st_size + 1); - if (buf == NULL) - { - printf ("Couldn't allocate buffer: %s\n", strerror(errno)); - return 1; - } - - if (read (fd, buf, st.st_size) != (ssize_t) st.st_size) - { - puts ("Couldn't read ChangeLog.14"); - return 1; - } - - close (fd); - buf[st.st_size] = '\0'; - -#ifdef __UCLIBC_HAS_XLOCALE__ - setlocale (LC_ALL, "de_DE.UTF-8"); -#endif - - char *string = buf; - size_t len = st.st_size; - - for (int testno = 0; testno < 4; ++testno) - for (int i = 0; i < sizeof (pat) / sizeof (pat[0]); ++i) - { - printf ("test %d pattern %d", testno, i); - - regex_t rbuf; - struct re_pattern_buffer rpbuf; - int err; - if (testno < 2) - { - err = regcomp (&rbuf, pat[i], - REG_EXTENDED | (testno ? REG_NOSUB : 0)); - if (err != 0) - { - putchar ('\n'); - char errstr[300]; - regerror (err, &rbuf, errstr, sizeof (errstr)); - puts (errstr); - return err; - } - } - else - { - re_set_syntax (RE_SYNTAX_POSIX_EGREP - | (testno == 3 ? RE_NO_SUB : 0)); - - memset (&rpbuf, 0, sizeof (rpbuf)); - const char *s = re_compile_pattern (pat[i], strlen (pat[i]), - &rpbuf); - if (s != NULL) - { - printf ("\n%s\n", s); + static const char *pat[] = { + ".?.?.?.?.?.?.?Log\\.13", + "(.?)(.?)(.?)(.?)(.?)(.?)(.?)Log\\.13", + "((((((((((.?))))))))))((((((((((.?))))))))))((((((((((.?))))))))))" + "((((((((((.?))))))))))((((((((((.?))))))))))((((((((((.?))))))))))" + "((((((((((.?))))))))))Log\\.13" + }; + char *buf, *string; + const char *fname = "tst-regex2.dat"; + struct stat st; + unsigned len; + int testno; + int exitcode = 0; + + int fd = open(fname, O_RDONLY); + if (fd < 0) { + printf("Couldn't open %s: %s\n", fname, strerror(errno)); + return 1; + } + if (fstat(fd, &st) < 0) { + printf("Couldn't fstat %s: %s\n", fname, strerror(errno)); + return 1; + } + len = st.st_size; + string = buf = malloc(len + 1); + if (buf == NULL) { + printf("Couldn't allocate %u bytes\n", len + 1); + return 1; + } + if (read(fd, buf, st.st_size) != (ssize_t) st.st_size) { + printf("Couldn't read %s\n", fname); return 1; - } + } - /* Just so that this can be tested with earlier glibc as well. */ - if (testno == 3) - rpbuf.no_sub = 1; - } + close(fd); + buf[len] = '\0'; -#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0 - struct timespec start, stop; - if (use_clock) - use_clock = clock_gettime (cl, &start) == 0; +#if defined __UCLIBC_HAS_XLOCALE__ || !defined __UCLIBC__ + setlocale(LC_ALL, "de_DE.UTF-8"); #endif - if (testno < 2) - { - regmatch_t pmatch[71]; - err = regexec (&rbuf, string, 71, pmatch, 0); - if (err == REG_NOMATCH) - { - puts ("\nregexec failed"); - return 1; - } - - if (testno == 0) - { - if (pmatch[0].rm_eo != pmatch[0].rm_so + 13 - || pmatch[0].rm_eo > len - || pmatch[0].rm_so < len - 100 - || strncmp (string + pmatch[0].rm_so, - " ChangeLog.13 for earlier changes", - sizeof " ChangeLog.13 for earlier changes" - 1) - != 0) - { - puts ("\nregexec without REG_NOSUB did not find the correct match"); - return 1; + for (testno = 0; testno < 2; ++testno) { + int i; + for (i = 0; i < sizeof(pat) / sizeof(pat[0]); ++i) { + struct timeval start, stop; + regex_t rbuf; + int err; + + printf("test %d pattern %d '%s'\n", testno, i, pat[i]); + gettimeofday(&start, NULL); + + err = regcomp(&rbuf, pat[i], + REG_EXTENDED | (testno ? REG_NOSUB : 0)); + if (err != 0) { + char errstr[300]; + regerror(err, &rbuf, errstr, sizeof(errstr)); + puts(errstr); + exitcode = 1; + goto contin1; + } + + regmatch_t pmatch[71]; + err = regexec(&rbuf, string, 71, pmatch, 0); + if (err == REG_NOMATCH) { + puts("regexec failed"); + exitcode = 1; + goto contin1; + } + + if (testno == 0) { + if (pmatch[0].rm_eo != pmatch[0].rm_so + 13 + || pmatch[0].rm_eo > len + || pmatch[0].rm_so < len - 100 + || strncmp(string + pmatch[0].rm_so, + " ChangeLog.13 for earlier changes", + sizeof " ChangeLog.13 for earlier changes" - 1 + ) != 0 + ) { + puts("regexec without REG_NOSUB did not find the correct match"); + exitcode = 1; + goto contin1; + } + + if (i > 0) { + int j, k, l; + for (j = 0, l = 1; j < 7; ++j) { + for (k = 0; k < (i == 1 ? 1 : 10); ++k, ++l) { + if (pmatch[l].rm_so != pmatch[0].rm_so + j + || pmatch[l].rm_eo != pmatch[l].rm_so + 1 + ) { + printf("pmatch[%d] incorrect\n", l); + exitcode = 1; + goto contin1; + } + } + } + } + } + + gettimeofday(&stop, NULL); + stop.tv_sec -= start.tv_sec; + if (stop.tv_usec < start.tv_usec) { + stop.tv_sec--; + stop.tv_usec += 1000000; + } + stop.tv_usec -= start.tv_usec; + printf(" %lu.%06lus\n", (unsigned long) stop.tv_sec, + (unsigned long) stop.tv_usec); + contin1: + regfree(&rbuf); } - - if (i > 0) - for (int j = 0, l = 1; j < 7; ++j) - for (int k = 0; k < (i == 1 ? 1 : 10); ++k, ++l) - if (pmatch[l].rm_so != pmatch[0].rm_so + j - || pmatch[l].rm_eo != pmatch[l].rm_so + 1) - { - printf ("\npmatch[%d] incorrect\n", l); - return 1; - } - } } - else - { - struct re_registers regs; - - memset (®s, 0, sizeof (regs)); - int match = re_search (&rpbuf, string, len, 0, len, - ®s); - if (match < 0) - { - puts ("\nre_search failed"); - return 1; - } - - if (match + 13 > len - || match < len - 100 - || strncmp (string + match, - " ChangeLog.13 for earlier changes", - sizeof " ChangeLog.13 for earlier changes" - 1) - != 0) - { - puts ("\nre_search did not find the correct match"); - return 1; - } - - if (testno == 2) - { - if (regs.num_regs != 2 + (i == 0 ? 0 : i == 1 ? 7 : 70)) - { - printf ("\nincorrect num_regs %d\n", regs.num_regs); - return 1; - } - - if (regs.start[0] != match || regs.end[0] != match + 13) - { - printf ("\nincorrect regs.{start,end}[0] = { %d, %d}\n", - regs.start[0], regs.end[0]); - return 1; - } - if (regs.start[regs.num_regs - 1] != -1 - || regs.end[regs.num_regs - 1] != -1) - { - puts ("\nincorrect regs.{start,end}[num_regs - 1]"); - return 1; + for (testno = 2; testno < 4; ++testno) { + int i; + for (i = 0; i < sizeof(pat) / sizeof(pat[0]); ++i) { + struct timeval start, stop; + struct re_pattern_buffer rpbuf; + struct re_registers regs; + const char *s; + int match; + + printf("test %d pattern %d '%s'\n", testno, i, pat[i]); + gettimeofday(&start, NULL); + + re_set_syntax(RE_SYNTAX_POSIX_EGREP + | (testno == 3 ? RE_NO_SUB : 0)); + memset(&rpbuf, 0, sizeof(rpbuf)); + s = re_compile_pattern(pat[i], strlen(pat[i]), &rpbuf); + if (s != NULL) { + printf("%s\n", s); + exitcode = 1; + goto contin2; + } + + memset(®s, 0, sizeof(regs)); + match = re_search(&rpbuf, string, len, 0, len, ®s); + if (match < 0) { + printf("re_search failed (err:%d)\n", match); + exitcode = 1; + goto contin2; + } + if (match + 13 > len) { + printf("re_search: match+13 > len (%d > %d)\n", match + 13, len); + exitcode = 1; + goto contin2; + } + if (match < len - 100) { + printf("re_search: match < len-100 (%d < %d)\n", match, len - 100); + exitcode = 1; + goto contin2; + } + if (strncmp(string + match, " ChangeLog.13 for earlier changes", + sizeof(" ChangeLog.13 for earlier changes") - 1 + ) != 0 + ) { + printf("re_search did not find the correct match" + "(found '%s' instead)\n", string + match); + exitcode = 1; + goto contin2; + } + + if (testno == 2) { + int expected = 72; + if (i == 0) + expected = 2; + if (i == 1) + expected = 9; + if (regs.num_regs != expected) { + printf("incorrect num_regs %d, expected %d\n", regs.num_regs, expected); + exitcode = 1; + goto contin2; + } + if (regs.start[0] != match || regs.end[0] != match + 13) { + printf("incorrect regs.{start,end}[0] = { %d, %d }," + " expected { %d, %d }\n", + regs.start[0], regs.end[0], + match, match + 13 + ); + exitcode = 1; + goto contin2; + } + if (regs.start[regs.num_regs - 1] != -1 + || regs.end[regs.num_regs - 1] != -1 + ) { + printf("incorrect regs.{start,end}[num_regs - 1] = { %d, %d }," + " expected { -1, -1 }\n", + regs.start[regs.num_regs - 1], regs.end[regs.num_regs - 1] + ); + exitcode = 1; + goto contin2; + } + + if (i > 0) { + int j, k, l; + for (j = 0, l = 1; j < 7; ++j) { + for (k = 0; k < (i == 1 ? 1 : 10); ++k, ++l) { + if (regs.start[l] != match + j + || regs.end[l] != match + j + 1 + ) { + printf("incorrect regs.{start,end}[%d] = { %d, %d }," + " expected { %d, %d }\n", + l, + regs.start[l], regs.end[l], + match + j, match + j + 1 + ); + exitcode = 1; + goto contin2; + } + } + } + } + } + + gettimeofday(&stop, NULL); + stop.tv_sec -= start.tv_sec; + if (stop.tv_usec < start.tv_usec) { + stop.tv_sec--; + stop.tv_usec += 1000000; + } + stop.tv_usec -= start.tv_usec; + printf(" %lu.%06lus\n", (unsigned long) stop.tv_sec, + (unsigned long) stop.tv_usec); + contin2: + regfree(&rpbuf); } - - if (i > 0) - for (int j = 0, l = 1; j < 7; ++j) - for (int k = 0; k < (i == 1 ? 1 : 10); ++k, ++l) - if (regs.start[l] != match + j - || regs.end[l] != regs.start[l] + 1) - { - printf ("\nregs.{start,end}[%d] incorrect\n", l); - return 1; - } - } - } - -#if defined _POSIX_CPUTIME && _POSIX_CPUTIME >= 0 - if (use_clock) - use_clock = clock_gettime (cl, &stop) == 0; - if (use_clock) - { - stop.tv_sec -= start.tv_sec; - if (stop.tv_nsec < start.tv_nsec) - { - stop.tv_sec--; - stop.tv_nsec += 1000000000 - start.tv_nsec; - } - else - stop.tv_nsec -= start.tv_nsec; - printf (": %ld.%09lds\n", (long) stop.tv_sec, (long) stop.tv_nsec); } - else -#endif - putchar ('\n'); - - if (testno < 2) - regfree (&rbuf); - else - regfree (&rpbuf); - } - - return 0; + return exitcode; } -#define TIMEOUT 20 -#define TEST_FUNCTION do_test () +#define TIMEOUT 100 +#define TEST_FUNCTION do_test() #include "../test-skeleton.c" diff --git a/test/regex/.regex.ChangeLog.14 b/test/regex/tst-regex2.dat index ace9f3b66..ace9f3b66 100644 --- a/test/regex/.regex.ChangeLog.14 +++ b/test/regex/tst-regex2.dat diff --git a/test/regex/tst-regexloc.c b/test/regex/tst-regexloc.c index 88ab58116..d862678e5 100644 --- a/test/regex/tst-regexloc.c +++ b/test/regex/tst-regexloc.c @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <sys/types.h> #include <regex.h> @@ -24,10 +23,12 @@ int main (int argc, char *argv[]) { -#ifdef __UCLIBC_HAS_XLOCALE__ +/* If uclibc has extended locale, or if it's a host build + * (assuming host libc always has locale): */ +#if defined __UCLIBC_HAS_XLOCALE__ || !defined __UCLIBC__ regex_t re; regmatch_t mat[1]; - int res = 1; + int exitcode = 1; if (setlocale (LC_ALL, "de_DE.ISO-8859-1") == NULL) puts ("cannot set locale"); @@ -37,11 +38,14 @@ main (int argc, char *argv[]) puts ("no match"); else { - printf ("match from %d to %d\n", mat[0].rm_so, mat[0].rm_eo); - res = mat[0].rm_so != 0 || mat[0].rm_eo != 6; + exitcode = mat[0].rm_so != 0 || mat[0].rm_eo != 6; + printf ("match from %d to %d - %s\n", + mat[0].rm_so, mat[0].rm_eo, + exitcode ? "WRONG!" : "ok" + ); } - return res; + return exitcode; #else puts("Test requires locale; skipping"); return 0; diff --git a/test/rpc/Makefile b/test/rpc/Makefile index 8ea934800..e098072fc 100644 --- a/test/rpc/Makefile +++ b/test/rpc/Makefile @@ -1,12 +1,8 @@ # uClibc rpc tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -TESTS := getrpcent - -ifeq ($(UCLIBC_HAS_REENTRANT_RPC),y) -TESTS += getrpcent_r -endif - +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -DODIFF_getrpcent := 1 diff --git a/test/rpc/Makefile.in b/test/rpc/Makefile.in new file mode 100644 index 000000000..5612ff202 --- /dev/null +++ b/test/rpc/Makefile.in @@ -0,0 +1,11 @@ +# uClibc rpc tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +TESTS := getrpcent + +ifeq ($(UCLIBC_HAS_REENTRANT_RPC),y) +TESTS += getrpcent_r +endif + +DODIFF_getrpcent := 1 + diff --git a/test/rpc/getrpcent_r.c b/test/rpc/getrpcent_r.c index 708deba10..65ca61cd9 100644 --- a/test/rpc/getrpcent_r.c +++ b/test/rpc/getrpcent_r.c @@ -1,6 +1,7 @@ #include <netdb.h> #include <stdio.h> #include <errno.h> +#include <string.h> int main(int argc, char *argv[]) { diff --git a/test/setjmp/Makefile b/test/setjmp/Makefile index 581ab3213..6feab59ef 100644 --- a/test/setjmp/Makefile +++ b/test/setjmp/Makefile @@ -1,4 +1,8 @@ # uClibc setjmp tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak diff --git a/test/setjmp/Makefile.in b/test/setjmp/Makefile.in new file mode 100644 index 000000000..a5b7b591a --- /dev/null +++ b/test/setjmp/Makefile.in @@ -0,0 +1 @@ +CFLAGS_bug269-setjmp = -fPIC diff --git a/test/setjmp/bug269-setjmp.c b/test/setjmp/bug269-setjmp.c index b11ac7b24..a9254a1df 100644 --- a/test/setjmp/bug269-setjmp.c +++ b/test/setjmp/bug269-setjmp.c @@ -12,9 +12,8 @@ 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. */ ; + License along with the GNU C Library; If not, see + <http://www.gnu.org/licenses/>. */ /* Test case for Bugzilla # 269 */ diff --git a/test/setjmp/tst-setjmp.c b/test/setjmp/tst-setjmp.c index f0feb99a8..ea1c29acd 100644 --- a/test/setjmp/tst-setjmp.c +++ b/test/setjmp/tst-setjmp.c @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <setjmp.h> diff --git a/test/signal/Makefile b/test/signal/Makefile index 2ff96fa73..c2afb5f50 100644 --- a/test/signal/Makefile +++ b/test/signal/Makefile @@ -1,8 +1,8 @@ # uClibc signal tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -ifeq ($(UCLIBC_HAS_OBSOLETE_BSD_SIGNAL),) -TESTS_DISABLED := tst-sigsimple -endif - +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak diff --git a/test/signal/Makefile.in b/test/signal/Makefile.in new file mode 100644 index 000000000..27791a911 --- /dev/null +++ b/test/signal/Makefile.in @@ -0,0 +1,10 @@ +# uClibc signal tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +ifeq ($(UCLIBC_HAS_OBSOLETE_BSD_SIGNAL),) +TESTS_DISABLED := tst-sigsimple +endif + +CFLAGS_tst-signalfd = -fPIC +CFLAGS_tst-sigset = -fPIC +CFLAGS_tst-sigsimple = -fPIC diff --git a/test/signal/tst-raise.c b/test/signal/tst-raise.c index d24c316cf..534ae7151 100644 --- a/test/signal/tst-raise.c +++ b/test/signal/tst-raise.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <errno.h> #include <string.h> diff --git a/test/signal/tst-signalfd.c b/test/signal/tst-signalfd.c new file mode 100644 index 000000000..1fbb748aa --- /dev/null +++ b/test/signal/tst-signalfd.c @@ -0,0 +1,63 @@ +/* vi: set sw=4 ts=4 sts=4: */ +/* + * signalfd test for uClibc + * Copyright (C) 2012 by Kevin Cernekee <cernekee@gmail.com> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <error.h> +#include <signal.h> +#include <sys/signalfd.h> +#include <sys/fcntl.h> + +static int +do_test(void) +{ + int fd, ret, result = 0; + struct signalfd_siginfo ssi; + sigset_t mask; + + sigemptyset(&mask); + sigaddset(&mask, SIGUSR1); + sigprocmask(SIG_BLOCK, &mask, NULL); + + fd = signalfd(-1, &mask, SFD_NONBLOCK); + if (fd < 0) { + printf("signalfd() failed: %s\n", strerror(errno)); + result = 1; + } + + /* this should return immediately with EAGAIN due to SFD_NONBLOCK */ + memset(&ssi, 0, sizeof(ssi)); + ret = read(fd, &ssi, sizeof(ssi)); + if (ret != -1 || errno != EAGAIN) { + error(0, 0, "first read() returned %d", ret); + result = 1; + } + + kill(getpid(), SIGUSR1); + + /* this should return a struct ssi indicating receipt of SIGUSR1 */ + ret = read(fd, &ssi, sizeof(ssi)); + if (ret != sizeof(ssi)) { + error(0, 0, "second read() returned %d", ret); + result = 1; + } + + if (ssi.ssi_signo != SIGUSR1) { + error(0, 0, "ssi contains bogus signo"); + result = 1; + } + + return result; +} + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/signal/tst-sigsimple.c b/test/signal/tst-sigsimple.c index 22bb85cba..80220eed0 100644 --- a/test/signal/tst-sigsimple.c +++ b/test/signal/tst-sigsimple.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <errno.h> #include <signal.h> diff --git a/test/silly/Makefile b/test/silly/Makefile index ccd701852..54f4bd023 100644 --- a/test/silly/Makefile +++ b/test/silly/Makefile @@ -1,7 +1,8 @@ # uClibc silly tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -RET_hello := 42 -RET_tiny := 42 diff --git a/test/silly/Makefile.in b/test/silly/Makefile.in new file mode 100644 index 000000000..c47734414 --- /dev/null +++ b/test/silly/Makefile.in @@ -0,0 +1,24 @@ +# uClibc silly tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +RET_hello := 42 +RET_tiny := 42 + +ifeq ($(TARGET_ARCH),ia64) +TESTS_DISABLED += tst-atomic tst-atomic-long +endif + +ifeq ($(TARGET_ARCH),mips) +TESTS_DISABLED += tst-atomic tst-atomic-long +endif + +ifeq ($(TARGET_ARCH),sparc) +TESTS_DISABLED += tst-atomic tst-atomic-long +endif + +atomic_headers := -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \ + -I$(top_srcdir)libc/sysdeps/linux \ + -I$(top_builddir)include + +CFLAGS_tst-atomic = $(atomic_headers) -fPIC +CFLAGS_tst-atomic-long = $(atomic_headers) -fPIC diff --git a/test/silly/hello.c b/test/silly/hello.c index 4aba926e6..d330597ab 100644 --- a/test/silly/hello.c +++ b/test/silly/hello.c @@ -1,4 +1,4 @@ -#include<stdio.h> +#include <stdio.h> #include <stdlib.h> int main(void) diff --git a/test/silly/tst-atomic-long.c b/test/silly/tst-atomic-long.c new file mode 100644 index 000000000..d13fb074c --- /dev/null +++ b/test/silly/tst-atomic-long.c @@ -0,0 +1,27 @@ +/* Tests for atomic.h macros. + Copyright (C) 2003-2015 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, see + <http://www.gnu.org/licenses/>. */ + +#include <bits/wordsize.h> + +#define atomic_t long +#if __WORDSIZE == 64 +# define TEST_ATOMIC64 1 +#endif + +#include "tst-atomic.c" diff --git a/test/silly/tst-atomic.c b/test/silly/tst-atomic.c new file mode 100644 index 000000000..fc773b231 --- /dev/null +++ b/test/silly/tst-atomic.c @@ -0,0 +1,573 @@ +/* Tests for atomic.h macros. + Copyright (C) 2003-2015 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, see + <http://www.gnu.org/licenses/>. */ + +#include <stdio.h> +#include <atomic.h> + +#ifndef atomic_t +# define atomic_t int +#endif + +#define CHK2(f,a1,a2,rv,new_mem) \ + retval = f(&mem, a1, a2); \ + if (retval != rv) { \ + printf("%s(mem, %lu, %lu): retval %lu != expected %lu\n", \ + #f, a1, a2, retval, rv); \ + ret = 1; \ + } \ + if (mem != new_mem) { \ + printf("%s(mem, %lu, %lu): mem %lu != expected %lu\n", \ + #f, a1, a2, mem, new_mem); \ + ret = 1; \ + } +#define CHK1(f,a1,rv,new_mem) \ + retval = f(&mem, a1); \ + if (retval != rv) { \ + printf("%s(mem, %lu): retval %lu != expected %lu\n", \ + #f, a1, retval, rv); \ + ret = 1; \ + } \ + if (mem != new_mem) { \ + printf("%s(mem, %lu): mem %lu != expected %lu\n", \ + #f, a1, mem, new_mem); \ + ret = 1; \ + } +#define CHK0(f,rv,new_mem) \ + retval = f(&mem); \ + if (retval != rv) { \ + printf("%s(mem): retval %lu != expected %lu\n", \ + #f, retval, rv); \ + ret = 1; \ + } \ + if (mem != new_mem) { \ + printf("%s(mem): mem %lu != expected %lu\n", \ + #f, mem, new_mem); \ + ret = 1; \ + } + +/* Test various atomic.h macros. */ +static int +do_test (void) +{ + atomic_t mem, expected, retval; + int ret = 0; + +#ifdef atomic_compare_and_exchange_val_acq + mem = 24; + CHK2(atomic_compare_and_exchange_val_acq, 35, 24, 24, 35); + mem = 12; + CHK2(atomic_compare_and_exchange_val_acq, 10, 15, 12, 12); + mem = -15; + CHK2(atomic_compare_and_exchange_val_acq, -56, -15, -15, -56); + mem = -1; + CHK2(atomic_compare_and_exchange_val_acq, 17, 0, -1, -1); +#endif + + mem = 24; + CHK2(atomic_compare_and_exchange_bool_acq, 35, 24, 0, 35); + mem = 12; + CHK2(atomic_compare_and_exchange_bool_acq, 10, 15, 1, 12); + mem = -15; + CHK2(atomic_compare_and_exchange_bool_acq, -56, -15, 0, -56); + mem = -1; + CHK2(atomic_compare_and_exchange_bool_acq, 17, 0, 1, -1); + + mem = 64; + CHK1(atomic_exchange_acq, 31, 64, 31); + mem = 2; + CHK1(atomic_exchange_and_add, 11, 2, 13); + mem = 2; + CHK1(atomic_exchange_and_add_acq, 11, 2, 13); + mem = 2; + CHK1(atomic_exchange_and_add_rel, 11, 2, 13); + + mem = -21; + atomic_add (&mem, 22); + if (mem != 1) + { + printf ("atomic_add(mem, 22): mem %lu != expected 1\n", mem); + ret = 1; + } + + mem = -1; + atomic_increment (&mem); + if (mem != 0) + { + printf ("atomic_increment(mem): mem %lu != expected 0\n", mem); + ret = 1; + } + + mem = 2; + if ((retval = atomic_increment_val (&mem)) != 3) + { + printf ("atomic_increment_val(mem): retval %lu != expected 3\n", retval); + ret = 1; + } + + mem = 0; + CHK0(atomic_increment_and_test, 0, 1); + mem = 35; + CHK0(atomic_increment_and_test, 0, 36); + mem = -1; + CHK0(atomic_increment_and_test, 1, 0); + mem = 17; + atomic_decrement (&mem); + if (mem != 16) + { + printf ("atomic_increment(mem): mem %lu != expected 16\n", mem); + ret = 1; + } + + if ((retval = atomic_decrement_val (&mem)) != 15) + { + printf ("atomic_decrement_val(mem): retval %lu != expected 15\n", retval); + ret = 1; + } + + mem = 0; + CHK0(atomic_decrement_and_test, 0, -1); + + mem = 15; + CHK0(atomic_decrement_and_test, 0, 14); + mem = 1; + CHK0(atomic_decrement_and_test, 1, 0); + mem = 1; + if (atomic_decrement_if_positive (&mem) != 1 + || mem != 0) + { + puts ("atomic_decrement_if_positive test 1 failed"); + ret = 1; + } + + mem = 0; + if (atomic_decrement_if_positive (&mem) != 0 + || mem != 0) + { + puts ("atomic_decrement_if_positive test 2 failed"); + ret = 1; + } + + mem = -1; + if (atomic_decrement_if_positive (&mem) != -1 + || mem != -1) + { + puts ("atomic_decrement_if_positive test 3 failed"); + ret = 1; + } + + mem = -12; + if (! atomic_add_negative (&mem, 10) + || mem != -2) + { + puts ("atomic_add_negative test 1 failed"); + ret = 1; + } + + mem = 0; + if (atomic_add_negative (&mem, 100) + || mem != 100) + { + puts ("atomic_add_negative test 2 failed"); + ret = 1; + } + + mem = 15; + if (atomic_add_negative (&mem, -10) + || mem != 5) + { + puts ("atomic_add_negative test 3 failed"); + ret = 1; + } + + mem = -12; + if (atomic_add_negative (&mem, 14) + || mem != 2) + { + puts ("atomic_add_negative test 4 failed"); + ret = 1; + } + + mem = 0; + if (! atomic_add_negative (&mem, -1) + || mem != -1) + { + puts ("atomic_add_negative test 5 failed"); + ret = 1; + } + + mem = -31; + if (atomic_add_negative (&mem, 31) + || mem != 0) + { + puts ("atomic_add_negative test 6 failed"); + ret = 1; + } + + mem = -34; + if (atomic_add_zero (&mem, 31) + || mem != -3) + { + puts ("atomic_add_zero test 1 failed"); + ret = 1; + } + + mem = -36; + if (! atomic_add_zero (&mem, 36) + || mem != 0) + { + puts ("atomic_add_zero test 2 failed"); + ret = 1; + } + + mem = 113; + if (atomic_add_zero (&mem, -13) + || mem != 100) + { + puts ("atomic_add_zero test 3 failed"); + ret = 1; + } + + mem = -18; + if (atomic_add_zero (&mem, 20) + || mem != 2) + { + puts ("atomic_add_zero test 4 failed"); + ret = 1; + } + + mem = 10; + if (atomic_add_zero (&mem, -20) + || mem != -10) + { + puts ("atomic_add_zero test 5 failed"); + ret = 1; + } + + mem = 10; + if (! atomic_add_zero (&mem, -10) + || mem != 0) + { + puts ("atomic_add_zero test 6 failed"); + ret = 1; + } + + mem = 0; + atomic_bit_set (&mem, 1); + if (mem != 2) + { + puts ("atomic_bit_set test 1 failed"); + ret = 1; + } + + mem = 8; + atomic_bit_set (&mem, 3); + if (mem != 8) + { + puts ("atomic_bit_set test 2 failed"); + ret = 1; + } + +#ifdef TEST_ATOMIC64 + mem = 16; + atomic_bit_set (&mem, 35); + if (mem != 0x800000010LL) + { + puts ("atomic_bit_set test 3 failed"); + ret = 1; + } +#endif + + mem = 0; + if (atomic_bit_test_set (&mem, 1) + || mem != 2) + { + puts ("atomic_bit_test_set test 1 failed"); + ret = 1; + } + + mem = 8; + if (! atomic_bit_test_set (&mem, 3) + || mem != 8) + { + puts ("atomic_bit_test_set test 2 failed"); + ret = 1; + } + +#ifdef TEST_ATOMIC64 + mem = 16; + if (atomic_bit_test_set (&mem, 35) + || mem != 0x800000010LL) + { + puts ("atomic_bit_test_set test 3 failed"); + ret = 1; + } + + mem = 0x100000000LL; + if (! atomic_bit_test_set (&mem, 32) + || mem != 0x100000000LL) + { + puts ("atomic_bit_test_set test 4 failed"); + ret = 1; + } +#endif + +#ifdef catomic_compare_and_exchange_val_acq + mem = 24; + if (catomic_compare_and_exchange_val_acq (&mem, 35, 24) != 24 + || mem != 35) + { + puts ("catomic_compare_and_exchange_val_acq test 1 failed"); + ret = 1; + } + + mem = 12; + if (catomic_compare_and_exchange_val_acq (&mem, 10, 15) != 12 + || mem != 12) + { + puts ("catomic_compare_and_exchange_val_acq test 2 failed"); + ret = 1; + } + + mem = -15; + if (catomic_compare_and_exchange_val_acq (&mem, -56, -15) != -15 + || mem != -56) + { + puts ("catomic_compare_and_exchange_val_acq test 3 failed"); + ret = 1; + } + + mem = -1; + if (catomic_compare_and_exchange_val_acq (&mem, 17, 0) != -1 + || mem != -1) + { + puts ("catomic_compare_and_exchange_val_acq test 4 failed"); + ret = 1; + } +#endif + + mem = 24; + if (catomic_compare_and_exchange_bool_acq (&mem, 35, 24) + || mem != 35) + { + puts ("catomic_compare_and_exchange_bool_acq test 1 failed"); + ret = 1; + } + + mem = 12; + if (! catomic_compare_and_exchange_bool_acq (&mem, 10, 15) + || mem != 12) + { + puts ("catomic_compare_and_exchange_bool_acq test 2 failed"); + ret = 1; + } + + mem = -15; + if (catomic_compare_and_exchange_bool_acq (&mem, -56, -15) + || mem != -56) + { + puts ("catomic_compare_and_exchange_bool_acq test 3 failed"); + ret = 1; + } + + mem = -1; + if (! catomic_compare_and_exchange_bool_acq (&mem, 17, 0) + || mem != -1) + { + puts ("catomic_compare_and_exchange_bool_acq test 4 failed"); + ret = 1; + } + + mem = 2; + if (catomic_exchange_and_add (&mem, 11) != 2 + || mem != 13) + { + puts ("catomic_exchange_and_add test failed"); + ret = 1; + } + + mem = -21; + catomic_add (&mem, 22); + if (mem != 1) + { + puts ("catomic_add test failed"); + ret = 1; + } + + mem = -1; + catomic_increment (&mem); + if (mem != 0) + { + puts ("catomic_increment test failed"); + ret = 1; + } + + mem = 2; + if (catomic_increment_val (&mem) != 3) + { + puts ("catomic_increment_val test failed"); + ret = 1; + } + + mem = 17; + catomic_decrement (&mem); + if (mem != 16) + { + puts ("catomic_decrement test failed"); + ret = 1; + } + + if (catomic_decrement_val (&mem) != 15) + { + puts ("catomic_decrement_val test failed"); + ret = 1; + } + + /* Tests for C11-like atomics. */ + mem = 11; + if (atomic_load_relaxed (&mem) != 11 || atomic_load_acquire (&mem) != 11) + { + puts ("atomic_load_{relaxed,acquire} test failed"); + ret = 1; + } + + atomic_store_relaxed (&mem, 12); + if (mem != 12) + { + puts ("atomic_store_relaxed test failed"); + ret = 1; + } + atomic_store_release (&mem, 13); + if (mem != 13) + { + puts ("atomic_store_release test failed"); + ret = 1; + } + + mem = 14; + expected = 14; + if (!atomic_compare_exchange_weak_relaxed (&mem, &expected, 25) + || mem != 25 || expected != 14) + { + puts ("atomic_compare_exchange_weak_relaxed test 1 failed"); + ret = 1; + } + if (atomic_compare_exchange_weak_relaxed (&mem, &expected, 14) + || mem != 25 || expected != 25) + { + puts ("atomic_compare_exchange_weak_relaxed test 2 failed"); + ret = 1; + } + mem = 14; + expected = 14; + if (!atomic_compare_exchange_weak_acquire (&mem, &expected, 25) + || mem != 25 || expected != 14) + { + puts ("atomic_compare_exchange_weak_acquire test 1 failed"); + ret = 1; + } + if (atomic_compare_exchange_weak_acquire (&mem, &expected, 14) + || mem != 25 || expected != 25) + { + puts ("atomic_compare_exchange_weak_acquire test 2 failed"); + ret = 1; + } + mem = 14; + expected = 14; + if (!atomic_compare_exchange_weak_release (&mem, &expected, 25) + || mem != 25 || expected != 14) + { + puts ("atomic_compare_exchange_weak_release test 1 failed"); + ret = 1; + } + if (atomic_compare_exchange_weak_release (&mem, &expected, 14) + || mem != 25 || expected != 25) + { + puts ("atomic_compare_exchange_weak_release test 2 failed"); + ret = 1; + } + + mem = 23; + if (atomic_exchange_acquire (&mem, 42) != 23 || mem != 42) + { + puts ("atomic_exchange_acquire test failed"); + ret = 1; + } + mem = 23; + if (atomic_exchange_release (&mem, 42) != 23 || mem != 42) + { + puts ("atomic_exchange_release test failed"); + ret = 1; + } + + mem = 23; + if (atomic_fetch_add_relaxed (&mem, 1) != 23 || mem != 24) + { + puts ("atomic_fetch_add_relaxed test failed"); + ret = 1; + } + mem = 23; + if (atomic_fetch_add_acquire (&mem, 1) != 23 || mem != 24) + { + puts ("atomic_fetch_add_acquire test failed"); + ret = 1; + } + mem = 23; + if (atomic_fetch_add_release (&mem, 1) != 23 || mem != 24) + { + puts ("atomic_fetch_add_release test failed"); + ret = 1; + } + mem = 23; + if (atomic_fetch_add_acq_rel (&mem, 1) != 23 || mem != 24) + { + puts ("atomic_fetch_add_acq_rel test failed"); + ret = 1; + } + + mem = 3; + if (atomic_fetch_and_acquire (&mem, 2) != 3 || mem != 2) + { + puts ("atomic_fetch_and_acquire test failed"); + ret = 1; + } + + mem = 4; + if (atomic_fetch_or_relaxed (&mem, 2) != 4 || mem != 6) + { + puts ("atomic_fetch_or_relaxed test failed"); + ret = 1; + } + mem = 4; + if (atomic_fetch_or_acquire (&mem, 2) != 4 || mem != 6) + { + puts ("atomic_fetch_or_acquire test failed"); + ret = 1; + } + + /* This is a single-threaded test, so we can't test the effects of the + fences. */ + atomic_thread_fence_acquire (); + atomic_thread_fence_release (); + atomic_thread_fence_seq_cst (); + + return ret; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/stat/Makefile b/test/stat/Makefile index 008a81248..03fdb960a 100644 --- a/test/stat/Makefile +++ b/test/stat/Makefile @@ -1,12 +1,8 @@ # uClibc stat tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -CFLAGS_stat64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 - -DODIFF_stat := 1 -DODIFF_stat64 := 1 - -OPTS_stat := Makefile -OPTS_stat64 := Makefile diff --git a/test/stat/Makefile.in b/test/stat/Makefile.in new file mode 100644 index 000000000..9c06dedb3 --- /dev/null +++ b/test/stat/Makefile.in @@ -0,0 +1,13 @@ +# uClibc stat tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +ifeq ($(UCLIBC_HAS_LFS),) +TESTS_DISABLED := stat64 +endif +CFLAGS_stat64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 + +DODIFF_stat := 1 +DODIFF_stat64 := 1 + +OPTS_stat := Makefile +OPTS_stat64 := Makefile diff --git a/test/stat/memcmp-stat.c b/test/stat/memcmp-stat.c index c38e3ff88..254c754c4 100644 --- a/test/stat/memcmp-stat.c +++ b/test/stat/memcmp-stat.c @@ -48,7 +48,7 @@ static void show_stat(struct stat *st) (long int)st->st_size, (long int)st->st_blksize, (long int)st->st_blocks, -#ifndef __UCLIBC__ +#if !defined(__UCLIBC__) || defined(__USE_MISC) (long int)st->st_atime, (long int)st->st_atim.tv_nsec, (long int)st->st_mtime, diff --git a/test/stat/stat-loop256.c b/test/stat/stat-loop256.c new file mode 100644 index 000000000..14284c184 --- /dev/null +++ b/test/stat/stat-loop256.c @@ -0,0 +1,32 @@ +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <sys/stat.h> +int main() +{ + struct stat statbuf; + int ret = 0; + char* loop255 = "/dev/loop255"; + char* loop256 = "/dev/loop256"; + mode_t mode = 0660; + mknod(loop255, mode, 0x7ff); + mknod(loop256, mode, 0x100700); + ret = stat(loop255, &statbuf); + if(ret < 0) { + printf("stat: Cant stat %s\n",loop255); + unlink(loop255); + exit(1); + } + ret = stat(loop256, &statbuf); + if(ret < 0) { + printf("stat: Cant stat %s\n",loop256); + unlink(loop255); + unlink(loop256); + exit(1); + } + + unlink(loop255); + unlink(loop256); + exit(0); +} + diff --git a/test/stdio/Makefile b/test/stdio/Makefile index d3ae2f368..95b930b9d 100644 --- a/test/stdio/Makefile +++ b/test/stdio/Makefile @@ -1,6 +1,8 @@ -# uClibc assert tests +# uClibc stdio tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -DODIFF_64bit := 1 diff --git a/test/stdio/Makefile.in b/test/stdio/Makefile.in new file mode 100644 index 000000000..3e60b4090 --- /dev/null +++ b/test/stdio/Makefile.in @@ -0,0 +1,10 @@ +# uClibc stdio tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +DODIFF_64bit := 1 + +ifeq ($(UCLIBC_HAS_GLIBC_CUSTOM_STREAMS),) +TESTS_DISABLED += tst-fmemopen +endif + +CFLAGS_tst-fmemopen = -fPIC diff --git a/test/stdio/lseek_no_lfs.c b/test/stdio/lseek_no_lfs.c new file mode 100644 index 000000000..54daf6b48 --- /dev/null +++ b/test/stdio/lseek_no_lfs.c @@ -0,0 +1,22 @@ +#include <stdio.h> +#include <string.h> +#include <errno.h> + +int main(int argc, char *argv[]) +{ + FILE * f = fopen(argv[0], "rb"); + if (!f) + { + printf("Error: Can't open %s, reason: %s\n", argv[0], strerror(errno)); + return 1; + } + + if (fseek(f, (unsigned)4096, (int)SEEK_SET) == -1) + { + printf("Test failed, fseek return fail code. errno=%u (%s)\n", errno, strerror(errno)); + return 1; + } + + fclose(f); + return 0; +} diff --git a/test/stdio/scanf_m.c b/test/stdio/scanf_m.c new file mode 100644 index 000000000..0ce78b6e4 --- /dev/null +++ b/test/stdio/scanf_m.c @@ -0,0 +1,24 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int main(void) +{ + const char *buf = "hello world"; + char *ps = NULL, *pc = NULL; + char s[6], c; + + /* Check that %[...]/%c work. */ + sscanf(buf, "%[a-z] %c", s, &c); + /* Check that %m[...]/%mc work. */ + sscanf(buf, "%m[a-z] %mc", &ps, &pc); + + if (strcmp(ps, "hello") != 0 || *pc != 'w' || + strcmp(s, "hello") != 0 || c != 'w') + return 1; + + free(ps); + free(pc); + + return 0; +} diff --git a/test/stdio/tst-fmemopen.c b/test/stdio/tst-fmemopen.c new file mode 100644 index 000000000..384faa1c9 --- /dev/null +++ b/test/stdio/tst-fmemopen.c @@ -0,0 +1,53 @@ +#include <string.h> +#include <stdio.h> +#include <stdlib.h> + +static char *text_input = "1 23 43"; + +static const char *good_answer = "1 529 1849 "; + + +static int +do_test (void) +{ + FILE *out, *in; + int v, s; + size_t size; + char *ptr; + + in = fmemopen(text_input, strlen(text_input), "r"); + if (in == NULL) { + perror("fmemopen"); + return 1; + } + + out = open_memstream(&ptr, &size); + if (out == NULL) { + perror("open_memstream"); + return 1; + } + + for (;;) { + s = fscanf(in, "%d", &v); + if (s <= 0) + break; + + s = fprintf(out, "%d ", v * v); + if (s == -1) { + puts("fprintf failed"); + exit(1); + } + } + fclose(in); + fclose(out); + + if (size != strlen(good_answer) || strcmp(good_answer, ptr) != 0) { + printf("failed: size=%zu; ptr=%s\n", size, ptr); + exit(1); + } + free(ptr); + exit(0); +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/stdlib/Makefile b/test/stdlib/Makefile index efec56d70..567e0e37a 100644 --- a/test/stdlib/Makefile +++ b/test/stdlib/Makefile @@ -1,9 +1,8 @@ # uClibc stdlib tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -DODIFF_qsort := 1 -DODIFF_testatexit := 1 -DODIFF_teston_exit := 1 -DODIFF_teststrtol := 1 diff --git a/test/stdlib/Makefile.in b/test/stdlib/Makefile.in new file mode 100644 index 000000000..91dfde412 --- /dev/null +++ b/test/stdlib/Makefile.in @@ -0,0 +1,19 @@ +# uClibc stdlib tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +DODIFF_qsort := 1 +DODIFF_testatexit := 1 +DODIFF_teston_exit := 1 +DODIFF_teststrtol := 1 + +TESTS_DISABLED := +ifeq ($(UCLIBC_HAS_PTY),) +TESTS_DISABLED += ptytest +endif +ifeq ($(UCLIBC_HAS_ARC4RANDOM),) +TESTS_DISABLED += testarc4random +endif + +CFLAGS_test-canon = -fPIC +CFLAGS_test-canon2 = -fPIC +CFLAGS_testatexit = -fPIC diff --git a/test/stdlib/qsort.c b/test/stdlib/qsort.c index abc505e2d..74f93315f 100644 --- a/test/stdlib/qsort.c +++ b/test/stdlib/qsort.c @@ -34,7 +34,15 @@ int main(void) printf("[%d] %s\n", i, dirbuf->d_name); } printf("\nCalling qsort()\n"); - qsort(array, numdir, sizeof(struct dirent *), alphasort); + /* Even though some manpages say that alphasort should be + * int alphasort(const void *a, const void *b), + * in reality glibc and uclibc have const struct dirent** + * instead of const void*. + * Therefore we get a warning here unless we use a cast, + * which makes people think that alphasort prototype + * needs to be fixed in uclibc headers. + */ + qsort(array, numdir, sizeof(struct dirent *), (void*) alphasort); for (i = 0; i < numdir; ++i) { dirbuf = array[i]; printf("[%d] %s\n", i, dirbuf->d_name); diff --git a/test/stdlib/test-canon.c b/test/stdlib/test-canon.c index 9770a948d..1b43dedfb 100644 --- a/test/stdlib/test-canon.c +++ b/test/stdlib/test-canon.c @@ -15,9 +15,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ /* This file must be run from within a directory called "stdlib". */ @@ -28,10 +27,11 @@ #include <string.h> #include <unistd.h> #include <sys/param.h> +#include <sys/stat.h> /* Prototype for our test function. */ extern int do_test (int argc, char *argv[]); -#include <test-skeleton.c> +#include "../test-skeleton.c" #ifndef PATH_MAX # define PATH_MAX 4096 diff --git a/test/stdlib/test-canon2.c b/test/stdlib/test-canon2.c new file mode 100644 index 000000000..4a03b2d48 --- /dev/null +++ b/test/stdlib/test-canon2.c @@ -0,0 +1,86 @@ +/* Test for realpath/canonicalize function. + Copyright (C) 1998 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, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <string.h> + + +/* 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 + +#include <test-skeleton.c> + +/* Name of the temporary files we create. */ +char *name1; +char *name2; + +/* Preparation. */ +void +do_prepare (int argc, char *argv[]) +{ + size_t test_dir_len; + int tfd; + + test_dir_len = strlen (test_dir); + + /* Generate the circular symlinks. */ + name1 = malloc (test_dir_len + sizeof ("/canonXXXXXX")); + mempcpy (mempcpy (name1, test_dir, test_dir_len), + "/canonXXXXXX", sizeof ("/canonXXXXXX")); + name2 = strdup (name1); + tfd = mkstemp(name1); + if (tfd < 0) { + printf("%s: cannot generate temp file name\n", __FUNCTION__); + exit(1); + } + close(tfd); + add_temp_file (name1); + tfd = mkstemp(name2); + if (tfd < 0) { + printf("%s: cannot generate temp file name\n", __FUNCTION__); + exit(1); + } + close(tfd); + add_temp_file (name2); +} + + +/* Run the test. */ +int +do_test (int argc, char *argv[]) +{ + char *canon; + + printf ("create symlinks from %s to %s and vice versa\n", name1, name2); + if (symlink (name1, name2) == -1 + || symlink (name2, name1) == -1) + /* We cannot test this. */ + return 0; + + /* Call the function. This is equivalent the using `realpath' but the + function allocates the room for the result. */ + errno = 0; + canon = canonicalize_file_name (name1); + + return canon != NULL || errno != ELOOP; +} diff --git a/test/stdlib/test-mkostemp-O_CLOEXEC.c b/test/stdlib/test-mkostemp-O_CLOEXEC.c new file mode 100644 index 000000000..9ff229af1 --- /dev/null +++ b/test/stdlib/test-mkostemp-O_CLOEXEC.c @@ -0,0 +1,45 @@ +#define _XOPEN_SOURCE_EXTENDED +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <sys/wait.h> +#include <errno.h> + +#if !defined __ARCH_USE_MMU__ +# define fork vfork +#endif + +int main(int argc, char *argv[]) { + int fd, status; + char buff[5]; + char template[] = "/tmp/test-mkostemp.XXXXXX"; + + fd = mkostemp(template, O_CLOEXEC); + unlink(template); + + snprintf(buff, 5, "%d", fd); + + if(!fork()) + if(execl("./test-mkostemp-child", "test-mkostemp-child", buff, NULL) == -1) + exit(EXIT_FAILURE); + + wait(&status); + + memset(buff, 0, 5); + lseek(fd, 0, SEEK_SET); + errno = 0; + if(read(fd, buff, 5) == -1) + exit(EXIT_FAILURE); + + if(!strncmp(buff, "test", 5)) + exit(EXIT_FAILURE); + else + exit(EXIT_SUCCESS); + + close(fd); + exit(EXIT_SUCCESS); +} diff --git a/test/stdlib/test-mkostemp-child.c b/test/stdlib/test-mkostemp-child.c new file mode 100644 index 000000000..708bd80a1 --- /dev/null +++ b/test/stdlib/test-mkostemp-child.c @@ -0,0 +1,22 @@ +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +int main(int argc, char *argv[]) { + int fd; + + /* This file gets built and run as a test, but its + * really just a helper for test-mkostemp-O_CLOEXEC.c. + * So, we'll always return succcess. + */ + if(argc != 2) + exit(EXIT_SUCCESS); + + sscanf(argv[1], "%d", &fd); + + if(write(fd, "test\0", 5) == -1) + ; /* Don't Panic! Failure is okay here. */ + + close(fd); + exit(EXIT_SUCCESS); +} diff --git a/test/stdlib/testarc4random.c b/test/stdlib/testarc4random.c new file mode 100644 index 000000000..14ff1cc36 --- /dev/null +++ b/test/stdlib/testarc4random.c @@ -0,0 +1,10 @@ +#include <stdlib.h> +#include <stdio.h> + +int main(void) +{ + int random_number; + random_number = arc4random() % 65536; + printf("%d\n", random_number); + return 0; +} diff --git a/test/stdlib/teststrtoq.c b/test/stdlib/teststrtoq.c new file mode 100644 index 000000000..6e1a4cbc6 --- /dev/null +++ b/test/stdlib/teststrtoq.c @@ -0,0 +1,89 @@ + +#include <stdlib.h> +#include <stdio.h> + + +const char *strings[]={ + /* some simple stuff */ + "0", "1", "10", + "100", "1000", "10000", "100000", "1000000", + "10000000", "100000000", "1000000000", + + /* negative */ + "-0", "-1", "-10", + "-100", "-1000", "-10000", "-100000", "-1000000", + "-10000000", "-100000000", "-1000000000", + + /* test base>10 */ + "a", "b", "f", "g", "z", + + /* test hex */ + "0x0", "0x1", "0xa", "0xf", "0x10", + + /* test octal */ + "00", "01", "07", "08", "0a", "010", + + /* other */ + "0x8000000", + + /* check overflow cases: (for 32 bit) */ + "2147483645", + "2147483646", + "2147483647", + "2147483648", + "2147483649", + "-2147483645", + "-2147483646", + "-2147483647", + "-2147483648", + "-2147483649", + "4294967293", + "4294967294", + "4294967295", + "4294967296", + "4294967297", + "-4294967293", + "-4294967294", + "-4294967295", + "-4294967296", + "-4294967297", + + /* bad input tests */ + "", + "00", + "0x", + "0x0", + "-", + "+", + " ", + " -", + " - 0", +}; +int n_tests=sizeof(strings)/sizeof(strings[0]); + + + +void do_test(int base); +void do_test(int base) +{ + int i; + quad_t n; + char *endptr; + + for(i=0;i<n_tests;i++){ + n=strtoq(strings[i],&endptr,base); + printf("strtoq(\"%s\",%d) len=%lu res=%qd\n", + strings[i],base,(unsigned long)(endptr-strings[i]),n); + } +} + +int main(int argc,char *argv[]) +{ + do_test(0); + do_test(8); + do_test(10); + do_test(16); + do_test(36); + + return 0; +} diff --git a/test/string/Makefile b/test/string/Makefile index a18d52e93..8948a50e3 100644 --- a/test/string/Makefile +++ b/test/string/Makefile @@ -1,6 +1,8 @@ # uClibc string tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -EXTRA_CFLAGS := -fno-builtin diff --git a/test/string/Makefile.in b/test/string/Makefile.in new file mode 100644 index 000000000..39fb91210 --- /dev/null +++ b/test/string/Makefile.in @@ -0,0 +1,8 @@ +# uClibc string tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +EXTRA_CFLAGS := -fno-builtin + +ifeq ($(TARGET_ARCH),h8300) +TESTS_DISABLED += stratcliff +endif diff --git a/test/string/stratcliff.c b/test/string/stratcliff.c index 41e774681..b45be4bde 100644 --- a/test/string/stratcliff.c +++ b/test/string/stratcliff.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #define _GNU_SOURCE 1 diff --git a/test/string/test-ffs.c b/test/string/test-ffs.c index 86e11758d..e43f12360 100644 --- a/test/string/test-ffs.c +++ b/test/string/test-ffs.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <stdio.h> diff --git a/test/string/testcopy.c b/test/string/testcopy.c index 60039f790..51c47a174 100644 --- a/test/string/testcopy.c +++ b/test/string/testcopy.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <stdio.h> diff --git a/test/string/tester.c b/test/string/tester.c index ac1b90118..7f3ff2865 100644 --- a/test/string/tester.c +++ b/test/string/tester.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -427,6 +426,7 @@ test_strncmp (void) 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", "abc", (size_t)-2) == 0, 15); + check (strncmp ("aa", "ab", (size_t)-1) < 0, 16); } static void diff --git a/test/string/tst-bswap.c b/test/string/tst-bswap.c index b2b4ef08d..52a271814 100644 --- a/test/string/tst-bswap.c +++ b/test/string/tst-bswap.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <byteswap.h> #include <stdio.h> diff --git a/test/string/tst-inlcall.c b/test/string/tst-inlcall.c index 2a4124ea5..7e2eba37e 100644 --- a/test/string/tst-inlcall.c +++ b/test/string/tst-inlcall.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #ifndef _GNU_SOURCE #define _GNU_SOURCE diff --git a/test/termios/Makefile b/test/termios/Makefile index 2aa6ccd90..098cca6e0 100644 --- a/test/termios/Makefile +++ b/test/termios/Makefile @@ -1,4 +1,8 @@ # uClibc termios tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak diff --git a/test/test-skeleton.c b/test/test-skeleton.c index adfc8b75b..4f2680485 100644 --- a/test/test-skeleton.c +++ b/test/test-skeleton.c @@ -14,10 +14,10 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ +#include <assert.h> #include <errno.h> #include <getopt.h> #include <malloc.h> @@ -44,19 +44,6 @@ # define TEST_DATA_LIMIT (64 << 20) /* Data limit (bytes) to run with. */ #endif -#define OPT_DIRECT 1000 -#define OPT_TESTDIR 1001 - -static struct option options[] = -{ -#ifdef CMDLINE_OPTIONS - CMDLINE_OPTIONS -#endif - { "direct", no_argument, NULL, OPT_DIRECT }, - { "test-dir", required_argument, NULL, OPT_TESTDIR }, - { NULL, 0, NULL, 0 } -}; - /* PID of the test itself. */ static pid_t pid; @@ -67,7 +54,7 @@ static const char *test_dir; struct temp_name_list { struct qelem q; - const char *name; + char *name; } *temp_name_list; /* Add temporary files in list. */ @@ -77,14 +64,17 @@ add_temp_file (const char *name) { struct temp_name_list *newp = (struct temp_name_list *) calloc (sizeof (*newp), 1); - if (newp != NULL) + char *newname = strdup (name); + if (newp != NULL && newname != NULL) { - newp->name = name; + newp->name = newname; if (temp_name_list == NULL) temp_name_list = (struct temp_name_list *) &newp->q; else insque (newp, temp_name_list); } + else + free (newp); } /* Delete all temporary files. */ @@ -94,17 +84,25 @@ delete_temp_files (void) while (temp_name_list != NULL) { remove (temp_name_list->name); - temp_name_list = (struct temp_name_list *) temp_name_list->q.q_forw; + free (temp_name_list->name); + + struct temp_name_list *next + = (struct temp_name_list *) temp_name_list->q.q_forw; + free (temp_name_list); + temp_name_list = next; } } -/* Create a temporary file. */ +/* Create a temporary file. Return the opened file descriptor on + success, or -1 on failure. Write the file name to *FILENAME if + FILENAME is not NULL. In this case, the caller is expected to free + *FILENAME. */ static int __attribute__ ((unused)) create_temp_file (const char *base, char **filename) { char *fname; - int fd; + int _fd; fname = (char *) malloc (strlen (test_dir) + 1 + strlen (base) + sizeof ("XXXXXX")); @@ -115,8 +113,8 @@ create_temp_file (const char *base, char **filename) } strcpy (stpcpy (stpcpy (stpcpy (fname, test_dir), "/"), base), "XXXXXX"); - fd = mkstemp (fname); - if (fd == -1) + _fd = mkstemp (fname); + if (_fd == -1) { printf ("cannot open temporary file '%s': %s\n", fname, strerror(errno)); free (fname); @@ -126,25 +124,33 @@ create_temp_file (const char *base, char **filename) add_temp_file (fname); if (filename != NULL) *filename = fname; + else + free (fname); - return fd; + return _fd; } /* Timeout handler. We kill the child and exit with an error. */ static void __attribute__ ((noreturn)) -timeout_handler (int sig __attribute__ ((unused))) +signal_handler (int sig __attribute__ ((unused))) { int killed = 0; int status; + int i; - /* Send signal. */ + assert (pid > 1); + /* Kill the whole process group. */ + kill (-pid, SIGKILL); + /* In case setpgid failed in the child, kill it individually too. */ kill (pid, SIGKILL); /* Wait for it to terminate. */ - int i; for (i = 0; i < 5; ++i) { +#ifdef __UCLIBC_HAS_REALTIME__ + struct timespec ts; +#endif killed = waitpid (pid, &status, WNOHANG|WUNTRACED); if (killed != 0) break; @@ -153,10 +159,14 @@ 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; +#ifdef __UCLIBC_HAS_REALTIME__ ts.tv_sec = 0; ts.tv_nsec = 100000000; nanosleep (&ts, NULL); +#else + /* No nanosleep, just sleep 1s instead of 0.1s */ + sleep(1); +#endif } if (killed != 0 && killed != pid) { @@ -168,6 +178,12 @@ timeout_handler (int sig __attribute__ ((unused))) CLEANUP_HANDLER; #endif + if (sig == SIGINT) + { + signal (sig, SIG_DFL); + raise (sig); + } + /* If we expected this signal: good! */ #ifdef EXPECTED_SIGNAL if (EXPECTED_SIGNAL == SIGALRM) @@ -190,6 +206,18 @@ timeout_handler (int sig __attribute__ ((unused))) exit (1); } +#ifdef __XXX_HANDLE_CTRL_C +static void +__attribute__ ((noreturn)) +handler_killpid(int sig) +{ + kill(pid, SIGKILL); /* kill test */ + signal(sig, SIG_DFL); + raise(sig); /* kill ourself */ + _exit(128 + sig); /* paranoia */ +} +#endif + /* We provide the entry point here. */ int main (int argc, char *argv[]) @@ -203,6 +231,7 @@ main (int argc, char *argv[]) int opt; unsigned int timeoutfactor = 1; pid_t termpid; + char *envstr_timeoutfactor; /* Make uses of freed and uninitialized memory known. */ #ifdef __MALLOC_STANDARD__ @@ -216,15 +245,18 @@ main (int argc, char *argv[]) setbuf (stdout, NULL); #endif - while ((opt = getopt_long (argc, argv, "+", options, NULL)) != -1) +# ifndef CMDLINE_OPTIONS +# define CMDLINE_OPTIONS "" +# endif + while ((opt = getopt (argc, argv, "+dt:" CMDLINE_OPTIONS)) >= 0) switch (opt) { case '?': exit (1); - case OPT_DIRECT: + case 'd': direct = 1; break; - case OPT_TESTDIR: + case 't': test_dir = optarg; break; #ifdef CMDLINE_PROCESS @@ -234,7 +266,7 @@ main (int argc, char *argv[]) /* If set, read the test TIMEOUTFACTOR value from the environment. This value is used to scale the default test timeout values. */ - char *envstr_timeoutfactor = getenv ("TIMEOUTFACTOR"); + envstr_timeoutfactor = getenv ("TIMEOUTFACTOR"); if (envstr_timeoutfactor != NULL) { char *envstr_conv = envstr_timeoutfactor; @@ -293,6 +325,9 @@ main (int argc, char *argv[]) if (pid == 0) { /* This is the child. */ +#ifdef RLIMIT_DATA + struct rlimit data_limit; +#endif #ifdef RLIMIT_CORE /* Try to avoid dumping core. */ struct rlimit core_limit; @@ -303,7 +338,6 @@ main (int argc, char *argv[]) #ifdef RLIMIT_DATA /* Try to avoid eating all memory if a test leaks. */ - struct rlimit data_limit; if (getrlimit (RLIMIT_DATA, &data_limit) == 0) { if (TEST_DATA_LIMIT == RLIM_INFINITY) @@ -320,7 +354,8 @@ main (int argc, char *argv[]) /* We put the test process in its own pgrp so that if it bogusly generates any job control signals, they won't hit the whole build. */ - setpgid (0, 0); + if (setpgid (0, 0) != 0) + printf ("Failed to set the process group ID: %m\n"); /* Execute the test function and exit with the return value. */ exit (TEST_FUNCTION); @@ -332,14 +367,23 @@ main (int argc, char *argv[]) exit (1); } +#ifdef __XXX_HANDLE_CTRL_C + signal (SIGTERM, handler_killpid); + signal (SIGINT, handler_killpid); + signal (SIGQUIT, handler_killpid); +#endif + /* Set timeout. */ #ifndef TIMEOUT /* Default timeout is two seconds. */ # define TIMEOUT 2 #endif - signal (SIGALRM, timeout_handler); + signal (SIGALRM, signal_handler); alarm (TIMEOUT * timeoutfactor); + /* Make sure we clean up if the wrapper gets interrupted. */ + signal (SIGINT, signal_handler); + /* Wait for the regular termination. */ termpid = TEMP_FAILURE_RETRY (waitpid (pid, &status, 0)); if (termpid == -1) diff --git a/test/testsuite.h b/test/testsuite.h index afc45b0c0..84c78156a 100644 --- a/test/testsuite.h +++ b/test/testsuite.h @@ -27,11 +27,12 @@ void error_msg(int result, int line, const char* file, const char* command) { failures++; - printf("\nFAILED TEST %lu: \n\t%s\n", (unsigned long)test_number, command); + printf("\nFAILED TEST %lu: \n\t%s\nResult: %d", + (unsigned long)test_number, command, result); printf("AT LINE: %d, FILE: %s\n\n", line, file); } -void success_msg(int result, const char* command) +void success_msg(int result __attribute__((unused)), const char* command __attribute__((unused))) { #if 0 printf("passed test: %s == 0\n", command); diff --git a/test/time/Makefile b/test/time/Makefile index 8c6978f0d..fed45697b 100644 --- a/test/time/Makefile +++ b/test/time/Makefile @@ -1,13 +1,8 @@ # uClibc time tests # 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 - -ifneq ($(UCLIBC_HAS_XLOCALE),y) -TESTS_DISABLED += tst-ftime_l -endif - +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -CFLAGS_tst-strptime2 := -std=c99 diff --git a/test/time/Makefile.in b/test/time/Makefile.in new file mode 100644 index 000000000..8afc013d7 --- /dev/null +++ b/test/time/Makefile.in @@ -0,0 +1,25 @@ +# uClibc time tests +# 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 + +ifeq ($(TARGET_avr32),y) +TESTS_DISABLED += tst-timerfd +endif + +ifneq ($(UCLIBC_HAS_XLOCALE),y) +TESTS_DISABLED += tst-ftime_l +endif + +ifneq ($(UCLIBC_HAS_WCHAR)$(UCLIBC_HAS_LOCALE),yy) +TESTS_DISABLED += tst_wcsftime +endif + +CFLAGS_tst-strptime2 := -std=c99 +CFLAGS_tst-ctime = -fPIC +CFLAGS_tst-futimens1 = -fPIC +CFLAGS_tst-timerfd = -fPIC + +DODIFF_futimens1 := 1 +DODIFF_tst_wcsftime := 1 diff --git a/test/time/test_time.c b/test/time/test_time.c index 2ce819a3f..ab2931895 100644 --- a/test/time/test_time.c +++ b/test/time/test_time.c @@ -12,9 +12,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <stdlib.h> diff --git a/test/time/tst-ctime.c b/test/time/tst-ctime.c new file mode 100644 index 000000000..91d827aa2 --- /dev/null +++ b/test/time/tst-ctime.c @@ -0,0 +1,44 @@ +/* vi: set sw=4 ts=4: */ +/* testcase for ctime(3) with large time + * Copyright (C) 2010 David A Ramos <daramos@gustav.stanford.edu> + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#define MAX_POSITIVE(type) (~0 & ~((type) 1 << (sizeof(type)*8 - 1))) + +int do_test(int argc, char **argv) { + char *correct = 0, *s; + int status; + + /* need a very high positive number (e.g., max - 1024) */ + time_t test = MAX_POSITIVE(time_t) - 1024; + + s = asctime(localtime(&test)); + + if (s) { + // copy static buffer to heap + correct = malloc(strlen(s)+1); + strcpy(correct, s); + } + + s = ctime(&test); + + printf("ANSI:\t%suClibc:\t%s", correct, s); + + if (s != correct && strcmp(correct, s)) + status = EXIT_FAILURE; + else + status = EXIT_SUCCESS; + + if (correct) + free(correct); + + return status; +} + +#include <test-skeleton.c> diff --git a/test/time/tst-futimens1.c b/test/time/tst-futimens1.c new file mode 100644 index 000000000..2c25bd4de --- /dev/null +++ b/test/time/tst-futimens1.c @@ -0,0 +1,105 @@ +/* vi: set sw=4 ts=4: */ +/* testcase for futimens(2) + * Copyright (C) 2009 Bernhard Reutner-Fischer <uClibc@uClibc.org> + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> +#include <stdlib.h> +#include <fcntl.h> +#include <stdio.h> +#include <unistd.h> + +struct +{ + char *name; /* name of file to open */ + int flags; /* flags for file descriptor */ + const struct timespec ts[2]; + int err; /* expected errno */ +} tests [] = +{ + {"futimens.tst", (O_CREAT|O_TRUNC), {{0,0},{0,0}}, 0}, + {"futimens.tst", (O_CREAT|O_TRUNC), {{99,0},{0,0}}, 0}, + {"futimens.tst", (O_CREAT|O_TRUNC), {{0,99},{0,0}}, 0}, + {"futimens.tst", (O_CREAT|O_TRUNC), {{0,0},{99,0}}, 0}, + {"futimens.tst", (O_CREAT|O_TRUNC), {{0,0},{0,99}}, 0}, + {"futimens.tst", (O_CREAT|O_TRUNC), {{11,2},{3,4}}, 0}, +}; +int do_test(int argc, char **argv) { + char *name; + int i, errors; + errors = argc - argc + 0; + unsigned has_stat_nsec = 0; + { + struct stat probe; + /* Let's attempt an educated guess if this filesystem supports + * nanosecond mtime. */ + if ((!stat(".", &probe)) && probe.st_mtim.tv_nsec) + has_stat_nsec = 1; + else if ((!stat(argv[0], &probe)) && probe.st_mtim.tv_nsec) + has_stat_nsec = 1; + } + for (i=0; i < (int) (sizeof(tests)/sizeof(tests[0])); ++i) { + int err, fd; + struct stat sb; + name = tests[i].name; + if (*name != '.') + unlink(name); + fd = open(name, tests[i].flags, 0660); + if (fd < 0) + abort(); + errno = 0; + err = futimens(fd, tests[i].ts); + if ((errno && !err) || (!errno && err)) { + err = errno; + printf("FAILED test %d (errno and return value disagree)\n", i); + ++errors; + } else + err = errno; + if (err != tests[i].err) { + printf("FAILED test %d (expected errno %d, got %d)\n", + i, tests[i].err, err); + ++errors; + continue; + } + if (stat(name, &sb) < 0) { + printf("FAILED test %d (verification)\n", i); + ++errors; + continue; + } else { + unsigned wrong = tests[i].ts[0].tv_sec != sb.st_atim.tv_sec || + tests[i].ts[0].tv_nsec != sb.st_atim.tv_nsec || + tests[i].ts[1].tv_sec != sb.st_mtim.tv_sec || + tests[i].ts[1].tv_nsec != sb.st_mtim.tv_nsec; + if (wrong) { + if (tests[i].ts[0].tv_sec != sb.st_atim.tv_sec) { + printf("FAILED test %d (access time, sec: expected %ld, got %ld)\n", + i, tests[i].ts[0].tv_sec, sb.st_atim.tv_sec); + ++errors; + } + if (tests[i].ts[0].tv_nsec != sb.st_atim.tv_nsec) { + printf("FAILED test %d (access time, nsec: expected %ld, got %ld)\n", + i, tests[i].ts[0].tv_nsec, sb.st_atim.tv_nsec); + errors += has_stat_nsec; + } + + if (tests[i].ts[1].tv_sec != sb.st_mtim.tv_sec) { + printf("FAILED test %d (modification time, sec: expected %ld, got %ld)\n", + i, tests[i].ts[1].tv_sec, sb.st_mtim.tv_sec); + ++errors; + } + if (tests[i].ts[1].tv_nsec != sb.st_mtim.tv_nsec) { + printf("FAILED test %d (modification time, nsec: expected %ld, got %ld)\n", + i, tests[i].ts[1].tv_nsec, sb.st_mtim.tv_nsec); + errors += has_stat_nsec; + } + } + } + } + if (*name != '.') + unlink(name); + printf("%d errors.\n", errors); + return (!errors) ? EXIT_SUCCESS : EXIT_FAILURE; +} +#include <test-skeleton.c> diff --git a/test/time/tst-strptime.c b/test/time/tst-strptime.c index 6356aa0d4..32001d47e 100644 --- a/test/time/tst-strptime.c +++ b/test/time/tst-strptime.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <locale.h> #include <stdio.h> diff --git a/test/time/tst-timerfd.c b/test/time/tst-timerfd.c new file mode 100644 index 000000000..5562ed74f --- /dev/null +++ b/test/time/tst-timerfd.c @@ -0,0 +1,71 @@ +/* vi: set sw=4 ts=4 sts=4: */ +/* + * timerfd test for uClibc + * Copyright (C) 2012 by Kevin Cernekee <cernekee@gmail.com> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <error.h> +#include <signal.h> +#include <stdint.h> +#include <inttypes.h> +#include <time.h> +#include <sys/timerfd.h> +#include <sys/fcntl.h> + +static int +do_test(void) +{ + int fd, ret, result = 0; + struct itimerspec s; + uint64_t val; + time_t start, now; + + fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK); + if (fd < 0) { + perror("timerfd() failed"); + result = 1; + } + s.it_value.tv_sec = 1; + s.it_value.tv_nsec = 0; + s.it_interval.tv_sec = 0; + s.it_interval.tv_nsec = 0; + timerfd_settime(fd, 0, &s, NULL); + start = time(NULL); + + /* this should return immediately with EAGAIN due to TFD_NONBLOCK */ + ret = read(fd, &val, sizeof(val)); + if (ret != -1 || errno != EAGAIN) { + error(0, 0, "first read() returned %d", ret); + result = 1; + } + + /* let the timer expire, then check it again */ + do { + now = time(NULL); + } while (now - start < 2); + + ret = read(fd, &val, sizeof(val)); + if (ret != sizeof(val)) { + error(0, 0, "second read() returned %d", ret); + result = 1; + } + + /* we are expecting a single expiration, since it_interval is 0 */ + if (val != 1) { + error(0, 0, "wrong number of expirations: %" PRIx64, val); + result = 1; + } + + return result; +} + +#define TIMEOUT 5 +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/time/tst-timezone.c b/test/time/tst-timezone.c index 4c879163c..e89be0b06 100644 --- a/test/time/tst-timezone.c +++ b/test/time/tst-timezone.c @@ -13,9 +13,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <time.h> #include <stdio.h> diff --git a/test/time/tst_wcsftime.c b/test/time/tst_wcsftime.c index 6e35f1e6f..5631d952a 100644 --- a/test/time/tst_wcsftime.c +++ b/test/time/tst_wcsftime.c @@ -1,39 +1,65 @@ #include <stdio.h> #include <time.h> #include <features.h> -#ifdef __UCLIBC_HAS_WCHAR__ #include <wchar.h> +#include <locale.h> + +#define NUM_OF_DATES 7 +#define NUM_OF_LOCALES 3 +#define BUF_SIZE 256 int -main (int argc, char *argv[]) +main (void) { - wchar_t buf[200]; - time_t t; + wchar_t buf[BUF_SIZE]; struct tm *tp; - int result = 0; + time_t time_list[NUM_OF_DATES] = { + 500, 68200000, 694223999, + 694224000, 704900000, 705000000, + 705900000 + }; + char *locale_list[NUM_OF_LOCALES] = { + "C", + "fr_FR.ISO-8859-1", + "ja_JP.UTF-8" + }; + int result = 0, ddd, lll; size_t n; - time (&t); - tp = gmtime (&t); + for (lll = 0; lll < NUM_OF_LOCALES; lll++) { + printf ("\nUsing locale: %s\n", locale_list[lll]); + char* set = setlocale(LC_ALL, locale_list[lll]); + if (set == NULL) { + printf ("FAILED!\n\n"); + continue; + } else + printf ("\n"); + for (ddd = 0; ddd < NUM_OF_DATES; ddd++) { + tp = localtime(&time_list[ddd]); + printf ("%ld corresponds to ", time_list[ddd]); - n = wcsftime (buf, sizeof (buf) / sizeof (buf[0]), - L"%H:%M:%S %Y-%m-%d\n", tp); - if (n != 21) - result = 1; + n = wcsftime (buf, sizeof (buf) / sizeof (buf[0]), + L"%H:%M:%S %Y-%m-%d%n", tp); + if (n != 21) { + result = 1; + printf ("FAILED!\n"); + } - wprintf (L"It is now %ls", buf); + printf ("%ls", buf); - wcsftime (buf, sizeof (buf) / sizeof (buf[0]), L"%A\n", tp); + wcsftime (buf, sizeof (buf) / sizeof (buf[0]), + L"%tor, as %%D %%T: %D %T%n", tp); + printf ("%ls", buf); - wprintf (L"The weekday is %ls", buf); + wcsftime (buf, sizeof (buf) / sizeof (buf[0]), L"%A (%a)%n", tp); + printf ("The weekday was %ls", buf); + wcsftime (buf, sizeof (buf) / sizeof (buf[0]), L"%B (%b) %Y%n", tp); + /* glibc bug? forgets aigu from french february février + * See s/printf (/wprintf (L/g */ + //wprintf (L"Month was %ls", buf); + printf ("Month was %ls", buf); + } + } return result; } - -#else -int main(void) -{ - puts("Test requires WCHAR support; skipping"); - return 0; -} -#endif diff --git a/test/tls/Makefile b/test/tls/Makefile new file mode 100644 index 000000000..607fec2c9 --- /dev/null +++ b/test/tls/Makefile @@ -0,0 +1,8 @@ +# uClibc TLS tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in +include ../Test.mak diff --git a/test/tls/Makefile.in b/test/tls/Makefile.in new file mode 100644 index 000000000..6e193a996 --- /dev/null +++ b/test/tls/Makefile.in @@ -0,0 +1,150 @@ +# uClibc TLS tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +TESTS := tst-tls1 tst-tls2 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 \ + tst-tls8 tst-tls9 tst-tls10 tst-tls11 tst-tls12 tst-tls13 \ + tst-tls14 tst-tls15 tst-tls16 tst-tls17 tst-tls18 tst-tls-at-ctor \ + tst-tls1-static tst-tls2-static tst-tls9-static +TESTS_DISABLED := tst-tls1-static tst-tls2-static tst-tls9-static + +# test always fails for every architecture, +# guessing some unimplemented check or feature +TESTS_DISABLED += tst-tls16 + +#all these tests require shared libraries +ifeq ($(HAVE_SHARED),) +TESTS_DISABLED := $(TESTS) +endif + +# All these tests need tls.h, which is not installed with glibc +GLIBC_TESTS_DISABLED := $(addsuffix _glibc,$(filter-out $(TESTS_DISABLED),$(TESTS))) + + +PTDIR := $(top_builddir)libpthread/nptl +SYSDEPS_DIR := $(top_srcdir)libc/sysdeps + +EXTRA_CFLAGS := -DNOT_IN_libc=1 \ + -std=gnu99 -I. \ + -I$(SYSDEPS_DIR)/linux \ + -I$(SYSDEPS_DIR)/linux/$(TARGET_ARCH) \ + -I$(PTDIR) \ + -I$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH) \ + -I$(PTDIR)/sysdeps/$(TARGET_ARCH) \ + -I$(PTDIR)/sysdeps/unix/sysv/linux \ + -I$(PTDIR)/sysdeps/pthread \ + -I$(PTDIR)/sysdeps/pthread/bits \ + -I$(PTDIR)/sysdeps/generic \ + -I$(top_builddir)ldso/include \ + -I$(top_builddir)ldso/ldso/$(TARGET_ARCH) \ + -I$(top_builddir)include \ + -include $(top_builddir)include/libc-symbols.h + +tlsmod17a-suffixes := 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 +tlsmod18a-suffixes := 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 +CFLAGS_tst-tlsmod1.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod2.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod3.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod4.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod5.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod6.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod7.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod8.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod9.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod10.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod11.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod12.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod13.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod13a.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod14a.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod14b.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod15a.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod15b.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod16a.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod16b.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod17a.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod17b.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod18a.so := -fPIC -DSHARED -shared +CFLAGS_tst-tlsmod-at-ctor.so := -fPIC -DSHARED -shared + +LDFLAGS_tst-tlsmod1.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod2.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod3.so := -shared -static-libgcc -L$(top_builddir)lib \ + tst-tlsmod2.so +LDFLAGS_tst-tlsmod4.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod5.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod6.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod7.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod8.so := -shared -static-libgcc -L$(top_builddir)lib \ + tst-tlsmod7.so +LDFLAGS_tst-tlsmod9.so := -shared -static-libgcc -L$(top_builddir)lib \ + tst-tlsmod8.so +LDFLAGS_tst-tlsmod10.so := -shared -static-libgcc -L$(top_builddir)lib \ + tst-tlsmod9.so +LDFLAGS_tst-tlsmod11.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod12.so := -shared -static-libgcc -L$(top_builddir)lib \ + tst-tlsmod11.so +LDFLAGS_tst-tlsmod13.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod13a.so := -shared -static-libgcc -L$(top_builddir)lib \ + tst-tlsmod13.so +LDFLAGS_tst-tlsmod14a.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod14b.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod15a.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod15b.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod16a.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod16b.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod17a.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod17b.so := -shared -static-libgcc -L$(top_builddir)lib \ + $(patsubst %,tst-tlsmod17a%.so,$(tlsmod17a-suffixes)) +LDFLAGS_tst-tlsmod18a.so := -shared -static-libgcc -L$(top_builddir)lib +LDFLAGS_tst-tlsmod-at-ctor.so := -shared -static-libgcc -L$(top_builddir)lib + +LDFLAGS_tst-tls3 := tst-tlsmod1.so tst-tlsmod4.so +LDFLAGS_tst-tls4 := -ldl +LDFLAGS_tst-tls5 := -ldl +LDFLAGS_tst-tls6 := -ldl +LDFLAGS_tst-tls7 := -ldl +LDFLAGS_tst-tls8 := -ldl +LDFLAGS_tst-tls9 := -ldl +LDFLAGS_tst-tls10 := -Wl,-rpath-link=. tst-tlsmod8.so tst-tlsmod7.so +LDFLAGS_tst-tls11 := -Wl,-rpath-link=. tst-tlsmod9.so tst-tlsmod10.so +LDFLAGS_tst-tls12 := -Wl,-rpath-link=. tst-tlsmod11.so tst-tlsmod12.so +LDFLAGS_tst-tls13 := -ldl -Wl,-rpath-link=. +LDFLAGS_tst-tls14 := -ldl -Wl,-rpath-link=. tst-tlsmod14a.so +LDFLAGS_tst-tls15 := -ldl -Wl,-rpath-link=. +LDFLAGS_tst-tls16 := -ldl -Wl,-rpath-link=. +LDFLAGS_tst-tls17 := -ldl -Wl,-rpath-link=. +LDFLAGS_tst-tls18 := -ldl -Wl,-rpath-link=. +LDFLAGS_tst-tls-at-ctor := tst-tlsmod-at-ctor.so + +tst-tls3: tst-tlsmod1.so tst-tlsmod4.so +tst-tls4: tst-tlsmod2.so +tst-tls5: tst-tlsmod2.so +tst-tls6: tst-tlsmod2.so +tst-tls7: tst-tlsmod2.so tst-tlsmod3.so +tst-tls8: tst-tlsmod2.so tst-tlsmod3.so tst-tlsmod4.so +tst-tls9: tst-tlsmod5.so tst-tlsmod6.so +tst-tls10: tst-tlsmod7.so tst-tlsmod8.so +tst-tls11: tst-tlsmod9.so tst-tlsmod10.so +tst-tls12: tst-tlsmod11.so tst-tlsmod12.so +tst-tls13: tst-tlsmod13.so tst-tlsmod13a.so +tst-tls14: tst-tlsmod14a.so tst-tlsmod14b.so +tst-tls15: tst-tlsmod15b.so +tst-tls16: tst-tlsmod16a.so tst-tlsmod16b.so +tst-tls17: tst-tlsmod17b.so +tst-tlsmod17b.so: $(patsubst %,tst-tlsmod17a%.so,$(tlsmod17a-suffixes)) +tst-tlsmod17a%.so: tst-tlsmod17a.c + $(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_tst-tlsmod17a.so) $< -o $@ \ + -DN=$* -Wl,-soname,$@ $(LDFLAGS) $(EXTRA_LIBS) \ + $(LDFLAGS_tst-tlsmod17a.so) +tst-tls18: $(patsubst %,tst-tlsmod18a%.so,$(tlsmod18a-suffixes)) +tst-tlsmod18a%.so: tst-tlsmod18a.c + $(Q)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_tst-tlsmod18a.so) $< -o $@ \ + -DN=$* -Wl,-soname,$@ $(LDFLAGS) $(EXTRA_LIBS) \ + $(LDFLAGS_tst-tlsmod18a.so) +tst-tls-at-ctor: tst-tlsmod-at-ctor.so + +ifeq ($(TARGET_ARCH),mips) +RET_tst-tls15 := 1 +endif + +WRAPPER := env LD_LIBRARY_PATH="$$PWD:.:$(LD_LIBRARY_PATH)" diff --git a/test/tls/README b/test/tls/README new file mode 100644 index 000000000..06c9eb743 --- /dev/null +++ b/test/tls/README @@ -0,0 +1,8 @@ +These tests were imported from 'glibc/elf' and are responsible for testing +the TLS functionality of the dynamic loader. The file 'tls-macros-mips.h' +is a copy of 'glibc/sysdeps/mips/tls-macros.h'. Dependency and link orders +are critical and should NOT be changed. Even if you think you know what +you are doing, do not touch the Makefile without posting to the uClibc +development mailing list. + +-Steve <sjhill@uclibc.org> diff --git a/test/tls/tls-macros-arm.h b/test/tls/tls-macros-arm.h new file mode 100644 index 000000000..13d0f9752 --- /dev/null +++ b/test/tls/tls-macros-arm.h @@ -0,0 +1,51 @@ +#define TLS_LE(x) \ + ({ int *__result; \ + void *tp = __builtin_thread_pointer (); \ + __asm__ ("ldr %0, 1f; " \ + "add %0, %1, %0; " \ + "b 2f; " \ + "1: .word " #x "(tpoff); " \ + "2: " \ + : "=&r" (__result) : "r" (tp)); \ + __result; }) + +#define TLS_IE(x) \ + ({ int *__result; \ + void *tp = __builtin_thread_pointer (); \ + __asm__ ("ldr %0, 1f; " \ + "3: ldr %0, [pc, %0];" \ + "add %0, %1, %0; " \ + "b 2f; " \ + "1: .word " #x "(gottpoff) + (. - 3b - 8); " \ + "2: " \ + : "=&r" (__result) : "r" (tp)); \ + __result; }) + +#define TLS_LD(x) \ + ({ char *__result; \ + int __offset; \ + extern void *__tls_get_addr (void *); \ + __asm__ ("ldr %0, 2f; " \ + "1: add %0, pc, %0; " \ + "b 3f; " \ + "2: .word " #x "(tlsldm) + (. - 1b - 8); " \ + "3: " \ + : "=r" (__result)); \ + __result = (char *)__tls_get_addr (__result); \ + __asm__ ("ldr %0, 1f; " \ + "b 2f; " \ + "1: .word " #x "(tlsldo); " \ + "2: " \ + : "=r" (__offset)); \ + (int *) (__result + __offset); }) + +#define TLS_GD(x) \ + ({ int *__result; \ + extern void *__tls_get_addr (void *); \ + __asm__ ("ldr %0, 2f; " \ + "1: add %0, pc, %0; " \ + "b 3f; " \ + "2: .word " #x "(tlsgd) + (. - 1b - 8); " \ + "3: " \ + : "=r" (__result)); \ + (int *)__tls_get_addr (__result); }) diff --git a/test/tls/tls-macros-mips.h b/test/tls/tls-macros-mips.h new file mode 100644 index 000000000..eed0938f2 --- /dev/null +++ b/test/tls/tls-macros-mips.h @@ -0,0 +1,64 @@ +/* Macros to support TLS testing in times of missing compiler support. */ + +#include <sys/cdefs.h> +#include <sys/asm.h> + +#define __STRING2(X) __STRING(X) +#define ADDU __STRING2(PTR_ADDU) +#define ADDIU __STRING2(PTR_ADDIU) +#define LW __STRING2(PTR_L) + +/* Load the GOT pointer, which may not be in $28 in a non-PIC + (abicalls pic0) function. */ +#ifndef __PIC__ +# if _MIPS_SIM != _ABI64 +# define LOAD_GP "move %[tmp], $28\n\tla $28, __gnu_local_gp\n\t" +# else +# define LOAD_GP "move %[tmp], $28\n\tdla $28, __gnu_local_gp\n\t" +# endif +# define UNLOAD_GP "\n\tmove $28, %[tmp]" +#else +# define LOAD_GP +# define UNLOAD_GP +#endif + +# define TLS_GD(x) \ + ({ void *__result, *__tmp; \ + extern void *__tls_get_addr (void *); \ + __asm__ (LOAD_GP ADDIU " %0, $28, %%tlsgd(" #x ")" \ + UNLOAD_GP \ + : "=r" (__result), [tmp] "=&r" (__tmp)); \ + (int *)__tls_get_addr (__result); }) +# define TLS_LD(x) \ + ({ void *__result, *__tmp; \ + extern void *__tls_get_addr (void *); \ + __asm__ (LOAD_GP ADDIU " %0, $28, %%tlsldm(" #x ")" \ + UNLOAD_GP \ + : "=r" (__result), [tmp] "=&r" (__tmp)); \ + __result = __tls_get_addr (__result); \ + __asm__ ("lui $3,%%dtprel_hi(" #x ")\n\t" \ + "addiu $3,$3,%%dtprel_lo(" #x ")\n\t" \ + ADDU " %0,%0,$3" \ + : "+r" (__result) : : "$3"); \ + __result; }) +# define TLS_IE(x) \ + ({ void *__result, *__tmp; \ + __asm__ (".set push\n\t.set mips32r2\n\t" \ + "rdhwr\t%0,$29\n\t.set pop" \ + : "=v" (__result)); \ + __asm__ (LOAD_GP LW " $3,%%gottprel(" #x ")($28)\n\t" \ + ADDU " %0,%0,$3" \ + UNLOAD_GP \ + : "+r" (__result), [tmp] "=&r" (__tmp) \ + : : "$3"); \ + __result; }) +# define TLS_LE(x) \ + ({ void *__result; \ + __asm__ (".set push\n\t.set mips32r2\n\t" \ + "rdhwr\t%0,$29\n\t.set pop" \ + : "=v" (__result)); \ + __asm__ ("lui $3,%%tprel_hi(" #x ")\n\t" \ + "addiu $3,$3,%%tprel_lo(" #x ")\n\t" \ + ADDU " %0,%0,$3" \ + : "+r" (__result) : : "$3"); \ + __result; }) diff --git a/test/tls/tls-macros-thumb.h b/test/tls/tls-macros-thumb.h new file mode 100644 index 000000000..dfa6582a5 --- /dev/null +++ b/test/tls/tls-macros-thumb.h @@ -0,0 +1,57 @@ +#define TLS_LE(x) \ + ({ int *__result; \ + void *tp = __builtin_thread_pointer (); \ + __asm__ ("ldr %0, 1f; " \ + "add %0, %1, %0; " \ + "b 2f; " \ + ".align 2; " \ + "1: .word " #x "(tpoff); " \ + "2: " \ + : "=&r" (__result) : "r" (tp)); \ + __result; }) + +#define TLS_IE(x) \ + ({ int *__result; \ + int tmp; \ + void *tp = __builtin_thread_pointer (); \ + __asm__ ("ldr %0, 1f; " \ + "adr %1, 1f; " \ + "ldr %0, [%1, %0]; " \ + "add %0, %2, %0; " \ + "b 2f; " \ + ".align 2; " \ + "1: .word " #x "(gottpoff); " \ + "2: " \ + : "=&r" (__result), "=&r"(tmp) : "r" (tp)); \ + __result; }) + +#define TLS_LD(x) \ + ({ char *__result; \ + int __offset; \ + extern void *__tls_get_addr (void *); \ + __asm__ ("ldr %0, 2f; " \ + ".align 2; " \ + "1: add %0, pc, %0; " \ + "b 3f; " \ + "2: .word " #x "(tlsldm) + (. - 1b - 4); " \ + "3: " \ + : "=r" (__result)); \ + __result = (char *)__tls_get_addr (__result); \ + __asm__ ("ldr %0, 1f; " \ + "b 2f; " \ + "1: .word " #x "(tlsldo); " \ + "2: " \ + : "=r" (__offset)); \ + (int *) (__result + __offset); }) + +#define TLS_GD(x) \ + ({ int *__result; \ + extern void *__tls_get_addr (void *); \ + __asm__ ("ldr %0, 2f; " \ + ".align 2; " \ + "1: add %0, pc, %0; " \ + "b 3f; " \ + "2: .word " #x "(tlsgd) + (. - 1b - 4); " \ + "3: " \ + : "=r" (__result)); \ + (int *)__tls_get_addr (__result); }) diff --git a/test/tls/tls-macros.h b/test/tls/tls-macros.h new file mode 100644 index 000000000..e4d87f26d --- /dev/null +++ b/test/tls/tls-macros.h @@ -0,0 +1,1000 @@ +/* Macros to support TLS testing in times of missing compiler support. */ + +#define COMMON_INT_DEF(x) \ + __asm__ (".tls_common " #x ",4,4") +/* XXX Until we get compiler support we don't need declarations. */ +#define COMMON_INT_DECL(x) + +/* XXX This definition will probably be machine specific, too. */ +#define VAR_INT_DEF(x) \ + __asm__ (".section .tdata\n\t" \ + ".globl " #x "\n" \ + ".balign 4\n" \ + #x ":\t.long 0\n\t" \ + ".size " #x ",4\n\t" \ + ".previous") +/* XXX Until we get compiler support we don't need declarations. */ +#define VAR_INT_DECL(x) + +#ifdef __mips__ +#include <tls-macros-mips.h> +#endif + +#ifdef __arm__ +#ifdef __thumb__ +#include <tls-macros-thumb.h> +#else +#include <tls-macros-arm.h> +#endif +#endif + + /* XXX Each architecture must have its own asm for now. */ +#ifdef __i386__ +# define TLS_LE(x) \ + ({ int *__l; \ + __asm__ ("movl %%gs:0,%0\n\t" \ + "subl $" #x "@tpoff,%0" \ + : "=r" (__l)); \ + __l; }) + +# ifdef __PIC__ +# define TLS_IE(x) \ + ({ int *__l; \ + __asm__ ("movl %%gs:0,%0\n\t" \ + "subl " #x "@gottpoff(%%ebx),%0" \ + : "=r" (__l)); \ + __l; }) +# else +# define TLS_IE(x) \ + ({ int *__l; \ + __asm__ ("call 1f\n\t" \ + ".subsection 1\n" \ + "1:\tmovl (%%esp), %%ebx\n\t" \ + "ret\n\t" \ + ".previous\n\t" \ + "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \ + "movl %%gs:0,%0\n\t" \ + "subl " #x "@gottpoff(%%ebx),%0" \ + : "=r" (__l)); \ + __l; }) +# endif + +# ifdef __PIC__ +# define TLS_LD(x) \ + ({ int *__l, __c, __d; \ + __asm__ ("leal " #x "@tlsldm(%%ebx),%%eax\n\t" \ + "call ___tls_get_addr@plt\n\t" \ + "leal " #x "@dtpoff(%%eax), %%eax" \ + : "=a" (__l), "=&c" (__c), "=&d" (__d)); \ + __l; }) +# else +# define TLS_LD(x) \ + ({ int *__l, __b, __c, __d; \ + __asm__ ("call 1f\n\t" \ + ".subsection 1\n" \ + "1:\tmovl (%%esp), %%ebx\n\t" \ + "ret\n\t" \ + ".previous\n\t" \ + "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \ + "leal " #x "@tlsldm(%%ebx),%%eax\n\t" \ + "call ___tls_get_addr@plt\n\t" \ + "leal " #x "@dtpoff(%%eax), %%eax" \ + : "=a" (__l), "=&b" (__b), "=&c" (__c), "=&d" (__d)); \ + __l; }) +# endif + +# ifdef __PIC__ +# define TLS_GD(x) \ + ({ int *__l, __c, __d; \ + __asm__ ("leal " #x "@tlsgd(%%ebx),%%eax\n\t" \ + "call ___tls_get_addr@plt\n\t" \ + "nop" \ + : "=a" (__l), "=&c" (__c), "=&d" (__d)); \ + __l; }) +# else +# define TLS_GD(x) \ + ({ int *__l, __c, __d; \ + __asm__ ("call 1f\n\t" \ + ".subsection 1\n" \ + "1:\tmovl (%%esp), %%ebx\n\t" \ + "ret\n\t" \ + ".previous\n\t" \ + "addl $_GLOBAL_OFFSET_TABLE_, %%ebx\n\t" \ + "leal " #x "@tlsgd(%%ebx),%%eax\n\t" \ + "call ___tls_get_addr@plt\n\t" \ + "nop" \ + : "=a" (__l), "=&c" (__c), "=&d" (__d)); \ + __l; }) +# endif + +#elif defined __x86_64__ + +# define TLS_LE(x) \ + ({ int *__l; \ + __asm__ ("mov %%fs:0,%0\n\t" \ + "lea " #x "@tpoff(%0), %0" \ + : "=r" (__l)); \ + __l; }) + +# define TLS_IE(x) \ + ({ int *__l; \ + __asm__ ("mov %%fs:0,%0\n\t" \ + "add " #x "@gottpoff(%%rip),%0" \ + : "=r" (__l)); \ + __l; }) + +# define TLS_LD(x) \ + ({ int *__l, __c, __d; \ + __asm__ ("leaq " #x "@tlsld(%%rip),%%rdi\n\t" \ + "call __tls_get_addr@plt\n\t" \ + "leaq " #x "@dtpoff(%%rax), %%rax" \ + : "=a" (__l), "=&c" (__c), "=&d" (__d) \ + : : "rdi", "rsi", "r8", "r9", "r10", "r11"); \ + __l; }) + +# ifdef __ILP32__ +# define TLS_GD_PREFIX +# else +# define TLS_GD_PREFIX ".byte 0x66\n\t" +# endif + +# define TLS_GD(x) \ + ({ int *__l, __c, __d; \ + __asm__ (TLS_GD_PREFIX \ + "leaq " #x "@tlsgd(%%rip),%%rdi\n\t" \ + ".word 0x6666\n\t" \ + "rex64\n\t" \ + "call __tls_get_addr@plt" \ + : "=a" (__l), "=&c" (__c), "=&d" (__d) \ + : : "rdi", "rsi", "r8", "r9", "r10", "r11"); \ + __l; }) + +#elif defined __sh__ + +# define TLS_LE(x) \ + ({ int *__l; void *__tp; \ + __asm__ ("stc gbr,%1\n\t" \ + "mov.l 1f,%0\n\t" \ + "bra 2f\n\t" \ + " add %1,%0\n\t" \ + ".align 2\n\t" \ + "1: .long " #x "@tpoff\n\t" \ + "2:" \ + : "=r" (__l), "=r" (__tp)); \ + __l; }) + +# ifdef __PIC__ +# define TLS_IE(x) \ + ({ int *__l; void *__tp; \ + register void *__gp __asm__("r12"); \ + __asm__ ("mov.l 1f,r0\n\t" \ + "stc gbr,%1\n\t" \ + "mov.l @(r0,r12),%0\n\t" \ + "bra 2f\n\t" \ + " add %1,%0\n\t" \ + ".align 2\n\t" \ + "1: .long " #x "@gottpoff\n\t" \ + "2:" \ + : "=r" (__l), "=r" (__tp) : "r" (__gp) : "r0"); \ + __l; }) +# else +# define TLS_IE(x) \ + ({ int *__l; void *__tp; \ + __asm__ ("mov.l r12,@-r15\n\t" \ + "mova 0f,r0\n\t" \ + "mov.l 0f,r12\n\t" \ + "add r0,r12\n\t" \ + "mov.l 1f,r0\n\t" \ + "stc gbr,%1\n\t" \ + "mov.l @(r0,r12),%0\n\t" \ + "bra 2f\n\t" \ + " add %1,%0\n\t" \ + ".align 2\n\t" \ + "1: .long " #x "@gottpoff\n\t" \ + "0: .long _GLOBAL_OFFSET_TABLE_\n\t" \ + "2: mov.l @r15+,r12" \ + : "=r" (__l), "=r" (__tp) : : "r0"); \ + __l; }) +#endif + +# ifdef __PIC__ +# define TLS_LD(x) \ + ({ int *__l; \ + register void *__gp __asm__("r12"); \ + __asm__ ("mov.l 1f,r4\n\t" \ + "mova 2f,r0\n\t" \ + "mov.l 2f,r1\n\t" \ + "add r0,r1\n\t" \ + "jsr @r1\n\t" \ + " add r12,r4\n\t" \ + "bra 4f\n\t" \ + " nop\n\t" \ + ".align 2\n\t" \ + "1: .long " #x "@tlsldm\n\t" \ + "2: .long __tls_get_addr@plt\n\t" \ + "4: mov.l 3f,%0\n\t" \ + "bra 5f\n\t" \ + " add r0,%0\n\t" \ + ".align 2\n\t" \ + "3: .long " #x "@dtpoff\n\t" \ + "5:" \ + : "=r" (__l) : "r" (__gp) : "r0", "r1", "r2", "r3", "r4", "r5", \ + "r6", "r7", "pr", "t"); \ + __l; }) +# else +# define TLS_LD(x) \ + ({ int *__l; \ + __asm__ ("mov.l r12,@-r15\n\t" \ + "mova 0f,r0\n\t" \ + "mov.l 0f,r12\n\t" \ + "add r0,r12\n\t" \ + "mov.l 1f,r4\n\t" \ + "mova 2f,r0\n\t" \ + "mov.l 2f,r1\n\t" \ + "add r0,r1\n\t" \ + "jsr @r1\n\t" \ + " add r12,r4\n\t" \ + "bra 4f\n\t" \ + " nop\n\t" \ + ".align 2\n\t" \ + "1: .long " #x "@tlsldm\n\t" \ + "2: .long __tls_get_addr@plt\n\t" \ + "0: .long _GLOBAL_OFFSET_TABLE_\n\t" \ + "4: mov.l 3f,%0\n\t" \ + "bra 5f\n\t" \ + " add r0,%0\n\t" \ + ".align 2\n\t" \ + "3: .long " #x "@dtpoff\n\t" \ + "5: mov.l @r15+,r12" \ + : "=r" (__l) : : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ + "pr", "t"); \ + __l; }) +#endif + +# ifdef __PIC__ +# define TLS_GD(x) \ + ({ int *__l; \ + register void *__gp __asm__("r12"); \ + __asm__ ("mov.l 1f,r4\n\t" \ + "mova 2f,r0\n\t" \ + "mov.l 2f,r1\n\t" \ + "add r0,r1\n\t" \ + "jsr @r1\n\t" \ + " add r12,r4\n\t" \ + "bra 3f\n\t" \ + " mov r0,%0\n\t" \ + ".align 2\n\t" \ + "1: .long " #x "@tlsgd\n\t" \ + "2: .long __tls_get_addr@plt\n\t" \ + "3:" \ + : "=r" (__l) : "r" (__gp) : "r0", "r1", "r2", "r3", "r4", "r5", \ + "r6", "r7", "pr", "t"); \ + __l; }) +# else +# define TLS_GD(x) \ + ({ int *__l; \ + __asm__ ("mov.l r12,@-r15\n\t" \ + "mova 0f,r0\n\t" \ + "mov.l 0f,r12\n\t" \ + "add r0,r12\n\t" \ + "mov.l 1f,r4\n\t" \ + "mova 2f,r0\n\t" \ + "mov.l 2f,r1\n\t" \ + "add r0,r1\n\t" \ + "jsr @r1\n\t" \ + " add r12,r4\n\t" \ + "bra 3f\n\t" \ + " mov r0,%0\n\t" \ + ".align 2\n\t" \ + "1: .long " #x "@tlsgd\n\t" \ + "2: .long __tls_get_addr@plt\n\t" \ + "0: .long _GLOBAL_OFFSET_TABLE_\n\t" \ + "3: mov.l @r15+,r12" \ + : "=r" (__l) : : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", \ + "pr", "t"); \ + __l; }) +#endif + +#elif defined __alpha__ + +register void *__gp __asm__("$29"); + +# define TLS_LE(x) \ + ({ int *__l; \ + __asm__ ("call_pal 158\n\tlda $0," #x "($0)\t\t!tprel" : "=v"(__l)); \ + __l; }) + +# define TLS_IE(x) \ + ({ char *__tp; unsigned long __o; \ + __asm__ ("call_pal 158\n\tldq %1," #x "($gp)\t\t!gottprel" \ + : "=v"(__tp), "=r"(__o) : "r"(__gp)); \ + (int *)(__tp + __o); }) + +# define TLS_LD(x) \ + ({ extern void *__tls_get_addr(void *); int *__l; void *__i; \ + __asm__ ("lda %0," #x "($gp)\t\t!tlsldm" : "=r" (__i) : "r"(__gp)); \ + __i = __tls_get_addr(__i); \ + __asm__ ("lda %0, " #x "(%1)\t\t!dtprel" : "=r"(__l) : "r"(__i)); \ + __l; }) + +# define TLS_GD(x) \ + ({ extern void *__tls_get_addr(void *); void *__i; \ + __asm__ ("lda %0," #x "($gp)\t\t!tlsgd" : "=r" (__i) : "r"(__gp)); \ + (int *) __tls_get_addr(__i); }) + + +#elif defined __ia64__ + +# define TLS_LE(x) \ + ({ void *__l; \ + __asm__ ("mov r2=r13\n\t" \ + ";;\n\t" \ + "addl %0=@tprel(" #x "),r2\n\t" \ + : "=r" (__l) : : "r2" ); __l; }) + +# define TLS_IE(x) \ + ({ void *__l; \ + register long __gp __asm__ ("gp"); \ + __asm__ (";;\n\t" \ + "addl r16=@ltoff(@tprel(" #x ")),gp\n\t" \ + ";;\n\t" \ + "ld8 r17=[r16]\n\t" \ + ";;\n\t" \ + "add %0=r13,r17\n\t" \ + ";;\n\t" \ + : "=r" (__l) : "r" (__gp) : "r16", "r17" ); __l; }) + +# define __TLS_CALL_CLOBBERS \ + "r2", "r3", "r8", "r9", "r10", "r11", "r14", "r15", "r16", "r17", \ + "r18", "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", \ + "r27", "r28", "r29", "r30", "r31", \ + "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", \ + "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ + "b6", "b7", \ + "out0", "out1", "out2", "out3", "out4", "out5", "out6", "out7" + +# define TLS_LD(x) \ + ({ void *__l; \ + register long __gp __asm__ ("gp"); \ + __asm__ (";;\n\t" \ + "mov loc0=gp\n\t" \ + "addl r16=@ltoff(@dtpmod(" #x ")),gp\n\t" \ + "addl out1=@dtprel(" #x "),r0\n\t" \ + ";;\n\t" \ + "ld8 out0=[r16]\n\t" \ + "br.call.sptk.many b0=__tls_get_addr" \ + ";;\n\t" \ + "mov gp=loc0\n\t" \ + "mov %0=r8\n\t" \ + ";;\n\t" \ + : "=r" (__l) : "r" (__gp) : "loc0", __TLS_CALL_CLOBBERS); \ + __l; }) + +# define TLS_GD(x) \ + ({ void *__l; \ + register long __gp __asm__ ("gp"); \ + __asm__ (";;\n\t" \ + "mov loc0=gp\n\t" \ + "addl r16=@ltoff(@dtpmod(" #x ")),gp\n\t" \ + "addl r17=@ltoff(@dtprel(" #x ")),gp\n\t" \ + ";;\n\t" \ + "ld8 out0=[r16]\n\t" \ + "ld8 out1=[r17]\n\t" \ + "br.call.sptk.many b0=__tls_get_addr" \ + ";;\n\t" \ + "mov gp=loc0\n\t" \ + "mov %0=r8\n\t" \ + ";;\n\t" \ + : "=r" (__l) : "r" (__gp) : "loc0", __TLS_CALL_CLOBBERS); \ + __l; }) + +#elif defined __sparc__ && !defined __arch64__ + +# define TLS_LE(x) \ + ({ int *__l; \ + __asm__ ("sethi %%tle_hix22(" #x "), %0" : "=r" (__l)); \ + __asm__ ("xor %1, %%tle_lox10(" #x "), %0" : "=r" (__l) : "r" (__l)); \ + __asm__ ("add %%g7, %1, %0" : "=r" (__l) : "r" (__l)); \ + __l; }) + +# ifdef __PIC__ +# define TLS_LOAD_PIC \ + ({ register long pc __asm__ ("%o7"); \ + long got; \ + __asm__ ("sethi %%hi(_GLOBAL_OFFSET_TABLE_-4), %1\n\t" \ + "call .+8\n\t" \ + "add %1, %%lo(_GLOBAL_OFFSET_TABLE_+4), %1\n\t" \ + "add %1, %0, %1\n\t" \ + : "=r" (pc), "=r" (got)); \ + got; }) +# else +# define TLS_LOAD_PIC \ + ({ long got; \ + __asm__ (".hidden _GLOBAL_OFFSET_TABLE_\n\t" \ + "sethi %%hi(_GLOBAL_OFFSET_TABLE_), %0\n\t" \ + "or %0, %%lo(_GLOBAL_OFFSET_TABLE_), %0" \ + : "=r" (got)); \ + got; }) +# endif + +# define TLS_IE(x) \ + ({ int *__l; \ + __asm__ ("sethi %%tie_hi22(" #x "), %0" : "=r" (__l)); \ + __asm__ ("add %1, %%tie_lo10(" #x "), %0" : "=r" (__l) : "r" (__l)); \ + __asm__ ("ld [%1 + %2], %0, %%tie_ld(" #x ")" \ + : "=r" (__l) : "r" (TLS_LOAD_PIC), "r" (__l)); \ + __asm__ ("add %%g7, %1, %0, %%tie_add(" #x ")" : "=r" (__l) : "r" (__l)); \ + __l; }) + +# define TLS_LD(x) \ + ({ int *__l; register void *__o0 __asm__ ("%o0"); \ + long __o; \ + __asm__ ("sethi %%tldm_hi22(" #x "), %0" : "=r" (__l)); \ + __asm__ ("add %1, %%tldm_lo10(" #x "), %0" : "=r" (__l) : "r" (__l)); \ + __asm__ ("add %1, %2, %0, %%tldm_add(" #x ")" \ + : "=r" (__o0) : "r" (TLS_LOAD_PIC), "r" (__l)); \ + __asm__ ("call __tls_get_addr, %%tgd_call(" #x ")\n\t" \ + " nop" \ + : "=r" (__o0) : "0" (__o0) \ + : "g1", "g2", "g3", "g4", "g5", "g6", "o1", "o2", "o3", "o4", \ + "o5", "o7", "cc"); \ + __asm__ ("sethi %%tldo_hix22(" #x "), %0" : "=r" (__o)); \ + __asm__ ("xor %1, %%tldo_lox10(" #x "), %0" : "=r" (__o) : "r" (__o)); \ + __asm__ ("add %1, %2, %0, %%tldo_add(" #x ")" : "=r" (__l) \ + : "r" (__o0), "r" (__o)); \ + __l; }) + +# define TLS_GD(x) \ + ({ int *__l; register void *__o0 __asm__ ("%o0"); \ + __asm__ ("sethi %%tgd_hi22(" #x "), %0" : "=r" (__l)); \ + __asm__ ("add %1, %%tgd_lo10(" #x "), %0" : "=r" (__l) : "r" (__l)); \ + __asm__ ("add %1, %2, %0, %%tgd_add(" #x ")" \ + : "=r" (__o0) : "r" (TLS_LOAD_PIC), "r" (__l)); \ + __asm__ ("call __tls_get_addr, %%tgd_call(" #x ")\n\t" \ + " nop" \ + : "=r" (__o0) : "0" (__o0) \ + : "g1", "g2", "g3", "g4", "g5", "g6", "o1", "o2", "o3", "o4", \ + "o5", "o7", "cc"); \ + __o0; }) + +#elif defined __sparc__ && defined __arch64__ + +# define TLS_LE(x) \ + ({ int *__l; \ + __asm__ ("sethi %%tle_hix22(" #x "), %0" : "=r" (__l)); \ + __asm__ ("xor %1, %%tle_lox10(" #x "), %0" : "=r" (__l) : "r" (__l)); \ + __asm__ ("add %%g7, %1, %0" : "=r" (__l) : "r" (__l)); \ + __l; }) + +# ifdef __PIC__ +# define TLS_LOAD_PIC \ + ({ long pc, got; \ + __asm__ ("sethi %%hi(_GLOBAL_OFFSET_TABLE_-4), %1\n\t" \ + "rd %%pc, %0\n\t" \ + "add %1, %%lo(_GLOBAL_OFFSET_TABLE_+4), %1\n\t" \ + "add %1, %0, %1\n\t" \ + : "=r" (pc), "=r" (got)); \ + got; }) +# else +# define TLS_LOAD_PIC \ + ({ long got; \ + __asm__ (".hidden _GLOBAL_OFFSET_TABLE_\n\t" \ + "sethi %%hi(_GLOBAL_OFFSET_TABLE_), %0\n\t" \ + "or %0, %%lo(_GLOBAL_OFFSET_TABLE_), %0" \ + : "=r" (got)); \ + got; }) +# endif + +# define TLS_IE(x) \ + ({ int *__l; \ + __asm__ ("sethi %%tie_hi22(" #x "), %0" : "=r" (__l)); \ + __asm__ ("add %1, %%tie_lo10(" #x "), %0" : "=r" (__l) : "r" (__l)); \ + __asm__ ("ldx [%1 + %2], %0, %%tie_ldx(" #x ")" \ + : "=r" (__l) : "r" (TLS_LOAD_PIC), "r" (__l)); \ + __asm__ ("add %%g7, %1, %0, %%tie_add(" #x ")" : "=r" (__l) : "r" (__l)); \ + __l; }) + +# define TLS_LD(x) \ + ({ int *__l; register void *__o0 __asm__ ("%o0"); \ + long __o; \ + __asm__ ("sethi %%tldm_hi22(" #x "), %0" : "=r" (__l)); \ + __asm__ ("add %1, %%tldm_lo10(" #x "), %0" : "=r" (__l) : "r" (__l)); \ + __asm__ ("add %1, %2, %0, %%tldm_add(" #x ")" \ + : "=r" (__o0) : "r" (TLS_LOAD_PIC), "r" (__l)); \ + __asm__ ("call __tls_get_addr, %%tgd_call(" #x ")\n\t" \ + " nop" \ + : "=r" (__o0) : "0" (__o0) \ + : "g1", "g2", "g3", "g4", "g5", "g6", "o1", "o2", "o3", "o4", \ + "o5", "o7", "cc"); \ + __asm__ ("sethi %%tldo_hix22(" #x "), %0" : "=r" (__o)); \ + __asm__ ("xor %1, %%tldo_lox10(" #x "), %0" : "=r" (__o) : "r" (__o)); \ + __asm__ ("add %1, %2, %0, %%tldo_add(" #x ")" : "=r" (__l) \ + : "r" (__o0), "r" (__o)); \ + __l; }) + +# define TLS_GD(x) \ + ({ int *__l; register void *__o0 __asm__ ("%o0"); \ + __asm__ ("sethi %%tgd_hi22(" #x "), %0" : "=r" (__l)); \ + __asm__ ("add %1, %%tgd_lo10(" #x "), %0" : "=r" (__l) : "r" (__l)); \ + __asm__ ("add %1, %2, %0, %%tgd_add(" #x ")" \ + : "=r" (__o0) : "r" (TLS_LOAD_PIC), "r" (__l)); \ + __asm__ ("call __tls_get_addr, %%tgd_call(" #x ")\n\t" \ + " nop" \ + : "=r" (__o0) : "0" (__o0) \ + : "g1", "g2", "g3", "g4", "g5", "g6", "o1", "o2", "o3", "o4", \ + "o5", "o7", "cc"); \ + __o0; }) + +#elif defined __s390x__ + +# define TLS_LE(x) \ + ({ unsigned long __offset; \ + __asm__ ("bras %0,1f\n" \ + "0:\t.quad " #x "@ntpoff\n" \ + "1:\tlg %0,0(%0)" \ + : "=a" (__offset) : : "cc" ); \ + (int *) (__builtin_thread_pointer() + __offset); }) + +# ifdef __PIC__ +# define TLS_IE(x) \ + ({ unsigned long __offset; \ + __asm__ ("bras %0,1f\n" \ + "0:\t.quad " #x "@gotntpoff\n" \ + "1:\tlg %0,0(%0)\n\t" \ + "lg %0,0(%0,%%r12):tls_load:" #x \ + : "=&a" (__offset) : : "cc" ); \ + (int *) (__builtin_thread_pointer() + __offset); }) +# else +# define TLS_IE(x) \ + ({ unsigned long __offset; \ + __asm__ ("bras %0,1f\n" \ + "0:\t.quad " #x "@indntpoff\n" \ + "1:\t lg %0,0(%0)\n\t" \ + "lg %0,0(%0):tls_load:" #x \ + : "=&a" (__offset) : : "cc" ); \ + (int *) (__builtin_thread_pointer() + __offset); }) +# endif + +# ifdef __PIC__ +# define TLS_LD(x) \ + ({ unsigned long __offset, __save12; \ + __asm__ ("bras %0,1f\n" \ + "0:\t.quad " #x "@tlsldm\n\t" \ + ".quad " #x "@dtpoff\n" \ + "1:\tlgr %1,%%r12\n\t" \ + "larl %%r12,_GLOBAL_OFFSET_TABLE_\n\t" \ + "lg %%r2,0(%0)\n\t" \ + "brasl %%r14,__tls_get_offset@plt:tls_ldcall:" #x "\n\t" \ + "lg %0,8(%0)\n\t" \ + "algr %0,%%r2\n\t" \ + "lgr %%r12,%1" \ + : "=&a" (__offset), "=&a" (__save12) \ + : : "cc", "0", "1", "2", "3", "4", "5", "14" ); \ + (int *) (__builtin_thread_pointer() + __offset); }) +# else +# define TLS_LD(x) \ + ({ unsigned long __offset; \ + __asm__ ("bras %0,1f\n" \ + "0:\t.quad " #x "@tlsldm\n\t" \ + ".quad " #x "@dtpoff\n" \ + "1:\tlarl %%r12,_GLOBAL_OFFSET_TABLE_\n\t" \ + "lg %%r2,0(%0)\n\t" \ + "brasl %%r14,__tls_get_offset@plt:tls_ldcall:" #x "\n\t" \ + "lg %0,8(%0)\n\t" \ + "algr %0,%%r2" \ + : "=&a" (__offset) \ + : : "cc", "0", "1", "2", "3", "4", "5", "12", "14" ); \ + (int *) (__builtin_thread_pointer() + __offset); }) +# endif + +# ifdef __PIC__ +# define TLS_GD(x) \ + ({ unsigned long __offset, __save12; \ + __asm__ ("bras %0,1f\n" \ + "0:\t.quad " #x "@tlsgd\n" \ + "1:\tlgr %1,%%r12\n\t" \ + "larl %%r12,_GLOBAL_OFFSET_TABLE_\n\t" \ + "lg %%r2,0(%0)\n\t" \ + "brasl %%r14,__tls_get_offset@plt:tls_gdcall:" #x "\n\t" \ + "lgr %0,%%r2\n\t" \ + "lgr %%r12,%1" \ + : "=&a" (__offset), "=&a" (__save12) \ + : : "cc", "0", "1", "2", "3", "4", "5", "14" ); \ + (int *) (__builtin_thread_pointer() + __offset); }) +# else +# define TLS_GD(x) \ + ({ unsigned long __offset; \ + __asm__ ("bras %0,1f\n" \ + "0:\t.quad " #x "@tlsgd\n" \ + "1:\tlarl %%r12,_GLOBAL_OFFSET_TABLE_\n\t" \ + "lg %%r2,0(%0)\n\t" \ + "brasl %%r14,__tls_get_offset@plt:tls_gdcall:" #x "\n\t" \ + "lgr %0,%%r2" \ + : "=&a" (__offset) \ + : : "cc", "0", "1", "2", "3", "4", "5", "12", "14" ); \ + (int *) (__builtin_thread_pointer() + __offset); }) +# endif + +#elif defined __s390__ + +# define TLS_LE(x) \ + ({ unsigned long __offset; \ + __asm__ ("bras %0,1f\n" \ + "0:\t.long " #x "@ntpoff\n" \ + "1:\tl %0,0(%0)" \ + : "=a" (__offset) : : "cc" ); \ + (int *) (__builtin_thread_pointer() + __offset); }) + +# ifdef __PIC__ +# define TLS_IE(x) \ + ({ unsigned long __offset; \ + __asm__ ("bras %0,1f\n" \ + "0:\t.long " #x "@gotntpoff\n" \ + "1:\tl %0,0(%0)\n\t" \ + "l %0,0(%0,%%r12):tls_load:" #x \ + : "=&a" (__offset) : : "cc" ); \ + (int *) (__builtin_thread_pointer() + __offset); }) +# else +# define TLS_IE(x) \ + ({ unsigned long __offset; \ + __asm__ ("bras %0,1f\n" \ + "0:\t.long " #x "@indntpoff\n" \ + "1:\t l %0,0(%0)\n\t" \ + "l %0,0(%0):tls_load:" #x \ + : "=&a" (__offset) : : "cc" ); \ + (int *) (__builtin_thread_pointer() + __offset); }) +# endif + +# ifdef __PIC__ +# define TLS_LD(x) \ + ({ unsigned long __offset, __save12; \ + __asm__ ("bras %0,1f\n" \ + "0:\t.long _GLOBAL_OFFSET_TABLE_-0b\n\t" \ + ".long __tls_get_offset@plt-0b\n\t" \ + ".long " #x "@tlsldm\n\t" \ + ".long " #x "@dtpoff\n" \ + "1:\tlr %1,%%r12\n\t" \ + "l %%r12,0(%0)\n\t" \ + "la %%r12,0(%%r12,%0)\n\t" \ + "l %%r1,4(%0)\n\t" \ + "l %%r2,8(%0)\n\t" \ + "bas %%r14,0(%%r1,%0):tls_ldcall:" #x "\n\t" \ + "l %0,12(%0)\n\t" \ + "alr %0,%%r2\n\t" \ + "lr %%r12,%1" \ + : "=&a" (__offset), "=&a" (__save12) \ + : : "cc", "0", "1", "2", "3", "4", "5" ); \ + (int *) (__builtin_thread_pointer() + __offset); }) +# else +# define TLS_LD(x) \ + ({ unsigned long __offset; \ + __asm__ ("bras %0,1f\n" \ + "0:\t.long _GLOBAL_OFFSET_TABLE_\n\t" \ + ".long __tls_get_offset@plt\n\t" \ + ".long " #x "@tlsldm\n\t" \ + ".long " #x "@dtpoff\n" \ + "1:\tl %%r12,0(%0)\n\t" \ + "l %%r1,4(%0)\n\t" \ + "l %%r2,8(%0)\n\t" \ + "bas %%r14,0(%%r1):tls_ldcall:" #x "\n\t" \ + "l %0,12(%0)\n\t" \ + "alr %0,%%r2" \ + : "=&a" (__offset) : : "cc", "0", "1", "2", "3", "4", "5", "12" ); \ + (int *) (__builtin_thread_pointer() + __offset); }) +# endif + +# ifdef __PIC__ +# define TLS_GD(x) \ + ({ unsigned long __offset, __save12; \ + __asm__ ("bras %0,1f\n" \ + "0:\t.long _GLOBAL_OFFSET_TABLE_-0b\n\t" \ + ".long __tls_get_offset@plt-0b\n\t" \ + ".long " #x "@tlsgd\n" \ + "1:\tlr %1,%%r12\n\t" \ + "l %%r12,0(%0)\n\t" \ + "la %%r12,0(%%r12,%0)\n\t" \ + "l %%r1,4(%0)\n\t" \ + "l %%r2,8(%0)\n\t" \ + "bas %%r14,0(%%r1,%0):tls_gdcall:" #x "\n\t" \ + "lr %0,%%r2\n\t" \ + "lr %%r12,%1" \ + : "=&a" (__offset), "=&a" (__save12) \ + : : "cc", "0", "1", "2", "3", "4", "5" ); \ + (int *) (__builtin_thread_pointer() + __offset); }) +# else +# define TLS_GD(x) \ + ({ unsigned long __offset; \ + __asm__ ("bras %0,1f\n" \ + "0:\t.long _GLOBAL_OFFSET_TABLE_\n\t" \ + ".long __tls_get_offset@plt\n\t" \ + ".long " #x "@tlsgd\n" \ + "1:\tl %%r12,0(%0)\n\t" \ + "l %%r1,4(%0)\n\t" \ + "l %%r2,8(%0)\n\t" \ + "bas %%r14,0(%%r1):tls_gdcall:" #x "\n\t" \ + "lr %0,%%r2" \ + : "=&a" (__offset) : : "cc", "0", "1", "2", "3", "4", "5", "12" ); \ + (int *) (__builtin_thread_pointer() + __offset); }) +# endif + +#elif defined __powerpc__ && !defined __powerpc64__ + +/*#include "config.h"*/ + +# define __TLS_CALL_CLOBBERS \ + "0", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", \ + "lr", "ctr", "cr0", "cr1", "cr5", "cr6", "cr7" + +/* PowerPC32 Local Exec TLS access. */ +# define TLS_LE(x) \ + ({ int *__result; \ + __asm__ ("addi %0,2," #x "@tprel" \ + : "=r" (__result)); \ + __result; }) + +/* PowerPC32 Initial Exec TLS access. */ +# ifdef HAVE_ASM_PPC_REL16 +# define TLS_IE(x) \ + ({ int *__result; \ + __asm__ ("bcl 20,31,1f\n1:\t" \ + "mflr %0\n\t" \ + "addis %0,%0,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t" \ + "addi %0,%0,_GLOBAL_OFFSET_TABLE_-1b@l\n\t" \ + "lwz %0," #x "@got@tprel(%0)\n\t" \ + "add %0,%0," #x "@tls" \ + : "=b" (__result) : \ + : "lr"); \ + __result; }) +# else +# define TLS_IE(x) \ + ({ int *__result; \ + __asm__ ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t" \ + "mflr %0\n\t" \ + "lwz %0," #x "@got@tprel(%0)\n\t" \ + "add %0,%0," #x "@tls" \ + : "=b" (__result) : \ + : "lr"); \ + __result; }) +# endif + +/* PowerPC32 Local Dynamic TLS access. */ +# ifdef HAVE_ASM_PPC_REL16 +# define TLS_LD(x) \ + ({ int *__result; \ + __asm__ ("bcl 20,31,1f\n1:\t" \ + "mflr 3\n\t" \ + "addis 3,3,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t" \ + "addi 3,3,_GLOBAL_OFFSET_TABLE_-1b@l\n\t" \ + "addi 3,3," #x "@got@tlsld\n\t" \ + "bl __tls_get_addr@plt\n\t" \ + "addi %0,3," #x "@dtprel" \ + : "=r" (__result) : \ + : __TLS_CALL_CLOBBERS); \ + __result; }) +# else +# define TLS_LD(x) \ + ({ int *__result; \ + __asm__ ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t" \ + "mflr 3\n\t" \ + "addi 3,3," #x "@got@tlsld\n\t" \ + "bl __tls_get_addr@plt\n\t" \ + "addi %0,3," #x "@dtprel" \ + : "=r" (__result) : \ + : __TLS_CALL_CLOBBERS); \ + __result; }) +# endif + +/* PowerPC32 General Dynamic TLS access. */ +# ifdef HAVE_ASM_PPC_REL16 +# define TLS_GD(x) \ + ({ register int *__result __asm__ ("r3"); \ + __asm__ ("bcl 20,31,1f\n1:\t" \ + "mflr 3\n\t" \ + "addis 3,3,_GLOBAL_OFFSET_TABLE_-1b@ha\n\t" \ + "addi 3,3,_GLOBAL_OFFSET_TABLE_-1b@l\n\t" \ + "addi 3,3," #x "@got@tlsgd\n\t" \ + "bl __tls_get_addr@plt" \ + : : \ + : __TLS_CALL_CLOBBERS); \ + __result; }) +# else +# define TLS_GD(x) \ + ({ register int *__result __asm__ ("r3"); \ + __asm__ ("bl _GLOBAL_OFFSET_TABLE_@local-4\n\t" \ + "mflr 3\n\t" \ + "addi 3,3," #x "@got@tlsgd\n\t" \ + "bl __tls_get_addr@plt" \ + : : \ + : __TLS_CALL_CLOBBERS); \ + __result; }) +# endif + +#elif defined __powerpc__ && defined __powerpc64__ + +/* PowerPC64 Local Exec TLS access. */ +# define TLS_LE(x) \ + ({ int * __result; \ + __asm__ ( \ + " addis %0,13," #x "@tprel@ha\n" \ + " addi %0,%0," #x "@tprel@l\n" \ + : "=b" (__result) ); \ + __result; \ + }) +/* PowerPC64 Initial Exec TLS access. */ +# define TLS_IE(x) \ + ({ int * __result; \ + __asm__ ( \ + " ld %0," #x "@got@tprel(2)\n" \ + " add %0,%0," #x "@tls\n" \ + : "=b" (__result) ); \ + __result; \ + }) +/* PowerPC64 Local Dynamic TLS access. */ +# define TLS_LD(x) \ + ({ int * __result; \ + __asm__ ( \ + " addi 3,2," #x "@got@tlsld\n" \ + " bl .__tls_get_addr\n" \ + " nop \n" \ + " addis %0,3," #x "@dtprel@ha\n" \ + " addi %0,%0," #x "@dtprel@l\n" \ + : "=b" (__result) : \ + : "0", "3", "4", "5", "6", "7", \ + "8", "9", "10", "11", "12", \ + "lr", "ctr", \ + "cr0", "cr1", "cr5", "cr6", "cr7"); \ + __result; \ + }) +/* PowerPC64 General Dynamic TLS access. */ +# define TLS_GD(x) \ + ({ int * __result; \ + __asm__ ( \ + " addi 3,2," #x "@got@tlsgd\n" \ + " bl .__tls_get_addr\n" \ + " nop \n" \ + " mr %0,3\n" \ + : "=b" (__result) : \ + : "0", "3", "4", "5", "6", "7", \ + "8", "9", "10", "11", "12", \ + "lr", "ctr", \ + "cr0", "cr1", "cr5", "cr6", "cr7"); \ + __result; \ + }) + +#elif defined __arc__ + +/* For now */ +#define TLS_LD(x) TLS_IE(x) + +#define TLS_GD(x) \ + ({ int *__result; \ + __asm__ ("add r0, pcl, @" #x "@tlsgd \n" \ + ".tls_gd_ld " #x "`bl __tls_get_addr@plt \n" \ + "mov %0, r0 \n" \ + : "=&r" (__result) \ + ::"r0","r1","r2","r3","r4","r5","r6","r7", \ + "r8","r9","r10","r11","r12"); \ + __result; }) + +#define TLS_LE(x) \ + ({ int *__result; \ + void *tp = __builtin_thread_pointer(); \ + __asm__ ("add %0, %1, @" #x "@tpoff \n" \ + : "=r" (__result) : "r"(tp)); \ + __result; }) + +#define TLS_IE(x) \ + ({ int *__result; \ + void *tp = __builtin_thread_pointer(); \ + __asm__ ("ld %0, [pcl, @" #x "@tlsie] \n" \ + "add %0, %1, %0 \n" \ + : "=&r" (__result) : "r" (tp)); \ + __result; }) + +#elif defined __xtensa__ + +#if defined(__XTENSA_WINDOWED_ABI__) +#define TLS_GD(x) \ + ({ int *__l; \ + __asm__ ("movi a8, " #x "@TLSFUNC\n\t" \ + "movi a10, " #x "@TLSARG\n\t" \ + "callx8.tls a8, " #x "@TLSCALL\n\t" \ + "mov %0, a10\n\t" \ + : "=r" (__l) \ + : \ + : "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); \ + __l; }) + +#define TLS_LD(x) \ + ({ int *__l; \ + __asm__ ("movi a8, _TLS_MODULE_BASE_@TLSFUNC\n\t" \ + "movi a10, _TLS_MODULE_BASE_@TLSARG\n\t" \ + "callx8.tls a8, _TLS_MODULE_BASE_@TLSCALL\n\t" \ + "movi %0, " #x "@TPOFF\n\t" \ + "add %0, %0, a10\n\t" \ + : "=r" (__l) \ + : \ + : "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); \ + __l; }) +#elif defined(__XTENSA_CALL0_ABI__) +#define TLS_GD(x) \ + ({ int *__l; \ + __asm__ ("movi a0, " #x "@TLSFUNC\n\t" \ + "movi a2, " #x "@TLSARG\n\t" \ + "callx0.tls a0, " #x "@TLSCALL\n\t" \ + "mov %0, a2\n\t" \ + : "=r" (__l) \ + : \ + : "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11");\ + __l; }) + +#define TLS_LD(x) \ + ({ int *__l; \ + __asm__ ("movi a0, _TLS_MODULE_BASE_@TLSFUNC\n\t" \ + "movi a2, _TLS_MODULE_BASE_@TLSARG\n\t" \ + "callx0.tls a0, _TLS_MODULE_BASE_@TLSCALL\n\t" \ + "movi %0, " #x "@TPOFF\n\t" \ + "add %0, %0, a2\n\t" \ + : "=r" (__l) \ + : \ + : "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11");\ + __l; }) +#else +#error Unsupported Xtensa ABI +#endif + +#define TLS_IE(x) TLS_LE(x) + +#define TLS_LE(x) \ + ({ int *__l; \ + int __t; \ + __asm__ ("rur %0, threadptr\n\t" \ + "movi %1, " #x "@TPOFF\n\t" \ + "add %0, %0, %1\n\t" \ + : "=r" (__l), "=r" (__t) ); \ + __l; }); \ + +#elif defined __metag__ + +# define TLS_GD(x) \ + ({ void *__result; \ + extern void *__tls_get_addr (void *); \ + __asm__ ("MOV %0, A1LbP\n\t" \ + "ADD %0, %0, #(" #x "@TLSGD)" \ + : "=d" (__result)); \ + (int *)__tls_get_addr (__result); }) + +# define TLS_LD(x) \ + ({ void *__result; \ + extern void *__tls_get_addr (void *); \ + __asm__ ("MOV %0, A1LbP\n\t" \ + "ADD %0, %0, #(" #x "@TLSLDM)" \ + : "=d" (__result)); \ + __result = __tls_get_addr (__result); \ + __asm__ ("ADDT %0,%0,#HI(" #x "@TLSLDO)\n\t" \ + "ADD %0,%0,#LO(" #x "@TLSLDO)" \ + : "+d" (__result)); \ + __result; }) + +# define TLS_IE(x) \ + ({ void *__result; \ + unsigned long __rel; \ + extern void *__metag_load_tp (void); \ + __asm__ ("GETD %0,[A1LbP+#(" #x "@TLSIE)]" \ + : "=d" (__rel)); \ + __result = __metag_load_tp(); \ + __result + __rel; }) + +# define TLS_LE(x) \ + ({ void *__result; \ + extern void *__metag_load_tp (void); \ + __result = __metag_load_tp(); \ + __asm__ ("ADDT %0,%0,#HI(" #x "@TLSLE)\n\t" \ + "ADD %0,%0,#LO(" #x "@TLSLE)" \ + : "+d" (__result)); \ + __result; }) + +#elif !defined TLS_LE || !defined TLS_IE \ + || !defined TLS_LD || !defined TLS_GD +# error "No support for this architecture so far." +#endif diff --git a/test/tls/tst-tls-at-ctor.c b/test/tls/tst-tls-at-ctor.c new file mode 100644 index 000000000..53aece181 --- /dev/null +++ b/test/tls/tst-tls-at-ctor.c @@ -0,0 +1,21 @@ +#include <stdio.h> +#include <stdlib.h> +#include <tls.h> + +#define TLS_VAR_INIT_VALUE 99 + +#ifdef USE_TLS +extern __thread int tls_var; +#endif + +int main(void) +{ + int ret = EXIT_SUCCESS; +#ifdef USE_TLS + if (tls_var != TLS_VAR_INIT_VALUE) { + printf("tls_var = %d - Expected value = %d\n", tls_var, TLS_VAR_INIT_VALUE); + ret = EXIT_FAILURE; + } +#endif + return ret; +} diff --git a/test/tls/tst-tls1-static.c b/test/tls/tst-tls1-static.c new file mode 100644 index 000000000..a01008073 --- /dev/null +++ b/test/tls/tst-tls1-static.c @@ -0,0 +1 @@ +#include "tst-tls1.c" diff --git a/test/tls/tst-tls1.c b/test/tls/tst-tls1.c new file mode 100644 index 000000000..f5ac6d2bc --- /dev/null +++ b/test/tls/tst-tls1.c @@ -0,0 +1,92 @@ +/* glibc test for TLS in ld.so. */ +#undef _LIBC +#include <stdio.h> + +#include <tls.h> + +#ifdef USE_TLS +# include "tls-macros.h" + + +/* Two common 'int' variables in TLS. */ +COMMON_INT_DEF(foo); +COMMON_INT_DEF(bar); +#endif + + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ +#ifdef USE_TLS + int result = 0; + int *ap, *bp; + + + /* Set the variable using the local exec model. */ + puts ("set bar to 1 (LE)"); + ap = TLS_LE (bar); + *ap = 1; + + + /* Get variables using initial exec model. */ + fputs ("get sum of foo and bar (IE)", stdout); + ap = TLS_IE (foo); + bp = TLS_IE (bar); + printf (" = %d\n", *ap + *bp); + result |= *ap + *bp != 1; + if (*ap != 0) + { + printf ("foo = %d\n", *ap); + result = 1; + } + if (*bp != 1) + { + printf ("bar = %d\n", *bp); + result = 1; + } + + + /* Get variables using local dynamic model. */ + fputs ("get sum of foo and bar (LD)", stdout); + ap = TLS_LD (foo); + bp = TLS_LD (bar); + printf (" = %d\n", *ap + *bp); + result |= *ap + *bp != 1; + if (*ap != 0) + { + printf ("foo = %d\n", *ap); + result = 1; + } + if (*bp != 1) + { + printf ("bar = %d\n", *bp); + result = 1; + } + + + /* Get variables using generic dynamic model. */ + fputs ("get sum of foo and bar (GD)", stdout); + ap = TLS_GD (foo); + bp = TLS_GD (bar); + printf (" = %d\n", *ap + *bp); + result |= *ap + *bp != 1; + if (*ap != 0) + { + printf ("foo = %d\n", *ap); + result = 1; + } + if (*bp != 1) + { + printf ("bar = %d\n", *bp); + result = 1; + } + + return result; +#else + return 0; +#endif +} + + +#include "../test-skeleton.c" diff --git a/test/tls/tst-tls10.c b/test/tls/tst-tls10.c new file mode 100644 index 000000000..fc0677072 --- /dev/null +++ b/test/tls/tst-tls10.c @@ -0,0 +1,40 @@ +#include "tst-tls10.h" + +#ifdef USE_TLS__THREAD +__thread int dummy __attribute__((visibility ("hidden"))) = 12; +__thread struct A local = { 1, 2, 3 }; +#endif + +#define CHECK(N, S) \ + p = f##N##a (); \ + if (p->a != S || p->b != S + 1 || p->c != S + 2) \ + abort () + +int +main (void) +{ + struct A *p; + if (local.a != 1 || local.b != 2 || local.c != 3) + abort (); +#ifdef USE_TLS__THREAD + if (a1.a != 4 || a1.b != 5 || a1.c != 6) + abort (); + if (a2.a != 22 || a2.b != 23 || a2.c != 24) + abort (); + if (a3.a != 10 || a3.b != 11 || a3.c != 12) + abort (); + if (a4.a != 25 || a4.b != 26 || a4.c != 27) + abort (); + check1 (); + check2 (); + if (f1a () != &a1 || f2a () != &a2 || f3a () != &a3 || f4a () != &a4) + abort (); + CHECK (5, 16); + CHECK (6, 19); + if (f7a () != &a2 || f8a () != &a4) + abort (); + CHECK (9, 28); + CHECK (10, 31); +#endif + exit (0); +} diff --git a/test/tls/tst-tls10.h b/test/tls/tst-tls10.h new file mode 100644 index 000000000..1be6adc29 --- /dev/null +++ b/test/tls/tst-tls10.h @@ -0,0 +1,38 @@ +#include <tls.h> +#include <stdlib.h> + +#if defined USE_TLS && defined HAVE___THREAD \ + && defined HAVE_TLS_MODEL_ATTRIBUTE +# define USE_TLS__THREAD + +struct A +{ + char a; + int b; + long long c; +}; + +extern __thread struct A a1, a2, a3, a4; +extern struct A *f1a (void); +extern struct A *f2a (void); +extern struct A *f3a (void); +extern struct A *f4a (void); +extern struct A *f5a (void); +extern struct A *f6a (void); +extern struct A *f7a (void); +extern struct A *f8a (void); +extern struct A *f9a (void); +extern struct A *f10a (void); +extern int f1b (void); +extern int f2b (void); +extern int f3b (void); +extern int f4b (void); +extern int f5b (void); +extern int f6b (void); +extern int f7b (void); +extern int f8b (void); +extern int f9b (void); +extern int f10b (void); +extern void check1 (void); +extern void check2 (void); +#endif diff --git a/test/tls/tst-tls11.c b/test/tls/tst-tls11.c new file mode 100644 index 000000000..816cf5cc2 --- /dev/null +++ b/test/tls/tst-tls11.c @@ -0,0 +1,27 @@ +#include "tst-tls10.h" + +#define CHECK(N, S) \ + p = f##N##a (); \ + if (p->a != S || p->b != S + 1 || p->c != S + 2) \ + abort () + +int +main (void) +{ +#ifdef USE_TLS__THREAD + struct A *p; + check1 (); + check2 (); + CHECK (1, 4); + CHECK (2, 22); + CHECK (3, 10); + CHECK (4, 25); + CHECK (5, 16); + CHECK (6, 19); + CHECK (7, 22); + CHECK (8, 25); + CHECK (9, 28); + CHECK (10, 31); +#endif + exit (0); +} diff --git a/test/tls/tst-tls12.c b/test/tls/tst-tls12.c new file mode 100644 index 000000000..84aa7d35c --- /dev/null +++ b/test/tls/tst-tls12.c @@ -0,0 +1,18 @@ +#include "tst-tls10.h" + +#define CHECK(N, S) \ + p = &a##N; \ + if (p->a != S || p->b != S + 1 || p->c != S + 2) \ + abort () + +int +main (void) +{ +#ifdef USE_TLS__THREAD + struct A *p; + check1 (); + CHECK (1, 4); + CHECK (2, 7); +#endif + exit (0); +} diff --git a/test/tls/tst-tls13.c b/test/tls/tst-tls13.c new file mode 100644 index 000000000..4cb74e76b --- /dev/null +++ b/test/tls/tst-tls13.c @@ -0,0 +1,30 @@ +/* Check unloading modules with data in static TLS block. */ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + + +static int +do_test (void) +{ + int i; + for (i = 0; i < 1000;) + { + printf ("round %d\n",++i); + + void *h = dlopen ("tst-tlsmod13a.so", RTLD_LAZY); + if (h == NULL) + { + printf ("cannot load: %s\n", dlerror ()); + exit (1); + } + + dlclose (h); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#define TIMEOUT 50 +#include "../test-skeleton.c" diff --git a/test/tls/tst-tls14.c b/test/tls/tst-tls14.c new file mode 100644 index 000000000..428fd5293 --- /dev/null +++ b/test/tls/tst-tls14.c @@ -0,0 +1,66 @@ +/* Check alignment of TLS variable. */ +#include <dlfcn.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> + +#include <tls.h> + +#if USE_TLS && HAVE___THREAD + +#define AL 4096 +struct foo +{ + int i; +} __attribute ((aligned (AL))); + +static __thread struct foo f; +static struct foo g; + + +extern int in_dso1 (void); + + +static int +do_test (void) +{ + int result = 0; + + int fail = (((uintptr_t) &f) & (AL - 1)) != 0; + printf ("&f = %p %s\n", &f, fail ? "FAIL" : "OK"); + result |= fail; + + fail = (((uintptr_t) &g) & (AL - 1)) != 0; + printf ("&g = %p %s\n", &g, fail ? "FAIL" : "OK"); + result |= fail; + + result |= in_dso1 (); + + void *h = dlopen ("tst-tlsmod14b.so", RTLD_LAZY); + if (h == NULL) + { + printf ("cannot open tst-tlsmod14b.so: %m\n"); + exit (1); + } + + int (*fp) (void) = (int (*) (void)) dlsym (h, "in_dso2"); + if (fp == NULL) + { + puts ("cannot find in_dso2"); + exit (1); + } + + result |= fp (); + + return result; +} + +#define TEST_FUNCTION do_test () + +#else + +#define TEST_FUNCTION 0 + +#endif + +#include "../test-skeleton.c" diff --git a/test/tls/tst-tls15.c b/test/tls/tst-tls15.c new file mode 100644 index 000000000..2c2df251b --- /dev/null +++ b/test/tls/tst-tls15.c @@ -0,0 +1,33 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +static int +do_test (void) +{ + void *h = dlopen ("tst-tlsmod15a.so", RTLD_NOW); + if (h != NULL) + { + puts ("unexpectedly succeeded to open tst-tlsmod15a.so"); + exit (1); + } + + h = dlopen ("tst-tlsmod15b.so", RTLD_NOW); + if (h == NULL) + { + puts ("failed to open tst-tlsmod15b.so"); + exit (1); + } + + int (*fp) (void) = (int (*) (void)) dlsym (h, "in_dso"); + if (fp == NULL) + { + puts ("cannot find in_dso"); + exit (1); + } + + return fp (); +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/tls/tst-tls16.c b/test/tls/tst-tls16.c new file mode 100644 index 000000000..17912dc30 --- /dev/null +++ b/test/tls/tst-tls16.c @@ -0,0 +1,53 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +static int +do_test (void) +{ + void *h = dlopen ("tst-tlsmod16a.so", RTLD_LAZY | RTLD_GLOBAL); + if (h == NULL) + { + puts ("unexpectedly failed to open tst-tlsmod16a.so"); + exit (1); + } + + void *p = dlsym (h, "tlsvar"); + + /* This dlopen should indeed fail, because tlsvar was assigned to + dynamic TLS, and the new module requests it to be in static TLS. + However, there's a possibility that dlopen succeeds if the + variable is, for whatever reason, assigned to static TLS, or if + the module fails to require static TLS, or even if TLS is not + supported. */ + h = dlopen ("tst-tlsmod16b.so", RTLD_NOW | RTLD_GLOBAL); + if (h == NULL) + { + return 0; + } + + puts ("unexpectedly succeeded to open tst-tlsmod16b.so"); + + + void *(*fp) (void) = (void *(*) (void)) dlsym (h, "in_dso"); + if (fp == NULL) + { + puts ("cannot find in_dso"); + exit (1); + } + + /* If the dlopen passes, at least make sure the address returned by + dlsym is the same as that returned by the initial-exec access. + If the variable was assigned to dynamic TLS during dlsym, this + portion will fail. */ + if (fp () != p) + { + puts ("returned values do not match"); + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/tls/tst-tls17.c b/test/tls/tst-tls17.c new file mode 100644 index 000000000..c1bc7d8f4 --- /dev/null +++ b/test/tls/tst-tls17.c @@ -0,0 +1,29 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +static int +do_test (void) +{ + void *h = dlopen ("tst-tlsmod17b.so", RTLD_LAZY); + if (h == NULL) + { + puts ("unexpectedly failed to open tst-tlsmod17b.so"); + exit (1); + } + + int (*fp) (void) = (int (*) (void)) dlsym (h, "tlsmod17b"); + if (fp == NULL) + { + puts ("cannot find tlsmod17b"); + exit (1); + } + + if (fp ()) + exit (1); + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/tls/tst-tls18.c b/test/tls/tst-tls18.c new file mode 100644 index 000000000..00dcdff4e --- /dev/null +++ b/test/tls/tst-tls18.c @@ -0,0 +1,38 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +static int +do_test (void) +{ + char modname[sizeof "tst-tlsmod18aXX.so"]; + void *h[20]; + for (int i = 0; i < 20; i++) + { + snprintf (modname, sizeof modname, "tst-tlsmod18a%d.so", i); + h[i] = dlopen (modname, RTLD_LAZY); + if (h[i] == NULL) + { + printf ("unexpectedly failed to open %s", modname); + exit (1); + } + } + + for (int i = 0; i < 20; i++) + { + int (*fp) (void) = (int (*) (void)) dlsym (h[i], "test"); + if (fp == NULL) + { + printf ("cannot find test in tst-tlsmod18a%d.so", i); + exit (1); + } + + if (fp ()) + exit (1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/test/tls/tst-tls2-static.c b/test/tls/tst-tls2-static.c new file mode 100644 index 000000000..55ffa5744 --- /dev/null +++ b/test/tls/tst-tls2-static.c @@ -0,0 +1 @@ +#include "tst-tls2.c" diff --git a/test/tls/tst-tls2.c b/test/tls/tst-tls2.c new file mode 100644 index 000000000..417489968 --- /dev/null +++ b/test/tls/tst-tls2.c @@ -0,0 +1,91 @@ +/* glibc test for TLS in ld.so. */ +#include <stdio.h> + +#include <tls.h> + +#ifdef USE_TLS +# include "tls-macros.h" + + +/* Two 'int' variables in TLS. */ +VAR_INT_DEF(foo); +VAR_INT_DEF(bar); +#endif + + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ +#ifdef USE_TLS + int result = 0; + int *ap, *bp; + + + /* Set the variable using the local exec model. */ + puts ("set bar to 1 (LE)"); + ap = TLS_LE (bar); + *ap = 1; + + + /* Get variables using initial exec model. */ + fputs ("get sum of foo and bar (IE)", stdout); + ap = TLS_IE (foo); + bp = TLS_IE (bar); + printf (" = %d\n", *ap + *bp); + result |= *ap + *bp != 1; + if (*ap != 0) + { + printf ("foo = %d\n", *ap); + result = 1; + } + if (*bp != 1) + { + printf ("bar = %d\n", *bp); + result = 1; + } + + + /* Get variables using local dynamic model. */ + fputs ("get sum of foo and bar (LD)", stdout); + ap = TLS_LD (foo); + bp = TLS_LD (bar); + printf (" = %d\n", *ap + *bp); + result |= *ap + *bp != 1; + if (*ap != 0) + { + printf ("foo = %d\n", *ap); + result = 1; + } + if (*bp != 1) + { + printf ("bar = %d\n", *bp); + result = 1; + } + + + /* Get variables using generic dynamic model. */ + fputs ("get sum of foo and bar (GD)", stdout); + ap = TLS_GD (foo); + bp = TLS_GD (bar); + printf (" = %d\n", *ap + *bp); + result |= *ap + *bp != 1; + if (*ap != 0) + { + printf ("foo = %d\n", *ap); + result = 1; + } + if (*bp != 1) + { + printf ("bar = %d\n", *bp); + result = 1; + } + + return result; +#else + return 0; +#endif +} + + +#include "../test-skeleton.c" diff --git a/test/tls/tst-tls3.c b/test/tls/tst-tls3.c new file mode 100644 index 000000000..84be43575 --- /dev/null +++ b/test/tls/tst-tls3.c @@ -0,0 +1,76 @@ +/* glibc test for TLS in ld.so. */ +#include <stdio.h> + +#include <tls.h> + +#ifdef USE_TLS +# include "tls-macros.h" + + +/* One define int variable, two externs. */ +COMMON_INT_DECL(foo); +VAR_INT_DECL(bar); +VAR_INT_DEF(baz); +#endif + + +extern int in_dso (void); + + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ +#ifdef USE_TLS + int result = 0; + int *ap, *bp, *cp; + + + /* Set the variable using the local exec model. */ + puts ("set baz to 3 (LE)"); + ap = TLS_LE (baz); + *ap = 3; + + + /* Get variables using initial exec model. */ + puts ("set variables foo and bar (IE)"); + ap = TLS_IE (foo); + *ap = 1; + bp = TLS_IE (bar); + *bp = 2; + + + /* Get variables using local dynamic model. */ + fputs ("get sum of foo, bar (GD) and baz (LD)", stdout); + ap = TLS_GD (foo); + bp = TLS_GD (bar); + cp = TLS_LD (baz); + printf (" = %d\n", *ap + *bp + *cp); + result |= *ap + *bp + *cp != 6; + if (*ap != 1) + { + printf ("foo = %d\n", *ap); + result = 1; + } + if (*bp != 2) + { + printf ("bar = %d\n", *bp); + result = 1; + } + if (*cp != 3) + { + printf ("baz = %d\n", *cp); + result = 1; + } + + + result |= in_dso (); + + return result; +#else + return 0; +#endif +} + + +#include "../test-skeleton.c" diff --git a/test/tls/tst-tls4.c b/test/tls/tst-tls4.c new file mode 100644 index 000000000..f92ee53ce --- /dev/null +++ b/test/tls/tst-tls4.c @@ -0,0 +1,56 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +#include <tls.h> + + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ +#ifdef USE_TLS + static const char modname[] = "tst-tlsmod2.so"; + int result = 0; + int *foop; + int (*fp) (int, int *); + void *h; + + h = dlopen (modname, RTLD_LAZY); + if (h == NULL) + { + printf ("cannot open '%s': %s\n", modname, dlerror ()); + exit (1); + } + + fp = dlsym (h, "in_dso"); + if (fp == NULL) + { + printf ("cannot get symbol 'in_dso': %s\n", dlerror ()); + exit (1); + } + + result |= fp (0, NULL); + + foop = dlsym (h, "foo"); + if (foop == NULL) + { + printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ()); + exit (1); + } + if (*foop != 16) + { + puts ("foo != 16"); + result = 1; + } + + dlclose (h); + + return result; +#else + return 0; +#endif +} + + +#include "../test-skeleton.c" diff --git a/test/tls/tst-tls5.c b/test/tls/tst-tls5.c new file mode 100644 index 000000000..a571d2cd3 --- /dev/null +++ b/test/tls/tst-tls5.c @@ -0,0 +1,72 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +#include <tls.h> + + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ +#ifdef USE_TLS + static const char modname[] = "tst-tlsmod2.so"; + int result = 0; + int *foop; + int *foop2; + int (*fp) (int, int *); + void *h; + + h = dlopen (modname, RTLD_LAZY); + if (h == NULL) + { + printf ("cannot open '%s': %s\n", modname, dlerror ()); + exit (1); + } + + foop = dlsym (h, "foo"); + if (foop == NULL) + { + printf ("cannot get symbol 'foo': %s\n", dlerror ()); + exit (1); + } + + *foop = 42; + + fp = dlsym (h, "in_dso"); + if (fp == NULL) + { + printf ("cannot get symbol 'in_dso': %s\n", dlerror ()); + exit (1); + } + + result |= fp (42, foop); + + foop2 = dlsym (h, "foo"); + if (foop2 == NULL) + { + printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ()); + exit (1); + } + + if (foop != foop2) + { + puts ("address of 'foo' different the second time"); + result = 1; + } + else if (*foop != 16) + { + puts ("foo != 16"); + result = 1; + } + + dlclose (h); + + return result; +#else + return 0; +#endif +} + + +#include "../test-skeleton.c" diff --git a/test/tls/tst-tls6.c b/test/tls/tst-tls6.c new file mode 100644 index 000000000..0ebc50737 --- /dev/null +++ b/test/tls/tst-tls6.c @@ -0,0 +1,107 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +#include <tls.h> +#include <link.h> +#ifdef __UCLIBC__ +#include "dl-elf.h" +#include "dl-hash.h" +#endif + + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ +#ifdef USE_TLS + static const char modname[] = "tst-tlsmod2.so"; + int result = 0; + int *foop; + int *foop2; + int (*fp) (int, int *); + void *h; + int i; + int modid = -1; + + for (i = 0; i < 10; ++i) + { + h = dlopen (modname, RTLD_LAZY); + if (h == NULL) + { + printf ("cannot open '%s': %s\n", modname, dlerror ()); + exit (1); + } + + /* Dirty test code here: we peek into a private data structure. + We make sure that the module gets assigned the same ID every + time. The value of the first round is used. */ +#ifdef __UCLIBC__ + if (modid == -1) + modid = ((struct dyn_elf *) h)->dyn->l_tls_modid; + else if (((struct dyn_elf *)h)->dyn->l_tls_modid != (size_t) modid) + { + printf ("round %d: modid now %zu, initially %d\n", + i, + ((struct dyn_elf *)h)->dyn->l_tls_modid, + modid); + result = 1; + } +#else + if (modid == -1) + modid = ((struct link_map *) h)->l_tls_modid; + else if (((struct link_map *) h)->l_tls_modid != modid) + { + printf ("round %d: modid now %zd, initially %d\n", + i, ((struct link_map *) h)->l_tls_modid, modid); + result = 1; + } +#endif + + foop = dlsym (h, "foo"); + if (foop == NULL) + { + printf ("cannot get symbol 'foo': %s\n", dlerror ()); + exit (1); + } + + *foop = 42 + i; + + fp = dlsym (h, "in_dso"); + if (fp == NULL) + { + printf ("cannot get symbol 'in_dso': %s\n", dlerror ()); + exit (1); + } + + result |= fp (42 + i, foop); + + foop2 = dlsym (h, "foo"); + if (foop2 == NULL) + { + printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ()); + exit (1); + } + + if (foop != foop2) + { + puts ("address of 'foo' different the second time"); + result = 1; + } + else if (*foop != 16) + { + puts ("foo != 16"); + result = 1; + } + + dlclose (h); + } + + return result; +#else + return 0; +#endif +} + + +#include "../test-skeleton.c" diff --git a/test/tls/tst-tls7.c b/test/tls/tst-tls7.c new file mode 100644 index 000000000..2dde9afa4 --- /dev/null +++ b/test/tls/tst-tls7.c @@ -0,0 +1,78 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +#include <tls.h> +#include <link.h> +#ifdef __UCLIBC__ +#include "dl-elf.h" +#include "dl-hash.h" +#endif + + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ +#ifdef USE_TLS + static const char modname[] = "tst-tlsmod3.so"; + int result = 0; + int (*fp) (void); + void *h; + int i; + int modid = -1; + + for (i = 0; i < 10; ++i) + { + h = dlopen (modname, RTLD_LAZY); + if (h == NULL) + { + printf ("cannot open '%s': %s\n", modname, dlerror ()); + exit (1); + } + + /* Dirty test code here: we peek into a private data structure. + We make sure that the module gets assigned the same ID every + time. The value of the first round is used. */ +#ifdef __UCLIBC__ + if (modid == -1) + modid = ((struct dyn_elf *) h)->dyn->l_tls_modid; + else if (((struct dyn_elf *)h)->dyn->l_tls_modid != (size_t) modid) + { + printf ("round %d: modid now %zu, initially %d\n", + i, + ((struct dyn_elf *)h)->dyn->l_tls_modid, + modid); + result = 1; + } +#else + if (modid == -1) + modid = ((struct link_map *) h)->l_tls_modid; + else if (((struct link_map *) h)->l_tls_modid != (size_t) modid) + { + printf ("round %d: modid now %zu, initially %d\n", + i, ((struct link_map *) h)->l_tls_modid, modid); + result = 1; + } +#endif + + fp = dlsym (h, "in_dso2"); + if (fp == NULL) + { + printf ("cannot get symbol 'in_dso2': %s\n", dlerror ()); + exit (1); + } + + result |= fp (); + + dlclose (h); + } + + return result; +#else + return 0; +#endif +} + + +#include "../test-skeleton.c" diff --git a/test/tls/tst-tls8.c b/test/tls/tst-tls8.c new file mode 100644 index 000000000..140de438e --- /dev/null +++ b/test/tls/tst-tls8.c @@ -0,0 +1,229 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +#include <tls.h> +#include <link.h> +#ifdef __UCLIBC__ +#include "dl-elf.h" +#include "dl-hash.h" +#endif + + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ +#ifdef USE_TLS + static const char modname1[] = "tst-tlsmod3.so"; + static const char modname2[] = "tst-tlsmod4.so"; + int result = 0; + int (*fp1) (void); + int (*fp2) (int, int *); + void *h1; + void *h2; + int i; + size_t modid1 = (size_t) -1; + size_t modid2 = (size_t) -1; + int *bazp; + + for (i = 0; i < 10; ++i) + { + h1 = dlopen (modname1, RTLD_LAZY); + if (h1 == NULL) + { + printf ("cannot open '%s': %s\n", modname1, dlerror ()); + exit (1); + } + + /* Dirty test code here: we peek into a private data structure. + We make sure that the module gets assigned the same ID every + time. The value of the first round is used. */ +#ifdef __UCLIBC__ + if (modid1 == (size_t) -1) + modid1 = ((struct dyn_elf *) h1)->dyn->l_tls_modid; + else if (((struct dyn_elf *)h1)->dyn->l_tls_modid != (size_t) modid1) + { + printf ("round %d: modid now %zd, initially %zd\n", + i, + ((struct dyn_elf *)h1)->dyn->l_tls_modid, + modid1); + result = 1; + } +#else + if (modid1 == (size_t) -1) + modid1 = ((struct link_map *) h1)->l_tls_modid; + else if (((struct link_map *) h1)->l_tls_modid != modid1) + { + printf ("round %d: modid now %zd, initially %zd\n", + i, ((struct link_map *) h1)->l_tls_modid, modid1); + result = 1; + } +#endif + + fp1 = dlsym (h1, "in_dso2"); + if (fp1 == NULL) + { + printf ("cannot get symbol 'in_dso2' in %s\n", modname1); + exit (1); + } + + result |= fp1 (); + + + + h2 = dlopen (modname2, RTLD_LAZY); + if (h2 == NULL) + { + printf ("cannot open '%s': %s\n", modname2, dlerror ()); + exit (1); + } + + /* Dirty test code here: we peek into a private data structure. + We make sure that the module gets assigned the same ID every + time. The value of the first round is used. */ +#ifdef __UCLIBC__ + if (modid2 == (size_t) -1) + modid2 = ((struct dyn_elf *)h2)->dyn->l_tls_modid; + else if (((struct dyn_elf *)h2)->dyn->l_tls_modid + != (size_t) modid2) + { + printf ("round %d: modid now %zd, initially %zd\n", + i, + ((struct dyn_elf *)h2)->dyn->l_tls_modid, + modid2); + result = 1; + } +#else + if (modid2 == (size_t) -1) + modid2 = ((struct link_map *) h2)->l_tls_modid; + else if (((struct link_map *) h2)->l_tls_modid != modid2) + { + printf ("round %d: modid now %zd, initially %zd\n", + i, ((struct link_map *) h2)->l_tls_modid, modid2); + result = 1; + } +#endif + + bazp = dlsym (h2, "baz"); + if (bazp == NULL) + { + printf ("cannot get symbol 'baz' in %s\n", modname2); + exit (1); + } + + *bazp = 42 + i; + + fp2 = dlsym (h2, "in_dso"); + if (fp2 == NULL) + { + printf ("cannot get symbol 'in_dso' in %s\n", modname2); + exit (1); + } + + result |= fp2 (42 + i, bazp); + + dlclose (h1); + dlclose (h2); + + + h1 = dlopen (modname1, RTLD_LAZY); + if (h1 == NULL) + { + printf ("cannot open '%s': %s\n", modname1, dlerror ()); + exit (1); + } + + /* Dirty test code here: we peek into a private data structure. + We make sure that the module gets assigned the same ID every + time. The value of the first round is used. */ +#ifdef __UCLIBC__ + if (((struct dyn_elf *)h1)->dyn->l_tls_modid + != modid1) + { + printf ("round %d: modid now %zd, initially %zd\n", + i, + ((struct dyn_elf *)h1)->dyn->l_tls_modid, + modid1); + result = 1; + } +#else + if (((struct link_map *) h1)->l_tls_modid != modid1) + { + printf ("round %d: modid now %zd, initially %zd\n", + i, ((struct link_map *) h1)->l_tls_modid, modid1); + result = 1; + } +#endif + + fp1 = dlsym (h1, "in_dso2"); + if (fp1 == NULL) + { + printf ("cannot get symbol 'in_dso2' in %s\n", modname1); + exit (1); + } + + result |= fp1 (); + + + + h2 = dlopen (modname2, RTLD_LAZY); + if (h2 == NULL) + { + printf ("cannot open '%s': %s\n", modname2, dlerror ()); + exit (1); + } + + /* Dirty test code here: we peek into a private data structure. + We make sure that the module gets assigned the same ID every + time. The value of the first round is used. */ +#ifdef __UCLIBC__ + if (((struct dyn_elf *)h2)->dyn->l_tls_modid + != modid2) + { + printf ("round %d: modid now %zd, initially %zd\n", + i, + ((struct dyn_elf *)h2)->dyn->l_tls_modid, + modid2); + result = 1; + } +#else + if (((struct link_map *) h2)->l_tls_modid != modid2) + { + printf ("round %d: modid now %zd, initially %zd\n", + i, ((struct link_map *) h2)->l_tls_modid, modid2); + result = 1; + } +#endif + + bazp = dlsym (h2, "baz"); + if (bazp == NULL) + { + printf ("cannot get symbol 'baz' in %s\n", modname2); + exit (1); + } + + *bazp = 62 + i; + + fp2 = dlsym (h2, "in_dso"); + if (fp2 == NULL) + { + printf ("cannot get symbol 'in_dso' in %s\n", modname2); + exit (1); + } + + result |= fp2 (62 + i, bazp); + + /* This time the dlclose calls are in reverse order. */ + dlclose (h2); + dlclose (h1); + } + + return result; +#else + return 0; +#endif +} + + +#include "../test-skeleton.c" diff --git a/test/tls/tst-tls9-static.c b/test/tls/tst-tls9-static.c new file mode 100644 index 000000000..51812ccc7 --- /dev/null +++ b/test/tls/tst-tls9-static.c @@ -0,0 +1 @@ +#include "tst-tls9.c" diff --git a/test/tls/tst-tls9.c b/test/tls/tst-tls9.c new file mode 100644 index 000000000..e317696df --- /dev/null +++ b/test/tls/tst-tls9.c @@ -0,0 +1,42 @@ +#include <dlfcn.h> +#include <stdio.h> +#include <stdlib.h> + +#include <link.h> +#include <tls.h> + +#define TEST_FUNCTION do_test () +static int +do_test (void) +{ +#ifdef USE_TLS + static const char modname1[] = "tst-tlsmod5.so"; + static const char modname2[] = "tst-tlsmod6.so"; + int result = 0; + + void *h1 = dlopen (modname1, RTLD_LAZY); + if (h1 == NULL) + { + printf ("cannot open '%s': %s\n", modname1, dlerror ()); + result = 1; + } + void *h2 = dlopen (modname2, RTLD_LAZY); + if (h2 == NULL) + { + printf ("cannot open '%s': %s\n", modname2, dlerror ()); + result = 1; + } + + if (h1 != NULL) + dlclose (h1); + if (h2 != NULL) + dlclose (h2); + + return result; +#else + return 0; +#endif +} + + +#include "../test-skeleton.c" diff --git a/test/tls/tst-tlsmod-at-ctor.c b/test/tls/tst-tlsmod-at-ctor.c new file mode 100644 index 000000000..bd04b5081 --- /dev/null +++ b/test/tls/tst-tlsmod-at-ctor.c @@ -0,0 +1,25 @@ +#include <stdio.h> +#include <tls.h> + +#define TLS_VAR_INIT_VALUE 99 + +#ifdef USE_TLS +__thread int tls_var __attribute__((tls_model("global-dynamic"))); +static __thread int local_tls_var __attribute__((tls_model("local-dynamic"))); +#endif + +void __attribute__((constructor)) libtls_ctor(void); +void libtls_ctor(void) +{ + printf("libtls: constructor!\n"); +#ifdef USE_TLS + local_tls_var = TLS_VAR_INIT_VALUE; + tls_var = local_tls_var; +#endif +} + +void __attribute__((destructor)) libtls_dtor(void); +void libtls_dtor(void) +{ + printf("libtls: destructor!\n"); +} diff --git a/test/tls/tst-tlsmod1.c b/test/tls/tst-tlsmod1.c new file mode 100644 index 000000000..b4954ca3e --- /dev/null +++ b/test/tls/tst-tlsmod1.c @@ -0,0 +1,68 @@ +#include <stdio.h> + +#include <tls.h> + +#ifdef USE_TLS +#include "tls-macros.h" + + +/* One define int variable, two externs. */ +COMMON_INT_DEF(foo); +VAR_INT_DEF(bar); +VAR_INT_DECL(baz); +#endif + +extern int in_dso (void); + +int +in_dso (void) +{ + int result = 0; +#ifdef USE_TLS + int *ap, *bp, *cp; + + /* Get variables using initial exec model. */ + fputs ("get sum of foo and bar (IE)", stdout); + __asm__ ("" ::: "memory"); + ap = TLS_IE (foo); + bp = TLS_IE (bar); + printf (" = %d\n", *ap + *bp); + result |= *ap + *bp != 3; + if (*ap != 1) + { + printf ("foo = %d\n", *ap); + result = 1; + } + if (*bp != 2) + { + printf ("bar = %d\n", *bp); + result = 1; + } + + + /* Get variables using generic dynamic model. */ + fputs ("get sum of foo and bar and baz (GD)", stdout); + ap = TLS_GD (foo); + bp = TLS_GD (bar); + cp = TLS_GD (baz); + printf (" = %d\n", *ap + *bp + *cp); + result |= *ap + *bp + *cp != 6; + if (*ap != 1) + { + printf ("foo = %d\n", *ap); + result = 1; + } + if (*bp != 2) + { + printf ("bar = %d\n", *bp); + result = 1; + } + if (*cp != 3) + { + printf ("baz = %d\n", *cp); + result = 1; + } +#endif + + return result; +} diff --git a/test/tls/tst-tlsmod10.c b/test/tls/tst-tlsmod10.c new file mode 100644 index 000000000..32e54f3c0 --- /dev/null +++ b/test/tls/tst-tlsmod10.c @@ -0,0 +1 @@ +#include "tst-tlsmod8.c" diff --git a/test/tls/tst-tlsmod11.c b/test/tls/tst-tlsmod11.c new file mode 100644 index 000000000..9938b5753 --- /dev/null +++ b/test/tls/tst-tlsmod11.c @@ -0,0 +1,6 @@ +#include "tst-tls10.h" + +#ifdef USE_TLS__THREAD +__thread struct A a1 = { 4, 5, 6 }; +__thread struct A a2 = { 7, 8, 9 }; +#endif diff --git a/test/tls/tst-tlsmod12.c b/test/tls/tst-tlsmod12.c new file mode 100644 index 000000000..4602709a1 --- /dev/null +++ b/test/tls/tst-tlsmod12.c @@ -0,0 +1,14 @@ +#include "tst-tls10.h" + +#ifdef USE_TLS__THREAD +extern __thread struct A a2 __attribute__((tls_model("initial-exec"))); + +void +check1 (void) +{ + if (a1.a != 4 || a1.b != 5 || a1.c != 6) + abort (); + if (a2.a != 7 || a2.b != 8 || a2.c != 9) + abort (); +} +#endif diff --git a/test/tls/tst-tlsmod13.c b/test/tls/tst-tlsmod13.c new file mode 100644 index 000000000..beca89f6f --- /dev/null +++ b/test/tls/tst-tlsmod13.c @@ -0,0 +1,14 @@ +#include <tls.h> + +#if defined USE_TLS && defined HAVE___THREAD \ + && defined HAVE_TLS_MODEL_ATTRIBUTE +__thread int a[2] __attribute__ ((tls_model ("initial-exec"))); +#else +int a[2]; +#endif + +int +foo (void) +{ + return a[0]; +} diff --git a/test/tls/tst-tlsmod13a.c b/test/tls/tst-tlsmod13a.c new file mode 100644 index 000000000..14b12b032 --- /dev/null +++ b/test/tls/tst-tlsmod13a.c @@ -0,0 +1,16 @@ +#include <tls.h> + +#if defined USE_TLS && defined HAVE___THREAD \ + && defined HAVE_TLS_MODEL_ATTRIBUTE +__thread int b[2] __attribute__ ((tls_model ("initial-exec"))); +#else +int b[2]; +#endif + +extern int foo (void); + +int +bar (void) +{ + return foo () + b[0]; +} diff --git a/test/tls/tst-tlsmod14a.c b/test/tls/tst-tlsmod14a.c new file mode 100644 index 000000000..0bb393d9c --- /dev/null +++ b/test/tls/tst-tlsmod14a.c @@ -0,0 +1,41 @@ +#include <stdint.h> +#include <stdio.h> + +#include <tls.h> + +#if USE_TLS && HAVE___THREAD + +#define AL 4096 +struct foo +{ + int i; +} __attribute ((aligned (AL))); + +static __thread struct foo f; +static struct foo g; + + +#ifndef FCT +# define FCT in_dso1 +#endif + + +int +FCT (void) +{ + puts (__func__); + + int result = 0; + + int fail = (((uintptr_t) &f) & (AL - 1)) != 0; + printf ("&f = %p %s\n", &f, fail ? "FAIL" : "OK"); + result |= fail; + + fail = (((uintptr_t) &g) & (AL - 1)) != 0; + printf ("&g = %p %s\n", &g, fail ? "FAIL" : "OK"); + result |= fail; + + return result; +} + +#endif diff --git a/test/tls/tst-tlsmod14b.c b/test/tls/tst-tlsmod14b.c new file mode 100644 index 000000000..24d9ceaf7 --- /dev/null +++ b/test/tls/tst-tlsmod14b.c @@ -0,0 +1,2 @@ +#define FCT in_dso2 +#include "tst-tlsmod14a.c" diff --git a/test/tls/tst-tlsmod15a.c b/test/tls/tst-tlsmod15a.c new file mode 100644 index 000000000..66c707129 --- /dev/null +++ b/test/tls/tst-tlsmod15a.c @@ -0,0 +1,6 @@ +extern int nonexistent_dummy_var; +int * +foo (void) +{ + return &nonexistent_dummy_var; +} diff --git a/test/tls/tst-tlsmod15b.c b/test/tls/tst-tlsmod15b.c new file mode 100644 index 000000000..4f63eab14 --- /dev/null +++ b/test/tls/tst-tlsmod15b.c @@ -0,0 +1,17 @@ +#include "tst-tls10.h" + +#ifdef USE_TLS__THREAD +__thread int mod15b_var __attribute__((tls_model("initial-exec"))); + +int +in_dso (void) +{ + return mod15b_var; +} +#else +int +in_dso (void) +{ + return 0; +} +#endif diff --git a/test/tls/tst-tlsmod16a.c b/test/tls/tst-tlsmod16a.c new file mode 100644 index 000000000..847c8090f --- /dev/null +++ b/test/tls/tst-tlsmod16a.c @@ -0,0 +1,7 @@ +#include <tls.h> + +#if defined HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE +int __thread tlsvar; +#else +int tlsvar; +#endif diff --git a/test/tls/tst-tlsmod16b.c b/test/tls/tst-tlsmod16b.c new file mode 100644 index 000000000..308e6bae9 --- /dev/null +++ b/test/tls/tst-tlsmod16b.c @@ -0,0 +1,13 @@ +#include <tls.h> + +#if defined HAVE___THREAD && defined HAVE_TLS_MODEL_ATTRIBUTE +extern __thread int tlsvar __attribute__((tls_model("initial-exec"))); +#else +extern int tlsvar; +#endif + +void * +in_dso (void) +{ + return &tlsvar; +} diff --git a/test/tls/tst-tlsmod17a.c b/test/tls/tst-tlsmod17a.c new file mode 100644 index 000000000..4d3965005 --- /dev/null +++ b/test/tls/tst-tlsmod17a.c @@ -0,0 +1,23 @@ +#include <stdio.h> + +#ifndef N +#define N 0 +#endif +#define CONCAT1(s, n) s##n +#define CONCAT(s, n) CONCAT1(s, n) + +__thread int CONCAT (v, N) = 4; + +int +CONCAT (tlsmod17a, N) (void) +{ + int *p = &CONCAT (v, N); + /* GCC assumes &var is never NULL, add optimization barrier. */ + __asm__ __volatile__ ("" : "+r" (p)); + if (p == NULL || *p != 4) + { + printf ("fail %d %p\n", N, p); + return 1; + } + return 0; +} diff --git a/test/tls/tst-tlsmod17b.c b/test/tls/tst-tlsmod17b.c new file mode 100644 index 000000000..617882873 --- /dev/null +++ b/test/tls/tst-tlsmod17b.c @@ -0,0 +1,15 @@ +#define P(N) extern int tlsmod17a##N (void); +#define PS P(0) P(1) P(2) P(3) P(4) P(5) P(6) P(7) P(8) P(9) \ + P(10) P(12) P(13) P(14) P(15) P(16) P(17) P(18) P(19) +PS +#undef P + +int +tlsmod17b (void) +{ + int res = 0; +#define P(N) res |= tlsmod17a##N (); + PS +#undef P + return res; +} diff --git a/test/tls/tst-tlsmod18a.c b/test/tls/tst-tlsmod18a.c new file mode 100644 index 000000000..e0ae65a88 --- /dev/null +++ b/test/tls/tst-tlsmod18a.c @@ -0,0 +1,21 @@ +#include <stdio.h> + +#ifndef N +# define N 0 +#endif + +static __thread int var = 4; + +int +test (void) +{ + int *p = &var; + /* GCC assumes &var is never NULL, add optimization barrier. */ + __asm__ __volatile__ ("" : "+r" (p)); + if (p == NULL || *p != 4) + { + printf ("fail %d %p\n", N, p); + return 1; + } + return 0; +} diff --git a/test/tls/tst-tlsmod2.c b/test/tls/tst-tlsmod2.c new file mode 100644 index 000000000..4547c9716 --- /dev/null +++ b/test/tls/tst-tlsmod2.c @@ -0,0 +1,38 @@ +#include <stdio.h> + +#include <tls.h> + +#ifdef USE_TLS +#include "tls-macros.h" + + +COMMON_INT_DEF(foo); + + +int +in_dso (int n, int *caller_foop) +{ + int *foop; + int result = 0; + + puts ("foo"); /* Make sure PLT is used before macros. */ + __asm__ ("" ::: "memory"); + + foop = TLS_GD (foo); + + if (caller_foop != NULL && foop != caller_foop) + { + printf ("callers address of foo differs: %p vs %p\n", caller_foop, foop); + result = 1; + } + else if (*foop != n) + { + printf ("foo != %d\n", n); + result = 1; + } + + *foop = 16; + + return result; +} +#endif diff --git a/test/tls/tst-tlsmod3.c b/test/tls/tst-tlsmod3.c new file mode 100644 index 000000000..12505f623 --- /dev/null +++ b/test/tls/tst-tlsmod3.c @@ -0,0 +1,41 @@ +#include <stdio.h> + +#include <tls.h> + +#ifdef USE_TLS +# include "tls-macros.h" + +extern int in_dso (int n, int *caller_foop); + +COMMON_INT_DEF(comm_n); + + + + +int +in_dso2 (void) +{ + int *foop; + int result = 0; + static int n; + int *np; + + puts ("foo"); /* Make sure PLT is used before macros. */ + __asm__ ("" ::: "memory"); + + foop = TLS_GD (foo); + np = TLS_GD (comm_n); + + if (n != *np) + { + printf ("n = %d != comm_n = %d\n", n, *np); + result = 1; + } + + result |= in_dso (*foop = 42 + n++, foop); + + *foop = 16; + + return result; +} +#endif diff --git a/test/tls/tst-tlsmod4.c b/test/tls/tst-tlsmod4.c new file mode 100644 index 000000000..4893cdae7 --- /dev/null +++ b/test/tls/tst-tlsmod4.c @@ -0,0 +1,38 @@ +#include <stdio.h> + +#include <tls.h> + +#ifdef USE_TLS +# include "tls-macros.h" + + +COMMON_INT_DEF(baz); + + +int +in_dso (int n, int *caller_bazp) +{ + int *bazp; + int result = 0; + + puts ("foo"); /* Make sure PLT is used before macros. */ + __asm__ ("" ::: "memory"); + + bazp = TLS_GD (baz); + + if (caller_bazp != NULL && bazp != caller_bazp) + { + printf ("callers address of baz differs: %p vs %p\n", caller_bazp, bazp); + result = 1; + } + else if (*bazp != n) + { + printf ("baz != %d\n", n); + result = 1; + } + + *bazp = 16; + + return result; +} +#endif diff --git a/test/tls/tst-tlsmod5.c b/test/tls/tst-tlsmod5.c new file mode 100644 index 000000000..2ec69e13b --- /dev/null +++ b/test/tls/tst-tlsmod5.c @@ -0,0 +1,7 @@ +#include <tls.h> + +#ifdef USE_TLS +#include "tls-macros.h" + +COMMON_INT_DEF(foo); +#endif diff --git a/test/tls/tst-tlsmod6.c b/test/tls/tst-tlsmod6.c new file mode 100644 index 000000000..0fda51b22 --- /dev/null +++ b/test/tls/tst-tlsmod6.c @@ -0,0 +1,7 @@ +#include <tls.h> + +#ifdef USE_TLS +#include "tls-macros.h" + +COMMON_INT_DEF(bar); +#endif diff --git a/test/tls/tst-tlsmod7.c b/test/tls/tst-tlsmod7.c new file mode 100644 index 000000000..944b97f9c --- /dev/null +++ b/test/tls/tst-tlsmod7.c @@ -0,0 +1,103 @@ +#include "tst-tls10.h" + +#ifdef USE_TLS__THREAD +__thread int dummy __attribute__((visibility ("hidden"))) = 12; +__thread struct A a1 = { 4, 5, 6 }; +__thread struct A a2 = { 7, 8, 9 }; +__thread struct A a3 __attribute__((tls_model("initial-exec"))) + = { 10, 11, 12 }; +__thread struct A a4 __attribute__((tls_model("initial-exec"))) + = { 13, 14, 15 }; +static __thread struct A local1 = { 16, 17, 18 }; +static __thread struct A local2 __attribute__((tls_model("initial-exec"))) + = { 19, 20, 21 }; + +void +check1 (void) +{ + if (a1.a != 4 || a1.b != 5 || a1.c != 6) + abort (); + if (a2.a != 22 || a2.b != 23 || a2.c != 24) + abort (); + if (a3.a != 10 || a3.b != 11 || a3.c != 12) + abort (); + if (a4.a != 25 || a4.b != 26 || a4.c != 27) + abort (); + if (local1.a != 16 || local1.b != 17 || local1.c != 18) + abort (); + if (local2.a != 19 || local2.b != 20 || local2.c != 21) + abort (); +} + +struct A * +f1a (void) +{ + return &a1; +} + +struct A * +f2a (void) +{ + return &a2; +} + +struct A * +f3a (void) +{ + return &a3; +} + +struct A * +f4a (void) +{ + return &a4; +} + +struct A * +f5a (void) +{ + return &local1; +} + +struct A * +f6a (void) +{ + return &local2; +} + +int +f1b (void) +{ + return a1.a; +} + +int +f2b (void) +{ + return a2.b; +} + +int +f3b (void) +{ + return a3.c; +} + +int +f4b (void) +{ + return a4.a; +} + +int +f5b (void) +{ + return local1.b; +} + +int +f6b (void) +{ + return local2.c; +} +#endif diff --git a/test/tls/tst-tlsmod8.c b/test/tls/tst-tlsmod8.c new file mode 100644 index 000000000..c1822fc0c --- /dev/null +++ b/test/tls/tst-tlsmod8.c @@ -0,0 +1,72 @@ +#include "tst-tls10.h" + +#ifdef USE_TLS__THREAD +__thread long long dummy __attribute__((visibility ("hidden"))) = 12; +__thread struct A a2 = { 22, 23, 24 }; +__thread struct A a4 __attribute__((tls_model("initial-exec"))) + = { 25, 26, 27 }; +static __thread struct A local1 = { 28, 29, 30 }; +static __thread struct A local2 __attribute__((tls_model("initial-exec"))) + = { 31, 32, 33 }; + +void +check2 (void) +{ + if (a2.a != 22 || a2.b != 23 || a2.c != 24) + abort (); + if (a4.a != 25 || a4.b != 26 || a4.c != 27) + abort (); + if (local1.a != 28 || local1.b != 29 || local1.c != 30) + abort (); + if (local2.a != 31 || local2.b != 32 || local2.c != 33) + abort (); +} + +struct A * +f7a (void) +{ + return &a2; +} + +struct A * +f8a (void) +{ + return &a4; +} + +struct A * +f9a (void) +{ + return &local1; +} + +struct A * +f10a (void) +{ + return &local2; +} + +int +f7b (void) +{ + return a2.b; +} + +int +f8b (void) +{ + return a4.a; +} + +int +f9b (void) +{ + return local1.b; +} + +int +f10b (void) +{ + return local2.c; +} +#endif diff --git a/test/tls/tst-tlsmod9.c b/test/tls/tst-tlsmod9.c new file mode 100644 index 000000000..e124144e4 --- /dev/null +++ b/test/tls/tst-tlsmod9.c @@ -0,0 +1,101 @@ +#include "tst-tls10.h" + +#ifdef USE_TLS__THREAD +__thread int dummy __attribute__((visibility ("hidden"))) = 12; +__thread struct A a1 = { 4, 5, 6 }; +__thread struct A a3 __attribute__((tls_model("initial-exec"))) + = { 10, 11, 12 }; +extern __thread struct A a4 __attribute__((tls_model("initial-exec"))); +static __thread struct A local1 = { 16, 17, 18 }; +static __thread struct A local2 __attribute__((tls_model("initial-exec"))) + = { 19, 20, 21 }; + +void +check1 (void) +{ + if (a1.a != 4 || a1.b != 5 || a1.c != 6) + abort (); + if (a2.a != 22 || a2.b != 23 || a2.c != 24) + abort (); + if (a3.a != 10 || a3.b != 11 || a3.c != 12) + abort (); + if (a4.a != 25 || a4.b != 26 || a4.c != 27) + abort (); + if (local1.a != 16 || local1.b != 17 || local1.c != 18) + abort (); + if (local2.a != 19 || local2.b != 20 || local2.c != 21) + abort (); +} + +struct A * +f1a (void) +{ + return &a1; +} + +struct A * +f2a (void) +{ + return &a2; +} + +struct A * +f3a (void) +{ + return &a3; +} + +struct A * +f4a (void) +{ + return &a4; +} + +struct A * +f5a (void) +{ + return &local1; +} + +struct A * +f6a (void) +{ + return &local2; +} + +int +f1b (void) +{ + return a1.a; +} + +int +f2b (void) +{ + return a2.b; +} + +int +f3b (void) +{ + return a3.c; +} + +int +f4b (void) +{ + return a4.a; +} + +int +f5b (void) +{ + return local1.b; +} + +int +f6b (void) +{ + return local2.c; +} +#endif diff --git a/test/uclibcng-testrunner.sh b/test/uclibcng-testrunner.sh new file mode 100644 index 000000000..943c95086 --- /dev/null +++ b/test/uclibcng-testrunner.sh @@ -0,0 +1,62 @@ +#!/bin/sh +#- +# Copyright (c) 2015 +# Thorsten "mirabilos" Glaser <tg@mirbsd.org> +# +# Provided that these terms and disclaimer and all copyright notices +# are retained or reproduced in an accompanying document, permission +# is granted to deal in this work without restriction, including un- +# limited rights to use, publicly perform, distribute, sell, modify, +# merge, give away, or sublicence. +# +# This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to +# the utmost extent permitted by applicable law, neither express nor +# implied; without malicious intent or gross negligence. In no event +# may a licensor, author or contributor be held liable for indirect, +# direct, other damage, loss, or other issues arising in any way out +# of dealing in the work, even if advised of the possibility of such +# damage or existence of a defect, except proven that it results out +# of said person's immediate fault when using the work as intended. +#- +# Testsuite runner + +die() { + echo >&2 E: "$*" + exit 1 +} + +test -s uclibcng-testrunner.in || die uclibcng-testrunner.in not found + +nfail=0 +npass=0 +while read expected_ret tst_src_name binary_name subdir cmd; do + printf '.... %s\r' "$binary_name" + (cd $subdir && eval "$cmd" >$binary_name.out 2>&1) </dev/null + ret=$? + test $ret = "$expected_ret" || { + echo "FAIL $binary_name got $ret expected $expected_ret" + nfail=`expr $nfail + 1` + sed 's/^/ /' <$subdir/$binary_name.out + continue + } + for x in $binary_name.out $test_src_name.out -; do + if test x"$x" = x"-"; then + echo "PASS $binary_name" + npass=`expr $npass + 1` + break + fi + test -e "$subdir/$x.good" || continue + if d=`diff -u "$subdir/$binary_name.out" "$subdir/$x.good"`; then + echo "PASS $binary_name" + npass=`expr $npass + 1` + else + echo "FAIL $binary_name expected output differs" + nfail=`expr $nfail + 1` + echo "$d" | sed 's/^/ /' + fi + break + done +done <uclibcng-testrunner.in +echo Total failed: $nfail +echo Total passed: $npass +test $nfail = 0 diff --git a/test/unistd/Makefile b/test/unistd/Makefile index c5007cdcc..796d7ccea 100644 --- a/test/unistd/Makefile +++ b/test/unistd/Makefile @@ -1,13 +1,8 @@ # uClibc unistd tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in include ../Test.mak - -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/Makefile.in b/test/unistd/Makefile.in new file mode 100644 index 000000000..da59a3689 --- /dev/null +++ b/test/unistd/Makefile.in @@ -0,0 +1,49 @@ +# uClibc unistd tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +TESTS_DISABLED := +# If LFS is not set, get rid of all *64 tests up front +ifeq ($(UCLIBC_HAS_LFS),) +TESTS_DISABLED += tst-preadwrite64 +endif + +# If we don't have LINUX_SPECIFIC, then get rid of tst-fallocate +ifeq ($(UCLIBC_LINUX_SPECIFIC),) +TESTS_DISABLED += tst-fallocate +endif + +ifeq ($(TARGET_avr32),y) +TESTS_DISABLED += tst-fallocate tst-posix_fallocate tst-fallocate64 +endif + +# The logic is similar for HAS_ADVANCED_REALTIME and +# tst-posix_fallocate/tst-posix_fallocate64 +ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),) +TESTS_DISABLED += tst-posix_fallocate +endif + +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 + +# for embedded systems 4 GB disk space is not available +TESTS_DISABLED += tst-posix_fallocate64 tst-fallocate64 + +CFLAGS_tst-fallocate = -fPIC +CFLAGS_tst-posix_fallocate = -fPIC +CFLAGS_tst-preadwrite = -fPIC +CFLAGS_tst-preadwrite64 = -fPIC + +# getconf.c lives in utils/ +# Testsuite cannot currently be built with O= anyway, so hardcode path here +getconf.c: + $(LN_S) ../../utils/$(@F) . +EXTRA_CLEAN += getconf.c +TESTS_DISABLED += getconf +CFLAGS_getconf = -DGETCONF_DIR='"$(CURDIR)"' +shell_tst-getconf: getconf getconf_glibc diff --git a/test/unistd/errno.c b/test/unistd/errno.c index 5fdb3b347..5d4fc726a 100644 --- a/test/unistd/errno.c +++ b/test/unistd/errno.c @@ -17,7 +17,7 @@ int main(void) { int r_clone, ret_errno; - r_clone = do_clone(child_fn, NULL, (int) NULL, NULL); + r_clone = do_clone(child_fn, NULL, 0, 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/tst-fallocate.c b/test/unistd/tst-fallocate.c new file mode 100644 index 000000000..fc81781bb --- /dev/null +++ b/test/unistd/tst-fallocate.c @@ -0,0 +1,166 @@ +#include <fcntl.h> +#include <sys/stat.h> + +#ifndef TST_FALLOCATE64 +# define stat64 stat +# define fstat64 fstat +# else +# ifndef O_LARGEFILE +# error no O_LARGEFILE but you want to test with LFS enabled +# endif +#endif + +static void do_prepare(void); +static int do_test(void); +#define PREPARE(argc, argv) do_prepare () +#define TEST_FUNCTION do_test () +#include <test-skeleton.c> + +static int fd; +static void +do_prepare (void) +{ + fd = create_temp_file ("tst-fallocate.", NULL); + if (fd == -1) + { + printf ("cannot create temporary file: %m\n"); + exit (1); + } +} + + +static int +do_test (void) +{ + struct stat64 st; + int c; + char garbage[4096]; + blkcnt_t blksb4; + + if (fstat64 (fd, &st) != 0) + { + puts ("1st fstat failed"); + return 1; + } + + if (st.st_size != 0) + { + puts ("file not created with size 0"); + return 1; + } + + /* This is the default mode which is identical to posix_fallocate(). + Note: we need a few extra blocks for FALLOC_FL_PUNCH_HOLE below. + While block sizes vary, we'll assume eight 4K blocks for good measure. */ + if (fallocate (fd, 0, 8 * 4096, 128) != 0) + { + puts ("1st fallocate call failed"); + return 1; + } + + if (fstat64 (fd, &st) != 0) + { + puts ("2nd fstat failed"); + return 1; + } + + if (st.st_size != 8 * 4096 + 128) + { + printf ("file size after 1st fallocate call is %llu, expected %u\n", + (unsigned long long int) st.st_size, 8u * 4096u + 128u); + return 1; + } + + /* Without FALLOC_FL_KEEP_SIZE, this would increaste the size of the file. */ + if (fallocate (fd, FALLOC_FL_KEEP_SIZE, 0, 16 * 4096) != 0) + { + puts ("2nd fallocate call failed"); + return 1; + } + + if (fstat64 (fd, &st) != 0) + { + puts ("3rd fstat failed"); + return 1; + } + + if (st.st_size != 8 * 4096 + 128) + { + printf ("file size changed in 2nd fallocate call to %llu, expected %u\n", + (unsigned long long int) st.st_size, 8u * 4096u + 128u); + return 1; + } + + /* Let's fill up the first eight 4k blocks with 'x' to force some allocations. */ + + memset(garbage, 'x', 4096); + for(c=0; c < 8; c++) + if(write(fd, garbage, 4096) == -1) + { + puts ("write failed"); + return 1; + } + + if (fstat64 (fd, &st) != 0) + { + puts ("4th fstat failed"); + return 1; + } + + blksb4 = st.st_blocks; + + /* Let's punch a hole in the entire file, turning it effectively into a sparse file. */ + if (fallocate (fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 8 * 4096 + 128) != 0) + { + puts ("3rd fallocate call failed"); + return 1; + } + + if (fstat64 (fd, &st) != 0) + { + puts ("5th fstat failed"); + return 1; + } + + if (st.st_size != 8 * 4096 + 128) + { + printf ("file size after 3rd fallocate call is %llu, expected %u\n", + (unsigned long long int) st.st_size, 8u * 4096u + 128u); + return 1; + } + + /* The number of allocated blocks should decrease. I hope this works on + all filesystems! */ + if (st.st_blocks >= blksb4) + { + printf ("number of blocks after 3rd fallocate call is %lu, expected less than %lu\n", + (unsigned long int) st.st_blocks, blksb4); + return 1; + } + +#ifdef TST_FALLOCATE64 + /* We'll just do a mode = 0 test for fallocate64() */ + if (fallocate64 (fd, 0, 4097ULL, 4294967295ULL + 2ULL) != 0) + { + puts ("1st fallocate64 call failed"); + return 1; + } + + if (fstat64 (fd, &st) != 0) + { + puts ("6th fstat failed"); + return 1; + } + + if (st.st_size != 4097ULL + 4294967295ULL + 2ULL) + { + printf ("file size after 1st fallocate64 call is %llu, expected %llu\n", + (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL); + return 1; + } +#endif + close (fd); + + return 0; +} + diff --git a/test/unistd/tst-fallocate64.c b/test/unistd/tst-fallocate64.c new file mode 100644 index 000000000..720428f8f --- /dev/null +++ b/test/unistd/tst-fallocate64.c @@ -0,0 +1,2 @@ +#define TST_FALLOCATE64 +#include "tst-fallocate.c" diff --git a/test/unistd/tst-getconf.sh b/test/unistd/tst-getconf.sh new file mode 100755 index 000000000..3a2aa4ea7 --- /dev/null +++ b/test/unistd/tst-getconf.sh @@ -0,0 +1,240 @@ +#! /bin/sh + +basedir="." + +# make sure to use the same locale everywhere. +LC_ALL=C +export LC_ALL +LANG=C +export LANG + +for suffix in _glibc '' +do +binary=$basedir/getconf$suffix +logfile=$basedir/tst-getconf$suffix.out +rm -f $logfile + +result=0 +while read name; do + case "$name" in + "#"*) continue;; + esac + echo -n "getconf $name: " >> $logfile + $binary "$name" 2>> $logfile >> $logfile + if test $? -ne 0; then + echo "*** $name FAILED" >> $logfile + result=1 + fi +done <<EOF +AIO_LISTIO_MAX +AIO_MAX +AIO_PRIO_DELTA_MAX +ARG_MAX +ATEXIT_MAX +BC_BASE_MAX +BC_DIM_MAX +BC_SCALE_MAX +BC_STRING_MAX +CHILD_MAX +COLL_WEIGHTS_MAX +DELAYTIMER_MAX +EXPR_NEST_MAX +HOST_NAME_MAX +IOV_MAX +LINE_MAX +LOGIN_NAME_MAX +NGROUPS_MAX +MQ_OPEN_MAX +MQ_PRIO_MAX +OPEN_MAX +_POSIX_ADVISORY_INFO +_POSIX_BARRIERS +_POSIX_ASYNCHRONOUS_IO +_POSIX_BASE +_POSIX_C_LANG_SUPPORT +_POSIX_C_LANG_SUPPORT_R +_POSIX_CLOCK_SELECTION +_POSIX_CPUTIME +_POSIX_DEVICE_IO +_POSIX_DEVICE_SPECIFIC +_POSIX_DEVICE_SPECIFIC_R +_POSIX_FD_MGMT +_POSIX_FIFO +_POSIX_FILE_ATTRIBUTES +_POSIX_FILE_LOCKING +_POSIX_FILE_SYSTEM +_POSIX_FSYNC +_POSIX_JOB_CONTROL +_POSIX_MAPPED_FILES +_POSIX_MEMLOCK +_POSIX_MEMLOCK_RANGE +_POSIX_MEMORY_PROTECTION +_POSIX_MESSAGE_PASSING +_POSIX_MONOTONIC_CLOCK +_POSIX_MULTI_PROCESS +_POSIX_NETWORKING +_POSIX_PIPE +_POSIX_PRIORITIZED_IO +_POSIX_PRIORITY_SCHEDULING +_POSIX_READER_WRITER_LOCKS +_POSIX_REALTIME_SIGNALS +_POSIX_REGEXP +_POSIX_SAVED_IDS +_POSIX_SEMAPHORES +_POSIX_SHARED_MEMORY_OBJECTS +_POSIX_SHELL +_POSIX_SIGNALS +_POSIX_SINGLE_PROCESS +_POSIX_SPAWN +_POSIX_SPIN_LOCKS +_POSIX_SPORADIC_SERVER +_POSIX_SYNCHRONIZED_IO +_POSIX_SYSTEM_DATABASE +_POSIX_SYSTEM_DATABASE_R +_POSIX_THREAD_ATTR_STACKADDR +_POSIX_THREAD_ATTR_STACKSIZE +_POSIX_THREAD_CPUTIME +_POSIX_THREAD_PRIO_INHERIT +_POSIX_THREAD_PRIO_PROTECT +_POSIX_THREAD_PRIORITY_SCHEDULING +_POSIX_THREAD_PROCESS_SHARED +_POSIX_THREAD_SAFE_FUNCTIONS +_POSIX_THREAD_SPORADIC_SERVER +_POSIX_THREADS +_POSIX_TIMEOUTS +_POSIX_TIMERS +_POSIX_TRACE +_POSIX_TRACE_EVENT_FILTER +_POSIX_TRACE_INHERIT +_POSIX_TRACE_LOG +_POSIX_TYPED_MEMORY_OBJECTS +_POSIX_USER_GROUPS +_POSIX_USER_GROUPS_R +_POSIX_VERSION +_POSIX_V7_ILP32_OFF32 +_POSIX_V7_ILP32_OFFBIG +_POSIX_V7_LP64_OFF64 +_POSIX_V7_LPBIG_OFFBIG +#_POSIX_V7_WIDTH_RESTRICTED_ENVS +POSIX2_C_BIND +POSIX2_C_DEV +POSIX2_C_VERSION +POSIX2_CHAR_TERM +POSIX2_FORT_DEV +POSIX2_FORT_RUN +POSIX2_LOCALEDEF +POSIX2_PBS +POSIX2_PBS_ACCOUNTING +POSIX2_PBS_LOCATE +POSIX2_PBS_MESSAGE +POSIX2_PBS_TRACK +POSIX2_SW_DEV +POSIX2_UPE +POSIX2_VERSION +_REGEX_VERSION +PAGE_SIZE +PAGESIZE +PTHREAD_DESTRUCTOR_ITERATIONS +PTHREAD_KEYS_MAX +PTHREAD_STACK_MIN +PTHREAD_THREADS_MAX +RE_DUP_MAX +RTSIG_MAX +SEM_NSEMS_MAX +SEM_VALUE_MAX +SIGQUEUE_MAX +STREAM_MAX +SYMLOOP_MAX +TIMER_MAX +TTY_NAME_MAX +TZNAME_MAX +#_XBS5_ILP32_OFF32 +#_XBS5_ILP32_OFFBIG +#_XBS5_LP64_OFF64 +#_XBS5_LPBIG_OFFBIG +_XOPEN_CRYPT +_XOPEN_ENH_I18N +_XOPEN_LEGACY +_XOPEN_REALTIME +_XOPEN_REALTIME_THREADS +_XOPEN_SHM +_XOPEN_UNIX +_XOPEN_VERSION +_XOPEN_XCU_VERSION +PATH +#POSIX_V7_ILP32_OFF32_CFLAGS +#POSIX_V7_ILP32_OFF32_LDFLAGS +#POSIX_V7_ILP32_OFF32_LIBS +#POSIX_V7_ILP32_OFF32_LINTFLAGS +#POSIX_V7_ILP32_OFFBIG_CFLAGS +#POSIX_V7_ILP32_OFFBIG_LDFLAGS +#POSIX_V7_ILP32_OFFBIG_LIBS +#POSIX_V7_ILP32_OFFBIG_LINTFLAGS +#POSIX_V7_LP64_OFF64_CFLAGS +#POSIX_V7_LP64_OFF64_LDFLAGS +#POSIX_V7_LP64_OFF64_LIBS +#POSIX_V7_LP64_OFF64_LINTFLAGS +#POSIX_V7_LPBIG_OFFBIG_CFLAGS +#POSIX_V7_LPBIG_OFFBIG_LDFLAGS +#POSIX_V7_LPBIG_OFFBIG_LIBS +#POSIX_V7_LPBIG_OFFBIG_LINTFLAGS +#XBS5_ILP32_OFF32_CFLAGS +#XBS5_ILP32_OFF32_LDFLAGS +#XBS5_ILP32_OFF32_LIBS +#XBS5_ILP32_OFF32_LINTFLAGS +#XBS5_ILP32_OFFBIG_CFLAGS +#XBS5_ILP32_OFFBIG_LDFLAGS +#XBS5_ILP32_OFFBIG_LIBS +#XBS5_ILP32_OFFBIG_LINTFLAGS +#XBS5_LP64_OFF64_CFLAGS +#XBS5_LP64_OFF64_LDFLAGS +#XBS5_LP64_OFF64_LIBS +#XBS5_LP64_OFF64_LINTFLAGS +#XBS5_LPBIG_OFFBIG_CFLAGS +#XBS5_LPBIG_OFFBIG_LDFLAGS +#XBS5_LPBIG_OFFBIG_LIBS +#XBS5_LPBIG_OFFBIG_LINTFLAGS +_NPROCESSORS_ONLN +_NPROCESSORS_CONF +EOF + +while read name; do + echo -n "getconf $name /: " >> $logfile + $binary "$name" / 2>> $logfile >> $logfile + if test $? -ne 0; then + echo "*** $name FAILED" >> $logfile + result=1 + fi +done <<EOF +FILESIZEBITS +LINK_MAX +MAX_CANON +MAX_INPUT +NAME_MAX +PATH_MAX +PIPE_BUF +POSIX_ALLOC_SIZE_MIN +POSIX_REC_INCR_XFER_SIZE +POSIX_REC_MAX_XFER_SIZE +POSIX_REC_MIN_XFER_SIZE +POSIX_REC_XFER_ALIGN +SYMLINK_MAX +_POSIX_CHOWN_RESTRICTED +_POSIX_NO_TRUNC +_POSIX_VDISABLE +_POSIX_ASYNC_IO +_POSIX_PRIO_IO +_POSIX_SYNC_IO +EOF + +done +exit $result + +# Preserve executable bits for this shell script. +Local Variables: +eval:(defun frobme () (set-file-modes buffer-file-name file-mode)) +eval:(make-local-variable 'file-mode) +eval:(setq file-mode (file-modes (buffer-file-name))) +eval:(make-local-variable 'after-save-hook) +eval:(add-hook 'after-save-hook 'frobme) +End: diff --git a/test/unistd/tst-posix_fallocate.c b/test/unistd/tst-posix_fallocate.c new file mode 100644 index 000000000..d41c604e8 --- /dev/null +++ b/test/unistd/tst-posix_fallocate.c @@ -0,0 +1,127 @@ +#include <fcntl.h> +#include <sys/stat.h> + +#ifndef TST_POSIX_FALLOCATE64 +# define stat64 stat +# define fstat64 fstat +# else +# ifndef O_LARGEFILE +# error no O_LARGEFILE but you want to test with LFS enabled +# endif +#endif + +static void do_prepare (void); +#define PREPARE(argc, argv) do_prepare () +static int do_test (void); +#define TEST_FUNCTION do_test () +#include <test-skeleton.c> + +static int fd; +static void +do_prepare (void) +{ + fd = create_temp_file ("tst-posix_fallocate.", NULL); + if (fd == -1) + { + printf ("cannot create temporary file: %m\n"); + exit (1); + } +} + + +static int +do_test (void) +{ + struct stat64 st; + + if (fstat64 (fd, &st) != 0) + { + puts ("1st fstat failed"); + return 1; + } + + if (st.st_size != 0) + { + puts ("file not created with size 0"); + return 1; + } + + if (posix_fallocate (fd, 512, 768) != 0) + { + puts ("1st posix_fallocate call failed"); + return 1; + } + + if (fstat64 (fd, &st) != 0) + { + puts ("2nd fstat failed"); + return 1; + } + + if (st.st_size != 512 + 768) + { + printf ("file size after 1st posix_fallocate call is %llu, expected %u\n", + (unsigned long long int) st.st_size, 512u + 768u); + return 1; + } + + if (posix_fallocate (fd, 0, 1024) != 0) + { + puts ("2nd posix_fallocate call failed"); + return 1; + } + + if (fstat64 (fd, &st) != 0) + { + puts ("3rd fstat failed"); + return 1; + } + + if (st.st_size != 512 + 768) + { + puts ("file size changed in 2nd posix_fallocate"); + return 1; + } + + if (posix_fallocate (fd, 2048, 64) != 0) + { + puts ("3rd posix_fallocate call failed"); + return 1; + } + + if (fstat64 (fd, &st) != 0) + { + puts ("4th fstat failed"); + return 1; + } + + if (st.st_size != 2048 + 64) + { + printf ("file size after 3rd posix_fallocate call is %llu, expected %u\n", + (unsigned long long int) st.st_size, 2048u + 64u); + return 1; + } +#ifdef TST_POSIX_FALLOCATE64 + if (posix_fallocate64 (fd, 4097ULL, 4294967295ULL + 2ULL) != 0) + { + puts ("4th posix_fallocate call failed"); + return 1; + } + + if (fstat64 (fd, &st) != 0) + { + puts ("5th fstat failed"); + return 1; + } + + if (st.st_size != 4097ULL + 4294967295ULL + 2ULL) + { + printf ("file size after 4th posix_fallocate call is %llu, expected %llu\n", + (unsigned long long int) st.st_size, 4097ULL + 4294967295ULL + 2ULL); + return 1; + } +#endif + close (fd); + + return 0; +} diff --git a/test/unistd/tst-posix_fallocate64.c b/test/unistd/tst-posix_fallocate64.c new file mode 100644 index 000000000..b1ee0ffdd --- /dev/null +++ b/test/unistd/tst-posix_fallocate64.c @@ -0,0 +1,2 @@ +#define TST_POSIX_FALLOCATE64 +#include "tst-posix_fallocate.c" diff --git a/test/unistd/tst-preadwrite.c b/test/unistd/tst-preadwrite.c index 281044858..66a1c0aa3 100644 --- a/test/unistd/tst-preadwrite.c +++ b/test/unistd/tst-preadwrite.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #include <errno.h> #include <error.h> @@ -44,7 +43,7 @@ extern int do_test (int argc, char *argv[]); #define TIMEOUT 20 /* sec */ /* This defines the `main' function and some more. */ -#include <test-skeleton.c> +#include "../test-skeleton.c" /* These are for the temporary file we generate. */ char *name; diff --git a/test/unistd/tst-preadwrite64.c b/test/unistd/tst-preadwrite64.c index 57098e864..a0ec021c6 100644 --- a/test/unistd/tst-preadwrite64.c +++ b/test/unistd/tst-preadwrite64.c @@ -14,9 +14,8 @@ 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. */ + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ #define PREAD pread64 #define PWRITE pwrite64 diff --git a/test/unistd/tst-pselect.c b/test/unistd/tst-pselect.c new file mode 100644 index 000000000..cab945119 --- /dev/null +++ b/test/unistd/tst-pselect.c @@ -0,0 +1,51 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <signal.h> +#include <sys/types.h> +#include <sys/select.h> + +// our SIGALRM handler +void handler(int signum) { + (void)signum; + puts("got signal\n"); +} + +static int +do_test (void) +{ + int rc; + sigset_t wait_mask, mask_sigchld; + struct sigaction act; + + // block SIGALRM. We want to handle it only when we're ready + sigemptyset(&mask_sigchld); + sigaddset(&mask_sigchld, SIGALRM); + sigprocmask(SIG_BLOCK, &mask_sigchld, &wait_mask); + sigdelset(&wait_mask, SIGALRM); + + // register a signal handler so we can see when the signal arrives + memset(&act, 0, sizeof(act)); + sigemptyset(&act.sa_mask); // just in case an empty set isn't all 0's (total paranoia) + act.sa_handler = handler; + sigaction(SIGALRM, &act, NULL); + + // send ourselves a SIGARLM. It will pend until we unblock that signal in pselect() + printf("sending ourselves a signal\n"); + kill(getpid(), SIGALRM); + + printf("signal is pending; calling pselect()\n"); + rc = pselect(0, NULL, NULL, NULL, NULL, &wait_mask); + if (rc != -1 || errno != EINTR) { + int e = errno; + printf("pselect() returned %d, errno %d (%s)\n", rc, e, strerror(e)); + exit(1); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include <test-skeleton.c> diff --git a/test/unistd/tstgetopt.c b/test/unistd/tstgetopt.c index 97ae2ef25..1c1263e67 100644 --- a/test/unistd/tstgetopt.c +++ b/test/unistd/tstgetopt.c @@ -21,7 +21,7 @@ main (int argc, char **argv) char *cvalue = NULL; int Cflag = 0; int nflag = 0; - int index; + int idx; int c; int result = 0; @@ -67,8 +67,8 @@ main (int argc, char **argv) result |= (aflag != 1 || bflag != 1 || cvalue == NULL || strcmp (cvalue, "foobar") != 0 || Cflag != 3 || nflag != 1); - for (index = optind; index < argc; index++) - printf ("Non-option argument %s\n", argv[index]); + for (idx = optind; idx < argc; idx++) + printf ("Non-option argument %s\n", argv[idx]); result |= optind + 1 != argc || strcmp (argv[optind], "random") != 0; |
