Skip to content

Commit 0651e71

Browse files
committed
test: test transactions with cycles
Provides coverage for systemd#26872. With systemd#26875 reverted: [16444.287652] testsuite-03.sh[71]: + for i in {0..19} [16444.287652] testsuite-03.sh[71]: + systemctl start transaction-cycle0.service [16444.359503] systemd[1]: ================================================================= [16444.360321] systemd[1]: ==1==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6180002e578e at pc 0x7f73b25ec7a6 bp 0x7ffc5531c6f0 sp 0x7ffc5531be68 [16444.360798] systemd[1]: [16444.361044] systemd[1]: READ of size 783 at 0x6180002e578e thread T0 (systemd) [16444.391684] systemd[1]: #0 0x7f73b25ec7a5 (/lib64/libasan.so.5+0x557a5) [16444.392167] systemd[1]: #1 0x7f73b260a1d5 in __interceptor_vasprintf (/lib64/libasan.so.5+0x731d5) [16444.392442] systemd[1]: #2 0x7f73afa1d1e1 in log_format_iovec ../src/basic/log.c:996 [16444.392750] systemd[1]: #3 0x7f73afa1e7b6 in log_struct_internal ../src/basic/log.c:1058 [16444.393101] systemd[1]: #4 0x7f73b1979136 in transaction_verify_order_one ../src/core/transaction.c:392 [16444.393540] systemd[1]: #5 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463 [16444.393946] systemd[1]: #6 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463 [16444.394262] systemd[1]: #7 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463 [16444.394532] systemd[1]: #8 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463 [16444.394812] systemd[1]: #9 0x7f73b197ac82 in transaction_verify_order_one ../src/core/transaction.c:463 ...
1 parent 88c98cb commit 0651e71

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/units/testsuite-03.sh

+17
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,21 @@ ELAPSED=$((END_SEC-START_SEC))
110110
[[ "$ELAPSED" -ge 3 ]] && [[ "$ELAPSED" -le 5 ]] || exit 1
111111
[[ "$RESULT" -ne 0 ]] || exit 1
112112

113+
# Test transactions with cycles
114+
# Provides coverage for issues like https://github.com/systemd/systemd/issues/26872
115+
for i in {0..19}; do
116+
cat >"/run/systemd/system/transaction-cycle$i.service" <<EOF
117+
[Unit]
118+
After=transaction-cycle$(((i + 1) % 20)).service
119+
Requires=transaction-cycle$(((i + 1) % 20)).service
120+
121+
[Service]
122+
ExecStart=true
123+
EOF
124+
done
125+
systemctl daemon-reload
126+
for i in {0..19}; do
127+
systemctl start "transaction-cycle$i.service"
128+
done
129+
113130
touch /testok

0 commit comments

Comments
 (0)