Commit Graph

193 Commits

Author SHA1 Message Date
Enji Cooper
d63d2d29cb Fix test-fenv:test_dfl_env when run on some amd64 CPUs
Compare the fields that the AMD [1] and Intel [2] specs say will be
set once fnstenv returns.

Not all amd64 capable processors zero out the env.__x87.__other field
(example: AMD Opteron 6308). The AMD64/x64 specs aren't explicit on what the
env.__x87.__other field will contain after fnstenv is executed, so the values
in env.__x87.__other could be filled with arbitrary data depending on how the
CPU-specific implementation of fnstenv.

1. http://support.amd.com/TechDocs/26569_APM_v5.pdf
2. http://www.intel.com/Assets/en_US/PDF/manual/253666.pdf

Discussed with: kib, Anton Rang <anton.rang@isilon.com>
Reviewed by: Daniel O'Connor <darius@dons.net.au> (earlier patch; pre-generalization)
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
Reported by: Bill Morchin <wmorchin@isilon.com>
2015-10-14 20:22:12 +00:00
Craig Rodrigues
60caf0c9c2 - Replace N(a)/N(i)/N(T)/LEN(a)/ARRAY_SIZE(a) with nitems()
- Add missing <err.h> for err() and <sys/sysctl.h> for sysctlbyname()
- NULL -> 0 for 5th parameter of sysctlbyname()

Submitted by: Andriy Voskoboinyk <s3erios@gmail com>
Differential Revision: https://reviews.freebsd.org/D3442
2015-08-29 19:47:20 +00:00
Jilles Tjoelker
89cead337a wordexp(): Improve some error codes.
Distinguish between WRDE_BADVAL and WRDE_SYNTAX based on when the error
occurred (parsing or execution), not based on whether WRDE_UNDEF was passed.

Also, return WRDE_NOSPACE for a few more unexpected results from sh.
2015-08-19 20:31:03 +00:00
Christian Brueffer
238ca3cb7e Add a missing break statement, which made the code default to IPv6.
PR:		201285
Submitted by:	David Binderman
MFC after:	1 week
2015-07-14 15:24:50 +00:00
John Baldwin
179fa75e6e Reassign copyright statements on several files from Advanced
Computing Technologies LLC to Hudson River Trading LLC.

Approved by:	Hudson River Trading LLC (who owns ACT LLC)
MFC after:	1 week
2015-04-23 14:22:20 +00:00
Jilles Tjoelker
9d14d0aaae wordexp(): Add testcase for non-default IFS in environment.
The non-default IFS is expected to be used.

MFC after:	1 week
2015-03-29 22:00:24 +00:00
Enji Cooper
bf5e6a8751 Garbage collect a prove test wrapper
MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
2015-01-20 21:58:49 +00:00
Enji Cooper
53cecec82e Convert tools/regression/lib/libc/stdio/test-fpclassify into an ATF testcase and
Rename as lib/libc/stdio/fpclassify2_test

Sponsored by: EMC / Isilon Storage Division
2014-11-16 20:29:57 +00:00
Enji Cooper
41a3b1244b Convert tools/regression/lib/libc/stdio/test-fmemopen into an ATF testcase and
rename as lib/libc/stdio/fmemopen2_test

Sponsored by: EMC / Isilon Storage Division
2014-11-16 19:57:47 +00:00
Enji Cooper
f1bcbd4aba Remove test-arc4random from this Makefile so others can continue to use
this as-is for the time being
2014-11-16 07:58:06 +00:00
Enji Cooper
37074d966d Convert tools/regression/lib/libc/gen/test-arc4random into an ATF testcase and
rename as lib/libc/gen/arc4random_test

