summaryrefslogtreecommitdiff
path: root/testprogs
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2020-10-22 11:39:04 +0200
committerKarolin Seeger <kseeger@samba.org>2020-10-27 08:22:02 +0000
commitdaeada8e48ea426288eb55187e3ff200bb81f145 (patch)
treebf807372cdea89a63936625340b17079634b387b /testprogs
parent069c5acc4b69d49ead2c2bb4b014905d43415d90 (diff)
downloadsamba-daeada8e48ea426288eb55187e3ff200bb81f145.tar.gz
testprogs: Add remove_directory to common test functions
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> (cherry picked from commit 3770f28c6289a9328b81968a4548bfaeb8bd40aa)
Diffstat (limited to 'testprogs')
-rwxr-xr-xtestprogs/blackbox/common_test_fns.inc11
1 files changed, 11 insertions, 0 deletions
diff --git a/testprogs/blackbox/common_test_fns.inc b/testprogs/blackbox/common_test_fns.inc
index a5611c63fa0..7b421e9eb08 100755
--- a/testprogs/blackbox/common_test_fns.inc
+++ b/testprogs/blackbox/common_test_fns.inc
@@ -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"
+}