Commit Graph

156 Commits

Author SHA1 Message Date
Will Andrews
c384464d25 tsearch_test: Test twalk & add some determinism. 2017-06-06 03:40:45 +00:00
Enji Cooper
ae442ee64a hostent_test_getaddrinfo_eq(..): call freeaddrinfo on ai when done
This plugs a leak of memory allocated via getaddrinfo.

MFC after:	1 week
Reported by:	Coverity
CID:		1346866
Sponsored by:	Dell EMC Isilon
2017-05-28 07:40:42 +00:00
Enji Cooper
dedafe6447 hostent_test_getnameinfo_eq(..): initialize found_a_host to false
MFC after:	1 week
Reported by:	Coverity
CID:		1368943
Sponsored by:	Dell EMC Isilon
2017-05-28 07:04:50 +00:00
Enji Cooper
49dd57f22d Bump WARNS from 1 to 3 after recent commits to fix warnings in the
directory.

Tested with:	clang 4.0, gcc 4.2.1, gcc 6.3.0
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-05-28 06:29:01 +00:00
Enji Cooper
8eb2367596 Push snapshot_file copying down into run_tests function, and mark snapshot_file
const char *.

This fixes a bogus set of errors from gcc about strdup not being allowed a NULL
argument.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-05-28 06:26:43 +00:00
Enji Cooper
e1f5475701 Fix a -Wunused-but-set-variable warning reported by gcc 6.3.0
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 05:31:18 +00:00
Enji Cooper
981aa50fc2 Fix -Wunused and -Wshadow warnings
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 05:26:45 +00:00
Enji Cooper
91c53523fd getgr_test: fix -Wunused warnings
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 04:43:02 +00:00
Enji Cooper
87a9deed3c getpw_test: fix -Wunused warnings
- Mark unused parameters __unused.
- Put dump_passwd under DEBUG as it's only used in that case.

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 04:41:06 +00:00
Enji Cooper
58c03e4e08 gethostby_test: fix multiple warning types
- Fix -Wmissing-declaration warning by staticizing run_tests.
- Fix -Wsign-compare warnings by casting size_t types to int
  for comparisons.

Reindent some of the code in sdump_hostent(..) to accomodate the
overall changes.

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 04:34:57 +00:00
Enji Cooper
42f519347e getproto_test: fix -Wunused warnings
Mark unused parameters __unused in functions.

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 04:15:57 +00:00
Enji Cooper
eaff481c05 getrpc_test: fix -Wunused warnings
- Mark unused function parameters unused.
- Remove an unused function prototype.

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 04:15:05 +00:00
Enji Cooper
2b19d77418 getserv_test: mark unused parameters __unused to fix corresponding
warnings

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 04:12:52 +00:00
Enji Cooper
93ee3b7e9b getusershell_test: mark mdata parameter in compare_usershell __unused
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 04:12:02 +00:00
Enji Cooper
bd8f63f25c getaddrinfo_test: mark unused function parameters __unused to fix -Wunused
warnings

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 04:11:04 +00:00
Enji Cooper
c4519040b5 getproto_test: fix -Wmissing-prototypes and -Wsign-compare warnings
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 04:05:19 +00:00
Enji Cooper
8b0fc406e5 getrpc_test: fix -Wmissing-prototypes and -Wsign-compare warnings
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 04:04:32 +00:00
Enji Cooper
905de51259 getaddrinfo_test: fix -Wsign-compare warnings
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 04:03:45 +00:00
Enji Cooper
93936a0653 getserv_test: fix -Wsign-compare and -Wmissing-prototypes warnings
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 04:03:06 +00:00
Enji Cooper
bbccc5a736 getusershell_test: staticize run_tests(..) to fix warnings
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 03:58:36 +00:00
Enji Cooper
4a9a8952c0 Fix -Wsign-compare warnings
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 03:47:58 +00:00
Enji Cooper
bd874c6a7f Staticize functions and remove unused variables to aid with bumping WARNS
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 03:42:49 +00:00
Enji Cooper
ae8cdfddc3 Sort make variables to suit style.Makefile(5)
This is being done prior to functional changes.

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 03:39:24 +00:00
Enji Cooper
3bdd6cf05d lib/libc/tests/nss: use calloc appropriately
The pattern used prior to this commit was `calloc(1, n * sizeof(type))`;
the pattern that should be used however is `calloc(n, sizeof(type))`.

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-05-28 02:55:04 +00:00
Konstantin Belousov
fade31741d Add tests for some cases in r318298.
The first test triggers the out of bounds read of the 'left' array. It
only fails when realpath.c is compiled with '-fsanitize=address'.