Sponsored by: EMC / Isilon Storage Division
2014-11-16 07:55:28 +00:00
Stefan Farfeleder
dfdc1bec71 Remove incorrect semicolon. 2014-10-26 17:56:58 +00:00
Enji Cooper
5738235523 Add diagnostic printfs and disable test # 4 on i386
Reviewed by: jmmv, rpaulo
MFC after: 3 days
Phabric: D749
PR: 191676
Sponsored by: EMC / Isilon Storage Division
2014-09-10 03:54:57 +00:00
Enji Cooper
0d1998fb9b Expand the tests structure in test_small(..) to workaround the
"initializer not constant" warning with gcc

Approved by: jmmv (mentor)
MFC after: 3 days
Phabric: D744
Sponsored by: EMC / Isilon Storage Division
2014-09-09 22:14:15 +00:00
Enji Cooper
8a3fd30740 Be ANSI-C compliant when defining CX_LIMITED_RANGE #pragma
This mutes warnings with clang

Approved by: rpaulo (mentor)
Reviewed by: das, kargl (both as part of a larger patch)
Phabric: D742
Sponsored by: EMC / Isilon Storage Division
2014-09-09 02:58:58 +00:00
Enji Cooper
5aa45fcb67 Integrate lib/libutil into the build/kyua
Remove the .t wrappers

Rename all of the TAP test applications from test-<test> to
<test>_test to match the convention described in the TestSuite
wiki page

humanize_number_test.c:

- Fix -Wformat warnings with counter variables
- Fix minor style(9) issues:
-- Header sorting
-- Variable declaration alignment/sorting in main(..)
-- Fit the lines in <80 columns
- Fix an off by one index error in the testcase output [*]
- Remove unnecessary `extern char * optarg;` (this is already provided by
  unistd.h)

Phabric: D555
Approved by: jmmv (mentor)
MFC after: 2 weeks
Obtained from: EMC / Isilon Storage Division [*]
Submitted by: Casey Peel <cpeel@isilon.com> [*]
Sponsored by: EMC / Isilon Storage Division
2014-08-13 04:56:27 +00:00
Enji Cooper
b236bcf168 Integrate lib/libnv into the build/kyua
Rename all of the TAP test applications from <test> to <test>_test
to match the convention described in the TestSuite wiki page

Phabric: D538
Approved by: jmmv (mentor)
Sponsored by: EMC / Isilon Storage Division
2014-08-05 18:41:27 +00:00
Enji Cooper
dfed135e5c Integrate lib/libmp into the build/kyua
- Remove the .t wrapper
- Fix -Wreturn-type warnings with clang

This change has been tested on amd64/i386

Phabric: D530
Reviewed by: jmmv
Approved by: jmmv (co-mentor)
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
2014-08-04 22:10:07 +00:00
Pietro Cerutti
ae5cb1b14b - Use strlen instead of hardcoding a number
- Terminate a sentence with a period

Approved by:	cognet
2014-06-03 07:11:22 +00:00
Pietro Cerutti
4c524a4287 - Return NULL and set errno to EINVAL if size is 0 (as required by POSIX).
Update the manpage to reflect this change.
- Always set the current position to the first null-byte when opening in append
mode. This makes the implementation compatible with glibc's. Update the test
suite.

Reported by:	pho
Approved by:	cognet
2014-06-02 13:48:57 +00:00
Jilles Tjoelker
93a65e1b5f libc/stdio: Fail fdopen() on an execute-only fd.
An execute-only fd (opened with O_EXEC) allows neither read() nor write()
and is therefore incompatible with all stdio modes. Therefore, the [EINVAL]
error applies.

