Commit Graph

409 Commits

Author SHA1 Message Date
Enji Cooper
a229b00539 Fix up previous commit
- Apply the logic to the FreeBSD block
- Fix a typo with the getconf(1) call that I would have caught, were
  it not for the fact that I got the blocks wrong.
- Consolidate the hardcoded buffer sizes to the NetBSD block.

This would have been discovered had I run the test on a system where
PATH_MAX != 1024 (I don't have that at my disposal right at this moment).

MFC after:	3 weeks
MFC with:	r318210
Sponsored by:	Dell EMC Isilon
2017-05-12 05:17:49 +00:00
Enji Cooper
8fb58d8b6a ssp_test:read:: query the value of MAXPATHLEN via getconf(1)
In the event the value of PATH_MAX was changed, the assumption that
MAXPATHLEN is 1024 (and hence the buffer length required to trigger
SSP to fail for read(2)) would be invalidated. Query getconf(1) for
the actual value of MAXPATHLEN via _XOPEN_PATH_MAX instead, and
increment the value by 1 to ensure that the SSP support tests the
stack smashing support properly.

MFC after:	3 weeks
Sponsored by:	Dell EMC Isilon
2017-05-12 05:06:48 +00:00
Enji Cooper
a41afc8290 Remove expected failure that no longer fails with gnu grep in base
Reported by:	Jenkins
Submitted by:	Kyle Evans <kevans91@ksu.edu>
Sponsored by:	Dell EMC Isilon
2017-05-09 04:11:53 +00:00
Ed Maste
e2127de812 bsdgrep: don't ouptut matches with -c, -l, -L
Refactoring done in r317703 broke -c, -l, and -L flags implying
suppression of match printing.  Fortunately this is just a matter of not
doing any printing of the resulting matches and context printing was not
broken in this refactoring.

Add some regression tests since this area may still see further
refactoring, include different context flags as well even though they
were not broken in this case.

PR:		219077
Submitted by:	Kyle kevans91@ksu.edu
Reported by:	markj
Reviewed by:	cem, ngie
Differential Revision:	https://reviews.freebsd.org/D10607
2017-05-05 17:35:05 +00:00
Brooks Davis
e351474725 Remove expected failure now that it was fixed in r317660.
PR:		211804
Reviewed by:	ngie
Obtained from:	CheriBSD
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D10576
2017-05-02 22:14:55 +00:00
Ed Maste
a4f3f02be6 bsdgrep: fix -w flag matching with an empty pattern
-w flag matching with an empty pattern was generally 'broken', allowing
matches to occur on any line whether or not it actually matches -w
criteria.

This fix required a good amount of refactoring to address.  procline()
is altered to *only* process the line and return whether it was a match
or not, necessary to be able to short-circuit the whole function in case
of this matchall flag. -m flag handling is moved out as well because it
suffers from the same fate as context handling if we bypass any actual
pattern matching.

The matching context (matches, mostly) didn't previously exist outside
of procline(), so we go ahead and create context object for file
processing bits to pass around.  grep_printline() was created due to
this, for the scenarios where the matches don't actually matter and we
just want to print a line or two, a la flushing the context queue and
no -o or --color specified.

Damage from this broken behavior would have been mitigated by the fact
that it is unlikely users would invoke grep -w with an empty pattern.

This was identified while checking PR 105221 for problems it this may
cause in BSD grep, but PR 105221 is *not* a report of this behavior.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Differential Revision:	https://reviews.freebsd.org/D10433
2017-05-02 20:39:33 +00:00
Ed Maste
befd089c0d bsdgrep: revise test case which will soon become a failure
Work in progress (D10315) is going to make egrep_empty_invalid an
actually invalid regex, to be consistent with the equivalent BRE "{"
behavior, when using regex(3).

Any non-0 exit value is acceptable, depending on how the installed grep
interprets the expression. GNU grep interprets it as non-matching, and
in the future BSD grep will interpret it is an error.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	cem, ngie
Differential Revision:	https://reviews.freebsd.org/D10572`
2017-05-02 18:37:11 +00:00
Ed Maste
945fc991b2 bsdgrep: fix -w -v matching improperly with certain patterns
-w and -v flag matching was mostly functional but had some minor
problems:

1. -w flag processing only allowed one iteration through pattern
   matching on a line. This was problematic if one pattern could match
   more than once, or if there were multiple patterns and the earliest/
   longest match was not the most ideal, and

2. Previous work "fixed" things to not further process a line if the
   first iteration through patterns produced no matches. This is clearly
   wrong if we're dealing with the more restrictive -w matching.

#2 breakage could have also occurred before recent broad rewrites, but
it would be more arbitrary based on input patterns as to whether or not
it actually affected things.

Fix both of these by forcing a retry of the patterns after advancing
just past the start of the first match if we're doing more restrictive
-w matching and we didn't get any hits to start with. Also move -v flag
processing outside of the loop so that we have a greater change to match
in the more restrictive cases. This wasn't strictly wrong, but it could
be a little more error prone.

While here, introduce some regressions tests for this behavior and fix
some excessive wrapping nearby that hindered readability. GNU grep
passes these new tests.

PR:		218467, 218811
Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	cem, ngie
Differential Revision:	https://reviews.freebsd.org/D10329
2017-05-02 02:32:10 +00:00
Enji Cooper
5199917cc6 Add more sanity tests for grep, egrep, and fgrep
The test suite currently lacks basic sanity checks to ensure that egrep,
fgrep, and grep are actually matching the right expression types, i.e. passing
the right flags to regcomp(3). Amend the test suite to make sure that not only
are the individual versions doing the right thing, but also that we don't have some
kind of frankenregex situation happening where egrep is accepting a BRE or
grep an ERE.

I've chosen to not expand the 'basic' test but to add the 'grep_sanity' checks
to their own test case since this is testing for more than just 'grep matches things',
but actual expression types.

Differential Revision:	D10444
Reviewed by:	emaste, ngie
Submitted by:	Kyle Evans <kevans91@ksu.edu>
Tested with:	bsdgrep, gnu grep (base, ports)
Sponsored by:	Dell EMC Isilon
2017-04-22 21:40:10 +00:00
Enji Cooper
6e5e4dbd06 Remove the expected failures for :context and :context2 with bsdgrep(1)
They're no longer needed after recent fixes made to bsdgrep(1).

Submitted by:	Kyle Evans <kevans91@ksu.edu> (via a previous diff in D10433)
Sponsored by:	Dell EMC Isilon
2017-04-22 21:26:15 +00:00
Ed Maste
e06ffa3230 bsdgrep: fix zero-length matches without the -o flag
r316477 broke zero-length matches when not using the -o flag, by
skipping over them entirely.

Add a regression test so that it doesn't break again in the future.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	cem emaste ngie
Differential Revision:	https://reviews.freebsd.org/D10333
2017-04-17 14:59:55 +00:00
Enji Cooper
9f67a48145 Fix expectations for testcases per bsdgrep vs gnu grep from base/ports
The following failures occur with various versions of grep:

BSD grep:
- :context
- :context2

GNU grep (base):
- :color
- :oflag_zerolen

GNU grep (ports):
- :recurse_symlink

Tested with:	bsdgrep (^/head@r316542), gnu grep (base/2.5.1), gnu grep (ports/2.27)
Reported by:	Jenkins (bsdgrep failures)
Sponsored by:	Dell EMC Isilon
2017-04-13 04:10:27 +00:00
Ed Maste
799c5faa8b bsdgrep: create additional tests for coverage on recent fixes
Create additional tests to cover regressions that were discovered by
PRs linked to reviews D10098, D10102, and D10104.

It is worth noting that neither bsdgrep(1) nor gnugrep(1) in the base
system currently pass all of these tests, and gnugrep(1) not quite being
up to snuff was also noted in at least one of the PRs.

PR:		175314 202022 195763 180990 197555 197531 181263 209116
Submitted by:	Kyle Evans <kevans91@ksu.edu>
Reviewed by:	cem, ngie, emaste
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10112
2017-04-05 18:41:44 +00:00
Enji Cooper
9532aae589 Annotate all changes made in r316178-r316180 with __FreeBSD__
Restore the stock (upstream) code under an #else block, so it's easier
for me to visualize and understand the code that needs to be upstreamed.

MFC after:	2 months
X-MFC with:	r316178, r316179, r316180
Sponsored by:	Dell EMC Isilon
2017-03-30 07:13:47 +00:00
Conrad Meyer
70aca7c8e8 t_msgctl: Fix the same msgsnd() misuse as t_msgsnd
msgsnd(2)'s msgsz argument does not describe the full structure, only the
message component.

Reported by:	Coverity
CIDs:		1368703, 1368711
Sponsored by:	Dell EMC Isilon
2017-03-29 21:31:45 +00:00
Conrad Meyer
1a663d3c00 Follow-up to r316179: More of the same
Reported by:	Coverity
CIDs:		1368705, 1368706, 1368707, 1368710
Sponsored by:	Dell EMC Isilon
2017-03-29 21:29:21 +00:00
Conrad Meyer
ebf1bc1768 t_msgsnd: Use msgsnd()'s msgsz argument correctly to avoid overflow
msgsnd's msgsz argument is the size of the message following the 'long'
message type.  Don't include the message type in the size of the message
when invoking msgsnd(2).

Reported by:	Coverity
CID:		1368712
Sponsored by:	Dell EMC Isilon
2017-03-29 21:26:13 +00:00
Enji Cooper
b49d92c2aa Remove all expected failures from lib/libc/locale/io_test for FreeBSD
This is no longer required as of r315616, as the test is no longer
built/installed.

This is being done to diff reduce with NetBSD.

Sponsored by:	Dell EMC Isilon
2017-03-20 03:52:06 +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
Enji Cooper
13081ad7c6 Add additional __FreeBSD_version guards around the hsearch_r testcases
The reasoning for this is the same as r276046: to ease MFCing the tests
to ^/stable/10 .

This was accidentally missed in r313439

MFC after:	1 week
X-MFC with:	r313439
Sponsored by:	Dell EMC Isilon
2017-03-01 03:31:12 +00:00
Eric van Gyzen
b215ceaaec Add sem_clockwait_np()
This function allows the caller to specify the reference clock
and choose between absolute and relative mode.  In relative mode,
the remaining time can be returned.

The API is similar to clock_nanosleep(3).  Thanks to Ed Schouten
for that suggestion.

While I'm here, reduce the sleep time in the semaphore "child"
test to greatly reduce its runtime.  Also add a reasonable timeout.

Reviewed by:	ed (userland)
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D9656
2017-02-23 19:36:38 +00:00
Enji Cooper
cad7148985 Oops... put the atf_tc_expect_fail in the testcase definition, not the
test suite definition
2017-02-07 19:02:59 +00:00
Enji Cooper
ce801ad813 Expect the t_precision long double checks to fail on FreeBSD/i386
There are some potential issues with the test (as brd@ has pointed out
elsewhere) with precision, etc not being set before the test, but as
always, more research is required.
2017-02-07 18:57:52 +00:00
Enji Cooper
62d02a8f74 Add #else case in run(..) to fix test on non-{amd64,arm64,mips} after
recent refactoring to the test
2017-02-07 06:34:02 +00:00
Enji Cooper
a678f77962 MFhead@r313380 2017-02-07 06:04:13 +00:00
Enji Cooper
87e886953f Expect :floatunditf to fail on FreeBSD/i386
The precision error on FreeBSD/i386 doesn't match the expected output in
long double form.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-02-07 04:15:41 +00:00
Enji Cooper
7047ed6854 Expect :hsearch_r_nonexistent to fail on FreeBSD
The docs and the behavior mismatch; as noted in the bug, the behavior
for hsearch_r matches Linux, whereas the docs seem to match NetBSD
requirements wise.

PR:	216872
2017-02-07 02:57:11 +00:00
Enji Cooper
f2b9adff63 Uncomment more of the hsearch_r testcases
Call hdestroy/hdestroy_r on FreeBSD instead of hdestroy(1?)(_r).

All but hdestroy_r_nonexistent pass as-is.
2017-02-07 02:00:14 +00:00
Enji Cooper
dd66b5baa8 Merge in changes from ^/vendor/NetBSD/tests/dist@r313245
Diff reduce lib/libm/t_pow.c per upstream changes
2017-02-04 18:20:07 +00:00
Enji Cooper
4421971444 Add back #else block accidentally removed in r312145
This fixes the build with !(amd64|arm64|mips*)
2017-01-18 09:46:02 +00:00
Enji Cooper
5f761d3c88 Merge ^/vendor/NetBSD/tests/dist@r312370 2017-01-18 05:36:09 +00:00
Enji Cooper
6fa647788e Reintroduce libutil.h #include for FreeBSD only for fparseln 2017-01-16 20:46:40 +00:00
Enji Cooper
f115a1c3e0 Remove explicit pthread_np.h #include, per change in libnetbsd@r312303 2017-01-16 18:52:05 +00:00
Enji Cooper
ea498175b9 Diff reduce with upstream and prep for next set of content pushes 2017-01-16 18:44:40 +00:00
Enji Cooper
4acf8d706e Diff reduce with upstream by using macros and logic integrated in
later revisions of the test
2017-01-16 18:36:38 +00:00
Enji Cooper
39a3103b41 Use sys/param.h instead of sys/types.h to prep for upstreaming to NetBSD 2017-01-16 18:17:53 +00:00
Enji Cooper
e2a4e9c682 Remove unnecessary whitespace diff 2017-01-16 18:04:14 +00:00
Enji Cooper
183ae521e5 Use _SED instead of hacking tests rewriting mknod ... p as mkfifo
Similar to r312297
2017-01-16 17:53:58 +00:00
Enji Cooper
267f10b14c Use _SED to rewrite mknod ... p command as mkfifo instead of
adding an unnecessary diff to the test
2017-01-16 17:49:53 +00:00
Enji Cooper
3b0a9131e6 Merge ^/vendor/NetBSD/tests/dist@r312294
This includes a number of accepted upstream fixes, as well as
a reimplementation of the net/carp/... testcase (which is
currently unused).
2017-01-16 17:43:43 +00:00
Enji Cooper
89964aab17 Add GLOB_STAR #ifdef to testcases which require GLOB_STAR support 2017-01-16 07:41:39 +00:00
Enji Cooper
f467f63cbb Remove sys/param.h
It was used for nitems, but I converted it to __arraycount later, and
is already pulled in by header pollution on FreeBSD as well as NetBSD
ala sys/cdefs.h
2017-01-16 07:39:08 +00:00
Enji Cooper
5ca8558309 Drop unnecessary diff rewriting dict(..) function
This is already being properly handled via ATF config require.files call
2017-01-16 07:34:45 +00:00
Enji Cooper
6a93de28a6 Diff reduce with upstream and consolidate #ifdefs where possible 2017-01-15 22:00:59 +00:00
Enji Cooper
bfb8e4c9c4 Remove libutil.h #include on FreeBSD and instead favor stdio.h from libnetbsd 2017-01-15 21:38:19 +00:00
Enji Cooper
caeb04e465 lib/libc/gen/t_glob.c: diff reduce with NetBSD's copy 2017-01-15 10:17:15 +00:00
Enji Cooper
f40f3adc42 Pull in ^/vendor/NetBSD/tests/dist@r312219
Remove divergence with upstream where possible
2017-01-15 10:04:20 +00:00
Enji Cooper
83e891f222 Revert t_pow@r312154
This hunk hasn't been accepted yet
2017-01-14 10:10:49 +00:00
Enji Cooper
1f6a3aa8e5 Fix the build using hunks pending upstream contributions 2017-01-14 10:08:22 +00:00
Enji Cooper
e0940c61c2 Diff reduce with upstream post-accepted contributions 2017-01-14 10:05:26 +00:00
Enji Cooper
81e7d81dc3 One more sys/types.h kevent clarification missed in r312151 2017-01-14 09:47:06 +00:00
Enji Cooper
ecab856bc9 Clarify why sys/types.h #include is needed on FreeBSD 2017-01-14 09:45:46 +00:00
Enji Cooper
c8300756f2 Use cleanup routines to remove POSIX semaphores instead of just blindly
unlinking them at the beginning of the testcase

This is a lot more intelligent in cleaning up the semaphores if the testcase
fails before sem_unlink is called.

Contributed back as bin/51872 upstream.
2017-01-14 09:42:06 +00:00
Enji Cooper
2a1440c618 Diff reduce with upstream by taking diff hunks that were contributed back 2017-01-14 09:38:40 +00:00
Enji Cooper
9f30f6b7c3 Readd the CMSG_DATA for assigning the kqueue... this testcase isn't officially
correct yet, but it's getting closer.
2017-01-14 09:25:09 +00:00
Enji Cooper
25785590d5 Remove extra EVSET I added in r312146 by accident 2017-01-14 09:21:36 +00:00
Enji Cooper
a41b7cf58e Diff reduce with upstream
Use CMSG_FIRSTHDR macro to properly link the kqueue to the socket to
get it to now return -1/EBADF with sendmsg per the testcase expectations
2017-01-14 09:20:54 +00:00
Enji Cooper
7bb9bc9cc2 Try to consolidate the #ifdef soup into FreeBSD vs non-FreeBSD blocks better 2017-01-14 08:47:00 +00:00
Enji Cooper
0e6a2253dc Diff reduce with upstream 2017-01-14 08:39:53 +00:00
Enji Cooper
6e515978dd Remove comment no longer true since the test no longer bombs out earlier on 2017-01-14 08:38:21 +00:00
Enji Cooper
04f40d86db Diff reduce with upstream 2017-01-14 08:36:43 +00:00
Enji Cooper
50e474a4f6 :strtold_nan: remove unnecessary strcmp check
It gets checked again later on in the testcase
2017-01-14 08:35:29 +00:00
Enji Cooper
1081817ad5 Diff reduce with upstream 2017-01-14 08:12:57 +00:00
Enji Cooper
154be35857 Use copy of sha2.h from libnetbsd 2017-01-14 08:11:17 +00:00
Enji Cooper
0e3f47800f Restore deleted line 2017-01-14 07:59:33 +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
9a62e988b3 r312133 should have used the non-FreeBSD block 2017-01-14 07:50:29 +00:00
Enji Cooper
4e9c68081e Diff reduce with upstream by using util.h from libnetbsd instead of libutil.h 2017-01-14 07:48:22 +00:00
Enji Cooper
3b85282333 Diff reduce with upstream 2017-01-14 07:39:07 +00:00
Enji Cooper
88dd6cd01d Copy ^/vendor/NetBSD/tests/dist/lib/libc/hash/t_hmac.c to
contrib/netbsd-tests/lib/libc/hash/t_hmac.c

This was missed in r303980
2017-01-14 07:16:15 +00:00
Enji Cooper
8eace6ac0f Try again with a better commit message 2017-01-14 07:15:14 +00:00
Enji Cooper
519b4f22b0 Copy ^/vendor/NetBSD/tests/dist to contrib/netbsd-tests
This was missed in r303980
2017-01-14 07:14:25 +00:00
Enji Cooper
63d1fd5970 Merge content currently under test from ^/vendor/NetBSD/tests/dist/@r312123
Sponsored by:	Dell EMC Isilon
2017-01-14 06:49:17 +00:00
Enji Cooper
792bbaba98 Remove contrib/netbsd-tests/fs/nfs/nfsservice/rpcbind
This should have been pruned in r305358

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-01-14 06:16:57 +00:00
Enji Cooper
36b9e15c66 Delete trailing whitespace and use __arraycount instead of nitems in contrib code
MFC after:	1 week
2017-01-14 03:54:23 +00:00
Enji Cooper
a5deb9babb Note that sys/types.h is required on FreeBSD for kqueue(2), unlike NetBSD
MFC after:	12 days
X-MFC with:	r305358
Sponsored by:	Dell EMC Isilon
2017-01-14 01:01:02 +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
Enji Cooper
35cfc322f1 Fix lib/libc/sys/access_test after r311925
sys/param.h needs to be #included in order for __FreeBSD_version to be checked

MFC after:	13 days
2017-01-12 08:31:42 +00:00
Enji Cooper
bccef7f6d9 Consolidate __NetBSD__ #ifdef
MFC after:	3 days
2017-01-11 10:20:35 +00:00
Enji Cooper
ddba0402f4 Import testcase updates with code contributed back to NetBSD
This also (inadvertently) contains an update to
contrib/netbsd-tests/lib/libc/sys/t_wait.c (new testcases).

MFC after:		2 weeks
In collaboration with:	christos@NetBSD.org
2017-01-11 09:51:34 +00:00
Enji Cooper
d1a6b5fb2f Fix whitespace in comment
MFC after:	3 days
2017-01-11 09:34:42 +00:00
Enji Cooper
0e0dd02306 Partially revert r311236
There's no sense in trying to close a file descriptor from the negative cases
with unlink_test; it's best to ignore these cases.

The mkfifo case does make sense to keep though.

MFC after:	3 days
2017-01-11 07:22:21 +00:00
Enji Cooper
19f27f3c34 Fix up r311227
Check for creat returning a value != -1, not a non-zero value

MFC after:	3 days
Pointyhat to:	ngie
Reported by:	Coverity
CID:		1368366
2017-01-11 07:17:03 +00:00
Enji Cooper
7931520d40 Diff reduce with upstream by removing signal.h #include
MFC after:	3 days
2017-01-10 10:27:09 +00:00
Enji Cooper
b6a72c5dbe Merge ^/vendor/NetBSD/tests/dist@r311868
This is the vendor accepted version of ^/head@r311245

MFC after:	3 days
2017-01-10 10:16:59 +00:00
Enji Cooper
2bbc0fe246 Merge the grammar fix for lib/libc/gen/raise_test:raise_stress
MFC after:	3 days
2017-01-10 10:12:36 +00:00
Enji Cooper
20a4ce8bf2 Redo fix for CID 979581
The previous change was flawed in terms of how it calculated the
buffer length for the sockaddr_un object. Use SUN_LEN where
appropriate and mute the Coverity complaint by using memset(.., 0, ..)
to zero out the entire structure instead of setting .sun_len to a bogus
value and strlcpy'ing in the contents of argv[1].

SUN_LEN is now being passed to bind(2) as well. For some odd reason
this wasn't flagged as a bug with Coverity.

Reported by:	jilles, jmallett
MFC after:	2 days
X-MFC with:	r311233
2017-01-05 07:46:57 +00:00
Enji Cooper
d6766132c2 run: ensure pthread_condattr_{init,setclock} is successful
MFC after:	1 week
Reported by:	Coverity
CID:		1268631, 1268633
2017-01-04 09:06:49 +00:00
Enji Cooper
dca7cc9815 setrlimit_basic: don't leak buf; free it on completion
MFC after:	3 days
Reported by:	Coverity
CID:		978311
2017-01-04 09:00:16 +00:00
Enji Cooper
fcc9604d43 revoke_perm: don't leak fd at the end of the test; close it
This code is unused on FreeBSD, but it mutes a valid Coverity warning
which would be true on NetBSD

MFC after:	3 days
Reported by:	Coverity
CID:		978311
2017-01-04 08:59:06 +00:00
Enji Cooper
621b0f13af stat_symlink: don't leak fd; close the file descriptor when done
MFC after:	3 days
Reported by:	Coverity
CID:		978314
2017-01-04 08:49:07 +00:00
Enji Cooper
c0b11b8e04 pipe_restart: free f on function exit to quell complaint from Coverity
MFC after:	3 days
Reported by:	Coverity
CID:		978307
2017-01-04 08:43:27 +00:00
Enji Cooper
64af3fbaba swapcontext1: test for getcontext(3) and swapcontext(3) success properly
The beforementioned libcalls both succeed if the return codes aren't -1

MFC after:	3 days
Reported by:	Coverity
CID:		976790, 976791
2017-01-04 08:35:46 +00:00
Enji Cooper
7251167f52 Clarify lifetime of child(..) function
Ensure child exits when complete as it's always run in a forked
process.

Add a missing break statement in :pselect_sigmask when calling
child(..) for clarity and to avoid weird domino effects if the
child process somehow does something it's not supposed to do
with the logfiles, file descriptors, etc

MFC after:	1 week
Reported by:	Coverity
CID:		1223369, 1223370, 1300301
2017-01-04 08:25:31 +00:00
Enji Cooper
17a0c1eb75 fpu: ensure calls to pthread_create succeed and test sched_yield to make
sure it returns 0

sched_yield tests for values returning 0 of type int and sched_yield is
of type long, so the test is a mismatch

MFC after:	1 week
Reported by:	Coverity
CID:		1254953, 1254954, 1254965, 1254966
2017-01-04 08:07:48 +00:00
Enji Cooper
b5bbd2a17c mincore_resid: free buf after use
MFC after:	3 days
Reported by:	Coverity
CID:		978304
2017-01-04 04:55:33 +00:00
Enji Cooper
83e8b13f15 {strchr,strlen}_basic: don't leak the dlopen'ed handle; close after use
MFC after:	3 days
Reported by:	Coverity
CID:		978299, 978300
2017-01-04 04:50:03 +00:00
Enji Cooper
5d37d9cc25 mknodat_fd: close dfd after use to avoid leaking it
MFC after:	3 days
Reported by:	Coverity
CID:		978287
2017-01-04 04:32:00 +00:00
Enji Cooper
f4cbf11049 mkfifoat_fd: close dfd after use to avoid leaking it
MFC after:	3 days
Reported by:	Coverity
CID:		978286
2017-01-04 04:29:53 +00:00
Enji Cooper
5641f109c1 fexecve: don't leak fd on fexecve(2) failure; close before calling err
MFC after:	3 days
Reported by:	Coverity
CID:		978285
2017-01-04 04:27:13 +00:00
Enji Cooper
3b33767589 tty: don't leak s after opening it with openpty
MFC after:	3 days
Reported by:	Coverity
CID:		978321
2017-01-04 04:19:05 +00:00
Enji Cooper
57f5b7d843 mmap_prot_3, mmap_truncate, mmap_truncate_signal: don't leak fd and map
Reported by:	Coverity
CID:		978306, 1251406, 1288196, 1300541
2017-01-04 04:10:36 +00:00
Enji Cooper
619898777b listen_low_port: check for errors from socket(2) before continuing
MFC after:	3 days
Reported by:	Coverity
CID:		976778
2017-01-04 03:59:50 +00:00
Enji Cooper
2020383ffd kqueue_desc_passing: initialize m.msg_flags to 0
This mutes an uninitialized scalar warning from Coverity

MFC after:	3 days
Reported by:	Coverity
CID:		979620
2017-01-04 03:54:54 +00:00
Enji Cooper
ab25ecadbf umask_open: don't leak fd on success
MFC after:	3 days
Reported by:	Coverity
CID:		978315
2017-01-04 03:41:16 +00:00
Enji Cooper
3c917d6fa3 unlink_fifo: don't leak the file descriptors opened with mkfifo and open
MFC fater:	3 days
Reported by:	Coverity
CID:		978316, 978317
2017-01-04 03:35:23 +00:00
Enji Cooper
6a64e31600 ttyname_err: close fd if it was opened successfully
MFC after:	3 days
Reported by:	Coverity
CID:		978292
2017-01-04 02:52:39 +00:00
Enji Cooper
cc34906655 Fix Coverity issues
- Initialize .sun_len before passing it to strlcpy and bind.
- Close fd on error

MFC after:	3 days
Reported by:	Coverity
CID:		978283, 979581
2017-01-04 02:46:36 +00:00
Enji Cooper
251d8e776e humanize_number_basic: don't leak buf
MFC after:	3 days
Reported by:	Coverity
CID:		1251407
2017-01-04 02:38:14 +00:00
Enji Cooper
06cd8428bc ftok_link: don't leak fd
MFC after:	3 days
Reported by:	Coverity
CID:		978291
2017-01-04 02:34:30 +00:00
Enji Cooper
05aee7d5b0 seekdir_basic: fix various Coverity issues
Address..
- .. resource leaks of file descriptors and memory
- .. unchecked return values from creat(2), mkdir(2), and telldir(3)
- .. potential NULL derefs after calling readdir(3)

MFC after:	1 week
Reported by:	Coverity
CID:		975255, 975256, 976989, 978989, 978990
2017-01-04 02:31:05 +00:00
Enji Cooper
cc7734cbac Change the process limits for RLIMIT_MEMLOCK to RLIM_INFINITY when
executing :mincore_resid

The default process limits in FreeBSD is 64kB for unprivileged users,
which empirically is too low to run the :mincore_resid testcase.

Process limits are inherited, so even though the default limit for
root users is RLIM_INFINITY, the inherited limit with "sudo" with the
default login.conf will be 64kB.

Use setrlimit to set rlim_max for RLIMIT_MEMLOCK to RLIM_INFINITY to
avoid ENOMEM issues when calling mlock to wire the mmap'ed address
space.

setrlimit requires root access to increase rlim_max, so require root
privileges when running the test

Discovered when executing the tests with sudo, e.g.
"sudo kyua test -k /usr/tests/lib/libc/sys/Kyuafile mincore_test"

MFC after:	2 weeks
2016-12-10 22:08:33 +00:00
Enji Cooper
5eabf0ffea Use _test_unmount instead of test_unmount in cleanup to avoid
false positives with atf_check when tmpfs is not loaded, etc

MFC after:	1 week
2016-12-09 23:44:25 +00:00
Enji Cooper
60fbebc327 - Ignore errors from umount
- Use _test_unmount instead of test_unmount in cleanup

MFC after:	1 week
2016-12-09 23:43:33 +00:00
Enji Cooper
5be335bb11 Make test_unmount usable in cleanup subroutines
- Duplicate test_unmount to _test_unmount
- Remove atf_check calls
- Call _test_unmount from test_unmount, checking the exit code
  at the end, and returning it to maintain the test_unmount
  "contract"

MFC after:	1 week
2016-12-09 23:42:04 +00:00
Enji Cooper
7f9dff23d3 Only run mdconfig -d -u 3 if /dev/md3 exists on the system
This will prevent "cleanup failures" (exit code != 0 returned) when
tmpfs is not loaded

MFC after:	1 week
2016-12-09 22:50:43 +00:00
Bryan Drewery
b4af531e83 Remove unneeded hack fixed by r309626.
strvis(3) being tainted by our mbtowc(3) calls was causing
spurious failures here.

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2016-12-06 17:06:14 +00:00
Enji Cooper
72a02000d9 Don't build :strvis_locale if VIS_NOLOCALE is undefined
The copy of contrib/libc-vis on ^/stable/10 doesn't contain all of the features
in the ^/stable/11 // ^/head version, including VIS_NOLOCALE. The risk is lower
in conditionally running the test instead of backporting the newer version of
libc-vis

MFC after:	now
2016-12-03 03:56:20 +00:00
Enji Cooper
612a96b4a8 Restore pathing for factor(1), which unnecessarily diverged in r278616
factor lives in /usr/games/, not /usr/bin, in NetBSD.

The correct way to handle this is do on-the-fly manipulation of the test
script via ATF_TESTS_SH_SED_<foo>, not by modify the pathing directly in
the test script.

This is being done to resolve an unnecessary conflict made when pulling
back ^/head@r309469 (contrib/netbsd-tests update) to ^/stable/10.

No functional change

MFC after:	now
2016-12-03 03:13:32 +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
Ruslan Bukin
130a08a362 Detect integer overflow and limit the number of positional
arguments in the string format.

Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
Differential Revision:	https://reviews.freebsd.org/D8286
2016-10-31 18:38:58 +00:00
Enji Cooper
def7fe87e9 Expect tests/sys/fs/tmpfs/link_test:kqueue to fail
It fails with: "dir/b did not receive NOTE_LINK"

Also, add needed cleanup logic to cleanup the mountpoint after the fact

MFC after:	2 weeks
PR:		213662
Sponsored by:	Dell EMC Isilon
2016-10-21 05:21:20 +00:00
Ruslan Bukin
21e609c4aa Skip test on FreeBSD only. So test can be upstreamed to NetBSD.
Requested by:	ngie
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-10-18 22:53:58 +00:00
Ruslan Bukin
bf7d7eae01 Skip test on MIPS as it modifies TLS pointer in set_mcontext().
Discussed with:	kib
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-10-18 10:13:54 +00:00
Enji Cooper
3e5c48d95f Change atf_skip call to atf_expect_fail to make it clear that a failure is
expected

MFC after:	2 weeks
PR:		212861
Suggested by:	jmmv
Sponsored by:	Dell EMC Isilon
2016-10-13 08:35:08 +00:00
Enji Cooper
ac3628603c Expect :large to fail on FreeBSD
FreeBSD doesn't appear to validate large -o size values like
NetBSD does

MFC after:	2 weeks
PR:		212862
Sponsored by:	Dell EMC Isilon
2016-10-13 08:27:19 +00:00
Enji Cooper
12be646525 Port contrib/netbsd-tests/fs/tmpfs/h_tools.c to FreeBSD
- Add inttypes.h #include for PRId64 macro
- Use FreeBSD's copy of getfh(2), which doesn't include a `fh_size` parameter.
  Use sizeof(fhandle_t) instead as the size of fhp is always fixed as
  fhandle_t, unlike NetBSD's copy of fhp, which is void*.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-10-13 07:32:25 +00:00
Enji Cooper
d01498defb Skip :uchg on FreeBSD
Unfortunately removing files with uchg set always succeeds with root on
FreeBSD. Unfortunately running the test as an unprivileged user isn't doable
because mounting tmpfs requires root

PR:		212861
Sponsored by:	Dell EMC Isilon
2016-10-13 07:02:54 +00:00
Ed Maste
fbf2d5a99b Add test for a musl libc memmem bug
With a short needle (aka little) musl's memmem could read past the end
of the haystack (aka big). This was fixed in musl commit c718f9f.

Reviewed by:	ed
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8137
2016-10-06 20:27:40 +00:00
Baptiste Daroussin
c7edf4fd0b localedef: Fix ctype dump (fixed wide spread errors)
This commit is from John Marino in dragonfly with the following commit log:

====
This was a CTYPE encoding error involving consecutive points of the same
ctype.  It was reported by myself to Illumos over a year ago but I was
unsure if it was only happening on BSD.  Given the cause, the bug is also
present on Illumos.

Basically, if consecutive points were of the exact same ctype, they would
be defined as a range regardless.  For example, all of these would be
considered equivalent:

  <A> ... <C>, <H>  (converts to <A> .. <H>)
  <A>, <B>, <H>     (converts to <A> .. <H>)
  <A>, <J> ... <H>  (converts to <A> .. <H>)

So all the points that shouldn't have been defined got "bridged" by the
extreme points.

The effects were recently reported to FreeBSD on PR 213013.  There are
countless places were the ctype flags are misdefined, so this is a major
fix that has to be MFC'd.
====

This reveals a bad change I did on the testsuite: while 0x07FF is a valid
unicode it is not used yet (reserved for future use)

PR:		213013
Submitted by:	marino@
Reported by:	Kurtis Rader <krader@skepticism.us>
Obtained from:	Dragonfly
MFC after:	1 month
2016-10-06 19:46:43 +00:00
Ruslan Bukin
de1a9339ea Use right piece of code for FreeBSD.
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-09-28 08:45:42 +00:00
Ruslan Bukin
615216628b Allow up to 6 arguments only on MIPS.
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-09-27 13:46:00 +00:00
Enji Cooper
43f24e2096 Port vnd_test to FreeBSD
Use mdmfs/mdconfig instead of vndconfig/newfs. vndconfig doesn't exist on FreeBSD.

TODO: need to parameterize out the md(4) device as it's currently hardcoded to "3"
(in both the FreeBSD and NetBSD cases).

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2016-09-20 16:40:15 +00:00
Enji Cooper
534501a247 Port to mknod_test and readdir_test to FreeBSD
The `mknod <file> p` command doesn't exist on FreeBSD, like on NetBSD. Use
mkfifo instead to create named pipes (FIFOs).

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2016-09-20 16:37:02 +00:00
Enji Cooper
548f948a56 Port sizes_test and statvfs_test to FreeBSD
Similar to r306030, use a simpler method for getting the value of
`hw.pagesize`, i.e. `sysctl -n hw.pagesize`. The awk filtering method doesn't
work on FreeBSD

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2016-09-20 16:31:57 +00:00
Enji Cooper
61e13648e7 Port contrib/netbsd-tests/fs/h_funcs.subr to FreeBSD
Use kldstat -m to determine whether or not a filesystem is loaded. This works
well with tmpfs, ufs, and zfs

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2016-09-20 16:28:57 +00:00
Enji Cooper
d3de062383 Port vnode_leak_test:main to FreeBSD
Use a simpler way of dumping kern.maxvnodes, i.e. `sysctl -n kern.maxvnodes`

The awk filtering method employed in NetBSD doesn't work on FreeBSD

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2016-09-20 16:27:34 +00:00
Enji Cooper
97bb4528d9 Remove expected failure for :basic (effectively reverting r305007, r305031)
This no longer fails as of r305952

PR:		212193
Sponsored by:	Dell EMC Isilon
2016-09-19 06:39:08 +00:00
Enji Cooper
3d1eb084e9 Fix tests/sys/kqueue NetBSD tests on 32-bit platforms by using proper
format specifier for pointers when printing them out with printf(3)

MFC after:	57 days
Pointyhat to:	ngie
Reported by:	bz, cy, Jenkins (i386 job)
Submitted by:	cy
Sponsored by:	EMC / Isilon Storage Division
2016-09-06 17:22:25 +00:00
Enji Cooper
8f2b5a5469 Port contrib/netbsd-tests/kernel/kqueue/... as tests/sys/kqueue/...
proc2_test must be skipped because the invariant tested
(`ke.fflags & NOTE_TRACKERR`) doesn't pass.

MFC after:	58 days
Submitted by:	kib (earlier form)
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D6172
2016-09-06 08:50:21 +00:00
Enji Cooper
7be8de4271 Fix lib/libc/rpc test assumptions added in r305358
- Require root in the tcp/udp subtests (it's needed on FreeBSD when
  registering services).
- Skip the tests if service registration fails.

MFC after:	59 days
X-MFC with:	r305358
Reported by:	Jenkins, rodrigc
Sponsored by:	EMC / Isilon Storage Division
2016-09-06 01:07:12 +00:00
Enji Cooper
3560641a48 Don't dedupe signals less than SIGRTMIN
FreeBSD always delivers all signals sent with sigqueue, except when
dealing with low memory conditions according to kib (see
bug # 212173 comment # 5).

In collaboration with:	kib
PR:	212173
Sponsored by:	EMC / Isilon Storage Division
2016-09-03 00:47:54 +00:00
Enji Cooper
10f26e7d81 Don't expect :fmod to fail on FreeBSD
Sponsored by:	EMC / Isilon Storage Division
2016-09-02 06:55:32 +00:00
Enji Cooper
9c73efe89c Fix typo
atf_tc_expect_fail should have been atf_expect_fail per atf-sh-api(3)

PR:		212193
Pointyhat to:	ngie
Sponsored by:	EMC / Isilon Storage Division
2016-08-29 22:34:31 +00:00
Enji Cooper
2f52412dee MFhead @ r305013 2016-08-29 18:53:36 +00:00
Enji Cooper
b5864e6de2 Expect :basic to fail due to recent output changes in dirname(3)
The dirname output change bug is actively being worked on, and this
commit will need to be reverted once it's fixed.

MFC after:	never
PR:		212193
Sponsored by:	EMC / Isilon Storage Division
2016-08-29 17:50:36 +00:00
Enji Cooper
6e122b9610 Add copious debugging to aid in determining why :sigqueue_rt is currently failing
For some odd reason SIGINT is only being delivered once, as opposed to multiple
times.

Disclaimer: this test was run on a kernel built on 08/14/2016. Need to build a
new kernel and rerun the test.
2016-08-26 04:31:19 +00:00
Enji Cooper
aaf3e744fd Detect virtual machines on FreeBSD using the kern.vm_guest sysctl
kern.vm_guest == none -> not a virtual machine

It's a bit of a misnomer with the function being named `isQEMU`... but FreeBSD's
support seems to be a bit more all-encompassing than NetBSD's is today.

Sponsored by: EMC / Isilon Storage Division
2016-08-26 03:46:43 +00:00
Enji Cooper
1ffd722a80 Don't test size[i] % align[i] == 0 case on FreeBSD
Per jemalloc(3)/aligned_alloc(3), the behavior is undefined if the size
isn't an integral multiple of the alignment. Thus, this is a NetBSD-specific
test.

Sponsored by: EMC / Isilon Storage Division
2016-08-25 19:17:16 +00:00