594167
From d924e5c3014a65e059fd414b90893d320e1784bd Mon Sep 17 00:00:00 2001
594167
From: Frantisek Sumsal <frantisek@sumsal.cz>
594167
Date: Thu, 27 Jan 2022 22:51:15 +0100
594167
Subject: [PATCH] test: temporary workaround for #21819
594167
594167
Since the TEST-64-UDEV-STORAGE fails are quite frequent now and the root
594167
cause is yet to be discovered, let's add a kludge that attempts to retry
594167
the test up to two more times in case it fails, so we don't
594167
unnecessarily disturb CIs while the issue is being investigated.
594167
594167
Revert this commit once #21819 is sorted out.
594167
594167
(cherry picked from commit 95e35511bbdb7810c00c2e4a6cbda5b187192f74)
594167
594167
Related: #2017035
594167
---
594167
 test/TEST-64-UDEV-STORAGE/test.sh | 11 ++++++++---
594167
 1 file changed, 8 insertions(+), 3 deletions(-)
594167
594167
diff --git a/test/TEST-64-UDEV-STORAGE/test.sh b/test/TEST-64-UDEV-STORAGE/test.sh
594167
index 0f26eaafeb..f784e65984 100755
594167
--- a/test/TEST-64-UDEV-STORAGE/test.sh
594167
+++ b/test/TEST-64-UDEV-STORAGE/test.sh
594167
@@ -119,7 +119,6 @@ test_run() {
594167
 
594167
     # Execute each currently defined function starting with "testcase_"
594167
     for testcase in "${TESTCASES[@]}"; do
594167
-        _image_cleanup
594167
         echo "------ $testcase: BEGIN ------"
594167
         # Note for my future frustrated self: `fun && xxx` (as well as ||, if, while,
594167
         # until, etc.) _DISABLES_ the `set -e` behavior in _ALL_ nested function
594167
@@ -130,8 +129,14 @@ test_run() {
594167
         # So, be careful when adding clean up snippets in the testcase_*() functions -
594167
         # if the `test_run_one()` function isn't the last command, you have propagate
594167
         # the exit code correctly (e.g. `test_run_one() || return $?`, see below).
594167
-        ec=0
594167
-        "$testcase" "$test_id" || ec=$?
594167
+
594167
+        # FIXME: temporary workaround for intermittent fails in certain tests
594167
+        # See: https://github.com/systemd/systemd/issues/21819
594167
+        for ((_i = 0; _i < 3; _i++)); do
594167
+            _image_cleanup
594167
+            ec=0
594167
+            "$testcase" "$test_id" && break || ec=$?
594167
+        done
594167
         case $ec in
594167
             0)
594167
                 passed+=("$testcase")