1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-09 01:18:19 +03:00
Commit Graph

3839 Commits

Author SHA1 Message Date
Frantisek Sumsal
686da1c095 test: ignore missing coverage in TEST-82-SOFTREBOOT
As we temporarily mount rootfs read-only there.
2023-06-03 16:30:46 +02:00
Adrian Vovk
0470f91983 sysupdate.d: Add way to drop binaries into $BOOT
As described in the BLS, we should place binaries into the XBOOTLDR
directory if it is available, otherwise into the ESP. Thus, we might
need to put binaries into /boot or into /efi depending on the existence
of the XBOOTLDR partition.

With this change, we introduce a new PathRelativeTo= config option that
makes this functionality possible
2023-06-03 09:13:27 +02:00
Luca Boccassi
e1aacab7d5
Merge pull request #27903 from mrc0mmand/test-followups
test: a couple of systemd-{coredump,pstore,run} followups
2023-06-02 23:56:58 +01:00
Lennart Poettering
093d545658 test: add integration test for soft reboots incl. fdstore passing 2023-06-02 18:43:11 +02:00
Lennart Poettering
8af66251a1 test: disable SoftReboot() in dfuzzer test for now
As requested:

https://github.com/systemd/systemd/pull/27435#issuecomment-1527810336
2023-06-02 18:43:11 +02:00
Frantisek Sumsal
50fb26d237 test: probe a couple more paths in systemd-run 2023-06-02 16:59:58 +02:00
Frantisek Sumsal
1326d2dd05 test: sync with the fake binary before killing it
On faster machines we might be too fast and kill the fake binary during
fork() which then makes kernel report a "wrong" binary in the coredump,
e.g.:

[   31.408078] testsuite-74.sh[548]: + /tmp/make-dump /tmp/test-dump SIGTRAP
[   31.409720] testsuite-74.sh[560]: + bin=/tmp/test-dump
[   31.409720] testsuite-74.sh[560]: + sig=SIGTRAP
[   31.409720] testsuite-74.sh[560]: + ulimit -c unlimited
[   31.409720] testsuite-74.sh[560]: + pid=561
[   31.409720] testsuite-74.sh[560]: + sleep 1
[   31.409720] testsuite-74.sh[560]: + kill -s SIGTRAP 561
[   31.409720] testsuite-74.sh[560]: + wait 561
[   31.491757] systemd[1]: Created slice system-systemd\x2dcoredump.slice.
[   31.524488] systemd[1]: Started systemd-coredump@0-563-0.service.
[   31.616372] systemd-coredump[564]: [🡕] Process 561 (make-dump) of user 0 dumped core.

                                      Stack trace of thread 561:
                                      #0  0x00007ff86bb49af7 _Fork (libc.so.6 + 0xd4af7)
                                      #1  0x00007ff86bb4965f __libc_fork (libc.so.6 + 0xd465f)
                                      #2  0x000055e88011b0ad make_child (bash + 0x550ad)
                                      #3  0x000055e8800fd05f n/a (bash + 0x3705f)
                                      #4  0x000055e880100116 execute_command_internal (bash + 0x3a116)
                                      #5  0x000055e8801011f2 execute_command_internal (bash + 0x3b1f2)
                                      #6  0x000055e8801025b6 execute_command (bash + 0x3c5b6)
                                      #7  0x000055e8800f134b reader_loop (bash + 0x2b34b)
                                      #8  0x000055e8800e757d main (bash + 0x2157d)
                                      #9  0x00007ff86ba98850 n/a (libc.so.6 + 0x23850)
                                      #10 0x00007ff86ba9890a __libc_start_main (libc.so.6 + 0x2390a)
                                      #11 0x000055e8800e83b5 _start (bash + 0x223b5)
                                      ELF object binary architecture: AMD x86-64
