Commit Graph

63 Commits

Author SHA1 Message Date
Joachim Wiberg
47a980728a test: new memleak test using valgrind
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 15:45:32 +02:00
Joachim Wiberg
477bb40c44 test: new test, verifies .conf option secure_mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-22 22:10:12 +02:00
Joachim Wiberg
577d20b8da test: use new logger() function in all tests
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-22 22:10:11 +02:00
Joachim Wiberg
7e1d7bcb06 test: a few more helper functions
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-22 22:10:11 +02:00
Joachim Wiberg
5b48dac64e test: new test to verify facility sorting to custom log file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-08 18:56:30 +02:00
Steffen Nurpmeso
908f1e6821 test/rotate_all.sh: address Joachim Wiberg comments (pull/46) 2022-03-14 05:52:46 +01:00
Steffen Nurpmeso
0bc4c82bae Test for "Implement forced log file rotation upon SIGUSR2" 2022-03-14 05:52:46 +01:00
Steffen Nurpmeso
f7abd0d10a test/notify.sh: address Joachim Wiberg's comments (pull/45) 2022-03-12 17:22:18 +01:00
Steffen Nurpmeso
bc103013cb Test for "Add "notify" keyword" 2022-03-12 15:29:33 +01:00
Joachim Wiberg
6022d3c7d0 Fix #49: add support for -8 command line option to allow 8-bit data
This patch allows the user to disable the 8-bit data check in the log
message validator.  If you have experienced problems with logging any
unicode (utf-8) messages after v1.6, this option is for you.

The correct way to handle this is to add proper parser support for the
Unicode BOM, defined in RFC5424[1], as NetBSD syslogd does[2], search
for IS_BOM().

[1]: https://datatracker.ietf.org/doc/html/rfc5424#appendix-A.8
[2]: http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/syslogd/syslogd.c?rev=1.138

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-07 20:57:00 +01:00
Joachim Wiberg
eb6e85e851 test: minor test cleanup and comments
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-06 01:10:32 +01:00
Joachim Wiberg
13b1fd0aa0 test: minor, shellcheck fixes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-06 01:10:32 +01:00
Joachim Wiberg
0a99c7f386 test: minor aesthetic, slightly improve test logging
Conforming tests should use SKIP/FAIL/OK, so let existing tests follow
that better.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-06 01:02:03 +01:00
Joachim Wiberg
f29f31340c test: refactor and generalize setup(), adding a setup2()
This patch refactors the way the primary and secondary syslogd is
started by the test framework.  The generalizations not only make the
code more readable, it hopefully also makes it easier to add new tests
in the future.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-06 00:56:03 +01:00
Joachim Wiberg
99028414c3 test: run all syslogd with kernel logging disabled
Since we currently cannot test kernel logging, and we don't want to risk
any log messages from the kernel to suddenly pop up and disturb tests,
this patch explicitly disables it.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-05 16:33:52 +01:00
Joachim Wiberg
d297a23e5a test: remote: start a receiver syslogd to manually verify rfc3164
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-11-24 09:01:16 +01:00
Joachim Wiberg
aad76ad03b test: refactor test.rc + start.sh + stop.sh -> lib.sh
Refactor test.rc, start.sh, and stop.sh into lib.sh that each test
sources and uses independently of each other.

