Couple of test fixes (#42185)

This commit is contained in:
Yu Watanabe
2026-05-20 10:15:01 +09:00
committed by GitHub
4 changed files with 13 additions and 19 deletions

View File

@@ -7,7 +7,6 @@ Description=Create a lot of memory pressure
# to throttle and be put under heavy pressure.
MemoryHigh=3M
Slice=TEST-55-OOMD-workload.slice
# Pin --vm-method to a portable method (zero-one): the default 'all' cycles
# through methods, including newer ones using AVX-512 instructions that SIGILL
# on CPUs without AVX-512 (e.g. AMD Zen 1-3), making the test flaky.
ExecStart=stress-ng --timeout 3m --vm 10 --vm-bytes 200M --vm-keep --vm-method=zero-one
# Pin --vm-method=lfsr32: the only stress-ng vm method without TARGET_CLONES,
# so it can't dispatch to an AVX-512 clone and SIGILL on CPUs lacking it.
ExecStart=stress-ng --timeout 3m --vm 10 --vm-bytes 200M --vm-keep --vm-method=lfsr32

View File

@@ -5,7 +5,6 @@ Description=Create some memory pressure
[Service]
MemoryHigh=12M
Slice=TEST-55-OOMD-workload.slice
# Pin --vm-method to a portable method (zero-one): the default 'all' cycles
# through methods, including newer ones using AVX-512 instructions that SIGILL
# on CPUs without AVX-512 (e.g. AMD Zen 1-3), making the test flaky.
ExecStart=stress-ng --timeout 3m --vm 10 --vm-bytes 200M --vm-keep --vm-method=zero-one
# Pin --vm-method=lfsr32: the only stress-ng vm method without TARGET_CLONES,
# so it can't dispatch to an AVX-512 clone and SIGILL on CPUs lacking it.
ExecStart=stress-ng --timeout 3m --vm 10 --vm-bytes 200M --vm-keep --vm-method=lfsr32

View File

@@ -65,9 +65,8 @@ mkdir "/tmp/$UNIT_NAME/test"
systemctl is-failed "$UNIT_NAME.socket"
assert_eq "$(systemctl show "$UNIT_NAME.socket" -P SubState)" "failed"
timeout --foreground 60 bash -c "while [[ -d '/tmp/$UNIT_NAME/test' ]]; do sleep .5; done"
timeout --foreground 60 bash -c "until systemctl is-active TEST-07-PID1-socket-OnFailure.service; do sleep .5; done"
[[ ! -e "/tmp/$UNIT_NAME/test" ]]
systemctl is-active TEST-07-PID1-socket-OnFailure.service
systemctl start "$UNIT_NAME.socket"
systemctl is-active "$UNIT_NAME.socket"

View File

@@ -366,13 +366,12 @@ EOF
systemctl reload systemd-oomd.service
# Run a transient service with OOMRules=testrule that generates memory pressure.
# Pin --vm-method to a portable method (zero-one): the default 'all' cycles
# through every method, including newer ones using AVX-512 instructions that
# SIGILL on CPUs without AVX-512 (e.g. AMD Zen 1-3), making the test flaky.
# Pin --vm-method=lfsr32: the only stress-ng vm method without TARGET_CLONES,
# so it can't dispatch to an AVX-512 clone and SIGILL on CPUs lacking it.
(! systemd-run --wait --unit=TEST-55-OOMD-testrules \
-p MemoryHigh=3M \
-p OOMRules=testrule \
stress-ng --timeout 3m --vm 10 --vm-bytes 50M --vm-keep --vm-method=zero-one)
stress-ng --timeout 3m --vm 10 --vm-bytes 50M --vm-keep --vm-method=lfsr32)
# Verify in the journal that the rule triggered
journalctl --sync
@@ -457,14 +456,12 @@ EOF
# Start the unit without --wait so we can check mid-run state. The
# stress-ng timeout bounds the test if anything goes wrong.
# Pin --vm-method to a portable method (zero-one): the default 'all' cycles
# through every method, including newer ones using AVX-512 instructions that
# SIGILL on CPUs without AVX-512 (e.g. AMD Zen 1-3) and would cause stress-ng
# to exit before the 6 s wait below elapses, failing the ActiveState check.
# Pin --vm-method=lfsr32: the only stress-ng vm method without TARGET_CLONES,
# so it can't SIGILL on AVX-512-less CPUs and exit before the 6 s wait below.
systemd-run --unit=TEST-55-OOMD-slowrule \
-p MemoryHigh=3M \
-p OOMRules=slowrule \
stress-ng --timeout 15s --vm 10 --vm-bytes 50M --vm-keep --vm-method=zero-one
stress-ng --timeout 15s --vm 10 --vm-bytes 50M --vm-keep --vm-method=lfsr32
# Wait long enough for oomd's 1s rule-check loop to evaluate the condition
# many times. With LastingSec=1h the kill must not fire.