diff options
author | Andreas Schneider <asn@samba.org> | 2020-10-22 11:39:04 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2020-10-22 16:05:30 +0000 |
commit | 3770f28c6289a9328b81968a4548bfaeb8bd40aa (patch) | |
tree | 15916f939b0e758eda86a60445cefce9d958a3f5 /testprogs | |
parent | 76db796181419967a483bcd71fe0cca313ccaf82 (diff) | |
download | samba-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-x | testprogs/blackbox/common_test_fns.inc | 11 |
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" +} |