[   31.666617] testsuite-74.sh[560]: /tmp/make-dump: line 12:   561 Trace/breakpoint trap   (core dumped) "$bin" infinity
...
$ coredumpctl list --file system.journal
TIME                         PID UID GID SIG     COREFILE EXE            SIZE
Fri 2023-06-02 10:42:10 CEST 561   0   0 SIGTRAP journal  /usr/bin/bash     -
Fri 2023-06-02 10:42:11 CEST 570   0   0 SIGABRT journal  /tmp/test-dump    -
Fri 2023-06-02 10:42:12 CEST 582   0   0 SIGTRAP missing  /tmp/test-dump    -
Fri 2023-06-02 10:42:13 CEST 593   0   0 SIGABRT missing  /tmp/test-dump    -
2023-06-02 13:24:32 +02:00
Frantisek Sumsal
e8ee168344 test: clean up our mess after the pstore test 2023-06-02 10:07:57 +02:00
Frantisek Sumsal
dee4a9923b test: add a couple of tests for systemd-run 2023-06-01 23:12:47 +02:00
Frantisek Sumsal
6178ced491 test: make the multiple-file test more thorough
Let's check if we keep the old records after multiple systemd-pstore
invocations (i.e. simulate a scenario where we get multiple crashes and
multiple machine reboots).
2023-06-01 20:06:40 +02:00
Frantisek Sumsal
57130ca01b test: make TEST-04 stable once again
Wait a bit if necessary for the cursor file to appear.

Follow-up fb35feae97.
2023-06-01 21:11:21 +09:00
Frantisek Sumsal
4c709f3908 test: skip the test early if we're built without systemd-homed
We check for homed stuff in the test itself, but this is way too late,
since we already started a unit that Requires=systemd-homed.service
(testsuite-46.service). For now this doesn't matter, but with #27852
the offending transaction is dropped from the job queue, making the test
fail.

Spotted in #27852 in Ubuntu CI.
2023-06-01 06:30:45 +09:00
Yu Watanabe
322bda8241
Merge pull request #27826 from yuwata/network-link-ready-without-ndisc-when-has-static-address
network: do not request dynamic addressing protocols finished when at…
2023-06-01 06:29:55 +09:00
Yu Watanabe
2f96a29c2c wait-online: request that at least one managed online interface exists
Fixes a regression caused by ab3aed4a03.

I thought the commit does not cause any severe regression. However,
drivers for network interfaces may be loaded later. So, we should wait
if no network interface is found.

Fixes #27822.
2023-05-31 22:12:03 +02:00
Daan De Meyer
edabe6fc11
Merge pull request #27806 from DaanDeMeyer/fix-mkosi-check
mkosi: Use proper check to detect whether we're in a VM
2023-05-31 15:26:05 +02:00
Daan De Meyer
2533fdd0fb
Merge pull request #27766 from rphibel/cleanup-cgroups-before-cleaning-units
Don't GC unit if it is in cgroup_empty_queue
2023-05-31 14:48:42 +02:00
Daan De Meyer
a0807bdc23 sysv-generator-test: Bump log level to info
Otherwise, non-fatal debug error logs might interfere with the test.
2023-05-31 14:19:25 +02:00
Luca Boccassi
1a7e5c51dc
Merge pull request #27853 from keszybz/various-bits-and-pieces-included-to-reuse-the-ci-run
Various bits and pieces included to reuse the ci run
2023-05-31 11:08:36 +01:00
Luca Boccassi
29084afd91
Merge pull request #27519 from yuwata/journalctl-fixes
journalctl: several fixes and cleanups for --follow
2023-05-31 11:05:54 +01:00
Luca Boccassi
23f315dc08
Merge pull request #27835 from keszybz/test-58-repart-modernization
Cleanup/simplifications for TEST-58-repart
2023-05-31 11:00:18 +01:00
Zbigniew Jędrzejewski-Szmek
088d8c99fe test-fstab-generator: fix test on systemd with systemd-boot
(… or other boot loaders implementing the Boot Loader Interface.)

