Commit Graph

2878 Commits

Author SHA1 Message Date
christos
272d6823df fix clang build. 2016-12-17 03:43:38 +00:00
ozaki-r
11a1604c2d Add tests for multiple routers 2016-12-16 09:11:18 +00:00
ozaki-r
2e89e8b1dc Unify common routines 2016-12-16 09:10:37 +00:00
ozaki-r
237c29ba3d Avoid using /var/run/rump.rtadvd.pid 2016-12-16 09:10:08 +00:00
ozaki-r
6e275c7668 Add a test case that deletes auto-configured addresses 2016-12-16 03:49:45 +00:00
ozaki-r
da9347803d Improve stability of the tests
- Do ifconfig -w 10 after ifconfig up
- Accept /1d0h0m..s/ in addition to /23h59m..s/ for expiration time
- Prevent new RA messages from coming after flushing entries

The changes should fix flapping of test results on babylon5.
2016-12-16 03:14:23 +00:00
kamil
b486a76971 Add ATF tests for hardware assisted watchpoints on amd64
Addedd tests:
 - watchpoint_count
 - watchpoint_read
 - watchpoint_write_unmodified
 - watchpoint_trap_code[0123]
 - watchpoint_trap_data_write[0123]
 - watchpoint_trap_data_rw[0123]

These code will be reused later for i386 and moved to a common place like
tests/kernel/arch/x86.

These tests are x86 specific only. The same API but different private
ptrace_watchpoint MD part has to be used on other ports.

All tests pass on amd64.

Sponsored by <The NetBSD Foundation>
2016-12-15 12:15:20 +00:00
kamil
a513f40fac Prepare t_ptrace_wait.h for hardware watchpoints API
Add new symbol ATF_TP_ADD_TC_HAVE_PTRACE_WATCHPOINTS() to be protected with
the __HAVE_PTRACE_WATCHPOINTS guard.


XXX:
    Mark check_happy() with __attribute__((optimize("O0"))).
    Disabled optimization is required to make tests for hardware assisted
    traps in .text functional.

    Tested with GCC 5.4 on NetBSD 7.99.47 amd64

Sponsored by <The NetBSD Foundation>
2016-12-15 08:57:24 +00:00
ozaki-r
d4c2ba5a74 Fix that cleanup doesn't run when DEBUG=false 2016-12-15 02:43:56 +00:00
ozaki-r
df9d638687 Add tests for flushing prefix and default router entries 2016-12-14 07:37:26 +00:00
kamil
15bac0f54a Define -D_KERNTYPES in CPPFLAGS unconditionally to fix MKRUMP=no build
Reported by Robert Swindells

Sponsored by <The NetBSD Foundation>
2016-12-14 06:19:59 +00:00
knakahara
ff8a15d36e add wait_for_disconnected to run_test() as well as run_test6().
Before commited MP-safe patch, IPv4 test can run in time without
wait_for_disconnected. Currently, wait_for_disconnected is required
because of locking overhead.
2016-12-14 03:30:30 +00:00
ozaki-r
031e076338 Rename dump because it's used in net_common.sh 2016-12-14 02:50:42 +00:00
kamil
b8092d5dfa Add regs1 in arch/i386/t_ptrace_wait*
regs1:
    Call PT_GETREGS and iterate over General Purpose registers

Sponsored by <The NetBSD Foundation>
2016-12-13 18:00:10 +00:00
kamil
9feae32a7c Remove dbregs* in arch/amd64/t_ptrace_wait*
CPU Debug Registers won't be exposed as is to userland.

Hardware Watchpoints will be exported to userland dedicated interface
through the ptrace(2) interface.

Sponsored by <The NetBSD Foundation>
2016-12-13 13:09:00 +00:00
kamil
5f84086eb7 Add regs1 in arch/amd64/t_ptrace_wait*
regs1:
    Call PT_GETREGS and iterate over General Purpose registers

Sponsored by <The NetBSD Foundation>
2016-12-13 13:04:18 +00:00
kamil
f9bea37eb4 Define in CPPFLAGS symbol _KERNTYPES in order to get PRIxREGISTER
This type will be used in t_ptrace_wait* for the printf(3) function.

Sponsored by <The NetBSD Foundation>
2016-12-13 12:59:46 +00:00
kamil
2826f37556 Remove dbregs[12] from t_ptrace_wait{,3,4,6,id,pid}
CPU Debug Registers won't be exposed as is to userland.

Hardware Watchpoints will be exported to userland dedicated interface
through the ptrace(2) interface.

