Commit graph

500 commits

Author SHA1 Message Date
Frantisek Sumsal 033601b79a test: wrap curl when running with ASan
Necessary (unfortunately) for curl on C8S.
2023-06-19 10:19:44 +02:00
Frantisek Sumsal 52db3601bd test: extend the DynamicUser=yes coverage workaround to a couple more services 2023-06-18 23:08:24 +02:00
Frantisek Sumsal 3bba91ef44 test: set $PATH to something predictable in the ASan wrapper
This is still necessary when running with clang's ASan, as it uses an
external binary to symbolize the stack traces.

Follow-up to ba79e8c2cc.
2023-06-15 14:53:32 +01:00
Frantisek Sumsal a6695a431f test: copy file xattrs (if any) as well 2023-06-13 10:15:27 +02:00
Frantisek Sumsal 8e81885531 test: wrap agetty & getfacl when running with sanitizers
The list is getting slightly ridiculous.
2023-06-07 16:26:21 +02:00
Frantisek Sumsal 93b896e90e test: drop $SKIP_INITRD
It's pointless nowadays, since we always need an initrd for the test VMs
as we require modules that are usually not compiled in the kernel.
2023-06-07 15:23:36 +02:00
Frantisek Sumsal 25bc469727 test: rebuild the ldconfig cache after changing its configuration
Follow-up to ba79e8c2cc.
2023-06-07 15:19:44 +02:00
Frantisek Sumsal 6f814d4f5d
Merge pull request #27933 from mrc0mmand/selinux
test: a couple of TEST-06-SELINUX tweaks
2023-06-06 11:18:50 +02:00
Frantisek Sumsal d5ab23aa54 test: a couple of assorted cleanups
- sort binaries
- send stdout/stderr of the autorelabel service to console as well
2023-06-05 23:30:01 +02:00
Frantisek Sumsal 8c0ace5739 test: add a reasoning why we don't use the SELinux-provided units 2023-06-05 22:52:38 +02:00
Yu Watanabe 3db7f3c58c
Merge pull request #27912 from mrc0mmand/cryptsetup-tests
test: add a couple more tests for systemd-cryptsetup
2023-06-06 03:34:59 +09:00
Frantisek Sumsal 71d7f02cc7 test: make check_result_*() set -e friendly 2023-06-05 16:50:13 +02:00
Frantisek Sumsal 00c2676972 test: minor cleanup
No functional change.
2023-06-05 16:50:13 +02:00
Frantisek Sumsal 0334afe4d0 test: make the root/data partition size configurable per test 2023-06-05 16:50:13 +02:00
Frantisek Sumsal 70bdf6e661 test: introduce test_require_bin() and use it
No functional change.
2023-06-05 16:50:13 +02:00
Frantisek Sumsal 18fa5c8283 test: move TPM2-related setup stuff into test-functions
And hide it all behind $TEST_SETUP_SWTPM.
2023-06-05 16:50:13 +02:00
Frantisek Sumsal 0efa27bd4b test: allow running only specified subtests/testcases
Useful when debugging, e.g.:

make -C test/TEST-74-AUX-UTILS clean setup run TEST_MATCH_SUBTEST=run

Resolves: #27914
2023-06-05 15:58:37 +02:00
Frantisek Sumsal dee4a9923b test: add a couple of tests for systemd-run 2023-06-01 23:12:47 +02: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 23ff8a776c test: install test specific modules in test_append_files() 2023-05-22 12:40:05 +09: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
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
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
Frantisek Sumsal 2de77dbfc7 test: wrap setfacl when running with ASan 2023-05-18 17:30:36 +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 d5a6ff8c18 test: cover --bind-user= 2023-05-18 16:50:24 +02:00
Frantisek Sumsal 786f6d81f7 test: pass $BUILD_DIR as $COVERAGE_BUILD_DIR to the system manager
To make additional coverage-related tweaks slightly easier.
2023-05-15 10:06:54 +02:00
Frantisek Sumsal 807626d1ce test: install the overlayfs/loop modules unconditionally 2023-05-14 19:32:07 +02:00
Frantisek Sumsal 3b2823a749 test: bind mount the $BUILD_DIR into nspawn containers
when collecting coverage. This applies only to containers started
via machinectl (or directly via the systemd-nspawn@.service unit).
2023-05-14 19:32:07 +02:00
Frantisek Sumsal ceea144ed8 test: use dropins to override system configuration
Instead of touching the configuration files directly.
2023-05-14 19:32:07 +02:00
Frantisek Sumsal 990b629e12 test: always install the script utility 2023-05-13 00:26:38 +02:00
Frantisek Sumsal 378db9e2b9 test: add a couple of tests for machinectl 2023-05-13 00:26:38 +02:00
Frantisek Sumsal c2df08b5b8 test: clean up the nspawn tests a bit 2023-05-12 18:05:29 +02:00
Zbigniew Jędrzejewski-Szmek 711169905e test: use sed and grep instead of perl
This gets rid of the all-but-one remaining uses of perl. I tested the new code
on my machine, so I'm fairly confident that it works as expected.