Also adjust the similar check in freopen() with a NULL path, even though
this checks an fd which is already from a FILE.
2014-04-21 17:40:23 +00:00
Jilles Tjoelker
9f36ecc590 libc: Add fopen() test to regression Makefile. 2014-04-21 12:39:35 +00:00
Warner Losh
3bdf775801 NO_MAN= has been deprecated in favor of MAN= for some time, go ahead
and finish the job. ncurses is now the only Makefile in the tree that
uses it since it wasn't a simple mechanical change, and will be
addressed in a future commit.
2014-04-13 05:21:56 +00:00
Julio Merino
0dc2dd5381 Remove broken tests for eui64_line.
This function is not public and brooks (initial committer adding the code)
suggests the deletion of the tests (which I don't know if they work)
instead of changing the visibility of the function.
2014-03-12 10:59:51 +00:00
Julio Merino
b83f6294d2 Make the strerror tests work without libtap.
Just replace the simple calls to the library with ad-hoc code.  We should
later rewrite these with the ATF libraries anyway, which are part of the
base system.
2014-03-12 10:45:22 +00:00
Pawel Jakub Dawidek
3baf1859b4 Regression tests for the libnv library.
Sponsored by:	The FreeBSD Foundation
2013-11-12 20:31:16 +00:00
John-Mark Gurney
44f01c419d don't assert on bad args, instead return an error..
Since so many programs don't check return value, always NUL terminate
the buf...

fix rounding when using base 1024 (the bug that started it all)...

add a set of test cases so we can make sure that things don't break
in the future...

Thanks to Clifton Royston for testing and the test program...

Approved by:	re (hrs, glebius)
MFC after:	1 week
2013-10-07 22:22:57 +00:00
Jilles Tjoelker
ef70de180c libc/stdio: Allow fopen/freopen modes in any order (except initial r/w/a).
Austin Group issue #411 requires 'e' to be accepted before and after 'x',
and encourages accepting the characters in any order, except the initial
'r', 'w' or 'a'.

Given that glibc accepts the characters after r/w/a in any order and that
diagnosing this problem may be hard, change our libc to behave that way as
well.
2013-09-06 13:47:16 +00:00
Jilles Tjoelker
366f0c9f45 libc/stdio: Run mkostemp test using prove. 2013-09-06 12:59:48 +00:00
Jilles Tjoelker
e32a0090d8 libc/stdio: Provide proper TAP output for fmemopen/open_[w]memstream.
A *.t file should provide Test Anything Protocol output so that it can be
run using the Perl "prove" tool.
2013-09-06 12:56:49 +00:00
Jilles Tjoelker
88dae73d36 fnmatch(): Add test for r254091 (pattern with single backslash).
This test cannot be converted to an sh(1) test because the syntax would be
invalid.

PR:		181129
MFC after:	1 week
2013-08-11 21:54:20 +00:00
Jilles Tjoelker
65ba8dff5f Add mkostemp() and mkostemps().
These are like mkstemp() and mkstemps() but allow passing open(2) flags like
O_CLOEXEC.
2013-08-09 17:24:23 +00:00
Jilles Tjoelker
8d0f6b5fc2 wordexp(): Fix syntax validation for backslashes in single-quotes. 2013-07-23 21:09:26 +00:00
Kevin Lo
2f31c8f52e Add missing headers. 2013-07-17 00:58:23 +00:00
Eitan Adler
8587d5deac Restore "all rights reserved" (spelled correctly). This was actually part of the standard text of the license which I did not realize prior.
Approved by:	bushman
2013-06-17 20:27:20 +00:00
Eitan Adler
353aa3e75b Remove lines declaring "All rights reserved" or similar comments: they
are not true as the files are actually under the BSD-2 license

Approved by:	bushman
2013-06-16 19:35:01 +00:00
David Schultz
7a62fe0f3e Fix some bugs in the complex trig tests so that they test both double
and float precision properly.
2013-06-10 06:03:03 +00:00
Ed Schouten
49111f0092 Add libiconv based versions of *c16*() and *c32*().
I initially thought wchar_t was locale independent, but this seems to be
only the case on Linux. This means that we cannot depend on the *wc*()
routines to implement *c16*() and *c32*(). Instead, use the Citrus
libiconv that is part of libc.

I'll see if there is anything I can do to make the existing functions
somewhat useful in case the system is built without libiconv in the
nearby future. If not, I'll simply remove the broken implementations.

Reviewed by:	jilles, gabor
2013-06-03 17:17:56 +00:00
David Schultz
8ffb5b838e Add more tests for log functions. A few are commented out because the
long double versions don't pass yet.  (They are rather nit-picky cases,
so there's ongoing discussion with Bruce about whether it is worth the
performance cost.)
2013-06-03 09:15:15 +00:00
David Schultz
45de1d006d Factor out some common code from the libm tests. This is a bit messy
because different tests have different ideas about what it means to be
"close enough" to the right answer, depending on the properties of the
function being tested.  In the process, I fixed some warnings and
added a few more 'volatile' hacks, which are sufficient to make all
the tests pass at -O2 with clang.
2013-06-02 04:30:03 +00:00
David Schultz
6bba248bee Fix some harmless bugs in a test. 2013-05-30 04:47:03 +00:00
David Schultz
659a67c641 Basic tests for complex inverse trig and hyperbolic functions. 2013-05-30 04:46:36 +00:00
Tijl Coosemans
9bea689e8b Fix cexp regression tests that have an infinite real part. The signs of the
result depend on the cosine and sine of the imaginary part.
Small values are used in the new tests such that cosine and sine are well
defined.