Fixes #27857.
2023-05-31 10:59:50 +01:00
Zbigniew Jędrzejewski-Szmek
e80444729f tests: drop unnecessary redirection of stderr
command -v doesn't print anything to stderr, let's use the canonical
form with just >/dev/null.
2023-05-30 16:04:35 +02:00
Daan De Meyer
cc11107fd2 test-udev: Skip running in container
Containers generally don't have permission to mknod() which is
required by test-udev so let's skip the test as well if we detect
we're running in a container.
2023-05-30 14:48:38 +02:00
Daan De Meyer
600bf76c17 repart: Allow target directory excludes
Currently, ExcludeFiles= supports excluding directories on the host
from being copied. Let's extend this to also support preventing files
from being copied into specific directories in the partition by adding
a new option ExcludeFilesTarget=. An example where this is useful is
when setting up btrfs subvolumes in the top level that are intended to
be mounted into specific locations, so /usr would be stored in @usr,
/home in @home, .... To accomplish this, we need to copy /usr to @usr
and prevent any files from being copied into /usr in the partition,
which with this commit, we'd be able to do as follows:

```
[Partition]
CopyFiles=/usr:@usr
ExcludeFilesTarget=/usr
```
2023-05-30 13:45:49 +02:00
Yu Watanabe
9e7d91ed97 network: do not request dynamic addressing protocols finished when at least one static address is configured
The setting IPv6AcceptRA= is defaults to yes, hence, even if a .network
file for an interface has static IP address configuration, it may takes
few seconds for the interface being configured state, as NDisc for the
interface needs to be finished. That makes wait-online.service
needlessly slow. Typically, such delay is not necessary for statically
configured networks.

Let's make the required condition slightly relaxed; if a .network file
has static IP address configurations, then let's make the matching
interface enter the 'configured' state soon after the static addresses
configured on the interface.

Note, this does not change the default for IPv6AcceptRA=, hence, NDisc
still runs on interfaces by default. So, addresses, routes, DNS servers,
and so on based on RA will be assigned on interfaces later.

Strictly speaking, this breaks backward compatibility, but the previous
behavior is not clearly documented. If a user requested both static
IPv4 address and IPv6 SLAAC address configured before an interface being
entered to the 'configured' state, then '--ipv6' for wait-online can be
used. So, the behavior change should not cause severe regression.

Closes #27779.
2023-05-30 17:39:11 +09:00
Zbigniew Jędrzejewski-Szmek
730ab2cc23 TEST-58: remove whitespace between redirection operator and its argument 2023-05-30 09:46:20 +02:00
Zbigniew Jędrzejewski-Szmek
1b6f8915f0 TEST-58: add echo calls to print what is happening
This makes it easier to identify the relevant test in the logs when
something fails.
2023-05-30 09:46:20 +02:00
Zbigniew Jędrzejewski-Szmek
dfb3ebfd60 TEST-58: create config files as root
There is really no reason to go out of our way to create the config files as
the unprivileged user. And in the logs, the runas calls are quite verbose,
distracting from the interesting stuff. Also add .defs/.imgs/.root to the
temporary paths to make them easier to distinguish in the logs.
2023-05-30 09:46:20 +02:00
Zbigniew Jędrzejewski-Szmek
b13d59243b test/README: fix advice for testsuite debugging
KERNEL_APPEND="systemd.unit=multi-user.target" is not very useful, because the
machine will still shut down as soon as the tests succeeds or fails. But
INTERACTIVE_DEBUG=1 works great, so let's simplify the instructions and
recommend that.
2023-05-30 09:46:20 +02:00
Richard Phibel
8db998981a core: Don't GC unit if it is in cgroup_empty_queue
The gc_unit_queue is dispatched before the cgroup_empty_queue.  Because
of this, when we enter in on_cgroup_empty_event, the unit in
cgroup_empty_queue may already have been freed and we don't clean up the
corresponding cgroup. With this change, we prevent the unit from being
garbage collected if it is in the cgroup_empty_queue.
2023-05-29 13:26:15 +02:00
Yu Watanabe
80ec3db5c7 journalctl: fix --follow with non-matching filter
When there is no matching entry stored in journal, then initial call of
`sd_journal_previous()` following `sd_journal_seek_tail()` returns
zero, and does not move the read pointer.
In the main loop, on every journal event, we call `sd_journal_next()`,
even though the current location is tail, and it takes no effect.

