Commit Graph

3637 Commits

Author SHA1 Message Date
roy d96ab75caf Handle ENOBUFS when receiving messages.
Don't send messages if the receiver has died.
2018-03-21 12:37:12 +00:00
kamil ce34db38fd Add new ATF tests: kernel/t_zombie
New tests attempting to kill, stop, drop or revive a zombie:
 - signal1 (SIGKILL)
 - signal2 (SIGSTOP)
 - signal3 (SIGABRT)
 - signal4 (SIGHUP)
 - signal5 (SIGCONT)

New test race1 verifying whether there are any kernel races when processing
signals to zombies, executing in a loop for 5 seconds.

These tests were inspired by a kernel unexpected behavior when a lookup
of a dying process could result in two detected entities once as an alive
process and once as a zombie.

race1 is similar to t_ptrace_wait* race1, however without ptrace(2) involved.

Sponsored by <The NetBSD Foundation>
2018-03-14 02:13:47 +00:00
kamil a9dda15d6e ATF: Add new test race1 in t_ptrace_wait*
Reuse the attach1's test body for race1.

Add a new test race1:
  Assert that await_zombie() in attach1 always finds a single
  process and no other error is reported

race1 requires HAVE_PID in wait(2)-like function.

This test is executed in a loop for 5 seconds (16k iterations on Intel i7).
A buggy kernel was asserting an error within this timeframe almost always.

The bug in the kernel is now gone and this test is expected to pass
correctly.

Sponsored by <The NetBSD Foundation>
2018-03-13 14:54:13 +00:00
kamil c6513ba7ad ATF t_ptrace_wait*: Disable debug messages in msg.h
msg.h is a dummy IPC interface.

Disable additional debugging logging here, especially wanted in race*
tests.

Sponsored by <The NetBSD Foundation>
2018-03-13 14:45:36 +00:00
kamil 8fa6ff479d Add a new function in ATF t_ptrace_wait*: await_zombie_raw()
Add await_zombie_raw() that is the same as await_zombie(), whith an
addition of additional "useconds_t ms" parameter indicating delays between
new polling for a zombie process.

This new function will be used for testing a race condition that has been
observed occassionally crashing a test case -- returning duplicate entries
for KERN_PROC_PID.

Sponsored by <The NetBSD Foundation>
2018-03-13 13:34:40 +00:00
knakahara a0d17a179a Enhance assertion ipsecif(4) ATF to avoid confusing setkey(8) error message.
When setkey(8) says "syntax error at [-E]", it must mean get_if_ipsec_unique()
failed.
2018-03-13 03:50:26 +00:00
joerg aa18a61198 Stub out on platforms without ifunc support in the linker. 2018-03-11 21:20:22 +00:00
joerg a64ef2fb9e Add ifunc support for statically linked applications on x86, ppc, sparc
and ARM.
2018-03-09 20:20:47 +00:00
joerg d3d2a5f92e Avoid casting fun by switching ifunc helper functions to return
long long. Dead beef is too useful to switch to a different constant.
2018-03-09 20:15:03 +00:00
kamil f25eee2811 ATF: Reenable attach2 in t_ptrace_wait*
The primary race specific to this test has been fixed in previous commit
(wrong WNOHANG).

This test is still racy and breaks like once every 30,000 execution.
This is down like from once from every 100th execution in the past.

The remaning race is not specific to attach2 and I can reproduce it with
at least attach1. It still looks like being specific to NetBSD and it's
not reproducible on Linux and FreeBSD. Perhaps a bug with pipe(2)/write(2)/
read(2) or close to these features.

Sponsored by <The NetBSD Foundation>
2018-03-07 16:40:06 +00:00
kamil 42ffdafce3 ATF: Correct a race bug in attach2 (t_ptrace_wait*)
At the end of the test we resume a tracer and expect to observe it to
collect the debuggee. We cannot from a parent point of view wait for
collecting it with WNOHANG without a race.

Remove the WNOHANG option from wait*(2) call. This corrects one type of
race.

This test is still racy for some other and unknown reason and this is being
investigated.

Sponsored by <The NetBSD Foundation>
2018-03-07 10:53:55 +00:00
ozaki-r d0486ec90d Tweak tests; increase the size of NS packets for the addition of a nonce 2018-03-07 02:30:37 +00:00
ozaki-r 6963349e89 Provide more informative reports on failures 2018-03-07 02:30:00 +00:00
kamil aad35b0998 Correct all ATF failures in t_ptrace_x86_wait.h (debug registers)
This code after refactoring stopped calling functions that were designed
to trigger expected behavior and thus, tests were breaking.

Sponsored by <The NetBSD Foundation>
2018-03-06 21:11:51 +00:00
kamil 570f001093 Remove PT_GET_SIGMASK / PT_SET_SIGMASK
These operations cloned Linux's specific PTRACE_GETSIGMASK / PTRACE_SETSIGMASK.
This feature was useful in applications like rr/criu/reptyr-like, where
the ptrace(2) interface is abused for the purpose of constructing an arbitrary
process. It's not reliable and not portable. For the NetBSD case it will be
better to invent something dedicated for serializing and deserializing a
process with threads.

Noted on tech-toolchain@ and blog entry

