]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
testprogs: Add remove_directory to common test functions
authorAndreas Schneider <asn@samba.org>
Thu, 22 Oct 2020 09:39:04 +0000 (11:39 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 22 Oct 2020 16:05:30 +0000 (16:05 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14542

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
testprogs/blackbox/common_test_fns.inc

index a5611c63fa044336d74985ded4d63111706ae5e5..7b421e9eb08781cccdad7f36d71db2e1018b1f1c 100755 (executable)
@@ -107,3 +107,14 @@ kerberos_kinit() {
        fi
        return $status
 }
+
+remove_directory() {
+       local xdir=${1}
+       shift
+
+       if [ "$xdir" == "/" ] || [ ! -d "$xdir" ] || [ ! $(ls -A "$xdir") ]; then
+               return
+       fi
+
+       rm -rf "$xdir"
+}