In such a case, we need to call `sd_journal_previous()` instead of
`sd_journal_next()`.
2023-05-28 23:53:58 +09:00
Yu Watanabe
fb35feae97 test: add testcase for 'journalctl --follow --cursor-file='
Also, add a FIXME comment to illustrate the issue uncovered after by
7a4ee86161.
2023-05-28 14:52:32 +09:00
Frantisek Sumsal
837773add4 Revert "test: add test case for systemd-update-utmp vs daemon-reexec"
Temporarily revert the test case for #27167, as the additional
daemon-reexecs exacerbate #27287, making CIs fail quite often.
As the #27167 is also covered by TEST-01-BASIC itself, since we do
daemon-reexec there anyway, we shouldn't lose any coverage, but it
should make CIs more stable until #27287 is figured out.

Resolves (or more like works around): #27807

This reverts commit d689f70a2c.
2023-05-27 07:57:20 +09:00
Zbigniew Jędrzejewski-Szmek
5287b3a87a
Merge pull request #27746 from yuwata/unit-bidirectional-dep
core/unit: make unit dependency always bidirectional
2023-05-26 16:20:48 +02:00
Zbigniew Jędrzejewski-Szmek
c4f521a91b
Merge pull request #27554 from ElvishJerricco/tmpfiles-c-escapes
tmpfiles: Allow C escapes
2023-05-26 15:42:48 +02:00
Lennart Poettering
0706718c07
Merge pull request #27563 from yuwata/fstab-generator
fstab-generator: support defining mount units through kernel command line
2023-05-26 02:52:19 -07:00
Yu Watanabe
83123a4498 core/unit: search shared namespace in transitive relation of JoinsNamespaceOf=
Previously, dependency chain of JoinsNamespaceOf= did not work, e.g.
- a.service has JoinsNamespaceOf=b.service
- b.service has JoinsNamespaceOf=c.service
if, first c.service, next a.service, finally b.service is started,
then a.service is not joined to the namespace of c.service. And, as
mentioned in the document, the namespace used by b.service is not
deterministic.

This makes when searching exsiting namespace to be joined, all units in
the transitive dependency of JoinsNamespaceOf= are checked.
2023-05-26 15:23:57 +09:00
Will Fancher
4b6621fef3 tmpfiles: Allow C escapes
Fixes #26955
2023-05-26 00:45:54 -04:00
Will Fancher
5f0ee1b635 tmpfiles: Test C-style escape sequences 2023-05-26 00:45:15 -04:00
Frantisek Sumsal
ba79e8c2cc test: split the ASan wrapper into smaller blocks and tidy it up a bit
No functional change (hopefully), just making it easier on the eyes.
2023-05-26 13:43:07 +09:00
Yu Watanabe
a60f96fcf5 core/unit: make JoinsNamespaceOf= implies the inverse dependency
Previously, even if a.service has JoinsNamespaceOf=b.service, the
inverse direction of reference was not introduced.
Hence, a.service is started earlier than b.service, the namespace will
not shared with b.service.
Also, even if a.service had the reference to b.service, b.service did not.
If b.service is freed earlier, then unit_clear_dependencies() does not clear
the reference from a to b, and will cause use-after-free on unit_free() for
a.service.

