[Libguestfs] [PATCH] tests: properly cleanup the temporary directories

Pino Toscano ptoscano at redhat.com
Mon Mar 17 14:05:44 UTC 2014


Chmod the temporary directory again so we can clean it all, avoid
leaving stray temporary directories.

This is a kind of revert of few parts of commit
22b0662ebf64e93dc275acc1cc37ebd12cce6b49, but adapted to the unique
$tmpdir used now.
---
 tests/test-binaries-exist.sh | 4 +++-
 tests/test-harder.sh         | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/test-binaries-exist.sh b/tests/test-binaries-exist.sh
index 3a2d50d..c40ce93 100755
--- a/tests/test-binaries-exist.sh
+++ b/tests/test-binaries-exist.sh
@@ -58,4 +58,6 @@ fi
 # These binaries should be runnable (since they are the same as the host).
 `find $d2 -name sync | head`
 
-rm -rf $tmpdir ||:
+# Need to chmod $d2 since rm -r can't remove unwritable directories.
+chmod -R +w $d2 ||:
+rm -rf $tmpdir
diff --git a/tests/test-harder.sh b/tests/test-harder.sh
index b010c35..e8bb32f 100755
--- a/tests/test-harder.sh
+++ b/tests/test-harder.sh
@@ -127,4 +127,6 @@ case $distro in
 	;;
 esac
 
-rm -rf $tmpdir ||:
+# Need to chmod $d2 since rm -r can't remove unwritable directories.
+chmod -R +w $d2 ||:
+rm -rf $tmpdir
-- 
1.8.3.1




More information about the Libguestfs mailing list