"LLDB restoration and return to ptrace(2)"
https://blog.netbsd.org/tnf/entry/lldb_restoration_and_return_to
2018-03-05 11:24:34 +00:00
uwe cd711bd2b9 Simplify - it's enough to set nctx.uc_link to &octx to restore old
context automatically when swapfunc() returns.
2018-02-28 21:36:50 +00:00
uwe 5eea33881e Add missing $ in the RCSID. 2018-02-28 21:29:10 +00:00
uwe da83da02db threadfunc - we do return from swapcontext() (since revision 1.2),
so drop the NOTREACHED comment.
2018-02-27 20:34:04 +00:00
uwe 02b9aeb870 swapfunc() is not passed to pthread_create, there's no need for it to
have any arguments.
2018-02-27 20:31:35 +00:00
uwe 738b2ab23a Drop unnecessary cast to makecontext() argument. 2018-02-27 20:24:50 +00:00
uwe 79bd7f2c4b Cleanup trailing whitespace. 2018-02-27 20:22:31 +00:00
kamil 5198f250f5 Include <inttypes.h> in t_ucontext.c
The <inttypes.h> user-land header is required for PRI types.
We were including indirectly <sys/inttypes.h> through <sys/*.h> sources,
and this worked for most of the ports.

This fixes indirectly a build for MIPS (tested ports: arc and hpcmips),
where PRI types (PRIxREGISTER) were undefined.

Noted by <uwe>.
2018-02-27 12:20:35 +00:00
kamil c3018cf20c Make the t_ucontext.c test more portable
Cast _UC_MACHINE_*(&u) to (register_t).
This allows to print the returned values with PRIxREGISTER.

This corrects build failures on MIPS and HPPA.
sizeof(int) == sizeof(long) on these 32-bit systems.
2018-02-27 11:15:53 +00:00
christos 6f17b07f09 fix spello 2018-02-25 15:31:07 +00:00
kamil 16ed291475 Add new tests in lib/libc/sys/t_ucontext
New tests:
 - ucontext_sp
 - ucontext_fp
 - ucontext_pc
 - ucontext_intrv

They test respectively:
 - _UC_MACHINE_SP
 - _UC_MACHINE_FP
 - _UC_MACHINE_PC
 - _UC_MACHINE_INTRV

These tests attempt to access and print the values from ucontext, without
interpreting the values.

This is a follow up of the _UC_MACHINE_FP() introduction.

These tests use PRIxREGISTER, and require to be built with -D_KERNTYPES.

Sponsored by <The NetBSD Foundation>
2018-02-25 14:27:07 +00:00
martin 3cbaed46a2 PR lib/53044: remove tests not provided by OpenSSL 1.1.x 2018-02-22 14:24:03 +00:00
christos 0f242fe63e make it compile again for those who don't have LOCAL_PEERCRED 2018-02-17 20:16:18 +00:00
christos 1d89963535 Add a test demonstrating thst LOCAL_PEEREID is busted. 2018-02-17 16:34:18 +00:00
christos bf0b06cfe9 remove clause 3, 4. 2018-02-17 00:28:47 +00:00
christos 98cc4b91d3 Use the same variable name for the accepted socket as with the AF_LOCAL test.
Call getpeereid on the accepted socket.
2018-02-16 22:20:18 +00:00
christos c587e5a36a make sure we call getpeername on the accepted socket! 2018-02-16 22:17:17 +00:00
christos 596e712e68 ensure that getpeereid does not succeed on tcp sockets. 2018-02-16 19:24:16 +00:00
christos e34e5e3adb explain what's going on before we fix it. 2018-02-16 16:30:20 +00:00
christos 474def7698 add getpeereid tests for non-unix sockets, returns garbage... 2018-02-16 16:23:15 +00:00
christos c88e952be5 add a getpeeeid test. 2018-02-16 16:08:22 +00:00
ozaki-r def6ba19bd Fix ping_opts_gateway and ping_opts_recordroute
We need to enable the options of source routing on all rump kernels.
2018-02-09 03:53:07 +00:00
christos c885e6eac2 put .PATH after the variable is defined. 2018-02-09 03:20:21 +00:00
christos 531428e66d fix 1.0 build; thanks ODE make. 2018-02-08 23:52:26 +00:00
christos 60b220f792 include the right test directory for the right openssl version 2018-02-08 23:41:26 +00:00
christos e1f413f949 adjust tests for 1.1 2018-02-08 21:59:10 +00:00
maxv f1624eef2e Now that we don't allow source-routed packets by default, set allowsrcrt=1
and forwsrcrt=1. Should fix the ATF failure.
2018-02-08 09:56:19 +00:00
dholland 32cded6cc9 Typos. 2018-02-08 09:05:16 +00:00
christos 853c815d40 md2 has been deprecated in OpenSSL-1.1 2018-02-07 13:18:33 +00:00
pgoyette 96bdb2f1f0 * Use 'struct testmsg' rather than 'struct mymsg' (avoids a conflict
with FreeBSD)
* Fix a broken call to open(2) with O_CREAT and no permission argument.
* ANSIfy function definitions.
* Improve failure messages.

From freebsd.org via Brooks Davis - Thanks!
2018-02-03 02:57:15 +00:00
ozaki-r 95dd9007db Commonalize and add tests of creating/destroying interfaces 2018-02-01 05:22:01 +00:00
mrg f2b04ca083 implement 32-bit compat support for raidframe.
convert several raidframe ioctls to be bitsize idempotent so that
they work the same in 32 and 64 bit worlds, allowing netbsd32 to
configure and query raid properly.  remove useless 'row' in a few
places.  add COMPAT_80 and put the old ioctls there.

raidframeio.h:
  RAIDFRAME_TEST_ACC
  - remove, unused
  RAIDFRAME_GET_COMPONENT_LABEL
  - convert to label not pointer to label
  RAIDFRAME_CHECK_RECON_STATUS_EXT
  RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT
  RAIDFRAME_CHECK_COPYBACK_STATUS_EXT
  - convert to progress info not pointer to info
  RAIDFRAME_GET_INFO
  - version entirely.
raidframevar.h:
  - rf_recon_req{} has row, flags and raidPtr removed (they're
    not a useful part of this interface.)
  - RF_Config_s{} and RF_DeviceConfig_s{} have numRow/rows removed.
  - RF_RaidDisk_s{} is re-ordered slightly to fix alignment
    padding - the actual data was already OK.
  - InstallSpareTable() loses row argument

rf_compat32.c has code for RF_Config_s{} in 32 bit mode, used
by RAIDFRAME_CONFIGURE and RAIDFRAME_GET_INFO32.

rf_compat80.c has code for rf_recon_req{}, RF_RaidDisk_s{} and
RF_DeviceConfig_s{} to handle RAIDFRAME_FAIL_DISK,
RAIDFRAME_GET_COMPONENT_LABEL, RAIDFRAME_CHECK_RECON_STATUS_EXT,
RAIDFRAME_CHECK_PARITYREWRITE_STATUS_EXT,
RAIDFRAME_CHECK_COPYBACK_STATUS_EXT, RAIDFRAME_GET_INFO.

move several of the per-ioctl code blocks into separate functions.

add rf_recon_req_internal{} to replace old usage of global
rf_recon_req{} that had unused void * in the structure, ruining
it's 32/64 bit ABI.

add missing case for RAIDFRAME_GET_INFO50.

adjust raid tests to use the new .conf format, and add a case to
test the old method as well.

raidctl:
deal with lack of 'row' members in a couple of places.
fail request no longer takes row.
handle "START array" sections with just "numCol numSpare", ie
no "numRow" specified.  for now, generate old-style configuration
but update raidctl.8 to specify the new style (keeping reference
to the old style.)

note that: RF_ComponentLabel_s::{row,num_rows} and
RF_SingleComponent_s::row are obsolete but not removed yet.
2018-01-18 00:32:48 +00:00
maya b42dccbff0 Use sysctl -n rather than parse the output.
From Ngie Cooper in PR bin/51870
2018-01-17 00:23:17 +00:00
maya 687000d215 - Add inttypes.h #include for PR* macros.
- close fd when done to prevent leak.
- use correct socket length when calling bind(2).

From Ngie Cooper in PR bin/51870
2018-01-17 00:22:29 +00:00
maya bcc7b2aa78 Improve portability of headers and sort them.
From Ngie Cooper in PR bin/51833
2018-01-17 00:16:43 +00:00
martin 87d689fb73 Sync sparc with sparc64 2018-01-14 19:59:51 +00:00
ozaki-r 11f91074e6 Change the prefix of test names to ipsecif_ to distinguish from tests for ipsec(4) 2018-01-11 07:58:22 +00:00
knakahara b8f54fc79b add ipsec(4) interface ATF. 2018-01-10 11:06:06 +00:00
martin cea0645f8c Add EVFILT_FS 2018-01-09 17:35:29 +00:00
martin ddaa1d089b Skip the test on non-modular kernels 2018-01-09 15:16:02 +00:00
martin edea8a3220 PR 52864: add a test for this bug, from sevan@ 2018-01-08 14:17:15 +00:00
maya f076331dd4 Build less of the test code if there's no linker ifunc support.
r1.6 changed the code in such a way that it was hitting a BFD assert on
MIPS, causing the builds to fail.

we were hitting the assert at binutils/dist/bfd/elfxx-mips.c:10879
2018-01-01 06:34:13 +00:00
gson ea958a7e2f Use the default ATF timeout instead of a reduced one of 5 seconds,
which isn't enough for pmax under gxemul on babylon5.netbsd.org.
2017-12-30 22:02:34 +00:00
martin 35cce3cf1f Double the nanosleep() time to make the test work more reliably on my
dual CPU alpha (where previously we sometimes ended up with no delay
at all).
2017-12-30 17:06:27 +00:00
martin d2225bb82b Skip all tests on architectures w/o ifunc linker/ld.elf_so support. 2017-12-30 16:53:34 +00:00
martin 30d82e28be Implement helper function for alpha 2017-12-30 16:35:03 +00:00
christos 8008d9c3e9 mips panic should be fixed on head. 2017-12-28 18:41:33 +00:00
kamil 994e8d0d72 atf: ptrace: Temporarily skip fpregs* tests on pmax
NetBSD/pmax 8.99.9 panics when attempting to use fpregs through ptrace(2).

Sponsored by <The NetBSD Foundation>
2017-12-28 09:47:52 +00:00
ozaki-r bd91015475 Fix build 2017-12-28 07:46:34 +00:00
ozaki-r 61673e6ea4 Add a test case for workqueue_wait 2017-12-28 07:10:25 +00:00
ozaki-r bfde781fbe Functionalize some routines to add new tests easily (NFC) 2017-12-28 07:09:31 +00:00
ozaki-r bf33e35aca Fix a race condition on taking the mutex
The workqueue worker can take the mutex before the tester tries to take it after
calling workqueue_enqueue. If it happens, the worker calls cv_broadcast before
the tester calls cv_timedwait and the tester will wait until the cv timed out

Take the mutex before calling workqueue_enqueue so that the tester surely calls
cv_timedwait before the worker calls cv_broadcast.

The fix stabilizes the test, t_workqueue/workqueue1.
2017-12-28 04:38:02 +00:00
ozaki-r 1315c7eeb1 Tweak use of cv_timedwait
- Handle its return value
- Specify more appropriate time-out periods (2 ticks is too short)
2017-12-28 04:36:15 +00:00
kamil 0c4b31088a atf: ptrace: Temporarily disable signal3 as it breaks now on some ports
This test is marked as failing with: PR kern/51918.
2017-12-27 13:38:51 +00:00
kamil 7db1f47f48 atf: t_ptrace_wait: Mark attach2 as racy 2017-12-25 12:38:01 +00:00
christos 57ab0cb5b9 fix priority tests for SCHED_OTHER 2017-12-24 17:37:23 +00:00
christos 17ceb61284 report which errno failed 2017-12-23 22:07:57 +00:00
kamil 8bb892187e ptrace atf: Clanup reports of failures
Mark resume* suspend* tests as expected failure and link with PR 51995.

Sponsored by <The NetBSD Foundation>
2017-12-22 17:35:14 +00:00
kamil 1432f3fc87 t_ptrace_wait*: Disable suspend* tests
These tests can hang the system. These interfaces will be improved and
temporarily disable them.
2017-12-21 09:56:47 +00:00
christos 1abf1d7802 Fix broken test: we can't assume that the current schedule priority range
will overlap with the requested scheduler range, so get the new scheduler
range, and then try to find a different priority. If that fails (to find
a different scheduling range), give up here.
2017-12-21 03:31:43 +00:00
christos 3a05faa2d8 make it fail instead of hang under qemu; XXX: need to investigate. 2017-12-18 19:20:40 +00:00
christos a0fb54ab67 Don't use SCHED_OTHER. 2017-12-18 13:18:23 +00:00
ozaki-r 0602b7c074 Adjust outputs of route's flags to include a numeric output 2017-12-18 04:11:46 +00:00
christos 1cbfcb1c83 Add expected failures. 2017-12-16 14:45:25 +00:00
christos 3bbd410a66 sync a bit more with reality; some things still fail, some new failures.
reduce spewage, be more explanatory about syscall errors.
2017-12-14 22:06:54 +00:00
nakayama 036e3ece76 Use SCRIPTS instead of PROGS to avoid strip(1) if STRIPFLAG=-s. 2017-12-14 14:38:17 +00:00
rin d4c8f2d859 Revert rev 1.4: fmtcheck(3) neglect unused trailing arguments as before.
"%d" is a valid format string with default format string "%d %s", etc.
2017-12-13 06:47:04 +00:00
christos 3fd3ffc3a1 PR/52812: scole_mail: src/tests/kernel/t_timeleft.c doesn't compile with MKRUMP=no
It needs libpthread regardless MKRUMP..
2017-12-12 18:19:45 +00:00
ryo c2f85cb6e9 As is the case with IPV6_PKTINFO, IP_PKTINFO can be sent without EADDRINUSE
even if the UDP address:port in use is specified.
2017-12-11 05:47:18 +00:00
bouyer 878cb1cfc5 Fix fallout from hid factorisation:
- need to install sys/dev/hid/hid.h for userland
- include it where needed - most of the time in place if usb/usbhid.h
2017-12-10 20:38:13 +00:00
christos f765c47147 Add tests to make sure that the program name is what it is supposed to be. 2017-12-10 15:37:54 +00:00
christos af7e02e58a Remove expected failure (fixed in kern_sig.c 1.339) 2017-12-10 14:09:42 +00:00
christos 0b33a75d8f fix usage. 2017-12-08 14:40:45 +00:00
christos 85bf85b701 make _lwp_park return the remaining time to sleep in the "ts" argument
if it is a relative timestamp, as discussed in tech-kern.
XXX: pullup-8
2017-12-08 01:19:29 +00:00
kre 20fdaa6a50 Update this test to expect the output that is supposed to be produced
by strfmon() rather than the output the old buggy implementation used
to produce.
2017-12-07 22:23:14 +00:00
christos 962d0d23f1 Add trapsignal tests that make sure that traps don't end up spinning
indefinitely, discussed in tech-kern.
2017-12-07 19:46:40 +00:00
kre 38400c3efe Correct a couple of broken test cases:
"%d"  does not take the same args as "%d %s"
	"%%"  does not take the same args as "%llx"
How did these ever survive any kind of even basic sanity check?
2017-12-07 09:37:33 +00:00
christos f2c3026d0a add a test to check that the interpreter is preserved when executing scripts. 2017-12-06 13:54:26 +00:00
kamil 7a515d1c37 Temporarily disable t_ptrace_wait*::resume1 in ATF tests
It hangs forever on releng machines.

Sponsored by <The NetBSD Foundation>
2017-12-04 12:53:46 +00:00
kre e55c81dc8f Since there has been no objection (or even comment) in response
to my message on tech-userlevel ...

    Subject: tests/lib/libpthread/t_mutex:mutex6
    Date: Thu, 23 Nov 2017 17:34:54 +0700
    Message-ID: <28385.1511433294@andromeda.noi.kre.to>

which can be found at:
	http://mail-index.netbsd.org/tech-userlevel/2017/11/23/msg011010.html

which analysed the mutex6 test case of this test, and concluded
that it was useless, nonsense, and broken (the whole test is just a
race - not even really using or testing mutexes), let it be henceforth
forever gone.
2017-12-01 13:25:29 +00:00
kre 3772e94e67 Since the C standard allows for intermediate floating results to contain
more precision bits than the data type expects, but (kind of obviously)
does not allow such values to be stored in memory, expecting the value
returned from strtod() (an intermediate result) to be identical (that is,
equal) to a stored value is incorrect.

So instead go back to checking that the two numbers are very very close.
See comments added to the test for more explanation.
2017-12-01 01:08:35 +00:00
kre 52a978120f Revert 1.4 (perhaps temporarily) and add even more diagnostics to those
added in 1.3 to see if it is possible to determine why the strict equality
test fails on i386, yet succeeds elsewhere.
2017-11-28 23:26:01 +00:00
kre 9fefbad1a9 Make this test somewhat deterministic - far fewer races, and most
of what are left are "race for the bus" type - if we lose, we just
wait for the next one ... slower but still reliable.

There are two exceptions ... when starting more than one rtadvd
(on different routers) we expect to receive an RA from each, but
all that we can check is that we received the (at least) right number
of RAs.  It is possible (though unlikely) that one router sent two
before another sent any, in which case we will not have the data we
expect, and a sub-test will fail.

Second, there is no way to know for sure that we have waited long
enough when we're waiting for data to expire - in systems with
correctly working clocks that actually measure time, this should not
be an issue, if data is due to expire in < 5 seconds, and we wait
5 seconds, and the data is still there, then that indicates a
failure, which should be detected.   Unfortunately with QEMU testing
time just isn't that reliable.  But fortunately, it is generally the
sleep which takes longer, while other timers run correctly, which is
the way that makes us happy...

While here lots of cleanups - everything from white space and
line wrapping, to removing superfluous quotes and adding some
(but probably not enough) that are not (though given the data is
all known here, lack of quotes will rarely hurt.)

Also take note of the fact that current rtadvd *cannot* delete its
pidfile, so waiting for that file to be removed is doomed to failure.
Do things in a way that works, rather than simply resorting to assassination.

Because we do a lot less "sleep and hope it is long enough" and more
"wait until it is observed to happen" the tests generally run in less
elapsed time than before (20% less has been observed.)  But because we
"wait until it is observed to happen" rather than just "sleep and hope
it is long enough" sometimes things take longer (and when that happens,
we no longer fail).  Up to 7% slower (overall) has been observed.
(Observations on an amd64 DomU, no idea yet as to what QEMU might observe.)
2017-11-25 07:58:47 +00:00
kre fa3a535c5c When comparing doubles (any floating point values) which have been
computed using different methods, don't expect to achieve identical
results (here, one constant is perhaps converted to binary from a string by
a cross compiler, the other is converted at run time).   Allow them to
have a small difference (for now, small is < 1e-7 - the constant is ~ 1e5,
so this is 12 orders of magnitude less) before failing (and include the
actual difference in the error message if it does fail.)
2017-11-24 21:30:43 +00:00
kre ec8433427a Fix the ndp_rtm test the same way the arp_rtm test was fixed:
1. get pid of bg process with $! not $?
2. expect a single message from route monitor, not two, after ndp -d
3. run atf_check just once to verify correct output, not once for each string
2017-11-24 03:38:32 +00:00
kre 91d7a90044 Cosmetic changes, NFC intended.
1. get rid of the "$*" fetish.
2. more consistency (not complete .. yet) with RUMP_SERVER setting
3. white space (esp around pipe ('|') symbols.)
4. drop unnecessary \ line joining.
2017-11-24 03:28:49 +00:00
kre b19b969600 Add some diagnostics to the strto test, so I can see why this
fails on i386 (on qemu) - will probably keep them when done.
2017-11-23 23:47:09 +00:00
kre af284e4305 Clean up the arp_rtm subtest...
1. Be assertive when claiming the pid of the background route monitor command,
   not polite...  (ie: $! will give you the pid, $? is just 0 there).
2. Since "wait 0" simply (always) exits with status 127, immediately (we
   know without thinking that we have no child with pid 0) the waits were
   ineffective - now (after fix #1) they work .. which requires the
   route monitor that watches the arp -d to exit after 1 message, not 2,
   as 1 is all it gets.   (If there really should be 2, someone needs to
   find out why the kernel is sending only 1 - I am not that someone).
3. The file contents need to be read only once, no matter how many patterns
   we need to look for, save some work, and do it that way (this is not
   really a bug,m but saving time for the ATF tests is always a good thing.)

Not sure if this will stop it randomly failing on bablyon5, but it might.
(The likely cause is that the "route.monitor" has not flushed its stdout
buffers at the time the "grep -A 3"  [aside: why that way to read the file??]
is performed, so fails to find its expected output ... the route monitor would
get an extra message once interfaces start being destroyed, I assume, and
would exit then, flushing its buffer, but by then it is too late.
If that is/was the cause, then it should be fixed now.)
2017-11-23 06:22:12 +00:00
kre 995ebd076a Since there was already a test to verify that vlan tag 4096 is
detected as invalid, become the "someone" referred to in the
previous commit log, and add tests for 0 and 4095 as well, and
while here, throw in a few more that might elicit bugs.

And if the shell running the tests is able, add tests of a few
random vlan tags between 2 and 4093 (1 and 4094 are always tested)
to check that anything in range works (well, partially check...)
2017-11-23 04:59:49 +00:00
kre 9327d63f48 Don't attempt to test vlan tags 0 or 4095, which are now rejected
as invalid (perhaps someone could add a test to verify that they
continue to be rejected?)
2017-11-23 04:12:36 +00:00
kre 1cec45a93f PR lib/52007
Move libevent from being a test playing sub-directory, to a groupy,
just hanging around, hoping someone will notice it, and throw it
a bone...  (mixed metaphors?)
2017-11-23 02:40:01 +00:00
martin c567f1919d ATF test program for PR kern/52738: check for mtime updates after rewriting
a file.
2017-11-19 21:05:26 +00:00
martin 7886ea7b21 PR kern/52167 strikes on sparc64 too. 2017-11-18 17:00:00 +00:00
kre a60600e0af Add a test case for "set -X".
Currently (or when testing any shell that does not support -X) the
test will be skipped (also for [m]ksh (but not ksh93 etc) where there
is an absurdly badly named -X option, skip the new test for them as well.)

When -X appears in /bin/sh, this will verify that it is probably working
(the test is MUCH more gruelling than any rational use of -X would be.)
2017-11-16 19:41:41 +00:00
msaitoh a799b2bceb Add test case of vlan(4)'s re-configure without destroy
(see also if_vlan.c rev. 1.104). Written by s-yamaguchi@iij.
2017-11-16 06:31:00 +00:00
ozaki-r 6676be48c1 Dedup some checks
And the change a bit optimizes checks of SA expirations, which
may shorten testing time.
2017-11-09 04:51:07 +00:00
ozaki-r eb73cc98c0 "Mark key_timehandler_ch callout as MP-safe" change needs one more sec to make lifetime tests stable 2017-11-09 04:50:37 +00:00
ozaki-r 7c8e9ac519 Stop using bpfjit
Because most architectures don't support it and npf still works without it.
2017-11-07 09:17:06 +00:00
ozaki-r a048c07157 Let rtadvd not use syslog for logging
Thanks to christos@ now rtadvd can log via stderr instead of syslog
by -D option.

Address PR bin/52701
2017-11-07 02:19:23 +00:00
kre 4559590210 In the fopen_regular and fopen_symlink tests, when (that is, if) a
failure occurs, distinguish in the failure message the cases where the
open succeeded (and should not have), and where it failed, but not for
the expected reason (the "wrong errno" case not tested, would require
manufacturing a broken kernel...).

Add O_NOFOLLOW ('l' mode modifier) tests to the fopen_mode test case
(tests that are intended to open the file) and also add a few missing
commas which were causing a few of the sub-tests to be skipped, and
others to be not quite testing exactly what was intended.
2017-11-06 23:06:55 +00:00
joerg da03f1ef14 init/fini for the main program is handled by crt0.o, so ifunc handling
is skipped right now as it iterates the same list. Don't repeat that
mistake and explicitly take care of it in the dynamic linker.
2017-11-06 21:16:03 +00:00
christos f3898d4d3b add a symlink test 2017-11-06 17:32:53 +00:00
ozaki-r 3339f807e5 Kill rtadvd surely even if the tests fail in the middle
It may help PR bin/52701.
2017-11-06 10:51:40 +00:00
ozaki-r 0de7b04927 Add test cases of NAT-T (transport mode)
A small C program is added to make a special socket (UDP_ENCAP_ESPINUDP)
and keep it to handle UDP-encapsulated ESP packets.
2017-10-30 15:59:23 +00:00
christos 38e7108a2d fix typo 2017-10-28 19:25:31 +00:00
christos 8bf35d4ee1 make tests print the values. 2017-10-28 19:24:55 +00:00
kre 001379fb42 The Zone test was obviously intended to test %Z rather than %z, otherwise
it would be (and has been) identical to the zone test, which would be a
pointless waste of time.
2017-10-27 05:14:11 +00:00
ozaki-r 0d858128c2 Handle esp-udp for NAT-T 2017-10-27 04:31:50 +00:00
kre 934582a916 Remove bogus errno checks, mktime() (and timegm()) does not guarantee
to leave errno unaltered if there is no error.   And does not.

While here, write -1 the same way everyone else does (not ~0, which
would not even be negative on a 1's complement host, if you can find one).

And while not needed for the test, but so that if checked, the result is
more likely to be what is anticipated, set tm_mday to an in-range value
in the mtime_negyear test (otherwise the correction results in the result
movng backwards to the last day of the previous month, which is the
end of Decemper, 1898, rather than the 1899 one would expect from year -1.)
2017-10-27 00:55:27 +00:00
ozaki-r 690df934db Add test cases for one SP with multiple SAs
These are for a bug reported recently which modifies SPs accidentally.
2017-10-20 03:45:47 +00:00
ozaki-r d031869d08 Suppress name resolution 2017-10-20 03:45:02 +00:00
ozaki-r 101922ebfc Fix incomplete SP setups 2017-10-20 03:43:51 +00:00
ozaki-r 25af614d05 Show packet counters 2017-10-20 03:42:53 +00:00
ryo 638374d825 add test case for new format 'f' and 'F' 2017-10-14 18:41:44 +00:00
msaitoh e75346fc5c Add a test case for duplicated VLAN ID. 2017-10-11 08:10:53 +00:00
kre 981c4cd0ef Make most of the resize_ffs tests skip if PUFFS is not configured
in the kernel.   (nb: for this purpose, a module that is configured
to autoload counts as configured in the kernel...)
2017-10-08 21:12:27 +00:00
kre 97beabe6b7 Don't bother attempting any of the (real) test cases if the SYSVMSG
option isn't configured in the kernel.
2017-10-08 08:31:05 +00:00
kre 1b3e61a16f Skip the mincore_shmseg test case if the SYSVSHM option is not configured
in the kernel.
2017-10-08 08:29:57 +00:00
kre 6618a9bf1f If we have SYSVMSG in kernel (test finds it) restore the signal handler
to its previous state, so any signals that occur during the rest of the
test gat handled just as they would (core dump) as if the handler was never
executed.   No need to bother if the SYSVMSG test fails, as in that case,
nothing else will be done anyway.
2017-10-07 17:15:44 +00:00
kre 5c624ca98d Add a new sub-test to validate ~ expansions.
Currently testing ~user is too much effort to contemplate (other than
assuming that it works in order to verify that it works...) so only bare ~
is being tested for now.   Maybe someday...

Right now (@ time of commit), this new test is expected to fail, as ~
expansions are horribly badly broken (have been for months, some forms
for much longer) in all but the simplest of uses.   Fix for that coming
very soon.
2017-10-06 17:05:05 +00:00
kre 4ad1e3d9c8 Make this test skip if running on a kernel without the SYSVMSG option.
(Assuming this behaves as intended the other tests which should behave
the same way will get upgrades as well.)
2017-10-06 17:00:28 +00:00
pgoyette a3959c1f67 Update recently-added test to adapt to new signature of LIST_MOVE() 2017-10-02 05:14:29 +00:00
pgoyette d77818a2a5 Add a new minimalistic test for LIST_MOVE to verify that the list's
first entry's prev pointer correctly points to the listhead.

This test will fail until a fix for LIST_MOVE is checked in (soon).
2017-10-02 04:15:56 +00:00
maya da0ec449a1 Add declaration. build fix
sorry, I forgot to commit this file.
2017-09-29 13:19:57 +00:00
maya aef814ffa9 Add simple test for workqueue(9) 2017-09-29 12:42:36 +00:00
maya d9fb11d888 Run both tests (rather than rumptest_threadjoin twice) 2017-09-29 10:22:36 +00:00
ozaki-r 960a3e1e52 Add tests of rtcache invalidation 2017-09-20 09:36:20 +00:00
nakayama e857ec7771 Add test mtree -O with same hash value in directory and leaf. 2017-09-07 04:05:21 +00:00
wiz 2168981001 Fix verb form. 2017-09-03 13:41:19 +00:00
maya d498d301ce Use a global double to stop GCC from optimizing the test away
Better diagnostic messages
More familiar test for 'even number'
2017-09-03 13:29:55 +00:00
kre 5f35bae3a5 Allow the test to build on systems where sys/mman.h does not provide
PROT_MPROTECT(), or if the test is built without _NETBSD_SOURCE defined,
by providing a dummy #define if the real one does not exist.  The test
might then fail, if the PROT_MPROTECT() is really needed, but that's
better than not building.
2017-09-01 16:51:58 +00:00
kre 70238ca755 Use PROT_MPROTECT() (which would have been better had it been called
PROT_MAXPROTECT or PROT_ALLOWPROTECT or something) on the mmap() call
which specifies PROT_NONE, and which we later want to change to PROT_READ,
otherwise when PAX is enabled, the mprotect() will fail.
2017-09-01 16:27:02 +00:00
maya cab44f07e4 Add a short case for the alpha test failure
Now I see it's down to the choice of -mfp-trap-mode (n works, su/sui/u don't)
2017-08-30 22:55:41 +00:00
maya 63a1be2348 use PRIu64 to print uint64_t, don't print sizeof
fixes build. sorry, built tested an older version for 32bit.
2017-08-30 14:24:20 +00:00
maya ba15b3ff94 Add test case for alpha's MPFR config test failure
This assert fires with -mieee, but not without it.
2017-08-30 10:51:06 +00:00
christos 64e9b5d330 add tests for 4->6 connections. 2017-08-28 10:19:57 +00:00
christos dc977faaf4 add v6 tests 2017-08-28 09:30:29 +00:00
ginsbach af29f831e2 PR/49003: Ngie Cooper: add <sys/time.h> 2017-08-25 22:59:47 +00:00
ginsbach 8f3f249e43 The military/nautical time zones were added following RFC 822 and RFC
2822 specifications.  Unfortunately they are specified incorrectly in
RFC-822 and not very clearly in RFC 2822. RFC 1123 clearly states they
are specified incorrectly - counting the wrong way from UTC - in RFC
822.  RFC 2822 just states they were implemented in a non-standard way.
Mea culpa for not noticing when originally implemented.  Fix them so
the correct calculations are made.
2017-08-24 01:01:09 +00:00
christos 50d315db6e Add test from PR/52499 2017-08-23 10:29:51 +00:00
christos c59e7c75da don't skip nexttoward for aarch64 and mips64 2017-08-21 17:11:18 +00:00
kre 5f02c8e934 Make the $'...' syntax tests test what is supposed to work, rather than
what I thought was required (just a couple of changes...).
2017-08-21 00:56:22 +00:00
christos 87415b4d75 fix build (missing nexttoward on mips64 and aarch64) 2017-08-20 08:25:47 +00:00
kre 9985dad5cb Add a few more sub-tests to the $'...' syntax tests.
Remove dome debug noise accidentally left in when the test was first added.
(This still does not matter just yet, but should do soon.)
2017-08-19 21:18:47 +00:00
kre 327a7bf9d0 Add a basic test for $'...' quoting (roughly C ctyle strings).
This test will be skipped on shells (such as /bin/sh in -current as of
the date of this commit) which do not support $'...'

While here fix a typo in a comment (there are probably more...)
2017-08-18 21:22:30 +00:00
he 7a813f9e6a Add test cases for nextafter() and nexttoward(). At the moment no
corner cases are tested, and the test cases are little more than a
verification that the functions are present in the implementation.
2017-08-17 09:14:28 +00:00
joerg 29f5b623d9 Add missing strfmon_l. Noticed by Bruno Haible. Add test case. 2017-08-16 13:53:19 +00:00
joerg 610e531ea3 Add sparc/sparc64 support for irelative relocations. 2017-08-12 09:03:27 +00:00
he 86dc433afa Re-enable the test for nearbyint(), now that all ports (save vax,
which has a separate #if section here) should have nearbyint().
2017-08-11 20:31:58 +00:00
perseant bb20dbc8c8 Separate the C/POSIX locale test from the rest; make it more thorough
and more correct.  This fixes a problem reported by martin@ when the
test is compiled with -funsigned-char.
2017-08-10 19:08:43 +00:00
joerg e78cfb8eb8 Add IRELATIVE support for ARM, X86 and PowerPC. 2017-08-10 19:03:25 +00:00
ryo 1581658c21 Add support IP_PKTINFO for sendmsg(2).
The source address or output interface can be specified by adding IP_PKTINFO
to the control part of the message on a SOCK_DGRAM or SOCK_RAW socket.

Reviewed by ozaki-r@ and christos@. thanks.
2017-08-10 04:31:58 +00:00
knakahara 5e20be26d9 Add counter check to vlan(4) ATF. Implemented by s-yamaguchi@IIJ, thanks. 2017-08-09 06:19:56 +00:00
ozaki-r 708290e277 Fix setkey -D -P outputs
The outputs were tweaked (by me), but I forgot updating libipsec
in my local ATF environment...
2017-08-08 02:27:03 +00:00
ozaki-r 3f30ca4e9f Clean up clunky eval strings
- Remove unnecessary \ at EOL
  - This allows to omit ; too
- Remove unnecessary quotes for arguments of atf_set
- Don't expand $DEBUG in eval
  - We expect it's expanded on execution

Suggested by kre@
2017-08-03 03:16:26 +00:00
ozaki-r 5084329750 Add test cases that there are SPs but no relevant SAs 2017-08-02 06:30:00 +00:00
ozaki-r 548d2e187c Add test cases for setsockopt(IP_IPSEC_POLICY) 2017-08-02 02:19:56 +00:00
kre 21aab71556 PR bin/48498 PR bin/52426
Add two new sh syntax test cases to check for bug fixes for the parser
problems (syntax errors unidentified) reported in the two PRs.

In the latter case, also include some tests that test similar
looking, valid, syntax - to make sure the fix for the PR does not
break code that should not fail.  This is not needed for the earlier
PR as other tests, and just normal parsing, is sufficient.

These tests have been verified to fail with a current /bin/sh and to
pass with the sh updates that are to be committed soon -- and because that
fix is expected within hours, the tests are not marked as expected to
fail, just let them actually fail for now.
2017-07-26 17:50:20 +00:00
kre 79eedfcd84 Do the previous test a better way - for a file, test is generally
adequate, but for a device, we really need to actually try opening
it to determine that it is possible - so do the test that way, then
if the open succeeds once, assume it will the second time (which then
holds it open.)
2017-07-25 22:28:22 +00:00
uwe 9b1c19fc0a Revert previous as it breaks at least sparc and hpcsh builds.
nearbyint() is not included in libm on all platforms.
2017-07-25 21:26:56 +00:00
kre ddab1f6e3b Correct oversight in previous ... redirecting into a compound statement
causes the shell to exit if the redirect fails (posix says "may exit"
and /bin/sh does - maybe should give that more thought) - which will
happen if /dev/pad0 does not exist, causing a very messy test abort
(the shell running the test is not supposed to just go away).  So
check tha the device exista and is readable before attempting to open it.

Problem brought to my attention by nat@ - thanks...
2017-07-25 21:25:03 +00:00
he 6fb4c3a397 Add a test checking nearbyint(), using the same table as used by
the existing lrint() test.
2017-07-24 18:14:46 +00:00
he 4624b40e19 Swap around the two last args to the check for expected fegetround(),
so the error message makes sense.
2017-07-24 18:13:36 +00:00
ozaki-r b0de75e145 Skip ipsec_spi_*_*_preferred_new_timeout when running on qemu
Probably due to PR 43997
2017-07-24 02:07:43 +00:00
perseant 508bf0d1f1 Add missing files from last commit:
Move Unicode <-> ku/ten mapping into the individual codec modules.
Mapping is based on existing iconv data for single-byte encodings,
and included for several, but not all, multibyte encodings.
2017-07-23 18:51:21 +00:00
joerg df826237c7 Avoid a race condition between dlclose and thread termination. 2017-07-21 16:39:20 +00:00
ozaki-r 6ff108ffbe Stop setting isr->sav on looking up sav in key_checkrequest 2017-07-21 04:43:42 +00:00
uwe 0188ee35ae Don't execute random garbage. Fixes mprotect_mremap_exec test. 2017-07-20 01:13:47 +00:00
ozaki-r a9fb96bdfe Don't make SAs expired on tests that delete SAs explicitly 2017-07-20 01:10:57 +00:00
ozaki-r 38d6ad3a8b Add tests that explicitly delete SAs instead of waiting for expirations 2017-07-19 02:06:47 +00:00
ozaki-r 80503e641a Make tests more stable
sleep command seems to wait longer than expected on anita so
use polling to wait for a state change.
2017-07-19 02:06:11 +00:00
kre ae98bc7d08 NFC: Typo in a comment corrected. 2017-07-18 13:17:37 +00:00
kre a94bbc243b Make sure that the open of /dev/pad0 has succeeded (or at the very
least been attempted) before attempting to open /dev/mixer to determine
if the system being tested has audio or not.  Leaving this for the background
cat command to do causes a race between that command and the parent sh.
Move this code to a helper function to avoid duplicating it.

Also avoid attempting to kill the background cat if it was never created.
The kill is likely unnecessary anyway, ATF seems to clean up processes
like that one without assistance.   Which is a good thing, as the kill
does not happen if the test is skipped, or fails.
2017-07-18 12:40:57 +00:00
ozaki-r 6ed91e62d5 Separate test files 2017-07-18 02:16:07 +00:00
kre 56aa5062b1 Add some tests for the (likely forthcoming) pipefail option (modelled
after than in ksh and bash, and the similar thing in zsh) for which a
request has been made for support in the NetBSD sh.

Until the support is committed, the test will be skipped.
2017-07-15 18:52:21 +00:00
kre 8d48762db3 Add basic tests for the forthcoming ',' '++' and '--' operators.
Until the support for those is committed to /bin/sh (and when testing
any other sh that does not support them) the new tests will be skipped.
2017-07-15 18:50:42 +00:00
ozaki-r 8534aec06b Fix wrong argument handling 2017-07-15 07:26:02 +00:00
perseant 4a641438c8 Add a simple collation test. This test is expected to fail on HEAD since
we do not yet have a working implementation of wcscoll.
2017-07-14 14:57:43 +00:00
joerg 3d39ee5ed6 VAX doesn't have the test cases, so stub the body as well. 2017-07-14 14:09:53 +00:00
ozaki-r dfda6b6abe Add test cases for SAs with different SPIs 2017-07-14 11:54:52 +00:00
perseant adbde1f900 Add ISO10646 versions of these tests, conditional on __STDC_ISO_10646__ .
Also make the tests a bit more verbose, to aid debugging when they fail.
2017-07-12 17:32:51 +00:00
joerg e5678be828 Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This
functions are used for destructors of thread_local objects.

If a pending destructor exists, prevent unloading of shared objects.
Introduce __dl_cxa_refcount interface for this purpose. When the last
reference is gone and the object has been dlclose'd before, the
unloading is finalized.

Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists
on providing __cxa_thread_atexit as direct wrapper without further
patching.
2017-07-11 15:21:31 +00:00
joerg 8f5d6573ba Reference correct binary in error messages. 2017-07-10 21:43:33 +00:00
christos f5fb881beb add another missing munmap (Kamil) 2017-07-09 22:18:43 +00:00
christos 2a9ed5d125 add munmap
#define for const.
2017-07-09 22:13:48 +00:00
christos 1ddb98e77f check for EFAULT on reads and writes to memory with not permission. 2017-07-09 22:04:04 +00:00
joerg d88dcd0fdc Fix ISO C compliance: strtol of "0xX" should give the largest valid
numeric prefix, which is 0.
2017-07-06 21:08:44 +00:00
ozaki-r 9f04f77dde Add test cases for updating SA/SP
The tests require newly-added udpate command of setkey.
2017-07-05 01:25:03 +00:00
nat 27ecfe9c27 As pad devices are now created on demand - pad has to be open for a
corresponding mixer to be available.
2017-07-03 09:08:35 +00:00
ozaki-r b95a267001 Add test cases for IPComp 2017-07-03 06:01:16 +00:00
joerg 5f391f4ae2 Export the guard size of the main thread via vm.guard_size. Add a
complementary writable sysctl for the initial guard size of threads
created via pthread_create. Let the existing attribut accessors do the
right thing. Raise the default guard size for threads to 64KB.
2017-07-02 16:41:32 +00:00
ozaki-r 3cd9889005 Check if ARP/NDP entries are purged when a related route is deleted 2017-06-30 07:57:12 +00:00
ozaki-r 3f42983046 Enable to remove multiple ARP/NDP entries for one destination
The kernel can have multiple ARP/NDP entries which have an indentical
destination on different interfaces. This is normal and can be
reproduce easily by ping -I or ping6 -S. We should be able to remove
such entries.

arp -d <ip> and ndp -d <ip> are changed to fetch all ARP/NDP entries
and remove matched entries. So we can remove multiple entries
described above. This fetch all and selective removal behavior is
the same as arp <ip> and ndp <ip>; they also do fetch all entries
and show only matched entries.

Related to PR 51179
2017-06-28 08:17:50 +00:00
ozaki-r da803ed70d Restore ARP/NDP entries to route show and netstat -r
Requested by dyoung@ some time ago
2017-06-28 04:14:53 +00:00
ozaki-r fcbd6bf4fa Drop RTF_LLINFO flag (now it's RTF_LLDATA) from local routes
They don't have llinfo anymore. And also the change fixes unexpected
behavior of ARP proxy.
2017-06-28 04:10:47 +00:00
ozaki-r d15c5ed0e5 Fix wrong comment 2017-06-27 04:56:13 +00:00
ozaki-r 7eee4dba21 Check existence of ARP/NDP entries
Checking ARP/NDP entries is valid rather than checking routes.
2017-06-27 04:52:45 +00:00
ozaki-r 59bb97369e Drop RTF_UP from a routing message of a deleted ARP/NDP entry 2017-06-26 06:59:56 +00:00
ozaki-r 057fd82362 Improve backward compatibility of (fake) routing messages on adding an ARP/NDP entry
A message originally included only DST and GATEWAY. Restore it.
2017-06-26 03:16:28 +00:00
ozaki-r 60f1157fbd Fix usage of routing messages on arp -d and ndp -d
It didn't work as we expected; we should set RTA_GATEWAY not
RTA_IFP on RTM_GET to return an if_index and the kernel should
use it on RTM_DELETE.
2017-06-26 03:13:40 +00:00
kre 8b5ee9a5ac Give this test a promotion! This was the test that enabled the sh's
STACKSTRNUL() bug to eventually be found.   Not any of the test cases
directly - the shell running the tests (the same /bin/sh) managed to
build one of the f_variable_syntax sub-tests incorrectly, and that was
enough to eventually allow the bug to be located and squashed.

Like all good promotions, this one comes with increased work, and no extra pay.
2017-06-24 11:09:42 +00:00
kre 82288f99fc NFC: Added some comments (about other comments)
We currently parse var expansions like "${x-"a b c"}" incorrectly
according to POSIX (and ancient tradition) though in a way that is
generally unexpcted (there are 2 quoted strings there, according
to the standard, "${x-" and "}" and 'a b c' is unquoted.)  This has
never been fixed in our sh, as like in many other shells, it is just
a little unbelievable, most people expect that inside the {} is a
whole new ballpark, and everything starts again, and it does in cases
like "${x%"a b c"}" (the newer matching operators.)  There have been
comments in this test explaining how the test is actually testing for
incorrect behaviour for a while now.

But I have since learned of POSIX bug #221 (2010), the resolution of which is
to make the problem case unspecified.  This will not actually become part
of posix until the next major version (POSIX 8) whenever that appears (still
years away I expect) - but at least we now can feel happier about the
way our code works and not worry quite so much about testing that incorrect
code keeps working incorrectly....
2017-06-24 11:06:17 +00:00
gson 557e6caeb6 Reduce the number of iterations in the bsize_torture test from 65535
to 1000 to make the ATF test suite as a whole take less time.  Before
the change, this single test case could take more than two hours to
run on a qemu emulated ARM.
2017-06-24 10:25:23 +00:00
ozaki-r f86487ba70 Test implicit removals of ARP/NDP entries
One test case reproudces PR 51179.
2017-06-22 10:06:33 +00:00
ozaki-r 3659ef5665 Purge all related L2 caches on removing a route
The change addresses situations similar to PR 51179.
2017-06-22 09:56:48 +00:00
ozaki-r 68c930f9c3 Fix typo 2017-06-22 09:05:02 +00:00
ozaki-r dc9233b94b Don't create a permanent L2 cache entry on adding an address to an interface
It was created to copy FreeBSD, however actually the cache isn't
necessary. Remove it to simplify the code and reduce the cost to
maintain it (e.g., keep a consistency with a corresponding local
route).
2017-06-21 09:05:31 +00:00
ozaki-r 04ce7456cf Set net.inet.arp.keep only if it's required 2017-06-21 03:10:42 +00:00
ozaki-r 72ce3b3ae5 Add missing declarations for cleanup 2017-06-19 10:57:37 +00:00
ozaki-r 6bf9d9c9db Add test cases of TCP/IPsec on an IPv4-mapped IPv6 address
It reproduces the same panic reported in PR kern/52304
(but not sure that its cause is also same).
2017-06-19 10:05:04 +00:00
ozaki-r 9b188107de Do netstat -a for an appropriate protocol 2017-06-19 09:20:29 +00:00
kre d9c02a764f Add a new test to verify correct operation when a command substitution
produces output with a very large number of consecutive embegged \n
characters.

This test is currently expected to fail (as of commit date) but is not
marked as atf_expect_fail as the shell should be fixed to avoid the
problem quite soon.   Until then almost anything might happen to the
sh that runs this test (from just plain wrong results, to core dumps,
even possibly the right results, though that's unlikely).

Whie doing this, get rid of the duplicate implementation of the
nested_cmdsubs_in_heredoc test (which was achieving nothing).  I know
how I managed to do that, but on advice of counsel, I ...   (it was
just a harmless waste of a tiny amount of CPU time "compiling" the test,
just like writing "x=0;" on consecutive lines....)
2017-06-16 07:37:41 +00:00
kre a238581652 Fix a really stupid typo/thinko that was preventing many of the
redirect syntax sub-tests from being attempted.
2017-06-16 07:30:32 +00:00
ozaki-r e40a78484b Test routing messages emitted on operations of ARP/NDP entries 2017-06-16 04:41:02 +00:00
christos 97ebf3e411 constify more to avoid gcc stupidity. 2017-06-14 21:43:02 +00:00
ozaki-r 388744f33f Enable DEBUG for babylon5 2017-06-14 02:33:37 +00:00
ozaki-r 1c8c9db525 Add test cases for vlan(4)
From s-yamaguchi@IIJ
2017-06-14 02:32:29 +00:00
martin a3b64c360a Avoid variable lenght buffers to help the stack protector (hopefully no
functional change)
2017-06-13 08:16:16 +00:00
kre e045f926b6 Add two new sub-tests to the c_line_wrapping test case.
These should detect if the errors that caused MAKDEV to fail and
pkgsrc/pkgtools/cwrappers to fail to build (problem detected in
libnbcompat/configure) ever return.

Also fixed one of the other sub-tests so that it actually does what
it should - no idea how this one has been passing, it did not for me
when I was checking the new ones (but perhaps in the interim I have
fixed something else in sh, the problem was in the area I have been
playing, and I originally debugged the new tests using a newer version
of /bin/sh than has yet been committed.)
2017-06-09 23:49:58 +00:00
bouyer bc73b88a51 Test bind()ing to a non-existent interface. 2017-06-09 08:23:45 +00:00
knakahara 1c9c125617 add tests of ioctl for /dev/crypto 2017-06-09 06:09:01 +00:00
perseant 8b7adb7bf9 Change t_sprintf to an expected failure, since we don't respect the empty
thousands separator of the C/POSIX locale (PR standards/52282).
2017-06-07 22:59:42 +00:00
kre 9817a5b1e5 Paranoia: add a new test case testing that $(( )) results get split
by IFS just the same as any other expansion (split when they should be,
and not when they shouldn't).

Good thing I did ... this discovered a regression in the new expand
code (from an hour or three ago) where quoted arith expansions are
being split, and shouldn't be.  (on the other hand, when they should
be split, they are being split correctly, so that's good...)

No need to worry too much about this, in real life (as opposed to
torture tests) no-one ever puts digits in IFS, and a $(( )) expansion
only ever contains digits, so in practice, splitting never happens,
whether because it is quoted, or just becaue there is nothing to split.

The FreeBSD shell does it correctly (they do word splitting using a
totally different mechanism than we do) - I will find where I missed
testing for quoted expansions later tonight.  Until that happens,
expect a test failure from t_fsplit:split_arith

While here add more comments in the other test casess (one had a comment
already) that our shell parses incorrectly (this is a parsing problem,
not an expansion problem, and the bug has existed forever .. and is
shared by bash).

That is, in an expression like "${var:-word}" the whole thing (including
word) is quoted by the double quotes, and in "${var:-"word"}" the
expansion is quoted, but 'word' is not, the 2nd " (the one before 'w')
ends the opening quote, and the third (before }) turns quoting on
again (it is required that there be an even number of unquoted quotes inside
a ${} expression, so things like "${var:-"word} are simply invalid.)
Another way of saying this, is that if the { is quoted (for which the
only way is using " to get to this kind of expansion at all) the }
must also be quoted (" quoted).  There is no quote nesting here.

This also means that in "${var:-'word'}" the single quotes are just
characters, they are quoted by the "" that surround them, just as in
"a 'string' containing quotes", but "${var:-"'word'"}} is valid and
contains a single quoted word.

Note that this is different than the patetrn-match/trim expansions
( ${var%pattern} etc) where any surrounding quotes do not affect the
pattern, and all forms of quoting can be used in it - but it always
parses as a pattern, and is never subject to filename expansion, so
a '*' in it that is to mean "match any string" does not need special
quoting to avoid it expanding to file names, regardless of whether
the ${var%*} is quoted or not, but a * that is to be matched as a
character literally does need to be quoted.

I will probably file a PR about this bug sometime, but as it is
very old, and doesn't every seem to bother anyone (and is shared by
bash) there isn't any big hurry to open yet another verry messy can
of excrement to fix it...

This does mean that the FreeBSD shell "fails" some of our tests.
(The test is wrong, their shell is correct.)
2017-06-03 15:15:49 +00:00
kre a12c6cfae6 Complete the special request by quoting chapter & verse from POSIX
as to why ${011} is ${11} and not ${9} (that is, why we interpret it
that way, the "why could it not be the other way?" is just "because
that is not how it was ever implemented".
2017-06-03 14:45:59 +00:00
kre 25950655c8 By special request, add a check that ${011} is ${11} not ${9} (etc) and
that ${08} is not an error.
2017-06-03 11:23:01 +00:00
kre 3806d6f4e4 Add some extra sub-tests checking splitting of ${#var} - just for my
piece of mind (to verify I was not breaking anything here.)

Also added some commentary better explaining why one of the tests of splitting
quoted variable expansions is almost certainly incorrect (both the tests,
and what sh does) ... though bash does the same as us, so all is not lost!
2017-06-03 10:27:05 +00:00
kre f0acc68ec6 Add a new test case "nested_arith" (that is, things like $(( 1 + $(( 2 )) ))
which will currently fail (some of the sub-tests, but this one stops on
first failure, so the test simply fails.)  This will be corrected later today.
2017-06-02 01:50:48 +00:00
kre 3782bd48c9 Add 3 new subtests to the shell_params test case. These test currently
broken behaviour (so for now, 3 of 15 subtests will fail).   This will
be corrected later today.
2017-06-02 01:48:13 +00:00
kre 06627d31e7 One more weird test of parsing (and correctly understanding) words
whose meaning is defined entirely by context.

For those who read commit messages, and want a (small) challenge,
work out where (and what) to insert as punctuation/operator chars
in the following to produce 3 ines of output, and what those will be:

	for in in in do in do case in in in echo do do echo in esac done

(There are no comments, quotes of any kind, or any kind of sub-shell,
including cmd substitutions)  With correct non alpha-numeric chars added,
it works.
2017-06-02 01:45:06 +00:00
kre bdbf3d66ba Guard against EVN being set, and possibly referencing an unset
variable, when we are running tests with sh -u
2017-06-02 01:38:44 +00:00
ozaki-r 56383415f1 Add IPSEC_KEY_DEBUG
Enable the debugging feature of IPsec key (sysctl net.key.debug)
on rump kernels if the ATF test is run with IPSEC_KEY_DEBUG=true.
2017-06-02 01:18:51 +00:00
perseant d4f6523beb Add tests for btowc(3)/wctob(3) and enable compilation of the test for
digittoint(3).

The digittoint(3) test is skipped since we don't provide that function yet.

One of the test cases for btowc(3) is also skipped, since it tests conversion
to Unicode---whereas our wchar_t representation is locale-dependent.
2017-06-01 15:45:02 +00:00
ozaki-r 946f090610 Test TCP communications over IPsec transport mode with ESP or AH
This tests SP caches of PCB.
2017-06-01 03:56:47 +00:00
ozaki-r 8504d69233 Remove a unused local variable 2017-06-01 03:51:47 +00:00
martin b40441be27 In the -m32 test, additionally test profiled binaries. 2017-05-31 11:08:35 +00:00
perseant ce11903f24 Add test cases for sprintf/sscanf/strto{d,l} and the is* and isw* ctype functions, for single-byte encodings 2017-05-30 23:44:02 +00:00