Systemd/test/meson.build

288 lines
12 KiB
Meson
Raw Normal View History

# SPDX-License-Identifier: LGPL-2.1+
test_data_files = '''
a.service
a-conj.service
b.service
basic.target
c.service
d.service
daughter.service
cgroup: Implement default propagation of MemoryLow with DefaultMemoryLow In cgroup v2 we have protection tunables -- currently MemoryLow and MemoryMin (there will be more in future for other resources, too). The design of these protection tunables requires not only intermediate cgroups to propagate protections, but also the units at the leaf of that resource's operation to accept it (by setting MemoryLow or MemoryMin). This makes sense from an low-level API design perspective, but it's a good idea to also have a higher-level abstraction that can, by default, propagate these resources to children recursively. In this patch, this happens by having descendants set memory.low to N if their ancestor has DefaultMemoryLow=N -- assuming they don't set a separate MemoryLow value. Any affected unit can opt out of this propagation by manually setting `MemoryLow` to some value in its unit configuration. A unit can also stop further propagation by setting `DefaultMemoryLow=` with no argument. This removes further propagation in the subtree, but has no effect on the unit itself (for that, use `MemoryLow=0`). Our use case in production is simplifying the configuration of machines which heavily rely on memory protection tunables, but currently require tweaking a huge number of unit files to make that a reality. This directive makes that significantly less fragile, and decreases the risk of misconfiguration. After this patch is merged, I will implement DefaultMemoryMin= using the same principles.
2019-03-28 13:50:50 +01:00
dml.slice
dml-passthrough.slice
dml-passthrough-empty.service
dml-passthrough-set-dml.service
dml-passthrough-set-ml.service
dml-override.slice
dml-override-empty.service
dml-discard.slice
dml-discard-empty.service
dml-discard-set-ml.service
e.service
end.service
f.service
g.service
grandchild.service
h.service
hello-after-sleep.target
hello.service
hwdb/10-bad.hwdb
i.service
journal-data/journal-1.txt
journal-data/journal-2.txt
cgroup: Add DisableControllers= directive to disable controller in subtree Some controllers (like the CPU controller) have a performance cost that is non-trivial on certain workloads. While this can be mitigated and improved to an extent, there will for some controllers always be some overheads associated with the benefits gained from the controller. Inside Facebook, the fix applied has been to disable the CPU controller forcibly with `cgroup_disable=cpu` on the kernel command line. This presents a problem: to disable or reenable the controller, a reboot is required, but this is quite cumbersome and slow to do for many thousands of machines, especially machines where disabling/enabling a stateful service on a machine is a matter of several minutes. Currently systemd provides some configuration knobs for these in the form of `[Default]CPUAccounting`, `[Default]MemoryAccounting`, and the like. The limitation of these is that Default*Accounting is overrideable by individual services, of which any one could decide to reenable a controller within the hierarchy at any point just by using a controller feature implicitly (eg. `CPUWeight`), even if the use of that CPU feature could just be opportunistic. Since many services are provided by the distribution, or by upstream teams at a particular organisation, it's not a sustainable solution to simply try to find and remove offending directives from these units. This commit presents a more direct solution -- a DisableControllers= directive that forcibly disallows a controller from being enabled within a subtree.
2018-12-03 15:38:06 +01:00
nomem.slice
nomemleaf.service
parent-deep.slice
parent.slice
sched_idle_bad.service
sched_idle_ok.service
sched_rr_bad.service
sched_rr_change.service
sched_rr_ok.service
shutdown.target
sleep.service
sockets.target
son.service
sysinit.target
test-execute/exec-basic.service
test-execute/exec-ambientcapabilities-merge-nfsnobody.service
test-execute/exec-ambientcapabilities-merge-nobody.service
test-execute/exec-ambientcapabilities-merge.service
test-execute/exec-ambientcapabilities-nfsnobody.service
test-execute/exec-ambientcapabilities-nobody.service
test-execute/exec-ambientcapabilities.service
test-execute/exec-bindpaths.service
test-execute/exec-capabilityboundingset-invert.service
test-execute/exec-capabilityboundingset-merge.service
test-execute/exec-capabilityboundingset-reset.service
test-execute/exec-capabilityboundingset-simple.service
test-execute/exec-condition-failed.service
test-execute/exec-condition-skip.service
test-execute/exec-cpuaffinity1.service
test-execute/exec-cpuaffinity2.service
test-execute/exec-cpuaffinity3.service
test-execute/exec-dynamicuser-fixeduser-adm.service
test-execute/exec-dynamicuser-fixeduser-games.service
test-execute/exec-dynamicuser-fixeduser-one-supplementarygroup.service
test-execute/exec-dynamicuser-fixeduser.service
test-execute/exec-dynamicuser-statedir-migrate-step1.service
test-execute/exec-dynamicuser-statedir-migrate-step2.service
test-execute/exec-dynamicuser-statedir.service
test-execute/exec-dynamicuser-supplementarygroups.service
test-execute/exec-environment-no-substitute.service
test-execute/exec-environment-empty.service
test-execute/exec-environment-multiple.service
test-execute/exec-environment.service
test-execute/exec-environmentfile.service
test-execute/exec-group-nfsnobody.service
test-execute/exec-group-nobody.service
test-execute/exec-group-nogroup.service
test-execute/exec-group.service
test-execute/exec-ignoresigpipe-no.service
test-execute/exec-ignoresigpipe-yes.service
test-execute/exec-inaccessiblepaths-mount-propagation.service
test-execute/exec-inaccessiblepaths-sys.service
test-execute/exec-ioschedulingclass-best-effort.service
test-execute/exec-ioschedulingclass-idle.service
test-execute/exec-ioschedulingclass-none.service
test-execute/exec-ioschedulingclass-realtime.service
test-execute/exec-oomscoreadjust-negative.service
test-execute/exec-oomscoreadjust-positive.service
test-execute/exec-passenvironment-absent.service
test-execute/exec-passenvironment-empty.service
test-execute/exec-passenvironment-repeated.service
test-execute/exec-passenvironment.service
test-execute/exec-personality-aarch64.service
test-execute/exec-personality-ppc64.service
test-execute/exec-personality-ppc64le.service
test-execute/exec-personality-s390.service
test-execute/exec-personality-x86-64.service
test-execute/exec-personality-x86.service
test-execute/exec-privatedevices-disabled-by-prefix.service
test-execute/exec-privatedevices-no-capability-mknod.service
test-execute/exec-privatedevices-no-capability-sys-rawio.service
test-execute/exec-privatedevices-no.service
test-execute/exec-privatedevices-yes-capability-mknod.service
test-execute/exec-privatedevices-yes-capability-sys-rawio.service
test-execute/exec-privatedevices-yes.service
test-execute/exec-privatenetwork-yes.service
test-execute/exec-privatetmp-no.service
test-execute/exec-privatetmp-yes.service
test-execute/exec-protecthome-tmpfs-vs-protectsystem-strict.service
test-execute/exec-protectkernelmodules-no-capabilities.service
test-execute/exec-protectkernelmodules-yes-capabilities.service
test-execute/exec-protectkernelmodules-yes-mount-propagation.service
test-execute/exec-readonlypaths-mount-propagation.service
test-execute/exec-readonlypaths-simple.service
test-execute/exec-readonlypaths-with-bindpaths.service
test-execute/exec-readonlypaths.service
test-execute/exec-readwritepaths-mount-propagation.service
test-execute/exec-restrictnamespaces-merge-all.service
test-execute/exec-restrictnamespaces-merge-and.service
test-execute/exec-restrictnamespaces-merge-or.service
test-execute/exec-restrictnamespaces-mnt-blacklist.service
test-execute/exec-restrictnamespaces-mnt.service
test-execute/exec-restrictnamespaces-no.service
test-execute/exec-restrictnamespaces-yes.service
test-execute/exec-runtimedirectory-mode.service
test-execute/exec-runtimedirectory-owner-nfsnobody.service
test-execute/exec-runtimedirectory-owner-nobody.service
test-execute/exec-runtimedirectory-owner-nogroup.service
test-execute/exec-runtimedirectory-owner.service
test-execute/exec-runtimedirectory.service
test-execute/exec-specifier-interpolation.service
test-execute/exec-specifier.service
test-execute/exec-specifier@.service
test-execute/exec-standardinput-data.service
test-execute/exec-standardinput-file.service
test-execute/exec-standardoutput-file.service
test-execute/exec-standardoutput-append.service
test-execute/exec-supplementarygroups-multiple-groups-default-group-user.service
test-execute/exec-supplementarygroups-multiple-groups-withgid.service
test-execute/exec-supplementarygroups-multiple-groups-withuid.service
test-execute/exec-supplementarygroups-single-group-user.service
test-execute/exec-supplementarygroups-single-group.service
test-execute/exec-supplementarygroups.service
test-execute/exec-systemcallerrornumber-name.service
test-execute/exec-systemcallerrornumber-number.service
test-execute/exec-systemcallfilter-failing.service
test-execute/exec-systemcallfilter-failing2.service
test-execute/exec-systemcallfilter-not-failing.service
test-execute/exec-systemcallfilter-not-failing2.service
test-execute/exec-systemcallfilter-system-user-nfsnobody.service
test-execute/exec-systemcallfilter-system-user-nobody.service
test-execute/exec-systemcallfilter-system-user.service
test-execute/exec-systemcallfilter-with-errno-multi.service
test-execute/exec-systemcallfilter-with-errno-name.service
test-execute/exec-systemcallfilter-with-errno-number.service
test-execute/exec-temporaryfilesystem-options.service
test-execute/exec-temporaryfilesystem-ro.service
test-execute/exec-temporaryfilesystem-rw.service
test-execute/exec-temporaryfilesystem-usr.service
test-execute/exec-umask-0177.service
test-execute/exec-umask-default.service
test-execute/exec-unsetenvironment.service
test-execute/exec-user-nfsnobody.service
test-execute/exec-user-nobody.service
test-execute/exec-user.service
test-execute/exec-workingdirectory.service
test-execute/exec-workingdirectory-trailing-dot.service
test-path/basic.target
test-path/path-changed.path
test-path/path-changed.service
test-path/path-directorynotempty.path
test-path/path-directorynotempty.service
test-path/path-exists.path
test-path/path-exists.service
test-path/path-existsglob.path
test-path/path-existsglob.service
test-path/path-makedirectory.path
test-path/path-makedirectory.service
test-path/path-modified.path
test-path/path-modified.service
test-path/path-mycustomunit.service
test-path/path-service.service
test-path/path-unit.path
test-path/paths.target
test-path/sysinit.target
test-umount/empty.mountinfo
2018-03-21 19:55:54 +01:00
test-umount/example.swaps
test-umount/garbled.mountinfo
test-umount/rhbug-1554943.mountinfo
2018-03-21 19:55:54 +01:00
testsuite.target
timers.target
unit-with-.service.d/20-override.conf
unit-with-multiple-.service.d/20-override.conf
unit-with-multiple-.service.d/30-override.conf
unit-with-multiple-dashes.service
unit-with-multiple-dashes.service.d/10-override.conf
unstoppable.service
'''.split()
if conf.get('ENABLE_RESOLVE') == 1
test_data_files += '''
test-resolve/_openpgpkey.fedoraproject.org.pkts
test-resolve/fedoraproject.org.pkts
test-resolve/gandi.net.pkts
test-resolve/google.com.pkts
test-resolve/root.pkts
test-resolve/sw1a1aa-sw1a2aa-sw1a2ab-sw1a2ac.find.me.uk.pkts
test-resolve/teamits.com.pkts
test-resolve/zbyszek@fedoraproject.org.pkts
test-resolve/_443._tcp.fedoraproject.org.pkts
test-resolve/kyhwana.org.pkts
test-resolve/fake-caa.pkts
'''.split()
endif
if install_tests
foreach file : test_data_files
subdir = file.split('/')[0]
if subdir == file
subdir = ''
endif
install_data(file,
install_dir : testsdir + '/testdata/' + subdir)
endforeach
endif
2017-07-14 01:21:40 +02:00
############################################################
meson: re-attach rule-syntax-check.py test 39/248 rule-syntax-check OK 0.07 s --- command --- /home/zbyszek/src/systemd-work/test/rule-syntax-check.py \ /home/zbyszek/src/systemd-work/build/../rules/60-block.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-cdrom_id.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-drm.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-evdev.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-input-id.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-alsa.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-input.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-storage.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-storage-tape.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-v4l.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-sensor.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-serial.rules \ /home/zbyszek/src/systemd-work/build/../rules/70-joystick.rules \ /home/zbyszek/src/systemd-work/build/../rules/70-mouse.rules \ /home/zbyszek/src/systemd-work/build/../rules/70-touchpad.rules \ /home/zbyszek/src/systemd-work/build/../rules/75-net-description.rules \ /home/zbyszek/src/systemd-work/build/../rules/75-probe_mtd.rules \ /home/zbyszek/src/systemd-work/build/../rules/78-sound-card.rules \ /home/zbyszek/src/systemd-work/build/../rules/80-drivers.rules \ /home/zbyszek/src/systemd-work/build/../rules/80-net-setup-link.rules \ /home/zbyszek/src/systemd-work/build/rules/50-udev-default.rules \ /home/zbyszek/src/systemd-work/build/rules/64-btrfs.rules \ /home/zbyszek/src/systemd-work/build/rules/99-systemd.rules --- stdout --- ... ------- It got dropped by mistake in 72cdb3e783174dcf9223a49f03e3b0e2ca95ddb8.
2017-11-22 12:42:28 +01:00
rule_syntax_check_py = find_program('rule-syntax-check.py')
if want_tests != 'false'
test('rule-syntax-check',
rule_syntax_check_py,
args : all_rules)
endif
meson: re-attach rule-syntax-check.py test 39/248 rule-syntax-check OK 0.07 s --- command --- /home/zbyszek/src/systemd-work/test/rule-syntax-check.py \ /home/zbyszek/src/systemd-work/build/../rules/60-block.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-cdrom_id.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-drm.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-evdev.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-input-id.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-alsa.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-input.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-storage.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-storage-tape.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-persistent-v4l.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-sensor.rules \ /home/zbyszek/src/systemd-work/build/../rules/60-serial.rules \ /home/zbyszek/src/systemd-work/build/../rules/70-joystick.rules \ /home/zbyszek/src/systemd-work/build/../rules/70-mouse.rules \ /home/zbyszek/src/systemd-work/build/../rules/70-touchpad.rules \ /home/zbyszek/src/systemd-work/build/../rules/75-net-description.rules \ /home/zbyszek/src/systemd-work/build/../rules/75-probe_mtd.rules \ /home/zbyszek/src/systemd-work/build/../rules/78-sound-card.rules \ /home/zbyszek/src/systemd-work/build/../rules/80-drivers.rules \ /home/zbyszek/src/systemd-work/build/../rules/80-net-setup-link.rules \ /home/zbyszek/src/systemd-work/build/rules/50-udev-default.rules \ /home/zbyszek/src/systemd-work/build/rules/64-btrfs.rules \ /home/zbyszek/src/systemd-work/build/rules/99-systemd.rules --- stdout --- ... ------- It got dropped by mistake in 72cdb3e783174dcf9223a49f03e3b0e2ca95ddb8.
2017-11-22 12:42:28 +01:00
############################################################
if conf.get('HAVE_SYSV_COMPAT') == 1
sysv_generator_test_py = find_program('sysv-generator-test.py')
if want_tests != 'false'
test('sysv-generator-test',
sysv_generator_test_py)
endif
endif
############################################################
tests: add a runner for installed tests We have "installed tests", but don't provide an easy way to run them. The protocol is very simple: each test must return 0 for success, 77 means "skipped", anything else is an error. In addition, we want to print test output only if the test failed. I wrote this simple script. It is pretty basic, but implements the functions listed above. Since it is written in python it should be easy to add option parsing (like running only specific tests, or running unsafe tests, etc.) I looked at the following alternatives: - Ubuntu root-unittests: this works, but just dumps all output to the terminal, has no coloring. - @ssahani's test runner [2] It uses the unittest library and the test suite was implented as a class, and doesn't implement any of the functions listed above. - cram [3,4] cram runs our tests, but does not understand the "ignore the output" part, has not support for our magic skip code (it uses hardcoded 80 instead), and seems dead upstream. - meson test Here the idea would be to provide an almost-empty meson.build file under /usr/lib/systemd/tests/ that would just define all the tests. This would allow us to reuse the test runner we use normally. Unfortunately meson requires a build directory and configuration to be done before running tests. This would be possible, but seems a lot of effort to just run a few binaries. [1] https://salsa.debian.org/systemd-team/systemd/blob/242c96addb06480ec9cd75248a5660f37a17b4b9/debian/tests/root-unittests [2] https://github.com/systemd/systemd-fedora-ci/blob/master/upstream/systemd-upstream-tests.py [3] https://bitheap.org/cram/ [4] https://pypi.org/project/pytest-cram/ Fixes #10069.
2018-09-20 16:34:14 +02:00
if install_tests
install_data('run-unit-tests.py',
install_mode : 'rwxr-xr-x',
install_dir : testsdir)
endif
############################################################
# prepare test/sys tree
sys_script_py = find_program('sys-script.py')
custom_target(
'sys',
command : [sys_script_py, meson.current_build_dir()],
output : 'sys',
build_by_default : want_tests != 'false')
if perl.found()
udev_test_pl = find_program('udev-test.pl')
if want_tests != 'false'
test('udev-test',
udev_test_pl,
timeout : 180)
endif
else
message('Skipping udev-test because perl is not available')
endif
if conf.get('ENABLE_HWDB') == 1
hwdb_test_sh = find_program('hwdb-test.sh')
if want_tests != 'false'
test('hwdb-test',
hwdb_test_sh,
timeout : 90)
endif
endif
fuzz: unify the "fuzz-regressions" directory with the main corpus There isn't really much need to keep them separate. Anything which is a good corpus entry can be used as a smoke test, and anything which which is a regression test can just as well be inserted into the corpus. The only functional difference from this patch (apart from different paths in output) is that the regression tests are now zipped together with the rest of the corpus. $ meson configure build -Dslow-tests=true && ninja -C build test ... 307/325 fuzz-dns-packet:issue-7888:address OK 0.06 s 308/325 fuzz-dns-packet:oss-fuzz-5465:address OK 0.04 s 309/325 fuzz-journal-remote:crash-5a8f03d4c3a46fcded39527084f437e8e4b54b76:address OK 0.07 s 310/325 fuzz-journal-remote:crash-96dee870ea66d03e89ac321eee28ea63a9b9aa45:address OK 0.05 s 311/325 fuzz-journal-remote:oss-fuzz-8659:address OK 0.05 s 312/325 fuzz-journal-remote:oss-fuzz-8686:address OK 0.07 s 313/325 fuzz-unit-file:oss-fuzz-6884:address OK 0.06 s 314/325 fuzz-unit-file:oss-fuzz-6885:address OK 0.05 s 315/325 fuzz-unit-file:oss-fuzz-6886:address OK 0.05 s 316/325 fuzz-unit-file:oss-fuzz-6892:address OK 0.05 s 317/325 fuzz-unit-file:oss-fuzz-6897:address OK 0.05 s 318/325 fuzz-unit-file:oss-fuzz-6897-evverx:address OK 0.06 s 319/325 fuzz-unit-file:oss-fuzz-6908:address OK 0.07 s 320/325 fuzz-unit-file:oss-fuzz-6917:address OK 0.07 s 321/325 fuzz-unit-file:oss-fuzz-6977:address OK 0.13 s 322/325 fuzz-unit-file:oss-fuzz-6977-unminimized:address OK 0.12 s 323/325 fuzz-unit-file:oss-fuzz-7004:address OK 0.05 s 324/325 fuzz-unit-file:oss-fuzz-8064:address OK 0.05 s 325/325 fuzz-unit-file:oss-fuzz-8827:address OK 0.52 s
2018-07-07 18:09:21 +02:00
subdir('fuzz')