The other test checks for ENOENT when running into an empty
symlink. This matches NetBSD's realpath(3) semantics. Previously,
empty symlinks were treated like ".".

Submitted by:	Jan Kokemц╪ller <jan.kokemueller@gmail.com>
PR:	219154
MFC after:	2 weeks
2017-05-18 13:49:53 +00:00
Conrad Meyer
241eb37e29 libc glob: Avoid pathological exponential behavior
Adapt glob's match() routine to use a greedy algorithm that avoids
exponential runtime in byzantine inputs.

While here, add a testcase for the byzantine input.

Prompted by:	https://research.swtch.com/glob
Authored by:	Yves Orton <demerphq at gmail.com>
Obtained from:	Perl (33252c318625f3c6c89b816ee88481940e3e6f95)
Sponsored by:	Dell EMC Isilon
2017-05-03 15:55:29 +00:00
Baptiste Daroussin
c48dc2a193 Fix strcoll_l disagreeing with strxfrm by reworking the forward order case in
wcscoll_l().

Illumos fixed this while grabbing back our patches:
https://www.illumos.org/rb/r/402/

This does not 100% fix what postgresql folks reported as there is still a
remaining issue: https://www.illumos.org/issues/7962, it improves the situation

The initial issue was reported in postgresql mailing lists:
https://www.postgresql.org/message-id/flat/111D0E27-A8F3-4A84-A4E0-B0FB703863DF@s24.com#111D0E27-A8F3-4A84-A4E0-B0FB703863DF@s24.com

Submitted by:	Yuri Pankov <yuri.pankov@nexenta.com>
Obtained from:	Illumos
MFC after:	2 weeks
2017-04-16 19:12:07 +00:00
Konstantin Belousov
9851b3400a Implement the memset_s(3) function as specified by the C11 ISO/IEC
9899:2011 Appendix K 3.7.4.1.

Other needed supporting types, defines and constraint_handler
infrastructure is added as specified in the C11 spec.

Submitted by:	Tom Rix <trix@juniper.net>
Sponsored by:	Juniper Networks
Discussed with:	ed
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D9903
Differential revision:	https://reviews.freebsd.org/D10161
2017-03-30 04:57:26 +00:00
Enji Cooper
fd752a71ce Don't build/install lib/libc/io_test anymore
The failing test requires the zh_TW.Big5 locale, which is no longer
installed as of r315568.

Add a note/pointer just in case someone considers re-adding it.

Reported by:	Jenkins
Sponsored by:	Dell EMC Isilon
2017-03-20 03:50:22 +00:00
Eric van Gyzen
3f8455b090 Add clock_nanosleep()
Add a clock_nanosleep() syscall, as specified by POSIX.
Make nanosleep() a wrapper around it.

Attach the clock_nanosleep test from NetBSD. Adjust it for the
FreeBSD behavior of updating rmtp only when interrupted by a signal.
I believe this to be POSIX-compliant, since POSIX mentions the rmtp
parameter only in the paragraph about EINTR. This is also what
Linux does. (NetBSD updates rmtp unconditionally.)

Copy the whole nanosleep.2 man page from NetBSD because it is complete
and closely resembles the POSIX description. Edit, polish, and reword it
a bit, being sure to keep any relevant text from the FreeBSD page.

Reviewed by:	kib, ngie, jilles
MFC after:	3 weeks
Relnotes:	yes
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D10020
2017-03-19 00:51:12 +00:00
Alan Somers
5a5a9018dc Increase WARNS for nss tests
ATF tests have a default WARNS of 0, unlike other usermode programs.

Reviewed by:  ngie
MFC after:    3 weeks
Sponsored by: Spectra Logic Corporation
Differential Revision:        https://reviews.freebsd.org/D9933
2017-03-11 00:03:41 +00:00
Alan Somers
b08fc26cbd Increase WARNS for iconv tests
ATF tests have a default WARNS of 0, unlike other usermode programs.

Reviewed by:	ngie
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corporation
Differential Revision:	https://reviews.freebsd.org/D9933
2017-03-11 00:02:05 +00:00
Enji Cooper
13876dc982 style(9): sort the #includes
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-09 09:25:11 +00:00
Enji Cooper
7532a6570b Move ATF_TC_WITHOUT_HEAD(getgrent) near the testcase it annotates
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-06 22:46:49 +00:00
Enji Cooper
99b33ca4ec Manipulate OBJDIR with :H when referencing dso directory
This reduces path lengths, etc in memory with make by a minimal value

