[u-boot-test-hooks PATCH 5/7] Update sdwire script to wait for umount

Simon Glass sjg at chromium.org
Sat Oct 30 20:25:37 CEST 2021


Sometimes the umount takes a while. Add the same wait loop as is used for
mount. Also rename the 'done' variable to 'complete' to void confusing it
with the end of the for loop.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 bin/flash.sdwire_common_mount | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/bin/flash.sdwire_common_mount b/bin/flash.sdwire_common_mount
index d696abb..6c763e6 100644
--- a/bin/flash.sdwire_common_mount
+++ b/bin/flash.sdwire_common_mount
@@ -25,10 +25,10 @@ mount_dir=/media/${mount_point}
 # Switch over to get USB card access
 sd-mux-ctrl --device-serial ${sdwire_serial} --ts
 
-done=false
+complete=false
 for i in {0..9}; do
     if out="$(mount UUID=${mount_uuid} 2>&1)"; then
-        done=true
+        complete=true
         break
     fi
     echo $out
@@ -41,7 +41,7 @@ for i in {0..9}; do
     fi
     sleep 1
 done
-if [[ $done = false ]]; then
+if [[ $complete = false ]]; then
     echo "Failed to mount UUID ${mount_uuid} after 10 tries"
     exit 1
 fi
@@ -53,7 +53,27 @@ if ! mountpoint -q ${mount_dir}; then
 fi
 
 writer.${flash_writer} ${mount_dir} ${U_BOOT_BUILD_DIR}
-umount ${mount_dir}
+
+complete=false
+for i in {0..9}; do
+    if out="$(umount ${mount_dir} 2>&1)"; then
+        complete=true
+        break
+    fi
+    echo $out
+    sleep 1
+done
+
+if [[ $complete = false ]]; then
+    echo "Failed to umount UUID ${mount_uuid} after 10 tries"
+    exit 1
+fi
+
+# Sanity check
+if mountpoint -q ${mount_dir}; then
+    echo "Mount ${mount_dir} still available after 'umount'"
+    exit 1
+fi
 
 # Back to card access for the DUT
 sd-mux-ctrl --device-serial ${sdwire_serial} --dut
-- 
2.33.1.1089.g2158813163f-goog



More information about the U-Boot mailing list