mirror of
https://github.com/systemd/systemd.git
synced 2025-02-08 09:57:41 +03:00
test: bump the reattach
timeout when running w/ plain QEMU
As it might sometimes take slightly longer without the acceleration: ``` [ 176.805681] testsuite-29.sh[534]: + cp /usr/share/app1.raw /tmp/app1_2.raw [ 176.885365] testsuite-29.sh[534]: + timeout 30 portablectl reattach --now --runtime --extension /tmp/app1_2.raw /usr/share/minimal_1.raw app1 [ 177.053358] portablectl[993]: (Matching unit files with prefixes 'app1'.) [ 177.138770] kernel: loop0: detected capacity change from 0 to 2965504 [ 177.343137] kernel: loop1: detected capacity change from 0 to 4096 ... [ 201.932062] systemd[1]: app1.service: Deactivated successfully. [ 202.009310] systemd[1]: Stopped app1.service. [ 202.053776] systemd[1]: app1.service: Consumed 2.183s CPU time. [ 202.125061] systemd[1]: Stopping app1.service... [ 202.611760] systemd[1]: Starting modprobe@dm_mod.service... [ 202.851031] systemd[1]: Starting modprobe@dm_verity.service... [ 202.909352] systemd[1]: Starting modprobe@loop.service... [ 203.198918] systemd[1]: Starting app1.service... [ 207.145494] kernel: audit: type=1130 audit(1663770336.105:428): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=kernel msg='unit=testsuite-29 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed' [ 207.652545] systemd[1]: testsuite-29.service: Main process exited, code=exited, status=124/n/a [ 207.665088] systemd[1]: testsuite-29.service: Failed with result 'exit-code'. [ 207.830522] systemd[1]: Failed to start testsuite-29.service. ... [ 208.889449] script1.sh[1035]: ID="centos" [ 208.889449] script1.sh[1035]: VERSION_ID="8" [ 208.889449] script1.sh[1035]: SYSEXT_SCOPE=portable [ 208.889449] script1.sh[1035]: PORTABLE_PREFIXES=app1 ... [ 214.155097] systemd[1]: app1.service: Deactivated successfully. ``` Spotted in Ubuntu CI and CentOS CI. Follow-up to 706c9a30ac.
This commit is contained in:
parent
957dfcc96d
commit
fa21a2cf9f
@ -20,14 +20,16 @@ export SYSTEMD_DISSECT_VERITY_TIMEOUT_SEC=30
|
||||
udevadm control --log-level debug
|
||||
|
||||
ARGS=()
|
||||
state_directory=/var/lib/private/
|
||||
STATE_DIRECTORY=/var/lib/private/
|
||||
if [[ -v ASAN_OPTIONS || -v UBSAN_OPTIONS ]]; then
|
||||
# If we're running under sanitizers, we need to use a less restrictive
|
||||
# profile, otherwise LSan syscall would get blocked by seccomp
|
||||
ARGS+=(--profile=trusted)
|
||||
# With the trusted profile DynamicUser is disabled, so the storage is not in private/
|
||||
state_directory=/var/lib/
|
||||
STATE_DIRECTORY=/var/lib/
|
||||
fi
|
||||
# Bump the timeout if we're running with plain QEMU
|
||||
[[ "$(systemd-detect-virt -v)" == "qemu" ]] && TIMEOUT=60 || TIMEOUT=30
|
||||
|
||||
systemd-dissect --no-pager /usr/share/minimal_0.raw | grep -q '✓ portable service'
|
||||
systemd-dissect --no-pager /usr/share/minimal_1.raw | grep -q '✓ portable service'
|
||||
@ -49,7 +51,7 @@ systemctl is-active minimal-app0-bar.service && exit 1
|
||||
|
||||
# Running with sanitizers may freeze the invoked service. See issue #24147.
|
||||
# Let's set timeout to improve performance.
|
||||
timeout 30 portablectl "${ARGS[@]}" reattach --now --runtime /usr/share/minimal_1.raw minimal-app0
|
||||
timeout "$TIMEOUT" portablectl "${ARGS[@]}" reattach --now --runtime /usr/share/minimal_1.raw minimal-app0
|
||||
|
||||
systemctl is-active minimal-app0.service
|
||||
systemctl is-active minimal-app0-bar.service
|
||||
@ -74,7 +76,7 @@ systemctl is-active minimal-app0.service
|
||||
systemctl is-active minimal-app0-foo.service
|
||||
systemctl is-active minimal-app0-bar.service && exit 1
|
||||
|
||||
timeout 30 portablectl "${ARGS[@]}" reattach --now --enable --runtime /tmp/minimal_1 minimal-app0
|
||||
timeout "$TIMEOUT" portablectl "${ARGS[@]}" reattach --now --enable --runtime /tmp/minimal_1 minimal-app0
|
||||
|
||||
systemctl is-active minimal-app0.service
|
||||
systemctl is-active minimal-app0-bar.service
|
||||
@ -94,7 +96,7 @@ systemctl is-active app0.service
|
||||
status="$(portablectl is-attached --extension app0 minimal_0)"
|
||||
[[ "${status}" == "running-runtime" ]]
|
||||
|
||||
timeout 30 portablectl "${ARGS[@]}" reattach --now --runtime --extension /usr/share/app0.raw /usr/share/minimal_1.raw app0
|
||||
timeout "$TIMEOUT" portablectl "${ARGS[@]}" reattach --now --runtime --extension /usr/share/app0.raw /usr/share/minimal_1.raw app0
|
||||
|
||||
systemctl is-active app0.service
|
||||
status="$(portablectl is-attached --extension app0 minimal_1)"
|
||||
@ -110,13 +112,13 @@ status="$(portablectl is-attached --extension app1 minimal_0)"
|
||||
|
||||
# Ensure that adding or removing a version to the image doesn't break reattaching
|
||||
cp /usr/share/app1.raw /tmp/app1_2.raw
|
||||
timeout 30 portablectl "${ARGS[@]}" reattach --now --runtime --extension /tmp/app1_2.raw /usr/share/minimal_1.raw app1
|
||||
timeout "$TIMEOUT" portablectl "${ARGS[@]}" reattach --now --runtime --extension /tmp/app1_2.raw /usr/share/minimal_1.raw app1
|
||||
|
||||
systemctl is-active app1.service
|
||||
status="$(portablectl is-attached --extension app1_2 minimal_1)"
|
||||
[[ "${status}" == "running-runtime" ]]
|
||||
|
||||
timeout 30 portablectl "${ARGS[@]}" reattach --now --runtime --extension /usr/share/app1.raw /usr/share/minimal_1.raw app1
|
||||
timeout "$TIMEOUT" portablectl "${ARGS[@]}" reattach --now --runtime --extension /usr/share/app1.raw /usr/share/minimal_1.raw app1
|
||||
|
||||
systemctl is-active app1.service
|
||||
status="$(portablectl is-attached --extension app1 minimal_1)"
|
||||
@ -127,8 +129,8 @@ portablectl detach --now --runtime --extension /usr/share/app1.raw /usr/share/mi
|
||||
# Ensure that the combination of read-only images, state directory and dynamic user works, and that
|
||||
# state is retained. Check after detaching, as on slow systems (eg: sanitizers) it might take a while
|
||||
# after the service is attached before the file appears.
|
||||
grep -q -F bar "${state_directory}/app0/foo"
|
||||
grep -q -F baz "${state_directory}/app1/foo"
|
||||
grep -q -F bar "${STATE_DIRECTORY}/app0/foo"
|
||||
grep -q -F baz "${STATE_DIRECTORY}/app1/foo"
|
||||
|
||||
# portablectl also works with directory paths rather than images
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user