Sponsored by <The NetBSD Foundation>
2016-12-13 12:25:05 +00:00
joerg
5e6012ec99 sig_atomic_t does not include volatile. Prevent static analysis from
understanding that the test function is dead.
2016-12-12 10:34:55 +00:00
knakahara
446d4c27f3 fix accidentally if_pppoe atf failure depends on cpu workload.
advised by s-yamaguchi@IIJ, thanks.
2016-12-12 09:56:58 +00:00
nat
baaaeb8681 Update test output to reflect audio changes. 2016-12-11 08:09:29 +00:00
kamil
f120395189 Skip t_exect test because it makes test machines to hang
exect(NULL,NULL,NULL) generates 15859 times SIGTRAP on amd64
Currently exect(3) is misdesigned -- see PR port-amd64/51700 and it
needs to be redone from scratch.

This test affects amd64 releng machines causing tests to hang or
fail. As there is little point to test interface that is still not,
designed and implemented and implemented and is breaking tests - skip it
unconditionally for all ports.

Sponsored by <The NetBSD Foundation>
2016-12-11 03:38:09 +00:00
alnsn
826f45ea87 AES XTS unit tests should now pass. 2016-12-11 00:23:44 +00:00
kamil
f6271ea6ad Restrict atf_tc_expect_fail(PR port-amd64/51700) only for amd64 (x86_64)
Other ports than amd64 have their own issues, mostly keeping this call as
unimplemented.

While there cast sig_atomic_t to int in the printf(3)-like call -- pointed
out by <martin>

Sponsored by <The NetBSD Foundation>
2016-12-09 08:34:37 +00:00
kamil
56cbf6fa65 Add check in t_exect_null to verify that SIGTRAP was emitted only once
Currently this test fails on amd64.

PR port-amd64/51700
    exect(NULL,NULL,NULL) generates 15859 times SIGTRAP on amd64

On FreeBSD/amd64 this tests passes correctly.

Sponsored by <The NetBSD Foundation>
2016-12-09 06:47:48 +00:00
kamil
5e8d31ff24 Attach t_exect to ATF tests and distribution
Add missing SIGTRAP handler. Assert there that the signal is SIGTRAP as
expected and si_code TRAP_TRACE.

This test will break on some ports that have dummy or incomplete
implementation of exect(2).

This test works on amd64 correctly.

Sponsored by <The NetBSD Foundation>
2016-12-09 06:12:02 +00:00
kamil
13f6a6536b Add new test t_exect to verify exect(2)
This test is a clone of tests/lib/libc/gen/execve/t_execve

t_exect_null:
    Tests an empty exect(2) executing

The function exect() executes a file with the program tracing facilities
enabled (see ptrace(2)).
    -- exect(2)

This test will be attached to build afterwards.

Sponsored by <The NetBSD Foundation>
2016-12-09 04:00:36 +00:00
kamil
4b927362a8 Fix Clang/LLVM build
Reported error:
    src/tests/kernel/t_ptrace_wait.c:4401:33:
    error: missing field 'pl_event' initializer
            [-Werror,-Wmissing-field-initializers]

Line in the code:
    struct ptrace_lwpinfo info = {0};

Appease it with initializing info to {0, 0}.

Sponsored by <The NetBSD Foundation>
2016-12-08 13:32:17 +00:00
kamil
9d8a67c608 Stop using atf_utils_fork() in tests/kernel/arch/amd64/t_ptrace_wait.c
Switch from:
    child = atf_utils_fork();
to:
    ATF_REQUIRE((child = fork()) != -1);

Prefer the latter as working as intended and not outputing to files with
danger to overwrite files' content after each fork in test-suite.

Discussed with Christos Zoulas.

Sponsored by <The NetBSD Foundation>
2016-12-07 22:24:44 +00:00
christos
319746a2a5 switch to using fork so we can see the child output. 2016-12-06 18:59:00 +00:00
kamil
f38bfbe41f Clean up after fixes and refactoring by Christos Zoulas
No functional change, remove dead and unneeded code.

Sponsored by <The NetBSD Foundation>
2016-12-06 08:03:09 +00:00
christos
3d6c55098c fix lwpinfo2 2016-12-05 22:05:53 +00:00
christos
7649084649 Fix the tests that broke after my changes.
XXX: This code is heavily duplicated and needs some merging.
2016-12-05 21:20:38 +00:00
christos
908ba66926 - abstract the pipe calls into routines.
- some of the tests that worked (really failed silently before) now fail.
2016-12-05 20:10:10 +00:00
kamil
7335a780bf Mark again lwpinfo2 with expected failure in t_ptrace_wait{,3,4,6,id,pid}
Only failure lwpinfo1 was addressed, not lwpinfo2.