Let's make JoinsNamespaceOf=b.service in a.service implies the inverse
dependency, i.e. JoinsNamespaceOf=a.service for b.service. Then, we can safely
free b.service.
2023-05-26 11:50:08 +09:00
Yu Watanabe
8493a82d0b test: add tests for JoinsNamespaceOf=
To illustrate the current behavior of the dependency.
2023-05-26 11:50:05 +09:00
Yu Watanabe
d689f70a2c test: add test case for systemd-update-utmp vs daemon-reexec 2023-05-24 20:06:10 +09:00
Yu Watanabe
08bc702b12 test: drop a workaround
Follow-up for 61961e693d.
2023-05-24 20:06:10 +09:00
Yu Watanabe
5f1f05b961
Merge pull request #27740 from dtardon/list-sessions-idle
Show idle status in `loginctl list-sessions`
2023-05-24 20:03:39 +09:00
Luca Boccassi
fe830b84d4
Merge pull request #27761 from yuwata/network-vlan-qos-mapping
network: fix vlan qos mapping
2023-05-24 09:59:41 +01:00
David Tardon
556723e738 loginctl: show session idle status in list-sessions 2023-05-24 10:04:45 +02:00
Yu Watanabe
5c4e96c28c test: rotate journal before storing coredumps
Hopefully fixes the failure like
https://jenkins-systemd.apps.ocp.cloud.ci.centos.org/job/upstream-vagrant-archlinux-sanitizers/2558/
---
[   66.708894] testsuite-74.sh[728]: + coredumpctl --json=off
[   66.709344] testsuite-74.sh[826]: TIME                        PID UID GID SIG     COREFILE EXE             SIZE
[   66.709773] testsuite-74.sh[826]: Tue 2023-05-23 22:10:17 UTC 739   0   0 SIGTRAP journal  /tmp/test-dump     -
[   66.711134] testsuite-74.sh[826]: Tue 2023-05-23 22:10:18 UTC 747   0   0 SIGABRT journal  /tmp/test-dump     -
[   66.711789] testsuite-74.sh[826]: Tue 2023-05-23 22:10:19 UTC 763   0   0 SIGTRAP present  /tmp/test-dump 53.5K
[   66.712460] testsuite-74.sh[826]: Tue 2023-05-23 22:10:20 UTC 776   0   0 SIGABRT present  /tmp/test-dump 53.3K
[   66.713505] testsuite-74.sh[728]: + coredumpctl --root=/
[   66.714144] testsuite-74.sh[828]: TIME                        PID UID GID SIG     COREFILE EXE             SIZE
[   66.714535] testsuite-74.sh[828]: Tue 2023-05-23 22:10:17 UTC 739   0   0 SIGTRAP journal  /tmp/test-dump     -
[   66.715208] testsuite-74.sh[828]: Tue 2023-05-23 22:10:18 UTC 747   0   0 SIGABRT journal  /tmp/test-dump     -
[   66.715907] testsuite-74.sh[828]: Tue 2023-05-23 22:10:19 UTC 763   0   0 SIGTRAP present  /tmp/test-dump 53.5K
[   66.716565] testsuite-74.sh[828]: Tue 2023-05-23 22:10:20 UTC 776   0   0 SIGABRT present  /tmp/test-dump 53.3K
[   66.717494] testsuite-74.sh[728]: + coredumpctl --directory=/var/log/journal
[   66.718188] testsuite-74.sh[830]: TIME                        PID UID GID SIG     COREFILE EXE             SIZE
[   66.882072] testsuite-74.sh[830]: Tue 2023-05-23 22:10:17 UTC 739   0   0 SIGTRAP journal  /tmp/test-dump     -
[   66.882642] testsuite-74.sh[830]: Tue 2023-05-23 22:10:18 UTC 747   0   0 SIGABRT journal  /tmp/test-dump     -
[   66.883450] testsuite-74.sh[830]: Tue 2023-05-23 22:10:19 UTC 763   0   0 SIGTRAP present  /tmp/test-dump 53.5K
[   66.883944] testsuite-74.sh[830]: Tue 2023-05-23 22:10:20 UTC 776   0   0 SIGABRT present  /tmp/test-dump 53.3K
[   66.885448] testsuite-74.sh[728]: + coredumpctl --file=/var/log/journal/2e1ed84be19a4e22adfc99ad849be1f6/system.journal
[   66.885989] testsuite-74.sh[728]: + at_exit
[   66.894162] coredumpctl[833]: No coredumps found.
---
2023-05-24 09:22:13 +02:00
Yu Watanabe
73d24e45f8 test-network: add tests for vlan QoS mapping 2023-05-24 11:15:44 +09:00
Yu Watanabe
93ec924c41 test: add test cases for defining mount and swap units from kernel cmdline 2023-05-24 08:23:22 +09:00
Yu Watanabe
82c29dbee0 test-fstab-generator: add tests for mount options 2023-05-24 08:23:22 +09:00
Yu Watanabe
70bf9f62b9 test-fstab-generator: also check file contents
Since e683878c0f, only filenames are
checked. Let's check contents of generated unit files.
2023-05-24 08:23:22 +09:00
Frantisek Sumsal
909eb4c01d json: correctly handle magic strings when parsing variant strv
We can't dereference the variant object directly, as it might be
a magic object (which has an address on a faulting page); use
json_variant_is_sensitive() instead that handles this case.

For example, with an empty array:

