|
|
594167 |
From c2f28b1ce0383e6366846a5993f59a7a4c3ccc11 Mon Sep 17 00:00:00 2001
|
|
|
594167 |
From: David Tardon <dtardon@redhat.com>
|
|
|
594167 |
Date: Wed, 13 Jul 2022 11:29:20 +0200
|
|
|
594167 |
Subject: [PATCH] test: ensure cleanup functions return success
|
|
|
594167 |
|
|
|
594167 |
Otherwise the return value of the last command is propagated, which may
|
|
|
594167 |
cause spurious test failures. E.g., pkill returns 1 if no process
|
|
|
594167 |
matched, which may be a problem in cleanup session:
|
|
|
594167 |
|
|
|
594167 |
cleanup_session() {
|
|
|
594167 |
...
|
|
|
594167 |
|
|
|
594167 |
pkill -u "$(id -u logind-test-user)"
|
|
|
594167 |
sleep 1
|
|
|
594167 |
pkill -KILL -u "$(id -u logind-test-user)"
|
|
|
594167 |
}
|
|
|
594167 |
|
|
|
594167 |
If there are no remaining processes when the final pkill runs, it will
|
|
|
594167 |
return 1 and therefore cleanup_session will return 1 as well.
|
|
|
594167 |
|
|
|
594167 |
(cherry picked from commit bd681a7eb04fd6d1fb9631e277bef93ceb06b321)
|
|
|
594167 |
|
|
|
594167 |
Related: #2100464
|
|
|
594167 |
---
|
|
|
594167 |
test/units/testsuite-35.sh | 8 ++++++++
|
|
|
594167 |
1 file changed, 8 insertions(+)
|
|
|
594167 |
|
|
|
594167 |
diff --git a/test/units/testsuite-35.sh b/test/units/testsuite-35.sh
|
|
|
594167 |
index 9c37fc36d0..ad14d8a73c 100755
|
|
|
594167 |
--- a/test/units/testsuite-35.sh
|
|
|
594167 |
+++ b/test/units/testsuite-35.sh
|
|
|
594167 |
@@ -13,6 +13,8 @@ cleanup_test_user() (
|
|
|
594167 |
sleep 1
|
|
|
594167 |
pkill -KILL -u "$(id -u logind-test-user)"
|
|
|
594167 |
userdel -r logind-test-user
|
|
|
594167 |
+
|
|
|
594167 |
+ return 0
|
|
|
594167 |
)
|
|
|
594167 |
|
|
|
594167 |
setup_test_user() {
|
|
|
594167 |
@@ -83,6 +85,8 @@ teardown_suspend() (
|
|
|
594167 |
|
|
|
594167 |
rm -f /run/udev/rules.d/70-logindtest-lid.rules
|
|
|
594167 |
udevadm control --reload
|
|
|
594167 |
+
|
|
|
594167 |
+ return 0
|
|
|
594167 |
)
|
|
|
594167 |
|
|
|
594167 |
test_suspend_on_lid() {
|
|
|
594167 |
@@ -224,6 +228,8 @@ cleanup_session() (
|
|
|
594167 |
pkill -u "$(id -u logind-test-user)"
|
|
|
594167 |
sleep 1
|
|
|
594167 |
pkill -KILL -u "$(id -u logind-test-user)"
|
|
|
594167 |
+
|
|
|
594167 |
+ return 0
|
|
|
594167 |
)
|
|
|
594167 |
|
|
|
594167 |
teardown_session() (
|
|
|
594167 |
@@ -234,6 +240,8 @@ teardown_session() (
|
|
|
594167 |
rm -f /run/udev/rules.d/70-logindtest-scsi_debug-user.rules
|
|
|
594167 |
udevadm control --reload
|
|
|
594167 |
rmmod scsi_debug
|
|
|
594167 |
+
|
|
|
594167 |
+ return 0
|
|
|
594167 |
)
|
|
|
594167 |
|
|
|
594167 |
check_session() (
|