svn commit: r292397 - in user/ngie/more-tests2: . bin/sh contrib/llvm/tools/lldb/docs etc/mtree etc/periodic/daily lib/libc/tests lib/libc/tests/nss lib/libc/tests/resolv lib/libfetch lib/libstand ...
Garrett Cooper
ngie at FreeBSD.org
Thu Dec 17 06:55:28 UTC 2015
Author: ngie
Date: Thu Dec 17 06:55:25 2015
New Revision: 292397
URL: https://svnweb.freebsd.org/changeset/base/292397
Log:
MFhead @ r292396
Added:
user/ngie/more-tests2/lib/libc/tests/nss/
- copied from r292396, head/lib/libc/tests/nss/
user/ngie/more-tests2/lib/libc/tests/resolv/
- copied from r292396, head/lib/libc/tests/resolv/
user/ngie/more-tests2/lib/msun/tests/cexp_test.c
- copied unchanged from r292396, head/lib/msun/tests/cexp_test.c
user/ngie/more-tests2/lib/msun/tests/conj_test.c
- copied unchanged from r292396, head/lib/msun/tests/conj_test.c
user/ngie/more-tests2/lib/msun/tests/csqrt_test.c
- copied unchanged from r292396, head/lib/msun/tests/csqrt_test.c
user/ngie/more-tests2/lib/msun/tests/fenv_test.c
- copied unchanged from r292396, head/lib/msun/tests/fenv_test.c
user/ngie/more-tests2/lib/msun/tests/fmaxmin_test.c
- copied unchanged from r292396, head/lib/msun/tests/fmaxmin_test.c
user/ngie/more-tests2/lib/msun/tests/ilogb_test.c
- copied unchanged from r292396, head/lib/msun/tests/ilogb_test.c
user/ngie/more-tests2/lib/msun/tests/invctrig_test.c
- copied unchanged from r292396, head/lib/msun/tests/invctrig_test.c
user/ngie/more-tests2/lib/msun/tests/logarithm_test.c
- copied unchanged from r292396, head/lib/msun/tests/logarithm_test.c
user/ngie/more-tests2/lib/msun/tests/lrint_test.c
- copied unchanged from r292396, head/lib/msun/tests/lrint_test.c
user/ngie/more-tests2/lib/msun/tests/nan_test.c
- copied unchanged from r292396, head/lib/msun/tests/nan_test.c
user/ngie/more-tests2/lib/msun/tests/nearbyint_test.c
- copied unchanged from r292396, head/lib/msun/tests/nearbyint_test.c
user/ngie/more-tests2/lib/msun/tests/next_test.c
- copied unchanged from r292396, head/lib/msun/tests/next_test.c
user/ngie/more-tests2/lib/msun/tests/rem_test.c
- copied unchanged from r292396, head/lib/msun/tests/rem_test.c
user/ngie/more-tests2/lib/msun/tests/trig_test.c
- copied unchanged from r292396, head/lib/msun/tests/trig_test.c
user/ngie/more-tests2/sys/modules/tcp/
- copied from r292396, head/sys/modules/tcp/
user/ngie/more-tests2/sys/netinet/tcp_stacks/
- copied from r292396, head/sys/netinet/tcp_stacks/
Deleted:
user/ngie/more-tests2/tools/regression/lib/libc/nss/
user/ngie/more-tests2/tools/regression/lib/libc/resolv/
user/ngie/more-tests2/tools/regression/lib/msun/test-cexp.c
user/ngie/more-tests2/tools/regression/lib/msun/test-cexp.t
user/ngie/more-tests2/tools/regression/lib/msun/test-conj.c
user/ngie/more-tests2/tools/regression/lib/msun/test-conj.t
user/ngie/more-tests2/tools/regression/lib/msun/test-csqrt.c
user/ngie/more-tests2/tools/regression/lib/msun/test-csqrt.t
user/ngie/more-tests2/tools/regression/lib/msun/test-fenv.c
user/ngie/more-tests2/tools/regression/lib/msun/test-fenv.t
user/ngie/more-tests2/tools/regression/lib/msun/test-fmaxmin.c
user/ngie/more-tests2/tools/regression/lib/msun/test-fmaxmin.t
user/ngie/more-tests2/tools/regression/lib/msun/test-ilogb.c
user/ngie/more-tests2/tools/regression/lib/msun/test-ilogb.t
user/ngie/more-tests2/tools/regression/lib/msun/test-invctrig.c
user/ngie/more-tests2/tools/regression/lib/msun/test-logarithm.c
user/ngie/more-tests2/tools/regression/lib/msun/test-logarithm.t
user/ngie/more-tests2/tools/regression/lib/msun/test-lrint.c
user/ngie/more-tests2/tools/regression/lib/msun/test-lrint.t
user/ngie/more-tests2/tools/regression/lib/msun/test-nan.c
user/ngie/more-tests2/tools/regression/lib/msun/test-nan.t
user/ngie/more-tests2/tools/regression/lib/msun/test-nearbyint.c
user/ngie/more-tests2/tools/regression/lib/msun/test-nearbyint.t
user/ngie/more-tests2/tools/regression/lib/msun/test-next.c
user/ngie/more-tests2/tools/regression/lib/msun/test-next.t
user/ngie/more-tests2/tools/regression/lib/msun/test-rem.c
user/ngie/more-tests2/tools/regression/lib/msun/test-rem.t
user/ngie/more-tests2/tools/regression/lib/msun/test-trig.c
user/ngie/more-tests2/tools/regression/lib/msun/test-trig.t
Modified:
user/ngie/more-tests2/MAINTAINERS (contents, props changed)
user/ngie/more-tests2/UPDATING
user/ngie/more-tests2/bin/sh/var.c
user/ngie/more-tests2/contrib/llvm/tools/lldb/docs/lldb.1
user/ngie/more-tests2/etc/mtree/BSD.tests.dist
user/ngie/more-tests2/etc/periodic/daily/800.scrub-zfs
user/ngie/more-tests2/lib/libc/tests/Makefile
user/ngie/more-tests2/lib/libfetch/http.c
user/ngie/more-tests2/lib/libstand/tftp.c
user/ngie/more-tests2/lib/msun/tests/Makefile
user/ngie/more-tests2/secure/lib/libcrypto/engines/Makefile
user/ngie/more-tests2/share/man/man9/VOP_GETPAGES.9
user/ngie/more-tests2/share/mk/src.opts.mk
user/ngie/more-tests2/sys/arm/arm/pmap-v6-new.c
user/ngie/more-tests2/sys/boot/efi/loader/arch/amd64/elf64_freebsd.c
user/ngie/more-tests2/sys/boot/efi/loader/arch/arm/exec.c
user/ngie/more-tests2/sys/boot/efi/loader/arch/arm64/exec.c
user/ngie/more-tests2/sys/boot/efi/loader/bootinfo.c
user/ngie/more-tests2/sys/boot/efi/loader/loader_efi.h
user/ngie/more-tests2/sys/boot/i386/libi386/libi386.h
user/ngie/more-tests2/sys/boot/i386/libi386/pxe.c
user/ngie/more-tests2/sys/boot/i386/loader/main.c
user/ngie/more-tests2/sys/cam/ctl/ctl.c
user/ngie/more-tests2/sys/cam/ctl/ctl_backend_block.c
user/ngie/more-tests2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
user/ngie/more-tests2/sys/cddl/dev/dtrace/dtrace_cddl.h
user/ngie/more-tests2/sys/cddl/dev/systrace/systrace.c
user/ngie/more-tests2/sys/compat/linux/linux_dtrace.h
user/ngie/more-tests2/sys/conf/kmod.mk
user/ngie/more-tests2/sys/dev/drm2/i915/i915_gem.c
user/ngie/more-tests2/sys/dev/drm2/ttm/ttm_tt.c
user/ngie/more-tests2/sys/dev/md/md.c
user/ngie/more-tests2/sys/dev/usb/serial/uftdi.c
user/ngie/more-tests2/sys/fs/fuse/fuse_vnops.c
user/ngie/more-tests2/sys/fs/nfsclient/nfs_clbio.c
user/ngie/more-tests2/sys/fs/smbfs/smbfs_io.c
user/ngie/more-tests2/sys/fs/tmpfs/tmpfs_subr.c
user/ngie/more-tests2/sys/geom/multipath/g_multipath.c
user/ngie/more-tests2/sys/kern/kern_exec.c
user/ngie/more-tests2/sys/kern/kern_exit.c
user/ngie/more-tests2/sys/kern/kern_fork.c
user/ngie/more-tests2/sys/kern/kern_proc.c
user/ngie/more-tests2/sys/kern/kern_racct.c
user/ngie/more-tests2/sys/kern/kern_sig.c
user/ngie/more-tests2/sys/kern/kern_timeout.c
user/ngie/more-tests2/sys/kern/subr_syscall.c
user/ngie/more-tests2/sys/kern/uipc_shm.c
user/ngie/more-tests2/sys/kern/uipc_syscalls.c
user/ngie/more-tests2/sys/kern/vfs_bio.c
user/ngie/more-tests2/sys/kern/vfs_cache.c
user/ngie/more-tests2/sys/kern/vfs_default.c
user/ngie/more-tests2/sys/kern/vfs_subr.c
user/ngie/more-tests2/sys/kern/vnode_if.src
user/ngie/more-tests2/sys/modules/Makefile
user/ngie/more-tests2/sys/net/if_stf.c
user/ngie/more-tests2/sys/net/route.h
user/ngie/more-tests2/sys/netinet/if_ether.c
user/ngie/more-tests2/sys/netinet/in_kdtrace.c
user/ngie/more-tests2/sys/netinet/in_kdtrace.h
user/ngie/more-tests2/sys/netinet/ip_carp.c
user/ngie/more-tests2/sys/netinet/sctp_cc_functions.c
user/ngie/more-tests2/sys/netinet/tcp.h
user/ngie/more-tests2/sys/netinet/tcp_input.c
user/ngie/more-tests2/sys/netinet/tcp_sack.c
user/ngie/more-tests2/sys/netinet/tcp_subr.c
user/ngie/more-tests2/sys/netinet/tcp_syncache.c
user/ngie/more-tests2/sys/netinet/tcp_timer.c
user/ngie/more-tests2/sys/netinet/tcp_usrreq.c
user/ngie/more-tests2/sys/netinet/tcp_var.h
user/ngie/more-tests2/sys/netinet/toecore.c
user/ngie/more-tests2/sys/netinet6/in6.c
user/ngie/more-tests2/sys/netinet6/nd6.c
user/ngie/more-tests2/sys/netinet6/nd6_nbr.c
user/ngie/more-tests2/sys/security/mac/mac_framework.c
user/ngie/more-tests2/sys/security/mac/mac_internal.h
user/ngie/more-tests2/sys/sys/buf.h
user/ngie/more-tests2/sys/sys/sysent.h
user/ngie/more-tests2/sys/sys/vnode.h
user/ngie/more-tests2/sys/vm/default_pager.c
user/ngie/more-tests2/sys/vm/device_pager.c
user/ngie/more-tests2/sys/vm/phys_pager.c
user/ngie/more-tests2/sys/vm/sg_pager.c
user/ngie/more-tests2/sys/vm/swap_pager.c
user/ngie/more-tests2/sys/vm/vm_fault.c
user/ngie/more-tests2/sys/vm/vm_glue.c
user/ngie/more-tests2/sys/vm/vm_object.c
user/ngie/more-tests2/sys/vm/vm_object.h
user/ngie/more-tests2/sys/vm/vm_page.c
user/ngie/more-tests2/sys/vm/vm_page.h
user/ngie/more-tests2/sys/vm/vm_pager.c
user/ngie/more-tests2/sys/vm/vm_pager.h
user/ngie/more-tests2/sys/vm/vnode_pager.c
user/ngie/more-tests2/sys/vm/vnode_pager.h
user/ngie/more-tests2/tests/freebsd_test_suite/macros.h
user/ngie/more-tests2/tools/build/mk/OptionalObsoleteFiles.inc
user/ngie/more-tests2/tools/regression/lib/msun/Makefile
user/ngie/more-tests2/usr.bin/netstat/ipsec.c
user/ngie/more-tests2/usr.bin/netstat/main.c
user/ngie/more-tests2/usr.sbin/Makefile.arm
user/ngie/more-tests2/usr.sbin/ndp/ndp.c
Directory Properties:
user/ngie/more-tests2/ (props changed)
user/ngie/more-tests2/contrib/llvm/ (props changed)
user/ngie/more-tests2/contrib/llvm/tools/lldb/ (props changed)
user/ngie/more-tests2/lib/libc/ (props changed)
user/ngie/more-tests2/share/ (props changed)
user/ngie/more-tests2/sys/ (props changed)
user/ngie/more-tests2/sys/boot/ (props changed)
user/ngie/more-tests2/sys/cddl/contrib/opensolaris/ (props changed)
user/ngie/more-tests2/sys/conf/ (props changed)
Modified: user/ngie/more-tests2/MAINTAINERS
==============================================================================
--- user/ngie/more-tests2/MAINTAINERS Thu Dec 17 06:35:31 2015 (r292396)
+++ user/ngie/more-tests2/MAINTAINERS Thu Dec 17 06:55:25 2015 (r292397)
@@ -37,9 +37,12 @@ contrib/llvm/tools/lldb emaste Pre-commi
contrib/netbsd-tests freebsd-testing,ngie Pre-commit review requested.
contrib/pjdfstest freebsd-testing,ngie,pjd Pre-commit review requested.
dev/usb/wlan adrian Pre-commit review requested, send to freebsd-wireless at freebsd.org
+*env(3) secteam Due to the problematic security history of this
+ code, please have patches reviewed by secteam.
etc/mail gshapiro Pre-commit review requested. Keep in sync with -STABLE.
etc/sendmail gshapiro Pre-commit review requested. Keep in sync with -STABLE.
fetch des Pre-commit review requested.
+geli pjd Pre-commit review requested (both sys/geom/eli/ and sbin/geom/class/eli/).
isci(4) jimharris Pre-commit review requested.
iwm(4) adrian Pre-commit review requested, send to freebsd-wireless at freebsd.org
iwn(4) adrian Pre-commit review requested, send to freebsd-wireless at freebsd.org
@@ -51,6 +54,7 @@ lpr gad Pre-commit review requested, pa
lpd/recvjob.c and lpd/printjob.c.
nanobsd imp Pre-commit phabricator review requested.
net80211 adrian Pre-commit review requested, send to freebsd-wireless at freebsd.org
+nfs freebsd-fs at FreeBSD.org, rmacklem is best for reviews.
nis(8), yp(8) araujo Pre-commit review requested.
nvd(4) jimharris Pre-commit review requested.
nvme(4) jimharris Pre-commit review requested.
@@ -59,6 +63,7 @@ opencrypto jmg Pre-commit review request
openssh des Pre-commit review requested.
openssl benl,jkim Pre-commit review requested.
otus(4) adrian Pre-commit review requested, send to freebsd-wireless at freebsd.org
+pci bus imp,jhb Pre-commit review requested.
pmcstudy(8) rrs Pre-commit review requested.
procfs des Pre-commit review requested.
pseudofs des Pre-commit review requested.
@@ -92,7 +97,6 @@ contrib/openbsm rwatson Pre-commit revie
sys/security/audit rwatson Pre-commit review requested.
ahc(4) gibbs Pre-commit review requested.
ahd(4) gibbs Pre-commit review requested.
-pci bus imp,jhb Pre-commit review requested.
cdboot jhb Pre-commit review requested.
pxeboot jhb Pre-commit review requested.
witness jhb Pre-commit review requested.
@@ -122,7 +126,6 @@ file obrien Insists to keep file blocke
contrib/bzip2 obrien Pre-commit review required.
geom freebsd-geom at FreeBSD.org
geom_concat pjd Pre-commit review preferred.
-geom_eli pjd Pre-commit review preferred.
geom_gate pjd Pre-commit review preferred.
geom_label pjd Pre-commit review preferred.
geom_mirror pjd Pre-commit review preferred.
@@ -133,7 +136,6 @@ geom_stripe pjd Pre-commit review prefer
geom_zero pjd Pre-commit review preferred.
sbin/geom pjd Pre-commit review preferred.
zfs freebsd-fs at FreeBSD.org
-nfs freebsd-fs at FreeBSD.org, rmacklem is best for reviews.
linux emul emulation Please discuss changes here.
bs{diff,patch} cperciva Pre-commit review requested.
portsnap cperciva Pre-commit review requested.
@@ -143,8 +145,6 @@ lib/libbluetooth emax Pre-commit review
lib/libsdp emax Pre-commit review preferred.
usr.bin/bluetooth emax Pre-commit review preferred.
usr.sbin/bluetooth emax Pre-commit review preferred.
-*env(3) secteam Due to the problematic security history of this
- code, please have patches reviewed by secteam.
share/zoneinfo edwin Heads-up appreciated, since our data is coming
from a third party source.
usr.sbin/zic edwin Heads-up appreciated, since this code is
Modified: user/ngie/more-tests2/UPDATING
==============================================================================
--- user/ngie/more-tests2/UPDATING Thu Dec 17 06:35:31 2015 (r292396)
+++ user/ngie/more-tests2/UPDATING Thu Dec 17 06:55:25 2015 (r292397)
@@ -31,6 +31,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
+20151216:
+ The tftp loader (pxeboot) now uses the option root-path directive. As a
+ consequence it no longer looks for a pxeboot.4th file on the tftp
+ server. Instead it uses the regular /boot infrastructure as with the
+ other loaders.
+
20151211:
The code to start recording plug and play data into the modules has
been committed. While the old tools will properly build a new kernel,
Modified: user/ngie/more-tests2/bin/sh/var.c
==============================================================================
--- user/ngie/more-tests2/bin/sh/var.c Thu Dec 17 06:35:31 2015 (r292396)
+++ user/ngie/more-tests2/bin/sh/var.c Thu Dec 17 06:55:25 2015 (r292397)
@@ -330,7 +330,7 @@ setvareq(char *s, int flags)
if (vp->flags & VREADONLY) {
if ((flags & (VTEXTFIXED|VSTACK)) == 0)
ckfree(s);
- error("%.*s: is read only", vp->name_len, s);
+ error("%.*s: is read only", vp->name_len, vp->text);
}
if (flags & VNOSET) {
if ((flags & (VTEXTFIXED|VSTACK)) == 0)
Modified: user/ngie/more-tests2/contrib/llvm/tools/lldb/docs/lldb.1
==============================================================================
--- user/ngie/more-tests2/contrib/llvm/tools/lldb/docs/lldb.1 Thu Dec 17 06:35:31 2015 (r292396)
+++ user/ngie/more-tests2/contrib/llvm/tools/lldb/docs/lldb.1 Thu Dec 17 06:55:25 2015 (r292397)
@@ -1,4 +1,4 @@
-.Dd June 7, 2012 \" DATE
+.Dd December 16, 2015 \" DATE
.Dt LLDB 1 \" Program name and manual section number
.Os
.Sh NAME \" Section Header - required - don't modify
@@ -8,6 +8,7 @@
.Nm lldb
.Op Fl hvdexw
.Op Fl a Ar arch
+.Op Fl c Ar core-file
.Op Fl l Ar script-language
.Op Fl s Ar lldb-commands
.Op Fl n Ar process-name
@@ -52,6 +53,8 @@ to it as early in the process-launch as
Specifies a currently running process that
.Nm
should attach to.
+.It Fl c, -core Ar core-file
+Specifies the core file to examine.
.It Fl l, -script-language Ar language
Tells the debugger to use the specified scripting language for
user-defined scripts, rather than the default. Valid scripting
Modified: user/ngie/more-tests2/etc/mtree/BSD.tests.dist
==============================================================================
--- user/ngie/more-tests2/etc/mtree/BSD.tests.dist Thu Dec 17 06:35:31 2015 (r292396)
+++ user/ngie/more-tests2/etc/mtree/BSD.tests.dist Thu Dec 17 06:55:25 2015 (r292397)
@@ -271,10 +271,14 @@
..
..
..
+ nss
+ ..
regex
data
..
..
+ resolv
+ ..
rpc
..
ssp
Modified: user/ngie/more-tests2/etc/periodic/daily/800.scrub-zfs
==============================================================================
--- user/ngie/more-tests2/etc/periodic/daily/800.scrub-zfs Thu Dec 17 06:35:31 2015 (r292396)
+++ user/ngie/more-tests2/etc/periodic/daily/800.scrub-zfs Thu Dec 17 06:55:25 2015 (r292397)
@@ -43,6 +43,10 @@ case "$daily_scrub_zfs_enable" in
rc=3
echo "Skipping faulted pool: ${pool}"
continue ;;
+ *UNAVAIL*)
+ rc=4
+ echo "Skipping unavailable pool: ${pool}"
+ continue ;;
esac
# determine how many days shall be between scrubs
Modified: user/ngie/more-tests2/lib/libc/tests/Makefile
==============================================================================
--- user/ngie/more-tests2/lib/libc/tests/Makefile Thu Dec 17 06:35:31 2015 (r292396)
+++ user/ngie/more-tests2/lib/libc/tests/Makefile Thu Dec 17 06:55:25 2015 (r292397)
@@ -10,7 +10,9 @@ TESTS_SUBDIRS+= gen
TESTS_SUBDIRS+= hash
TESTS_SUBDIRS+= inet
TESTS_SUBDIRS+= net
+TESTS_SUBDIRS+= nss
TESTS_SUBDIRS+= regex
+TESTS_SUBDIRS+= resolv
TESTS_SUBDIRS+= rpc
TESTS_SUBDIRS+= stdio
TESTS_SUBDIRS+= stdlib
Modified: user/ngie/more-tests2/lib/libfetch/http.c
==============================================================================
--- user/ngie/more-tests2/lib/libfetch/http.c Thu Dec 17 06:35:31 2015 (r292396)
+++ user/ngie/more-tests2/lib/libfetch/http.c Thu Dec 17 06:55:25 2015 (r292397)
@@ -130,8 +130,8 @@ struct httpio
int chunked; /* chunked mode */
char *buf; /* chunk buffer */
size_t bufsize; /* size of chunk buffer */
- ssize_t buflen; /* amount of data currently in buffer */
- int bufpos; /* current read offset in buffer */
+ size_t buflen; /* amount of data currently in buffer */
+ size_t bufpos; /* current read offset in buffer */
int eof; /* end-of-file flag */
int error; /* error flag */
size_t chunksize; /* remaining size of current chunk */
@@ -215,6 +215,7 @@ http_fillbuf(struct httpio *io, size_t l
if (io->eof)
return (0);
+ /* not chunked: just fetch the requested amount */
if (io->chunked == 0) {
if (http_growbuf(io, len) == -1)
return (-1);
@@ -227,6 +228,7 @@ http_fillbuf(struct httpio *io, size_t l
return (io->buflen);
}
+ /* chunked, but we ran out: get the next chunk header */
if (io->chunksize == 0) {
switch (http_new_chunk(io)) {
case -1:
@@ -238,6 +240,7 @@ http_fillbuf(struct httpio *io, size_t l
}
}
+ /* fetch the requested amount, but no more than the current chunk */
if (len > io->chunksize)
len = io->chunksize;
if (http_growbuf(io, len) == -1)
@@ -246,8 +249,9 @@ http_fillbuf(struct httpio *io, size_t l
io->error = errno;
return (-1);
}
+ io->bufpos = 0;
io->buflen = nbytes;
- io->chunksize -= io->buflen;
+ io->chunksize -= nbytes;
if (io->chunksize == 0) {
if (fetch_read(io->conn, &ch, 1) != 1 || ch != '\r' ||
@@ -255,8 +259,6 @@ http_fillbuf(struct httpio *io, size_t l
return (-1);
}
- io->bufpos = 0;
-
return (io->buflen);
}
Modified: user/ngie/more-tests2/lib/libstand/tftp.c
==============================================================================
--- user/ngie/more-tests2/lib/libstand/tftp.c Thu Dec 17 06:35:31 2015 (r292396)
+++ user/ngie/more-tests2/lib/libstand/tftp.c Thu Dec 17 06:55:25 2015 (r292397)
@@ -399,6 +399,8 @@ tftp_open(const char *path, struct open_
struct tftp_handle *tftpfile;
struct iodesc *io;
int res;
+ size_t pathsize;
+ const char *extraslash;
if (strcmp(f->f_dev->dv_name, "net") != 0) {
#ifdef __i386__
@@ -424,10 +426,22 @@ tftp_open(const char *path, struct open_
io->destip = servip;
tftpfile->off = 0;
- tftpfile->path = strdup(path);
+ pathsize = (strlen(rootpath) + 1 + strlen(path) + 1) * sizeof(char);
+ tftpfile->path = malloc(pathsize);
if (tftpfile->path == NULL) {
- free(tftpfile);
- return(ENOMEM);
+ free(tftpfile);
+ return(ENOMEM);
+ }
+ if (rootpath[strlen(rootpath) - 1] == '/' || path[0] == '/')
+ extraslash = "";
+ else
+ extraslash = "/";
+ res = snprintf(tftpfile->path, pathsize, "%s%s%s",
+ rootpath, extraslash, path);
+ if (res < 0 || res > pathsize) {
+ free(tftpfile->path);
+ free(tftpfile);
+ return(ENOMEM);
}
res = tftp_makereq(tftpfile);
Modified: user/ngie/more-tests2/lib/msun/tests/Makefile
==============================================================================
--- user/ngie/more-tests2/lib/msun/tests/Makefile Thu Dec 17 06:35:31 2015 (r292396)
+++ user/ngie/more-tests2/lib/msun/tests/Makefile Thu Dec 17 06:55:25 2015 (r292397)
@@ -36,11 +36,34 @@ NETBSD_ATF_TESTS_C+= sqrt_test
NETBSD_ATF_TESTS_C+= tan_test
NETBSD_ATF_TESTS_C+= tanh_test
+TAP_TESTS_C+= cexp_test
+TAP_TESTS_C+= conj_test
+TAP_TESTS_C+= csqrt_test
+TAP_TESTS_C+= fenv_test
+TAP_TESTS_C+= fmaxmin_test
+TAP_TESTS_C+= ilogb_test
+TAP_TESTS_C+= invctrig_test
+TAP_TESTS_C+= logarithm_test
+TAP_TESTS_C+= lrint_test
+TAP_TESTS_C+= nan_test
+TAP_TESTS_C+= nearbyint_test
+TAP_TESTS_C+= next_test
+TAP_TESTS_C+= rem_test
+TAP_TESTS_C+= trig_test
+
+.for t in ${TAP_TESTS_C}
+CFLAGS.$t+= -O0
+CFLAGS.$t+= -I${SRCTOP}/tools/regression/lib/msun
+.endfor
+
CSTD= c99
-LIBADD+= m
#COPTS+= -Wfloat-equal
+IGNORE_PRAGMA=
+
+LIBADD+= m
+
# Copied from lib/msun/Makefile
.if ${MACHINE_CPUARCH} == "i386"
ARCH_SUBDIR= i387
Copied: user/ngie/more-tests2/lib/msun/tests/cexp_test.c (from r292396, head/lib/msun/tests/cexp_test.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/ngie/more-tests2/lib/msun/tests/cexp_test.c Thu Dec 17 06:55:25 2015 (r292397, copy of r292396, head/lib/msun/tests/cexp_test.c)
@@ -0,0 +1,322 @@
+/*-
+ * Copyright (c) 2008-2011 David Schultz <das at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Tests for corner cases in cexp*().
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+
+#include <assert.h>
+#include <complex.h>
+#include <fenv.h>
+#include <float.h>
+#include <math.h>
+#include <stdio.h>
+
+#include "test-utils.h"
+
+#pragma STDC FENV_ACCESS ON
+#pragma STDC CX_LIMITED_RANGE OFF
+
+/*
+ * Test that a function returns the correct value and sets the
+ * exception flags correctly. The exceptmask specifies which
+ * exceptions we should check. We need to be lenient for several
+ * reasons, but mainly because on some architectures it's impossible
+ * to raise FE_OVERFLOW without raising FE_INEXACT. In some cases,
+ * whether cexp() raises an invalid exception is unspecified.
+ *
+ * These are macros instead of functions so that assert provides more
+ * meaningful error messages.
+ *
+ * XXX The volatile here is to avoid gcc's bogus constant folding and work
+ * around the lack of support for the FENV_ACCESS pragma.
+ */
+#define test(func, z, result, exceptmask, excepts, checksign) do { \
+ volatile long double complex _d = z; \
+ assert(feclearexcept(FE_ALL_EXCEPT) == 0); \
+ assert(cfpequal_cs((func)(_d), (result), (checksign))); \
+ assert(((void)(func), fetestexcept(exceptmask) == (excepts))); \
+} while (0)
+
+/* Test within a given tolerance. */
+#define test_tol(func, z, result, tol) do { \
+ volatile long double complex _d = z; \
+ assert(cfpequal_tol((func)(_d), (result), (tol), \
+ FPE_ABS_ZERO | CS_BOTH)); \
+} while (0)
+
+/* Test all the functions that compute cexp(x). */
+#define testall(x, result, exceptmask, excepts, checksign) do { \
+ test(cexp, x, result, exceptmask, excepts, checksign); \
+ test(cexpf, x, result, exceptmask, excepts, checksign); \
+} while (0)
+
+/*
+ * Test all the functions that compute cexp(x), within a given tolerance.
+ * The tolerance is specified in ulps.
+ */
+#define testall_tol(x, result, tol) do { \
+ test_tol(cexp, x, result, tol * DBL_ULP()); \
+ test_tol(cexpf, x, result, tol * FLT_ULP()); \
+} while (0)
+
+/* Various finite non-zero numbers to test. */
+static const float finites[] =
+{ -42.0e20, -1.0, -1.0e-10, -0.0, 0.0, 1.0e-10, 1.0, 42.0e20 };
+
+
+/* Tests for 0 */
+void
+test_zero(void)
+{
+
+ /* cexp(0) = 1, no exceptions raised */
+ testall(0.0, 1.0, ALL_STD_EXCEPT, 0, 1);
+ testall(-0.0, 1.0, ALL_STD_EXCEPT, 0, 1);
+ testall(CMPLXL(0.0, -0.0), CMPLXL(1.0, -0.0), ALL_STD_EXCEPT, 0, 1);
+ testall(CMPLXL(-0.0, -0.0), CMPLXL(1.0, -0.0), ALL_STD_EXCEPT, 0, 1);
+}
+
+/*
+ * Tests for NaN. The signs of the results are indeterminate unless the
+ * imaginary part is 0.
+ */
+void
+test_nan()
+{
+ int i;
+
+ /* cexp(x + NaNi) = NaN + NaNi and optionally raises invalid */
+ /* cexp(NaN + yi) = NaN + NaNi and optionally raises invalid (|y|>0) */
+ for (i = 0; i < nitems(finites); i++) {
+ printf("# Run %d..\n", i);
+ testall(CMPLXL(finites[i], NAN), CMPLXL(NAN, NAN),
+ ALL_STD_EXCEPT & ~FE_INVALID, 0, 0);
+ if (finites[i] == 0.0)
+ continue;
+ /* XXX FE_INEXACT shouldn't be raised here */
+ testall(CMPLXL(NAN, finites[i]), CMPLXL(NAN, NAN),
+ ALL_STD_EXCEPT & ~(FE_INVALID | FE_INEXACT), 0, 0);
+ }
+
+ /* cexp(NaN +- 0i) = NaN +- 0i */
+ testall(CMPLXL(NAN, 0.0), CMPLXL(NAN, 0.0), ALL_STD_EXCEPT, 0, 1);
+ testall(CMPLXL(NAN, -0.0), CMPLXL(NAN, -0.0), ALL_STD_EXCEPT, 0, 1);
+
+ /* cexp(inf + NaN i) = inf + nan i */
+ testall(CMPLXL(INFINITY, NAN), CMPLXL(INFINITY, NAN),
+ ALL_STD_EXCEPT, 0, 0);
+ /* cexp(-inf + NaN i) = 0 */
+ testall(CMPLXL(-INFINITY, NAN), CMPLXL(0.0, 0.0),
+ ALL_STD_EXCEPT, 0, 0);
+ /* cexp(NaN + NaN i) = NaN + NaN i */
+ testall(CMPLXL(NAN, NAN), CMPLXL(NAN, NAN),
+ ALL_STD_EXCEPT, 0, 0);
+}
+
+void
+test_inf(void)
+{
+ int i;
+
+ /* cexp(x + inf i) = NaN + NaNi and raises invalid */
+ for (i = 0; i < nitems(finites); i++) {
+ printf("# Run %d..\n", i);
+ testall(CMPLXL(finites[i], INFINITY), CMPLXL(NAN, NAN),
+ ALL_STD_EXCEPT, FE_INVALID, 1);
+ }
+ /* cexp(-inf + yi) = 0 * (cos(y) + sin(y)i) */
+ /* XXX shouldn't raise an inexact exception */
+ testall(CMPLXL(-INFINITY, M_PI_4), CMPLXL(0.0, 0.0),
+ ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
+ testall(CMPLXL(-INFINITY, 3 * M_PI_4), CMPLXL(-0.0, 0.0),
+ ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
+ testall(CMPLXL(-INFINITY, 5 * M_PI_4), CMPLXL(-0.0, -0.0),
+ ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
+ testall(CMPLXL(-INFINITY, 7 * M_PI_4), CMPLXL(0.0, -0.0),
+ ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
+ testall(CMPLXL(-INFINITY, 0.0), CMPLXL(0.0, 0.0),
+ ALL_STD_EXCEPT, 0, 1);
+ testall(CMPLXL(-INFINITY, -0.0), CMPLXL(0.0, -0.0),
+ ALL_STD_EXCEPT, 0, 1);
+ /* cexp(inf + yi) = inf * (cos(y) + sin(y)i) (except y=0) */
+ /* XXX shouldn't raise an inexact exception */
+ testall(CMPLXL(INFINITY, M_PI_4), CMPLXL(INFINITY, INFINITY),
+ ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
+ testall(CMPLXL(INFINITY, 3 * M_PI_4), CMPLXL(-INFINITY, INFINITY),
+ ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
+ testall(CMPLXL(INFINITY, 5 * M_PI_4), CMPLXL(-INFINITY, -INFINITY),
+ ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
+ testall(CMPLXL(INFINITY, 7 * M_PI_4), CMPLXL(INFINITY, -INFINITY),
+ ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
+ /* cexp(inf + 0i) = inf + 0i */
+ testall(CMPLXL(INFINITY, 0.0), CMPLXL(INFINITY, 0.0),
+ ALL_STD_EXCEPT, 0, 1);
+ testall(CMPLXL(INFINITY, -0.0), CMPLXL(INFINITY, -0.0),
+ ALL_STD_EXCEPT, 0, 1);
+}
+
+void
+test_reals(void)
+{
+ int i;
+
+ for (i = 0; i < nitems(finites); i++) {
+ /* XXX could check exceptions more meticulously */
+ printf("# Run %d..\n", i);
+ test(cexp, CMPLXL(finites[i], 0.0),
+ CMPLXL(exp(finites[i]), 0.0),
+ FE_INVALID | FE_DIVBYZERO, 0, 1);
+ test(cexp, CMPLXL(finites[i], -0.0),
+ CMPLXL(exp(finites[i]), -0.0),
+ FE_INVALID | FE_DIVBYZERO, 0, 1);
+ test(cexpf, CMPLXL(finites[i], 0.0),
+ CMPLXL(expf(finites[i]), 0.0),
+ FE_INVALID | FE_DIVBYZERO, 0, 1);
+ test(cexpf, CMPLXL(finites[i], -0.0),
+ CMPLXL(expf(finites[i]), -0.0),
+ FE_INVALID | FE_DIVBYZERO, 0, 1);
+ }
+}
+
+void
+test_imaginaries(void)
+{
+ int i;
+
+ for (i = 0; i < nitems(finites); i++) {
+ printf("# Run %d..\n", i);
+ test(cexp, CMPLXL(0.0, finites[i]),
+ CMPLXL(cos(finites[i]), sin(finites[i])),
+ ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
+ test(cexp, CMPLXL(-0.0, finites[i]),
+ CMPLXL(cos(finites[i]), sin(finites[i])),
+ ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
+ test(cexpf, CMPLXL(0.0, finites[i]),
+ CMPLXL(cosf(finites[i]), sinf(finites[i])),
+ ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
+ test(cexpf, CMPLXL(-0.0, finites[i]),
+ CMPLXL(cosf(finites[i]), sinf(finites[i])),
+ ALL_STD_EXCEPT & ~FE_INEXACT, 0, 1);
+ }
+}
+
+void
+test_small(void)
+{
+ static const double tests[] = {
+ /* csqrt(a + bI) = x + yI */
+ /* a b x y */
+ 1.0, M_PI_4, M_SQRT2 * 0.5 * M_E, M_SQRT2 * 0.5 * M_E,
+ -1.0, M_PI_4, M_SQRT2 * 0.5 / M_E, M_SQRT2 * 0.5 / M_E,
+ 2.0, M_PI_2, 0.0, M_E * M_E,
+ M_LN2, M_PI, -2.0, 0.0,
+ };
+ double a, b;
+ double x, y;
+ int i;
+
+ for (i = 0; i < nitems(tests); i += 4) {
+ printf("# Run %d..\n", i);
+ a = tests[i];
+ b = tests[i + 1];
+ x = tests[i + 2];
+ y = tests[i + 3];
+ test_tol(cexp, CMPLXL(a, b), CMPLXL(x, y), 3 * DBL_ULP());
+
+ /* float doesn't have enough precision to pass these tests */
+ if (x == 0 || y == 0)
+ continue;
+ test_tol(cexpf, CMPLXL(a, b), CMPLXL(x, y), 1 * FLT_ULP());
+ }
+}
+
+/* Test inputs with a real part r that would overflow exp(r). */
+void
+test_large(void)
+{
+
+ test_tol(cexp, CMPLXL(709.79, 0x1p-1074),
+ CMPLXL(INFINITY, 8.94674309915433533273e-16), DBL_ULP());
+ test_tol(cexp, CMPLXL(1000, 0x1p-1074),
+ CMPLXL(INFINITY, 9.73344457300016401328e+110), DBL_ULP());
+ test_tol(cexp, CMPLXL(1400, 0x1p-1074),
+ CMPLXL(INFINITY, 5.08228858149196559681e+284), DBL_ULP());
+ test_tol(cexp, CMPLXL(900, 0x1.23456789abcdep-1020),
+ CMPLXL(INFINITY, 7.42156649354218408074e+83), DBL_ULP());
+ test_tol(cexp, CMPLXL(1300, 0x1.23456789abcdep-1020),
+ CMPLXL(INFINITY, 3.87514844965996756704e+257), DBL_ULP());
+
+ test_tol(cexpf, CMPLXL(88.73, 0x1p-149),
+ CMPLXL(INFINITY, 4.80265603e-07), 2 * FLT_ULP());
+ test_tol(cexpf, CMPLXL(90, 0x1p-149),
+ CMPLXL(INFINITY, 1.7101492622e-06f), 2 * FLT_ULP());
+ test_tol(cexpf, CMPLXL(192, 0x1p-149),
+ CMPLXL(INFINITY, 3.396809344e+38f), 2 * FLT_ULP());
+ test_tol(cexpf, CMPLXL(120, 0x1.234568p-120),
+ CMPLXL(INFINITY, 1.1163382522e+16f), 2 * FLT_ULP());
+ test_tol(cexpf, CMPLXL(170, 0x1.234568p-120),
+ CMPLXL(INFINITY, 5.7878851079e+37f), 2 * FLT_ULP());
+}
+
+int
+main(int argc, char *argv[])
+{
+
+ printf("1..7\n");
+
+ test_zero();
+ printf("ok 1 - cexp zero\n");
+
+ test_nan();
+ printf("ok 2 - cexp nan\n");
+
+ test_inf();
+ printf("ok 3 - cexp inf\n");
+
+#if defined(__i386__)
+ printf("not ok 4 - cexp reals # TODO: PR # 191676 fails assertion on i386\n");
+#else
+ test_reals();
+ printf("ok 4 - cexp reals\n");
+#endif
+
+ test_imaginaries();
+ printf("ok 5 - cexp imaginaries\n");
+
+ test_small();
+ printf("ok 6 - cexp small\n");
+
+ test_large();
+ printf("ok 7 - cexp large\n");
+
+ return (0);
+}
Copied: user/ngie/more-tests2/lib/msun/tests/conj_test.c (from r292396, head/lib/msun/tests/conj_test.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/ngie/more-tests2/lib/msun/tests/conj_test.c Thu Dec 17 06:55:25 2015 (r292397, copy of r292396, head/lib/msun/tests/conj_test.c)
@@ -0,0 +1,139 @@
+/*-
+ * Copyright (c) 2008 David Schultz <das at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Tests for conj{,f,l}()
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <assert.h>
+#include <complex.h>
+#include <fenv.h>
+#include <math.h>
+#include <stdio.h>
+
+#include "test-utils.h"
+
+#pragma STDC CX_LIMITED_RANGE OFF
+
+/* Make sure gcc doesn't use builtin versions of these or honor __pure2. */
+static float complex (*libconjf)(float complex) = conjf;
+static double complex (*libconj)(double complex) = conj;
+static long double complex (*libconjl)(long double complex) = conjl;
+static float (*libcrealf)(float complex) = crealf;
+static double (*libcreal)(double complex) = creal;
+static long double (*libcreall)(long double complex) = creall;
+static float (*libcimagf)(float complex) = cimagf;
+static double (*libcimag)(double complex) = cimag;
+static long double (*libcimagl)(long double complex) = cimagl;
+
+static const double tests[] = {
+ /* a + bI */
+ 0.0, 0.0,
+ 0.0, 1.0,
+ 1.0, 0.0,
+ -1.0, 0.0,
+ 1.0, -0.0,
+ 0.0, -1.0,
+ 2.0, 4.0,
+ 0.0, INFINITY,
+ 0.0, -INFINITY,
+ INFINITY, 0.0,
+ NAN, 1.0,
+ 1.0, NAN,
+ NAN, NAN,
+ -INFINITY, INFINITY,
+};
+
+int
+main(int argc, char *argv[])
+{
+ static const int ntests = sizeof(tests) / sizeof(tests[0]) / 2;
+ complex float in;
+ complex long double expected;
+ int i;
+
+ printf("1..%d\n", ntests * 3);
+
+ for (i = 0; i < ntests; i++) {
+ __real__ expected = __real__ in = tests[2 * i];
+ __imag__ in = tests[2 * i + 1];
+ __imag__ expected = -cimag(in);
+
+ assert(fpequal(libcrealf(in), __real__ in));
+ assert(fpequal(libcreal(in), __real__ in));
+ assert(fpequal(libcreall(in), __real__ in));
+ assert(fpequal(libcimagf(in), __imag__ in));
+ assert(fpequal(libcimag(in), __imag__ in));
+ assert(fpequal(libcimagl(in), __imag__ in));
+
+ feclearexcept(FE_ALL_EXCEPT);
+ if (!cfpequal(libconjf(in), expected)) {
+ printf("not ok %d\t# conjf(%#.2g + %#.2gI): "
+ "wrong value\n",
+ 3 * i + 1, creal(in), cimag(in));
+ } else if (fetestexcept(FE_ALL_EXCEPT)) {
+ printf("not ok %d\t# conjf(%#.2g + %#.2gI): "
+ "threw an exception\n",
+ 3 * i + 1, creal(in), cimag(in));
+ } else {
+ printf("ok %d\t\t# conjf(%#.2g + %#.2gI)\n",
+ 3 * i + 1, creal(in), cimag(in));
+ }
+
+ feclearexcept(FE_ALL_EXCEPT);
+ if (!cfpequal(libconj(in), expected)) {
+ printf("not ok %d\t# conj(%#.2g + %#.2gI): "
+ "wrong value\n",
+ 3 * i + 2, creal(in), cimag(in));
+ } else if (fetestexcept(FE_ALL_EXCEPT)) {
+ printf("not ok %d\t# conj(%#.2g + %#.2gI): "
+ "threw an exception\n",
+ 3 * i + 2, creal(in), cimag(in));
+ } else {
+ printf("ok %d\t\t# conj(%#.2g + %#.2gI)\n",
+ 3 * i + 2, creal(in), cimag(in));
+ }
+
+ feclearexcept(FE_ALL_EXCEPT);
+ if (!cfpequal(libconjl(in), expected)) {
+ printf("not ok %d\t# conjl(%#.2g + %#.2gI): "
+ "wrong value\n",
+ 3 * i + 3, creal(in), cimag(in));
+ } else if (fetestexcept(FE_ALL_EXCEPT)) {
+ printf("not ok %d\t# conjl(%#.2g + %#.2gI): "
+ "threw an exception\n",
+ 3 * i + 3, creal(in), cimag(in));
+ } else {
+ printf("ok %d\t\t# conjl(%#.2g + %#.2gI)\n",
+ 3 * i + 3, creal(in), cimag(in));
+ }
+ }
+
+ return (0);
+}
Copied: user/ngie/more-tests2/lib/msun/tests/csqrt_test.c (from r292396, head/lib/msun/tests/csqrt_test.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ user/ngie/more-tests2/lib/msun/tests/csqrt_test.c Thu Dec 17 06:55:25 2015 (r292397, copy of r292396, head/lib/msun/tests/csqrt_test.c)
@@ -0,0 +1,295 @@
+/*-
+ * Copyright (c) 2007 David Schultz <das at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Tests for csqrt{,f}()
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+
+#include <assert.h>
+#include <complex.h>
+#include <float.h>
+#include <math.h>
+#include <stdio.h>
+
+#include "test-utils.h"
+
+/*
+ * This is a test hook that can point to csqrtl(), _csqrt(), or to _csqrtf().
+ * The latter two convert to float or double, respectively, and test csqrtf()
+ * and csqrt() with the same arguments.
+ */
+long double complex (*t_csqrt)(long double complex);
+
+static long double complex
+_csqrtf(long double complex d)
+{
+
+ return (csqrtf((float complex)d));
+}
+
+static long double complex
+_csqrt(long double complex d)
+{
+
+ return (csqrt((double complex)d));
+}
+
+#pragma STDC CX_LIMITED_RANGE OFF
+
+/*
+ * Compare d1 and d2 using special rules: NaN == NaN and +0 != -0.
+ * Fail an assertion if they differ.
+ */
+static void
+assert_equal(long double complex d1, long double complex d2)
+{
+
+ assert(cfpequal(d1, d2));
+}
+
+/*
+ * Test csqrt for some finite arguments where the answer is exact.
+ * (We do not test if it produces correctly rounded answers when the
+ * result is inexact, nor do we check whether it throws spurious
+ * exceptions.)
+ */
+static void
+test_finite()
+{
+ static const double tests[] = {
+ /* csqrt(a + bI) = x + yI */
+ /* a b x y */
+ 0, 8, 2, 2,
+ 0, -8, 2, -2,
+ 4, 0, 2, 0,
+ -4, 0, 0, 2,
+ 3, 4, 2, 1,
+ 3, -4, 2, -1,
+ -3, 4, 1, 2,
+ -3, -4, 1, -2,
+ 5, 12, 3, 2,
+ 7, 24, 4, 3,
+ 9, 40, 5, 4,
+ 11, 60, 6, 5,
+ 13, 84, 7, 6,
+ 33, 56, 7, 4,
+ 39, 80, 8, 5,
+ 65, 72, 9, 4,
+ 987, 9916, 74, 67,
+ 5289, 6640, 83, 40,
+ 460766389075.0, 16762287900.0, 678910, 12345
+ };
+ /*
+ * We also test some multiples of the above arguments. This
+ * array defines which multiples we use. Note that these have
+ * to be small enough to not cause overflow for float precision
+ * with all of the constants in the above table.
+ */
+ static const double mults[] = {
+ 1,
+ 2,
+ 3,
+ 13,
+ 16,
+ 0x1.p30,
+ 0x1.p-30,
+ };
+
+ double a, b;
+ double x, y;
+ int i, j;
+
+ for (i = 0; i < nitems(tests); i += 4) {
+ for (j = 0; j < nitems(mults); j++) {
+ a = tests[i] * mults[j] * mults[j];
+ b = tests[i + 1] * mults[j] * mults[j];
+ x = tests[i + 2] * mults[j];
+ y = tests[i + 3] * mults[j];
+ assert(t_csqrt(CMPLXL(a, b)) == CMPLXL(x, y));
+ }
+ }
+
+}
+
+/*
+ * Test the handling of +/- 0.
+ */
+static void
+test_zeros()
+{
+
+ assert_equal(t_csqrt(CMPLXL(0.0, 0.0)), CMPLXL(0.0, 0.0));
+ assert_equal(t_csqrt(CMPLXL(-0.0, 0.0)), CMPLXL(0.0, 0.0));
+ assert_equal(t_csqrt(CMPLXL(0.0, -0.0)), CMPLXL(0.0, -0.0));
+ assert_equal(t_csqrt(CMPLXL(-0.0, -0.0)), CMPLXL(0.0, -0.0));
+}
+
+/*
+ * Test the handling of infinities when the other argument is not NaN.
+ */
+static void
+test_infinities()
+{
+ static const double vals[] = {
+ 0.0,
+ -0.0,
+ 42.0,
+ -42.0,
+ INFINITY,
+ -INFINITY,
+ };
+
+ int i;
+
+ for (i = 0; i < nitems(vals); i++) {
+ if (isfinite(vals[i])) {
+ assert_equal(t_csqrt(CMPLXL(-INFINITY, vals[i])),
+ CMPLXL(0.0, copysignl(INFINITY, vals[i])));
+ assert_equal(t_csqrt(CMPLXL(INFINITY, vals[i])),
+ CMPLXL(INFINITY, copysignl(0.0, vals[i])));
+ }
+ assert_equal(t_csqrt(CMPLXL(vals[i], INFINITY)),
+ CMPLXL(INFINITY, INFINITY));
+ assert_equal(t_csqrt(CMPLXL(vals[i], -INFINITY)),
+ CMPLXL(INFINITY, -INFINITY));
+ }
+}
+
+/*
+ * Test the handling of NaNs.
+ */
+static void
+test_nans()
+{
+
+ assert(creall(t_csqrt(CMPLXL(INFINITY, NAN))) == INFINITY);
+ assert(isnan(cimagl(t_csqrt(CMPLXL(INFINITY, NAN)))));
+
+ assert(isnan(creall(t_csqrt(CMPLXL(-INFINITY, NAN)))));
+ assert(isinf(cimagl(t_csqrt(CMPLXL(-INFINITY, NAN)))));
+
+ assert_equal(t_csqrt(CMPLXL(NAN, INFINITY)),
+ CMPLXL(INFINITY, INFINITY));
+ assert_equal(t_csqrt(CMPLXL(NAN, -INFINITY)),
+ CMPLXL(INFINITY, -INFINITY));
+
+ assert_equal(t_csqrt(CMPLXL(0.0, NAN)), CMPLXL(NAN, NAN));
+ assert_equal(t_csqrt(CMPLXL(-0.0, NAN)), CMPLXL(NAN, NAN));
+ assert_equal(t_csqrt(CMPLXL(42.0, NAN)), CMPLXL(NAN, NAN));
+ assert_equal(t_csqrt(CMPLXL(-42.0, NAN)), CMPLXL(NAN, NAN));
+ assert_equal(t_csqrt(CMPLXL(NAN, 0.0)), CMPLXL(NAN, NAN));
+ assert_equal(t_csqrt(CMPLXL(NAN, -0.0)), CMPLXL(NAN, NAN));
+ assert_equal(t_csqrt(CMPLXL(NAN, 42.0)), CMPLXL(NAN, NAN));
+ assert_equal(t_csqrt(CMPLXL(NAN, -42.0)), CMPLXL(NAN, NAN));
+ assert_equal(t_csqrt(CMPLXL(NAN, NAN)), CMPLXL(NAN, NAN));
+}
+
+/*
+ * Test whether csqrt(a + bi) works for inputs that are large enough to
+ * cause overflow in hypot(a, b) + a. In this case we are using
+ * csqrt(115 + 252*I) == 14 + 9*I
+ * scaled up to near MAX_EXP.
+ */
+static void
+test_overflow(int maxexp)
+{
+ long double a, b;
+ long double complex result;
+
+ a = ldexpl(115 * 0x1p-8, maxexp);
+ b = ldexpl(252 * 0x1p-8, maxexp);
+ result = t_csqrt(CMPLXL(a, b));
+ assert(creall(result) == ldexpl(14 * 0x1p-4, maxexp / 2));
+ assert(cimagl(result) == ldexpl(9 * 0x1p-4, maxexp / 2));
+}
+
+int
+main(int argc, char *argv[])
+{
+
+ printf("1..15\n");
+
+ /* Test csqrt() */
+ t_csqrt = _csqrt;
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-user
mailing list