Reviewed by:	das
2013-05-28 08:50:50 +00:00
David Schultz
7dbbb6dde3 Fix some regressions caused by the switch from gcc to clang. The fixes
are workarounds for various symptoms of the problem described in clang
bugs 3929, 8100, 8241, 10409, and 12958.

The regression tests did their job: they failed, someone brought it
up on the mailing lists, and then the issue got ignored for 6 months.
Oops. There may still be some regressions for functions we don't have
test coverage for yet.
2013-05-27 08:50:10 +00:00
Ed Schouten
5f4cd89cce Add missing #includes, to keep Clang silent. 2013-05-25 18:04:24 +00:00
Ed Schouten
50c77c6e8b Add <uchar.h>.
The <uchar.h> header, part of C11, adds a small number of utility
functions for 16/32-bit "universal" characters, which may or may not be
UTF-16/32. As our wchar_t is already ISO 10646, simply add light-weight
wrappers around wcrtomb() and mbrtowc().

While there, also add (non-yet-standard) _l functions, similar to the
ones we already have for the other locale-dependent functions.

Reviewed by:	theraven
2013-05-21 19:59:37 +00:00
Jilles Tjoelker
e9dec7758d popen(): Add 'e' mode character to set close-on-exec on the new fd.
If 'e' is used, the kernel must support the recently added pipe2() system
call.

The use of pipe2() with O_CLOEXEC also fixes race conditions between
concurrent popen() calls from different threads, even if the close-on-exec
flag on the fd of the returned FILE is later cleared (because popen() closes
all file descriptors from earlier popen() calls in the child process).
Therefore, this approach should be used in all cases when pipe2() can be
assumed present.

The old version of popen() rejects "re" and "we" but treats "r+e" like "r+".
2013-05-20 17:31:18 +00:00
Jilles Tjoelker
86b75745ad Add a test program for popen(). 2013-05-20 13:05:51 +00:00
Jilles Tjoelker
70d41b5846 wordexp(): Remove wrong IFS usage.
Words in shell script are separated by spaces or tabs independent of the
value of IFS. The value of IFS is only relevant for the result of
substitutions. Therefore, there should be a space between 'wordexp' and the
words to be expanded, not an IFS character.

Paranoia might dictate that the shell ignore IFS from the environment (even
though our sh currently uses it), so do not depend on it in the new test
case.
2013-04-01 20:50:07 +00:00
John Baldwin
9240031ac6 Add an implementation of open_memstream() and open_wmemstream(). These
routines provide write-only stdio FILE objects that store their data in a
dynamically allocated buffer.  They are a string builder interface somewhat
akin to a completely dynamic sbuf.

Reviewed by:	bde, jilles (earlier versions)
MFC after:	1 month
2013-02-27 19:50:46 +00:00