Merge pull request #34591 from teknoraver/timer

timer: introduce DeferReactivation setting
This commit is contained in:
Yu Watanabe
2024-10-12 08:12:38 +09:00
committed by GitHub
14 changed files with 97 additions and 8 deletions
@@ -0,0 +1,6 @@
[Unit]
Description=Testing systemd timers
[Service]
Type=simple
ExecStart=sh -c 'date +%%s >>/tmp/realtime-test.log ; sleep 5'
@@ -0,0 +1,10 @@
[Unit]
Description=Testing systemd timers
[Timer]
OnCalendar=*:*:0/5
AccuracySec=1us
DeferReactivation=true
[Install]
WantedBy=timers.target
+2
View File
@@ -7,3 +7,5 @@ integration_tests += [
'vm' : true,
},
]
testdata_subdirs += [meson.current_source_dir() / 'TEST-74-AUX-UTILS.units']
@@ -7,6 +7,7 @@ AllowedCPUs=
AllowedMemoryNodes=
AllowIsolate=
Also=
DeferReactivation=
AmbientCapabilities=
AssertACPower=
AssertArchitecture=
@@ -33,6 +33,7 @@ Persistent=true
AccuracySec=24h
RandomizedDelaySec=234234234
FixedRandomDelay=true
DeferReactivation=true
Persistent=no
Unit=foo.service
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: LGPL-2.1-or-later
set -eux
set -o pipefail
systemctl start realtime-test.timer
sleep 35
mindelta=10
last=
while read -r time; do
if [ -n "$last" ]; then
delta=$((time - last))
if [ "$delta" -lt $mindelta ]; then
echo "Timer fired too early: $delta < $mindelta" >/failed
break
fi
fi
last=$time
done </tmp/realtime-test.log
test ! -s /failed