summaryrefslogtreecommitdiff
path: root/testprogs
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2020-10-22 11:39:04 +0200
committerAndreas Schneider <asn@cryptomilk.org>2020-10-22 16:05:30 +0000
commit3770f28c6289a9328b81968a4548bfaeb8bd40aa (patch)
tree15916f939b0e758eda86a60445cefce9d958a3f5 /testprogs
parent76db796181419967a483bcd71fe0cca313ccaf82 (diff)
downloadsamba-3770f28c6289a9328b81968a4548bfaeb8bd40aa.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>
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"
+}