Sponsored by:	Dell EMC Isilon
2017-02-11 20:14:50 +00:00
Enji Cooper
a678f77962 MFhead@r313380 2017-02-07 06:04:13 +00:00
Enji Cooper
9a41ce4a69 Expect :int_within_limits to fail when ptrdiff_t/*intmax_t differ in base type
The %t{d,u} (ptrdiff_t) tests fail for the following reasons:
- ptrdiff_t is by definition int32_t on !LP64 architectures and int64_t on
  LP64 architectures.
- intmax_t is by definition fixed to int64_t on all architectures.
- Some of the code in lib/libc/stdio/... is promoting ptrdiff_t to *intmax_t
  when parsing/representing the value.

PR:		191674
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 05:39:00 +00:00
Enji Cooper
1eca9a9a49 Wrap strcmp/wcscmp calls with ATF_CHECK_MSG and drop atf_tc_fail use
The reasoning here was the same as what was done in r313376:
- Gather as many results as possible instead of failing early and
  not testing the rest of the cases.
- Simplify logic when checking test inputs vs outputs and printing
  test result.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 04:25:21 +00:00
Enji Cooper
0653d1fb68 Fix :hexadecimal_floating_point on i386
Don't exclude i386 from LDBL_MANT_DIG == 64; it works properly in
that case.

While here, replace strcmp + atf_tc_fail with ATF_CHECK_MSG for 2
reasons:
- Gather as many results as possible instead of failing early and
  not testing the rest of the cases.
- Simplify logic when checking test inputs vs outputs and printing
  test result.

Tested on:	amd64, i386
MFC after: 	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 03:46:48 +00:00
Enji Cooper
be996c0522 Add -DSKIP_LEFTASSOC to CFLAGS so leftassoc is skipped, like on NetBSD 2017-01-15 10:03:03 +00:00
Enji Cooper
0a57eb32ad Remove CFLAGS for sha2_test
The previous code used to grab definitions from these openssl/openssh,
but this is no longer needed and is no longer correct. libnetbsd
provides all of the needed definitions

libnetbsd is added to CFLAGS automatically via netbsd-tests.test.mk --
hence all of CFLAGS can be cleared
2017-01-14 12:55:32 +00:00
Enji Cooper
1cb4521644 Diff reduce with upstream using lib/libnetbsd's updated copy of sha1.h 2017-01-14 07:58:40 +00:00
Enji Cooper
cdebaff820 Upgrade NetBSD tests to 01.11.2017_23.20 snapshot
This contains some new testcases in /usr/tests/...:

- .../lib/libc
- .../lib/libthr
- .../lib/msun
- .../sys/kern

Tested on:	amd64, i386
MFC after:	1 month
2017-01-13 03:33:57 +00:00
Enji Cooper
9527fa4f66 Remove __HAVE_LONG_DOUBLE #define from t_strtod.c and place it in Makefile
This is to enable support in other testcases

Inspired by lib/msun/tests/Makefile .

MFC after:	1 week
2017-01-12 08:40:52 +00:00
Bryan Drewery
2d22bf634a Support spaces in group names.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2016-12-06 23:43:04 +00:00
Bryan Drewery
710542df20 Fix setrlimit_test:setrlimit_memlock when the system has exceeded vm.max_wired.
This uses the same fix as r294894 did for the mlock test.  The code from
that commit is moved into a common object file which PROGS supports
building first.

Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D8689
2016-12-01 22:12:58 +00:00
Enji Cooper
aa1a469bcd Only build lib/libc/tests/iconv if MK_ICONV != no
MFC after:	1 week
Reported by:	damian@damianek.be
Sponsored by:	Dell EMC Isilon
2016-10-21 04:54:43 +00:00
Ed Schouten
4ef9bd22ed Improve typing of POSIX search tree functions.
Back in 2015 when I reimplemented these functions to use an AVL tree, I
was annoyed by the weakness of the typing of these functions. Both tree
nodes and keys are represented by 'void *', meaning that things like the
documentation for these functions are an absolute train wreck.

To make things worse, users of these functions need to cast the return
value of tfind()/tsearch() from 'void *' to 'type_of_key **' in order to
access the key. Technically speaking such casts violate aliasing rules.
I've observed actual breakages as a result of this by enabling features
like LTO.

I've filed a bug report at the Austin Group. Looking at the way the bug
got resolved, they made a pretty good step in the right direction. A new
type 'posix_tnode' has been added to correspond to tree nodes. It is
still defined as 'void' for source-level compatibility, but in the very
far future it could be replaced by a proper structure type containing a
key pointer.

MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D8205
2016-10-13 18:25:40 +00:00
Ruslan Bukin
c3fa65b1c8 Fix typos: use correct string format and value to compare.
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8226
2016-10-13 15:26:51 +00:00
Ruslan Bukin
5bec6d5513 Mark SSP broken on MIPS.
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-09-27 09:44:30 +00:00