[gvfs] gvfs-test: More robust cleanup of temporary home directory



commit 025792d444cbbc12e0d64969c59645f5d7fac174
Author: Martin Pitt <martinpitt gnome org>
Date:   Thu Jun 13 15:06:09 2013 +0200

    gvfs-test: More robust cleanup of temporary home directory
    
    Especially the trash:// tests have a tendency to leave the gvfs-metadata child
    around a little while after killing the D-BUS daemon, and thus leaving the
    temporary home directory busy. Retry for a few times to allow gvfsd-metadata to
    clean up itself.

 test/gvfs-test |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/test/gvfs-test b/test/gvfs-test
index 1da2a8f..5360f62 100755
--- a/test/gvfs-test
+++ b/test/gvfs-test
@@ -1671,4 +1671,16 @@ if __name__ == '__main__':
         if not in_testbed:
             dbus_daemon.terminate()
             dbus_daemon.wait()
-            shutil.rmtree(temp_home)
+            # it might take a while until the child processes terminate and
+            # release usage of the home dir, so try several times
+            timeout = 20
+            while timeout > 0:
+                try:
+                    shutil.rmtree(temp_home)
+                    break
+                except OSError as e:
+                    timeout -= 1
+                    time.sleep(0.1)
+                    if timeout <= 0:
+                        raise
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]