freebsd-skq/tests/sys
Alex Richardson df093aa946 tests/sys/audit: Avoid race caused by starting auditd(8) for testing
In the CheriBSD CI we reproducibly see the first test in sys/audit
(administrative:acct_failure) fail due to a missing startup message.
It appears this is caused by a race condition when starting auditd:
`service auditd onestart` returns as soon as the initial auditd() parent
exits (after the daemon(3) call).
We can avoid this problem by setting up the auditd infrastructure
in-process: libauditd contains audit_quick_{start,stop}() functions that
look like they are ideally suited to this task.
This patch also avoids forking lots of shell processes for each of the 418
tests by using `auditon(A_SENDTRIGGER, &trigger, sizeof(trigger))` to check
for a running auditd(8) instead of using `service auditd onestatus`.

With these two changes (and D28388 to fix the XFAIL'd test) I can now
boot and run `cd /usr/tests/sys/audit && kyua test` without any failures
in a single-core QEMU instance. Before there would always be at least one
failed test.

Besides making the tests more reliable in CI, a nice side-effect of this
change is that it also significantly speeds up running them by avoiding
lots of fork()/execve() caused by shell scripts:
Running kyua test on an AArch64 QEMU took 315s before and now takes 68s,
so it's roughly 3.5 times faster. This effect is even larger when running
on a CHERI-RISC-V QEMU since emulating CHERI instructions on an x86 host
is noticeably slower than emulating AArch64.

Test Plan: aarch64+amd64 QEMU no longer fail.

Reviewed By:	asomers
Differential Revision: https://reviews.freebsd.org/D28451
2021-02-18 14:02:48 +00:00
..
acl Drop "All rights reserved" from all my stuff. This includes 2020-10-28 13:46:11 +00:00
aio lio_listio: validate aio_lio_opcode 2021-01-11 19:53:01 -07:00
audit tests/sys/audit: Avoid race caused by starting auditd(8) for testing 2021-02-18 14:02:48 +00:00
auditpipe Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
capsicum Temporarily skip failing test cases in CI: 2020-10-07 09:53:24 +00:00
cddl build: provide a default WARNS for all in-tree builds 2020-09-18 17:17:46 +00:00
common Add tests verifying IPv4/IPv6 output for TCP/UDP/raw paths. 2020-03-23 12:21:32 +00:00
devrandom Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
fifo Avoid hard-coding pipe buffer sizes in the pipe and fifo kqueue tests. 2020-05-20 17:48:18 +00:00
file close_range/closefrom: fix regression from close_range introduction 2020-04-13 17:55:31 +00:00
fs fusefs: set d_off during VOP_READDIR 2021-02-12 21:50:52 -07:00
geom build: provide a default WARNS for all in-tree builds 2020-09-18 17:17:46 +00:00
kern Fix build with read-only source dir after 83c20b8a2d 2021-02-03 09:30:53 +00:00
kqueue Enable timer tests in sys.kqueue.libkqueue.kqueue_test.main on i386 2020-04-22 09:53:41 +00:00
mac Resolve conflict between the fusefs(5) and mac_bsdextended(4) tests 2020-05-02 20:14:59 +00:00
mqueue Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
net Fix dst/netmask handling in routing socket code. 2021-02-16 20:30:04 +00:00
netgraph New Netgraph module ng_macfilter: 2020-12-08 15:09:42 +00:00
netinet ping: fix some man pages and tests after r368045 2020-11-26 04:55:02 +00:00
netinet6 ping: fix some man pages and tests after r368045 2020-11-26 04:55:02 +00:00
netipsec ping: fix some man pages and tests after r368045 2020-11-26 04:55:02 +00:00
netmap Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
netpfil pf tests: Explicitly ask for python3 2021-02-17 14:04:33 +01:00
opencrypto ossl: port to arm64 2020-12-04 21:12:17 +00:00
pjdfstest Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00
posixshm posixshm_test.c: remove tautological checks 2020-12-11 22:52:20 +00:00
sys Revert r357246 2020-01-29 22:37:01 +00:00
vfs tests/sys/vfs/lookup_cap_dotdot: No longer aborts after ATF update 2021-02-04 17:57:27 +00:00
vm [tests] Fix unused variable warning in gcc 2020-11-13 18:50:24 +00:00
Makefile New Netgraph module ng_macfilter: 2020-12-08 15:09:42 +00:00
Makefile.depend
Makefile.inc Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00