==1547789==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000023 (pc 0x7fd616ca9a18 bp 0x7ffcba1dc7c0 sp 0x7ffcba1dc6d0 T0)
==1547789==The signal is caused by a READ memory access.
==1547789==Hint: address points to the zero page.
SCARINESS: 10 (null-deref)
    #0 0x7fd616ca9a18 in json_variant_strv ../src/shared/json.c:2190
    #1 0x408332 in oci_args ../src/nspawn/nspawn-oci.c:173
    #2 0x7fd616cc09ce in json_dispatch ../src/shared/json.c:4400
    #3 0x40addf in oci_process ../src/nspawn/nspawn-oci.c:428
    #4 0x7fd616cc09ce in json_dispatch ../src/shared/json.c:4400
    #5 0x41fef5 in oci_load ../src/nspawn/nspawn-oci.c:2187
    #6 0x4061e4 in LLVMFuzzerTestOneInput ../src/nspawn/fuzz-nspawn-oci.c:23
    #7 0x40691c in main ../src/fuzz/fuzz-main.c:50
    #8 0x7fd61564a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
    #9 0x7fd61564a5c8 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x275c8)
    #10 0x405da4 in _start (/home/fsumsal/repos/@systemd/systemd/build-san/fuzz-nspawn-oci+0x405da4)

DEDUP_TOKEN: json_variant_strv--oci_args--json_dispatch
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ../src/shared/json.c:2190 in json_variant_strv
==1547789==ABORTING

Or with an empty string in an array:

../src/shared/json.c:2202:39: runtime error: member access within misaligned address 0x000000000007 for type 'struct JsonVariant', which requires 8 byte alignment
0x000000000007: note: pointer points here
<memory cannot be printed>
    #0 0x7f35f4ca9bcf in json_variant_strv ../src/shared/json.c:2202
    #1 0x408332 in oci_args ../src/nspawn/nspawn-oci.c:173
    #2 0x7f35f4cc09ce in json_dispatch ../src/shared/json.c:4400
    #3 0x40addf in oci_process ../src/nspawn/nspawn-oci.c:428
    #4 0x7f35f4cc09ce in json_dispatch ../src/shared/json.c:4400
    #5 0x41fef5 in oci_load ../src/nspawn/nspawn-oci.c:2187
    #6 0x4061e4 in LLVMFuzzerTestOneInput ../src/nspawn/fuzz-nspawn-oci.c:23
    #7 0x40691c in main ../src/fuzz/fuzz-main.c:50
    #8 0x7f35f364a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
    #9 0x7f35f364a5c8 in __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x275c8)
    #10 0x405da4 in _start (/home/fsumsal/repos/@systemd/systemd/build-san/fuzz-nspawn-oci+0x405da4)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/shared/json.c:2202:39 in

Note: this happens only if json_variant_copy() in json_variant_set_source() fails.