install_iscsi() has one majestic perl invocation, but we can't get rid of it
easily: it extends the code of tgt-admin to print some list of files. Obviously
this only works because tgt-admin is written in perl, and perl will be installed
if tgt-admin is installed. install_iscsi() is used in TEST-64-UDEV-STORAGE
conditionally if tgtadm is installed, so this can stay as is.
2023-05-09 08:11:10 +02:00
Frantisek Sumsal 94d82b5980 tree-wide: code spelling fixes
As reported by Fossies.
2023-04-20 21:54:59 +02:00
Frantisek Sumsal e6c281c1cb test: add a couple of tests for getty-generator 2023-04-14 13:54:27 +02:00
Frantisek Sumsal 82929336c7 test: drop binary stripping stuff
Stripping the binaries in the test images makes potential stack straces
quite useless, so let's drop the stripping stuff to make test fails a bit
more developer friendly.

Related: https://github.com/systemd/systemd-centos-ci/pull/616
2023-04-12 10:33:32 +09:00
Yu Watanabe 18a6cd4ba3 test-64: add tests for compat devlinks for NVMe drive 2023-04-08 06:12:29 +09:00
Frantisek Sumsal 61961e693d test: check if we skip the full setup on daemon-reexec
A simple test case for issue #27106.

Resolves: #27139
2023-04-07 07:53:14 +09:00
Thomas Blume d6d0661631 test/test-functions: fix typo in install_suse_systemd() 2023-04-04 20:39:11 +01:00
Frantisek Sumsal 2e4f69946c
Merge pull request #27087 from mrc0mmand/missing-coverage
test: set ReadWritePaths= for test-.services when built w/ coverage
2023-04-01 18:59:42 +02:00
Frantisek Sumsal e660c590a5 test: set ReadWritePaths= for test-.services when built w/ coverage
Let's make the dropin, to make the build dir writable for gcov, a bit
more generic, so it can be used by all units starting with prefix test-.
This should help with a bunch of recent reports about missing coverage I
got, as well as with existing test units using DynamicUser=true.

This might feel a bit like a magic trick from behind the curtains, but I
want to touch the actual tests as little as possible, since it makes them
unnecessarily messy (see the various workarounds for sanitizers), and
the coverage reports are generated only in a specific CI job anyway.
2023-03-31 19:23:31 +02:00
Thomas Blume c7bf1959d7 test: use setpriv instead of su for user switch from root
systemd-repart needs to find mkfs.ext4 for the test.
This is located in the directory /usr/sbin on openSUSE Tumbleweed.
But since the variable ALWAYS_SET_PATH in /etc/login.defs is set to yes,
su re-initializes the $PATH variable and removes /usr/sbin.
Hence, mkfs.ext4 is not found and the test fails.
Using setpriv instead of su fixes this issue and is more appropriate to
do the switch user task from root.

[zjs: move setpriv to $BASICTOOLS and force-push to retrigger CI]
2023-03-31 22:26:44 +08:00
Luca Boccassi 49e8342965 test: do not remove state directory on failure
The test log is in the state directory, and we want to keep it around
when a test fails.

Follow-up for: 256a835f1c
2023-03-29 12:59:02 +09:00
Luca Boccassi e8114a4f86 portable: add PORTABLE_NAME_AND_VERSION= and other metadata to LogsExtraFields=
This is useful to identify log messages with metadata from the images
they run on. Look for ID/VERSION_ID/IMAGE_ID/IMAGE_VERSION/BUILD_ID,
with a SYSEXT_ prefix if we are looking at an extension, and append via
LogExtraFields= as respectively PORTABLE_NAME_AND_VERSION= in case of a
single image. In case of extensions, append as PORTABLE_ROOT_NAME_AND_VERSION=
for the base and one PORTABLE_EXTENSION_AND_VERSION= for each extension.

Example with a base and two extensions, with the unit coming from the
first extension:

[Service]
RootImage=/home/bluca/git/systemd/base.raw
Environment=PORTABLE=app0.raw
BindReadOnlyPaths=/etc/os-release:/run/host/os-release
LogExtraFields=PORTABLE=app0.raw
Environment=PORTABLE_ROOT=base.raw
LogExtraFields=PORTABLE_ROOT=base.raw
LogExtraFields=PORTABLE_ROOT_NAME_AND_VERSION=debian_10

ExtensionImages=/home/bluca/git/systemd/app0.raw
LogExtraFields=PORTABLE_EXTENSION=app0.raw
LogExtraFields=PORTABLE_EXTENSION_NAME_AND_VERSION=app_0

ExtensionImages=/home/bluca/git/systemd/app1.raw
LogExtraFields=PORTABLE_EXTENSION=app1.raw
LogExtraFields=PORTABLE_EXTENSION_NAME_AND_VERSION=app_1
2023-03-28 12:14:21 +01:00
Franck Bui 04ef5d1bd7 test: don't export $TOOLS_DIR
It's not (and shouldn't be) used by any test scripts.
2023-03-27 17:20:18 +02:00
Franck Bui 256a835f1c test: clean up $STATEDIR too 2023-03-27 17:20:18 +02:00
Franck Bui 0c566150c8 test: $STATEDIR should not point to /usr/lib/systemd/tests when NO_BUILD=1
When testing the binaries from the host, make sure to not store the state data
below /usr but use a dedicated directory in /var/tmp/ instead.

The working directories of the tests, initially located in /var/tmp, are also
moved in a dedicated directory /var/tmp/systemd-tests.
2023-03-27 17:20:15 +02:00
Luca Boccassi 8e1a129136
Merge pull request #26870 from fbuihuu/move-unit-tests-in-a-dedicated-subdir
Move unit tests in a dedicated subdir
2023-03-27 09:38:15 +01:00