PR kern/51685

Sponsored by <The NetBSD Foundation>
2016-12-05 07:18:10 +00:00
kamil
e01acbd702 lwpinfo1 and lwpinfo2 in t_ptrace_wait{,3,4,6,id,pid} no longer fails
Remove atf_tc_expect_fail() linked with PR kern/51685.

Issue fixed by Christsos Zoulas in src/sys/kern/kern_sig.c r. 1.331

Sponsored by <The NetBSD Foundation>
2016-12-04 23:48:02 +00:00
kamil
1a4e4ead74 Add dbregs_dr[0123]_trap_variable in arch/amd64/t_ptrace_wait*
Add new preliminary tests for testing that CPU Debug Registers can be used
to trap on a variable (write operation).

dbregs_dr0_trap_variable:
    Verify that setting trap with DR0 triggers SIGTRAP

dbregs_dr1_trap_variable:
    Verify that setting trap with DR1 triggers SIGTRAP

dbregs_dr2_trap_variable:
    Verify that setting trap with DR2 triggers SIGTRAP

dbregs_dr3_trap_variable:
    Verify that setting trap with DR3 triggers SIGTRAP

Sponsored by <The NetBSD Foundation>
2016-12-04 03:38:58 +00:00
kamil
a58716a3f0 Add new tests lwpinfo1 in t_ptrace_wait* and lwpinfo2 under HAVE_PID guard
lwpinfo1:
    Verify baic LWPINFO call for single thread (PT_TRACE_ME)

lwpinfo2:
    Verify baic LWPINFO call for single thread (PT_ATTACH from tracer)

Both tests are marked as expected failure PR kern/51685:
    ptrace(2): Signal does not set PL_EVENT_SIGNAL in
    (struct ptrace_lwpinfo.)pl_event

Sponsored by <The NetBSD Foundation>
2016-12-03 07:23:08 +00:00
kamil
4b9f3a9f8a Define new tests for CPU Debug Registers in t_ptrace_wait{,3,4,6,id,pid}
Rename dbregs1 to dbregs_print
Rename dbregs[2345] to dbregs_preserve_dr[0123]

Add new tests dbregs_preserve_dr[0123]_yield.

dbregs_preserve_dr0_yield:
     Verify that setting DR0 is preserved across ptrace(2) calls with
     scheduler yield

dbregs_preserve_dr1_yield:
     Verify that setting DR1 is preserved across ptrace(2) calls with
     scheduler yield

dbregs_preserve_dr2_yield:
     Verify that setting DR2 is preserved across ptrace(2) calls with
     scheduler yield

dbregs_preserve_dr3_yield:
     Verify that setting DR3 is preserved across ptrace(2) calls with
     scheduler yield

Add new tests dbregs_preserve_dr[0123]_continued.

dbregs_preserve_dr0_continued:
    Verify that setting DR0 is preserved across ptrace(2) calls and with
    continued child

dbregs_preserve_dr1_continued:
    Verify that setting DR1 is preserved across ptrace(2) calls and with
    continued child

dbregs_preserve_dr2_continued:
    Verify that setting DR2 is preserved across ptrace(2) calls and with
    continued child

dbregs_preserve_dr3_continued:
    Verify that setting DR3 is preserved across ptrace(2) calls and with
    continued child

Use more meaningful names for these tests as they are MD specific and
testing precise functionality. Also there will be a growing number of
tests in this category and prefixing everything with plain dbregs and
trailing with a number cannot be verbose.

Sponsored by <The NetBSD Foundation>
2016-12-03 01:41:15 +00:00
kamil
0904a3bc79 Add new tests dbregs[2345] in MD arch/amd64/ t_ptrace_wait{,3,4,6,id,pid}
dbregs2:
    Verify that setting DR0 is preserved across ptrace(2) calls

dbregs3:
    Verify that setting DR1 is preserved across ptrace(2) calls

dbregs4:
    Verify that setting DR2 is preserved across ptrace(2) calls

dbregs5:
    Verify that setting DR3 is preserved across ptrace(2) calls

These tests are deliberately fine-grained as they are expected to penetrate
precisely each functional aspect of CPU Debug Registers on amd64 one after
another.

These tests (and MI ones) might be generated or merged with helper
functions, however in order to copy-and-paste them out of a test-suite and
quickly port to other platform (in order to compare results) it's useful to
keep them as stand-alone as they are.

Code from these tests might be shared with other ports in future, for the
same reason keep them currently as they are.