Found by Nallocfuzz.
2023-05-23 20:18:21 +02:00
David Tardon
98a155962d test: extend test for loginctl list-* 2023-05-23 09:29:21 +02:00
Luca Boccassi
b1f17f78e3
Merge pull request #27739 from dtardon/test-session-properties
Add a test for org.freedesktop.logind1.Session SetIdleHint
2023-05-22 23:55:25 +01:00
David Tardon
b4ad59596d login: do not hardcode tty used in TEST-35-LOGIN
The test can be run manually outside of CI.
2023-05-22 21:13:15 +02:00
Frantisek Sumsal
7234a2131b test: use run_testcases() in a few more places 2023-05-22 16:02:49 +02:00
Frantisek Sumsal
587ae50d55 test: add a missing session activation
Otherwise test_list_user_sessions() would fail unless ordered after
test_session(), which activates the session.
2023-05-22 16:02:49 +02:00
Frantisek Sumsal
030a516314 test: prefix "internal" stuff with an underscore
Since bash has no namespaces, let's do the second best thing and prefix
all "internal" stuff with an underscore, to minimize the chance of a name
conflict in the future.
2023-05-22 16:02:49 +02:00
Frantisek Sumsal
b60d910d12 test: abstract the test case logic into a shared function 2023-05-22 16:02:49 +02:00
Frantisek Sumsal
7942811255 test: fix a typo in the cleanup stuff 2023-05-22 12:39:47 +02:00
Yu Watanabe
23ff8a776c test: install test specific modules in test_append_files() 2023-05-22 12:40:05 +09:00
Dmitry V. Levin
9e36da1541 udevadm-verify: introduce --no-summary option
When udevadm verify is invoked by an analyzer tool like rpminspect
to verify individual udev rules files, the summary just clutters the
output, so provide an option to turn the summary off.
2023-05-21 23:20:30 +09:00
Mike Yuan
a3d975b240
test: add tests for networkctl edit/cat 2023-05-21 15:55:42 +08:00
Yu Watanabe
b3bd6ccd1e
Merge pull request #27707 from mrc0mmand/tests
test: provide coverage for a couple of recent-ish issues
2023-05-20 08:40:01 +09:00
Yu Watanabe
294c20198b test: replace Makefile for several tests with symlink to the one for TEST-01-BASIC 2023-05-20 05:42:24 +09:00
Yu Watanabe
396f6900ae
Merge pull request #27676 from ldv-alt/udevadm-verify
udevadm-verify: add support for directory arguments
2023-05-20 05:41:05 +09:00
Frantisek Sumsal
a9ec30ab7e test: check if we correctly handle locales with leading spaces
Provides coverage for #27179.
2023-05-19 21:35:47 +02:00
Frantisek Sumsal
305aa43815 tests: run all functions with testcase_ prefix automagically 2023-05-19 20:03:34 +02:00
Frantisek Sumsal
b74df879fc test: check if we correctly handle invalid UTF-8 in mount stuff
Provides coverage for #27611.
2023-05-19 20:03:34 +02:00
Frantisek Sumsal
928733cd86 test: assorted TEST-13-NSPAWN tweaks 2023-05-19 20:03:34 +02:00
Frantisek Sumsal
c11c50a53f test: check if we can use --merge with --follow
Provides coverage for #24565.
2023-05-19 20:03:34 +02:00
Luca Boccassi
d936595672 manager: restrict Dump*() to privileged callers or ratelimit
Dump*() methods can take quite some time due to the amount of data to
serialize, so they can potentially stall the manager. Make them
privileged, as they are debugging tools anyway. Use a new 'dump'
capability for polkit, and the 'reload' capability for SELinux, as
that's also non-destructive but slow.

If the caller is not privileged, allow it but rate limited to 10 calls
every 10 minutes.
2023-05-19 15:18:23 +01:00
Frantisek Sumsal
038efe6df1 test: build the SELinux test module on the host
Let's save some time and build the SELinux test module on the host
instead of a possibly unaccelerated VM. This brings the runtime of
TEST-06-SELINUX from ~12 minutes down to a ~1 minute.
2023-05-19 11:45:11 +02:00
Frantisek Sumsal
daeb95a1d8 test: drop generated stuff from the final coverage report
Let's drop stuff from the current $BUILD_DIR from the final coverage
report, as it's all generated files (mostly gperf) which we don't
really care about and it makes the Coveralls report confusing, since it
reports "source not available" for all such files.
2023-05-19 11:07:07 +02:00
Frantisek Sumsal
ff40235b9b test: make the stress test slightly less stressful on slower machines
Without acceleration this part of the test takes over 10 minutes (!),
which feels quite unnecessary. Let's cut down the number of stuff we
dump to the journal in such case, but keep the original value if we run
with acceleration (since in that case it takes less than 10 seconds).
2023-05-19 10:48:15 +02:00
Yu Watanabe
65f2ff7998
Merge pull request #27685 from keszybz/the-semiannual-excercise-in-output-narrowing
The semiannual excercise in output narrowing
2023-05-19 03:04:47 +09:00
Yu Watanabe
ec0bd9611a
Merge pull request #27684 from mrc0mmand/more-nspawn-tests
test: further extend systemd-nspawn coverage
2023-05-19 03:00:54 +09:00
Dmitry V. Levin
a9802abaee udevadm-verify: add support for directory arguments
When an argument specified to udevadm verify is a directory,
verify all *.rules files in that directory.

