Merge pull request #29628 from mrc0mmand/systemd-executor-test

test: slightly improve sd-executor's coverage
This commit is contained in:
Luca Boccassi
2023-10-19 19:39:39 +01:00
committed by GitHub
3 changed files with 88 additions and 1 deletions
+7 -1
View File
@@ -2255,7 +2255,13 @@ void exec_params_serialized_done(ExecParameters *p) {
p->cgroup_path = mfree(p->cgroup_path);
p->prefix = strv_free(p->prefix);
if (p->prefix) {
for (ExecDirectoryType t = 0; t < _EXEC_DIRECTORY_TYPE_MAX; t++)
free(p->prefix[t]);
p->prefix = mfree(p->prefix);
}
p->received_credentials_directory = mfree(p->received_credentials_directory);
p->received_encrypted_credentials_directory = mfree(p->received_encrypted_credentials_directory);
+74
View File
@@ -0,0 +1,74 @@
exec-context-environment=TERM=linux
exec-context-umask=0022
exec-context-protect-home=no
exec-context-protect-system=no
exec-context-ignore-sigpipe=yes
exec-context-keyring-mode=private
exec-context-protect-proc=default
exec-context-proc-subset=all
exec-context-runtime-directory-preserve-mode=no
exec-context-directories-RuntimeDirectory=0755
exec-context-directories-StateDirectory=0755
exec-context-directories-CacheDirectory=0755
exec-context-directories-LogsDirectory=0755
exec-context-directories-ConfigurationDirectory=0755
exec-context-limit-NOFILE=1024:524288
exec-context-limit-MEMLOCK=8388608
exec-context-std-input=null
exec-context-std-output=journal
exec-context-std-error=inherit
exec-context-stdio-as-fds=yes
exec-context-tty-rows=4294967295
exec-context-tty-columns=4294967295
exec-context-syslog-priority=30
exec-context-syslog-level-prefix=yes
exec-context-log-level-max=-1
exec-context-mount-propagation-flag=0
exec-context-utmp-mode=init
exec-context-syscall-errno=2147483646
exec-context-mount-image=/foo.raw /run/img2:3 root:nosuid
exec-command-path=mount
exec-command-argv=mount
exec-command-flags=0
exec-parameters-runtime-scope=system
exec-parameters-environment=LANG=C.UTF-8
exec-parameters-environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
exec-parameters-flags=13855
exec-parameters-cgroup-supported=1965
exec-parameters-cgroup-path=/system.slice/run-u26.service
exec-parameters-cgroup-id=3376
exec-parameters-prefix-directories-RuntimeDirectory=/run
exec-parameters-prefix-directories-StateDirectory=/var/lib
exec-parameters-prefix-directories-CacheDirectory=/var/cache
exec-parameters-prefix-directories-LogsDirectory=/var/log
exec-parameters-prefix-directories-ConfigurationDirectory=/etc
exec-parameters-stdin-fd=44
exec-parameters-stdout-fd=45
exec-parameters-stderr-fd=63
exec-parameters-user-lookup-fd=65
exec-parameters-unit-id=run-u26.service
exec-parameters-invocation-id-string=fd06144c3fc64436b42b30b2eb8189ee
exec-cgroup-context-cpu-accounting=yes
exec-cgroup-context-memory-accounting=yes
exec-cgroup-context-tasks-accounting=yes
exec-cgroup-context-allowed-cpus=
exec-cgroup-context-startup-allowed-cpus=
exec-cgroup-context-allowed-memory-nodes=
exec-cgroup-context-startup-allowed-memory-nodes=
exec-cgroup-context-tasks-max-value=15
exec-cgroup-context-tasks-max-scale=100
exec-cgroup-context-device-policy=auto
exec-cgroup-context-managed-oom-swap=auto
exec-cgroup-context-managed-oom-memory-pressure=auto
exec-cgroup-context-managed-oom-memory-pressure-limit=0
exec-cgroup-context-managed-oom-preference=none
exec-cgroup-context-memory-pressure-watch=auto
exec-cgroup-context-memory-pressure-threshold-usec=200000
exec-cgroup-context-ip-address-allow-reduced=yes
exec-cgroup-context-ip-address-deny-reduced=yes
+7
View File
@@ -674,4 +674,11 @@ if command -v mksquashfs >/dev/null 2>&1; then
(! test -f /tmp/test-50-confext/etc/waldo )
fi
# Sneak in a couple of expected-to-fail invocations to cover
# https://github.com/systemd/systemd/issues/29610
(! systemd-run -P -p MountImages="/this/should/definitely/not/exist.img:/run/img2\:3:nosuid" false)
(! systemd-run -P -p ExtensionImages="/this/should/definitely/not/exist.img" false)
(! systemd-run -P -p RootImage="/this/should/definitely/not/exist.img" false)
(! systemd-run -P -p ExtensionDirectories="/foo/bar /foo/baz" false)
touch /testok