Sponsored by <The NetBSD Foundation>
2016-12-02 06:49:00 +00:00
knakahara
a3ee55e14c fix typo. ping6 deadline option is not "-w" but "-X". 2016-12-02 06:19:50 +00:00
kamil
96cf2030eb Refactor location of amd64-specific ATF tests to new dir kernel/arch/amd64
Rename
 - tests/kernel/t_ptrace_amd64_wait.c
to
 - tests/kernel/arch/amd64/t_ptrace_wait.c
and adapt appropriate files accordingly.

New directory will be used for more amd64-specific tests, verifying the
MD parts of the kernel.

Remove old entries from distrib/sets/lists as they were added a while ago.

Sponsored by <The NetBSD Foundation>
2016-12-02 05:54:14 +00:00
knakahara
5c3ea1ee6e fix accidentally if_pppoe atf failure depends on cpu workload. 2016-12-02 05:28:27 +00:00
kamil
6df343d465 Add new test file t_ptrace_amd64_wait.c and refactor t_ptrace_*wait* tests
Clone t_ptrace_wait.c to t_ptrace_amd64_wait.c and put common parts to
t_ptrace_wait.h.

The t_ptrace_amd64_wait.c file is dedicated to hold amd64-specific tests
for the ptrace(2) interface.

Add new basic test dbreg1 in t_ptrace_amd64_wait{,3,4,6,id,pid}:
    Verify plain PT_GETDBREGS with printing Debug Registers

Fix evbarm64-aarch64 issue pointed by <christos>, kill1 and kill2 tests
must be defined without PT_STEP guards.

Sponsored by <The NetBSD Foundation>
2016-12-01 20:11:17 +00:00
hannken
f3e32599e8 - Change vcache_reclaim() to always call VOP_INACTIVE() before VOP_RECLAIM().
When called from vrecycle() or vgone() there is a window where the refcount
  is greater than zero and another thread could get and release a reference
  that would miss VOP_INACTIVE() as the refcount doesn't drop to zero.

  Adjust test fs/puffs/t_basic:  test VOP_INACTIVE count being greater zero.

- Make vrecycle() more robust by checking v_usecount first and preventing
  further references across vn_lock().  Fixes a deadlock where one thread
  starts unmount, second thread locks a directory and allocates a vnode
  and first thread tries to vrecycle() the directory.
  First thread holds vfs_busy and wants vnode, second thread holds vnode
  and wants vfs_busy.

- With these fixes in place change cleanvnode() to use vget()/vrecycle()
  to reclaim the vnode.
2016-12-01 14:49:03 +00:00
kamil
26286941d5 Add new tests kill[12] in t_ptrace_wait{,3,4,6,id,pid}
New tests verify that PT_CONTINUE with SIGKILL is equivalent to PT_KILL.

kill1:
    Verify that PT_CONTINUE with SIGKILL terminates child

kill2:
    Verify that PT_KILL terminates child

Sponsored by <The NetBSD Foundation>
2016-11-30 21:12:53 +00:00
kamil
8834a805a6 Add new tests dbregs[12] in t_ptrace_wait{,3,4,6,id,pid}
dbregs1:
    Verify plain PT_GETDBREGS call without further steps

dbregs2:
    Verify PT_GETDBREGS and PT_SETDBREGS calls without changing regs

These tests are to be used to verify CPU Debug Register accessors in the
ptrace(2) interface.

Additionally fix also fpregs2 test to really call PT_SETFPREGS.

Sponsored by <The NetBSD Foundation>
2016-11-29 21:58:13 +00:00
kamil
1843779dc6 Add more tests for PT_STEP step[234] in t_ptrace_wait{,3,4,6,id,pid}
step2:
    Verify PT_STEP called twice

step3:
    Verify PT_STEP called three times

step4:
    Verify PT_STEP called four times

The purpose of these tests is to assert that PT_STEP can be called more
than once and it sill works.

Sponsored by <The NetBSD Foundation>
2016-11-29 21:31:45 +00:00
kamil
dc4348e29b Add new test step1 in t_prace_wait{,3,4,6,id,pid} under PT_STEP guards
step1:
   Verify single PT_STEP call.

This function is calculating happy numbers just to consume CPU cycles for
the test purpose.

PT_STEP raises SIGTRAP to by caught by a debugger.

Sponsored by <The NetBSD Foundation>
2016-11-28 21:37:00 +00:00
ozaki-r
b8a0fa35f1 Use redirection instead of pipeline
This is a workaround for PR bin/51667.
2016-11-28 07:29:56 +00:00