More simplfication and cleanup needed.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-11-22 15:18:19 +01:00
Joachim Wiberg
2d95e0ccf0 test: fix search path for scripts
Fails when building in a sub-directory

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-11-22 11:22:04 +01:00
Joachim Wiberg
523926a07d test: initial refactor to support running in parallel in an unshare
The release suite fails with no permissions to dump loopback, so let's
run tests in an unshare, one per test, with and start as many syslogd as
needed for each test -- also easier to debug since all are then fully
stand-alone.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-11-22 04:59:23 +01:00
Joachim Wiberg
9ce3c2e8ec Fix #39: update tests to use -P fn and -C fn
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-06-30 23:00:09 +02:00
Joachim Wiberg
a38daf0896 test: clean up residual test files
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-05-05 05:01:12 +02:00
Joachim Wiberg
dbdc1cdf91 test: Update fwd.sh to ignore kernel logs
With the new support for /dev/kmsg the tests can run on a system that
already has a syslog daemon, and still receive all kernel messages.  We
want to ignore those in this (all?) tests and focus on the forwarding of
messages between two sysklogd.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2021-01-15 09:40:31 +01:00
Joachim Nilsson
d94163d721 Add unit test to check syslog.conf rule option parsing
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2020-01-19 10:46:59 +01:00
Joachim Nilsson
7b122449cc test: Increase run time for -- MARK -- test
We should make sure to also check that we don't get more MARK messages
than expected based on the -mMIN value.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-06 18:13:55 +01:00
Joachim Nilsson
799b03447a test: Add --MARK-- test to verify idle functionality works
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-01 21:12:02 +01:00
Joachim Nilsson
77119e2625 test: stop.sh: Exit on first error
We want to catch regressions when syslogd dies before we can tell it to
exit.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
7937cd0f55 test: Include new fwd.sh test in dist
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 11:07:28 +01:00
Joachim Nilsson
e45d7d0671 test: No need to export MSG variable
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 11:07:15 +01:00
Joachim Nilsson
245dea43bc test: Sender randomizes port, allow any in FWD test syslogd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 09:11:53 +01:00
Joachim Nilsson
7343c55f6e test: Shift delay to *really* wati for tshark to start before logging
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-14 01:40:33 +01:00
Joachim Nilsson
fcded43abf test: Add FWD test, two syslog daemons, a custom port and RFC5424
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-14 01:36:41 +01:00
Joachim Nilsson
cf9d281e5b syslogd: Adopt FreeBSD -F instead of -n to run in foreground
This change will probably break most installations.  We do this to free
up '-n' for use as disabling DNS lookups, from FreeBSD *and* NetBSD.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 17:08:47 +01:00
Joachim Nilsson
d6370aeb1f Follow-up to 69608f7: Update API test with TAG formatting change
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 08:31:36 +01:00
Joachim Nilsson
6ac6abe60e test: Verify new secure mode, and remote log to default port
It's a lot easier to debug the remote test with Wireshark if we log to
the default service port on the remote host.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:02 +01:00
Joachim Nilsson
11ab6c55bc test: Don't overwrite bar.conf
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:02 +01:00
Joachim Nilsson
4ee6211277 syslogd: Refactor internals to use new socket API
This patch is inspired, in part, by FreeBSD syslogd but now diverges
onto its own path.  Special handling for AF_UNIX sockets are required
on Linux, which unlike BSD cannot use getaddrinfo() on UNIX sockets.

- Rip out old funix[] and finet support
- Add new concept of peers
- Linked list of peers can be > 20
- Temporarily open up to accept all remote conns
- Remove old logerror(), replaced with new log macros

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:01 +01:00
Joachim Nilsson
172ae92887 test: Extend API test with logger verifing structured data
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 23:21:33 +01:00
Joachim Nilsson
6059d873a5 Fix stray 'g' that sneaked in last test update
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:13:28 +01:00
Joachim Nilsson
939a28f6f8 Test with a secondary UNIX socket
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:08:29 +01:00
Joachim Nilsson
4376def121 Allow running tests stand-alone
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-07 19:08:29 +01:00
Joachim Nilsson
8142c780e0 Wait a bit before checking the log file, also check if it's alive
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 16:38:30 +01:00
Joachim Nilsson
999f713115 Dump actual v1.conf file on error
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 16:26:44 +01:00
Joachim Nilsson
66e9975234 Actually return error when API test fails, dump more logs
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 16:22:29 +01:00
Joachim Nilsson
09085b2ba9 Debug API test, syslogp() fails on Travis-CI for some reason
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-06 16:07:13 +01:00
Joachim Nilsson
0ade961e60 Fix syslog() and syslogp() message formatting in API test
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 20:10:36 +01:00
Joachim Nilsson
512aaa1afc Fix paths for out-of-tree builds, found by make distcheck
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 20:09:54 +01:00
Joachim Nilsson
e202196152 Add missing files to distribution, found by make distcheck
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-04 20:09:15 +01:00
Joachim Nilsson
c35f4de7fc Travis-CI: Build all test programs as regular user, or clang fails
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 19:52:37 +01:00
Joachim Nilsson
dca48d8b7d test: Extend API test with three more phases
- with/without openlog()
- setlogmask()
- syslogp() API

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 19:51:39 +01:00
Joachim Nilsson
f07d00f910 test: Enable syslogd debug mode, log in test/start.log
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-03 19:51:02 +01:00