summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* tests: add reproducers for several issues uncovered with fuzz-journald-syslogEvgeny Vereshchagin2018-09-035-0/+8
| | | | This is a follow-up to a70f343cacf03ac51cdefb0d2e.
* Merge pull request #9977 from sourcejedi/no-remount-superblock3Yu Watanabe2018-09-014-4/+11
|\ | | | | Namespace fixes
| * namespace: fix mode for TemporaryFileSystem=Alan Jenkins2018-09-012-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... when no mount options are passed. Change the code, to avoid the following failure in the newly added tests: exec-temporaryfilesystem-rw.service: Executing: /usr/bin/sh -x -c '[ "$(stat -c %a /var)" == 755 ]' ++ stat -c %a /var + '[' 1777 == 755 ']' Received SIGCHLD from PID 30364 (sh). Child 30364 (sh) died (code=exited, status=1/FAILURE) (And I spotted an opportunity to use TAKE_PTR() at the end).
| * namespace: don't try to remount superblocksAlan Jenkins2018-08-302-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't remount the underlying superblocks, if we are inside a user namespace and running Linux <= 4.17. We can only change the per-mount flags (MS_REMOUNT | MS_BIND). This type of mount() call can only change the per-mount flags, so we don't have to worry about passing the right string options now. Fixes #9914 ("Since 1beab8b was merged, systemd has been failing to start systemd-resolved inside unprivileged containers" ... "Failed to re-mount '/run/systemd/unit-root/dev' read-only: Operation not permitted"). > It's basically my fault :-). I pointed out we could remount read-only > without MS_BIND when reviewing the PR that added TemporaryFilesystem=, > and poettering suggested to change PrivateDevices= at the same time. > I think it's safe to change back, and I don't expect anyone will notice > a difference in behaviour. > > It just surprised me to realize that > `TemporaryFilesystem=/tmp:size=10M,ro,nosuid` would not apply `ro` to the > superblock (underlying filesystem), like mount -osize=10M,ro,nosuid does. > Maybe a comment could note the kernel version (v4.18), that lets you > remount without MS_BIND inside a user namespace. This makes the code longer and I guess this function is still ugly, sorry. One obstacle to cleaning it up is the interaction between `PrivateDevices=yes` and `ReadOnlyPaths=/dev`. I've added a test for the existing behaviour, which I think is now the correct behaviour.
* | tests: also run TEST-01-BASIC in an unprivileged container (#9957)Evgeny Vereshchagin2018-08-302-6/+18
|/ | | | | This should make it much easier to catch regressions like https://github.com/systemd/systemd/issues/9914 and https://github.com/systemd/systemd/issues/8535.
* test: add testcase for issue 10007 by oss-fuzzYu Watanabe2018-08-222-0/+7
|
* tmpfiles: use fd_get_path() even less excessivelyFranck Bui2018-08-211-0/+45
| | | | | | | | | | | | | | | | A follow-up for commit 9d874aec451b591401d9b14cf8743b9d179159b2. This patch makes "path" parameter mandatory in fd_set_*() helpers removing the need to use fd_get_path() when NULL was passed. The caller is supposed to pass the fd anyway so assuming that it also knows the path should be safe. Actually, the only case where this was useful (or used) was when we were walking through directory trees (in item_do()). But even in those cases the paths could be constructed trivially, which is still better than relying on fd_get_path() (which is an ugly API). A very succinct test case is also added for 'z/Z' operators so the code dealing with recursive operators is tested minimally.
* test: make TEST-22 easier to debug, by outputting to /dev/consoleLennart Poettering2018-08-081-0/+2
|
* test: don't use "nobody:nogroup" for testsLennart Poettering2018-08-082-30/+30
| | | | | | | This user/group doesn't apply to Fedora. Let's use daemon:daemon instead like the other tests, as it actually tends to exist everywhere.
* tmpfiles: add more testsFranck Bui2018-07-304-0/+377
|
* test: Increase qemu timeout from 90s to 180sMichael Biebl2018-07-271-2/+2
| | | | | | The usage of an initrd made TEST-09-ISSUE-2691 more likely to fail with a timeout, so increase the timeout by 90s and adjust TimeoutStopSec= accordingly.
* Merge pull request #9720 from yuwata/fix-9702Zbigniew Jędrzejewski-Szmek2018-07-263-0/+24
|\ | | | | Fix DynamicUser=yes with static User= whose UID and GID are different
| * test: add tests for DynamicUser= with static User= whose UID and GID are ↵Yu Watanabe2018-07-263-0/+24
| | | | | | | | different
* | test: add test for Type=execLennart Poettering2018-07-253-0/+74
|/
* Add support for opening files for appendingZsolt Dollenstein2018-07-203-0/+28
| | | | Addresses part of #8983
* tests: allow passing additional arguments to nspawn via NSPAWN_ARGUMENTSEvgeny Vereshchagin2018-07-181-1/+1
|
* tests: use the asan wrapper to boot a VM/container if systemd is built with ASANEvgeny Vereshchagin2018-07-181-2/+6
|
* tests: create the asan wrapper automatically if systemd has been built with ASANEvgeny Vereshchagin2018-07-181-0/+24
|
* test: Drop SKIP_INITRD for QEMU-based testsMichael Biebl2018-07-166-6/+2
| | | | | | Not all distros support booting without an initrd. E.g. the Debian kernel builds ext4 as a module and so relies on an initrd to successfully start the QEMU-based images.
* test: Fix typo in TEST-19-DELEGATEMichael Biebl2018-07-151-1/+1
|
* test: Fix networkd test for an already running serviceMartin Pitt2018-07-091-4/+34
| | | | | | | | | | | | | | Mount tmpfses over the networkd and resolved config and state directories, and stop the services beforehand. This ensures that the test does not mess with an existing networkd/resolved setup. At least for ethernet setups, this does not sever existing links, so is good enough for the CI cases we are interested in (QEMU and LXC). Relax the skip check to only skip the test when trying to run this on real iron, but start running it in virtual machines now. This allows us to run the test on Ubuntu 18.04 LTS in CI, which uses both services by default.
* test: Reset systemd-resolved.service in networkd testMartin Pitt2018-07-091-2/+2
| | | | | | Like s-networkd.service itself, it can happen that s-resolved.service runs into restart limits. Don't enforce a successful call, as on machines without resolved the unit might not be loaded.
* tests: redirect ASAN reports on journald to a fileEvgeny Vereshchagin2018-07-031-0/+6
| | | | Otherwise, they will end up in /dev/null.
* tests: add a wrapper for when systemd is built with ASANEvgeny Vereshchagin2018-07-031-1/+34
|
* test: fix networkd-test.py rate limiting and dynamic userMartin Pitt2018-07-031-0/+8
| | | | | | | | - Reset systemd-networkd.service before each test run, to avoid running into restart limits. - Our networkd-test-router.service unit needs to run as root and thus can't use `User=`; but networkd still insists on the `systemd-network` system user to exist, so create it.
* tests: up the image size a little, use twice that size with STRIP_BINARIES=noEvgeny Vereshchagin2018-07-021-2/+6
| | | | to make sure that there's enough room for unstripped binaries.
* test: add test for specifier of configuration directory rootYu Watanabe2018-06-212-0/+2
|
* tree-wide: drop copyright headers from frequent contributorsZbigniew Jędrzejewski-Szmek2018-06-201-1/+0
| | | | | | | | Fixes #9320. for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms' done
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-06-142-4/+0
| | | | | | | perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-143-3/+3
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: use proper unicode © instead of (C) where we canLennart Poettering2018-06-146-7/+7
| | | | | | Let's use a proper unicode copyright symbol where we can, it's prettier. This important patch is very important.
* Merge pull request #9246 from keszybz/ellipsize-invalid-mem-refLennart Poettering2018-06-112-1/+14
|\ | | | | Fix invalid memory reference in ellipsize_mem()
| * basic/ellipsize: do not assume the string is NUL-terminated when length is givenZbigniew Jędrzejewski-Szmek2018-06-112-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | oss-fuzz flags this as: ==1==WARNING: MemorySanitizer: use-of-uninitialized-value 0. 0x7fce77519ca5 in ascii_is_valid systemd/src/basic/utf8.c:252:9 1. 0x7fce774d203c in ellipsize_mem systemd/src/basic/string-util.c:544:13 2. 0x7fce7730a299 in print_multiline systemd/src/shared/logs-show.c:244:37 3. 0x7fce772ffdf3 in output_short systemd/src/shared/logs-show.c:495:25 4. 0x7fce772f5a27 in show_journal_entry systemd/src/shared/logs-show.c:1077:15 5. 0x7fce772f66ad in show_journal systemd/src/shared/logs-show.c:1164:29 6. 0x4a2fa0 in LLVMFuzzerTestOneInput systemd/src/fuzz/fuzz-journal-remote.c:64:21 ... I didn't reproduce the issue, but this looks like an obvious error: the length is specified, so we shouldn't use the string with any functions for normal C-strings.
| * meson: add fuzz regressions to listZbigniew Jędrzejewski-Szmek2018-06-111-1/+5
| | | | | | | | Apparently I haven't been very good at remembering to do this.
* | fuzz: add testcase for issue 8827Yu Watanabe2018-06-112-0/+6
|/
* test: turn off the kernel's passive agressive /dev/kmsg ratelimit for our testsLennart Poettering2018-06-061-0/+1
|
* test: make sure output of test TEST-03 test service ends up on consoleLennart Poettering2018-06-062-1/+3
|
* test: disable QEMU based testing for TEST-16-EXTEND-TIMEOUTLennart Poettering2018-06-062-0/+2
| | | | | | | | | | | | | | The test is heavily dependent on timeouts, and if we are run in potentially very slow QEMU instances there's a good chance we'll miss some which we normally wouldn't miss. Hence, let's test this one in nspawn only. Given that the test is purely in service management it shouldn't matter whether it runs in nspawn or qemu, hence keep running it in nspawn, but don't bother with qemu. Similar, do this for TEST-03-JOBS, too, which operates with relatively short sleep times internally. Fixes: #9123
* tests: tighten check for TEST-06-SELINUX dependencies a bitLennart Poettering2018-06-061-1/+1
| | | | | | | | As it turns out /usr/share/selinux/devel/ is now included in more RPMs than just selinux-policy-devel (specifically container-selinux, which is pulled in by various container related RPMs). Let's hence tighten the dependency check a bit and look for systemd's .if file, which is what we actually care about.
* Merge pull request #9167 from keszybz/ellipsizationLennart Poettering2018-06-041-0/+6
|\ | | | | Ellipsization fixes based on unit-testing and fuzzing
| * test-ellipsize: add tests for ellipsize_mem, fix bugsZbigniew Jędrzejewski-Szmek2018-06-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | First, ellipsize() and ellipsize_mem() should not read past the input buffer. Those functions take an explicit length for the input data, so they should not assume that the buffer is terminated by a nul. Second, ellipsization was off in various cases where wide on multi-byte characters were used. We had some basic test for ellipsize(), but apparently it wasn't enough to catch more serious cases. Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8686.
* | test: add test for trailing dot in WorkingDirectory= and RuntimeDirectory=Yu Watanabe2018-06-033-0/+10
|/
* shared/logs-show: be more careful before using a _SOURCE_REALTIME_TIMESTAMP ↵Zbigniew Jędrzejewski-Szmek2018-05-311-0/+0
| | | | | | | | entry journalctl -o short would display those entries, but journalctl -o short-full would refuse. If the entry is bad, just fall back to the receive-side realtime timestamp like we would if it was completely missing.
* shared/logs-show: fix mixup between length-based memory duplication and ↵Zbigniew Jędrzejewski-Szmek2018-05-311-0/+0
| | | | | | | | | | | | string operations We'd look for a '=' separator using memchr, i.e. ignoring any nul bytes in the string, but then do a strndup, which would terminate on any nul byte, and then again do a memcmp, which would access memory past the chunk allocated by strndup. Of course, we probably shouldn't allow keys with nul bytes in them. But we currently do, so there might be journal files like that out there. So let's fix the journal-reading code first.
* journal-remote: when an entry is rejected with -EBADMSG, do not rotate the ↵Zbigniew Jędrzejewski-Szmek2018-05-311-0/+0
| | | | | | | | | | | journal file Something is wrong with the entry (probably a missing timestamp), so no point in rotating. But suppress the error in process_source(), so that the processing of the data stream continues. Also, just return 0 from writer_write() on success, the only caller doesn't care.
* fuzz-journal-remote: a fuzzer for journal-remote over-the-wire inputZbigniew Jędrzejewski-Szmek2018-05-312-0/+181
|
* Fix pattern to detect distributionSergio Lindo Mansilla2018-05-301-3/+3
| | | | | | | With operator '=', when in /etc/os-release: ID_LIKE="opensuse suse" # Tumbleweed since at least 2018-04-24 or ID_LIKE="suse opensuse" # Leap 15
* core: introduce specifiers for /tmp and /var/tmpLennart Poettering2018-05-291-0/+2
| | | | | | | | | | | This corresponds nicely with the specifiers we already pass for /var/lib, /var/cache, /run and so on. This is particular useful to update the test-path service files to operate without guessable files, thus allowing multiple parallel test-path invocations to pass without issues (the idea is to set $TMPDIR early on in the test to some private directory, and then only use the new %T or %V specifier to refer to it).
* Merge pull request #8817 from yuwata/cleanup-nsflagsLennart Poettering2018-05-244-0/+29
|\ | | | | core: allow to specify RestrictNamespaces= multiple times
| * test: add tests for merging RestrictNamespaces=Yu Watanabe2018-05-054-0/+29
| |