From: Andreas Schneider Date: Thu, 22 Oct 2020 09:39:04 +0000 (+0200) Subject: testprogs: Add remove_directory to common test functions X-Git-Tag: talloc-2.3.2~193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3770f28c6289a9328b81968a4548bfaeb8bd40aa;p=thirdparty%2Fsamba.git testprogs: Add remove_directory to common test functions BUG: https://bugzilla.samba.org/show_bug.cgi?id=14542 Signed-off-by: Andreas Schneider Reviewed-by: Alexander Bokovoy --- 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" +}