Suggested-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2023-05-18 17:00:00 +00:00
Luca Boccassi
8fb26ccd36 integration test: pass 'noresume' to qemu
When running on Debian/Ubuntu, I get a minute delay or so on every boot
because the local initramfs tries to resume from hibernation. This is
not really useful here, so always skip it
2023-05-18 16:45:55 +01:00
Dmitry V. Levin
75390455cb testsuite-17.11.sh: fix assert_1()
Fix assert_1() to exit with an error status in case of a failed assertion.
2023-05-18 15:45:55 +00:00
Frantisek Sumsal
2de77dbfc7 test: wrap setfacl when running with ASan 2023-05-18 17:30:36 +02:00
Zbigniew Jędrzejewski-Szmek
02e0f430a0 meson: rename "dist-check" suite to "dist"
*Now* one of those tests is the longest, let's make them a bit shorter.
2023-05-18 17:18:11 +02:00
Frantisek Sumsal
0d4519dd84 test: don't mount /sys & /proc if already mounted 2023-05-18 16:50:24 +02:00
Frantisek Sumsal
cbd20ab41b test: add a couple of tests for nspawn config files 2023-05-18 16:50:24 +02:00
Frantisek Sumsal
28ed232639 test: create nspawn config files when collecting coverage
Which bind-mounts the $BUILD_DIR into the container. This whole coverage
thing is getting slightly ridiculous.

Follow-up to 3b2823a749, but for non-machinectl containers.
2023-05-18 16:50:24 +02:00
Frantisek Sumsal
d5a6ff8c18 test: cover --bind-user= 2023-05-18 16:50:24 +02:00
Frantisek Sumsal
74696ba5ef test: add a couple of sanity tests for --port= 2023-05-18 16:50:24 +02:00
Frantisek Sumsal
cf260f799f test: drop "check" from test case names 2023-05-18 16:50:24 +02:00
Frantisek Sumsal
f0193b4b63 test: exercise a couple of error paths in nspawn's OCI code as well 2023-05-18 16:50:24 +02:00
Zbigniew Jędrzejewski-Szmek
e2e736cbbd fuzz: rename long samples
With those long filenames, output doesn't fit on the terminal.
2023-05-18 15:23:27 +02:00
Yu Watanabe
f0485be000
Merge pull request #27677 from mrc0mmand/test-followups
test: get rid of the busybox stuff
2023-05-18 17:47:02 +09:00
Frantisek Sumsal
a6dac790c8 test: explicitly use bash
To avoid unexpected surprised in CIs with different default shell.
2023-05-17 23:22:54 +02:00
Frantisek Sumsal
5656759d06 test: get rid of the busybox stuff
It already required a lot of workarounds, since the busybox utilities
often work differently than their "full" counterparts, and putting
the container together using our "tools" is quite simple anyway.
2023-05-17 23:22:54 +02:00
Frantisek Sumsal
c01f0184b9 test: mangle the machine ID only for the QEMU test part
systemd-nspawn doesn't like invalid machine IDs and refuses to boot with one:

TEST-74-AUX-UTILS RUN: Tests for auxiliary utilities
...
Spawning container TEST-74-AUX-UTILS--3 on /var/tmp/systemd-test-TEST-74-AUX-UTILS_3/root.
Press Ctrl-] three times within 1s to kill container.
Failed to read machine ID from container image: Structure needs cleaning
E: nspawn failed with exit code 1

Follow-up to b4d42a82eb.
2023-05-17 15:10:22 +01:00
Frantisek Sumsal
7c6fa5bf16 test: move runas() to the shared utility library 2023-05-16 23:07:45 +02:00
Frantisek Sumsal
e71bac7222 test: make shellcheck happy again
No functional changes.
2023-05-16 23:07:45 +02:00
Frantisek Sumsal
16eb568766 test: merge TEST-48-START-STOP-NO-RELOAD into TEST-23-UNIT-FILE 2023-05-16 23:07:45 +02:00
Frantisek Sumsal
518c3e2722 test: merge TEST-49-RUNTIME-BIND-PATHS into TEST-23-UNIT-FILE 2023-05-16 23:07:45 +02:00
Frantisek Sumsal
ab1b2f22fd test: clean up test artifacts
So we don't run into unexpected fails when two tests use the same paths.
2023-05-16 23:07:45 +02:00