test_smbclient_tarmode.pl: add a clean option to erase the local path
authorAurélien Aptel <aurelien.aptel@gmail.com>
Tue, 2 Jul 2013 21:20:53 +0000 (23:20 +0200)
committerJim McDonough <jmcd@samba.org>
Tue, 5 Nov 2013 13:42:41 +0000 (08:42 -0500)
Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
source3/script/tests/test_smbclient_tarmode.pl

index 89280569973b5a0362ffa2db3f60b85ce9eaacf1..ea65041c7f47d17d7b53c9b8d95e59452fd453b3 100755 (executable)
@@ -57,6 +57,7 @@ our @SMBARGS   = ();
 our $DEBUG = 0;
 our $MAN   = 0;
 our $HELP  = 0;
+our $CLEAN = 0;
 
 =head1 SYNOPSIS
 
@@ -102,6 +103,7 @@ GetOptions('u|user=s'       => \$USER,
 
            'test=i'         => \$SINGLE_TEST,
 
+           'clean'          => \$CLEAN,
            'debug'          => \$DEBUG,
            'h|help'         => \$HELP,
            'man'            => \$MAN) or pod2usage(2);
@@ -127,6 +129,11 @@ push @SMBARGS, @ARGV;
 # path to store the downloaded tarball
 my $TAR = "$TMP/tarmode.tar";
 
+if($CLEAN) {
+    # clean the whole root first
+    remove_tree($LOCALPATH, { keep_root => 1 });
+}
+
 #####
 
 # RUN TESTS