test_smbclient_tarmode.pl: add tests for X and I.
authorAurélien Aptel <aurelien.aptel@gmail.com>
Mon, 1 Jul 2013 15:25:29 +0000 (17:25 +0200)
committerJim McDonough <jmcd@samba.org>
Tue, 5 Nov 2013 13:42:40 +0000 (08:42 -0500)
Found a bug while doing so. X doesn't exclude file path.

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 91c11931607939abe483d88e34050c174116fa82..615d2169a1c0c749e82c5306bd501bbb2a20e887 100755 (executable)
@@ -12,9 +12,9 @@ test_smbclient_tarmode.pl - Test for smbclient tar backup feature
 # c g      DONE
 # c a      DONE
 # c N      DONE
-# c I      #
+# c I      DONE
 # c I r    #
-# c X      #
+# c X      DONE
 # c X r    #
 # c F      #
 # c F r    #
@@ -139,6 +139,8 @@ my @all_tests = (
     [\&test_creation_reset,       '-a'],
     [\&test_creation_reset,       'tarmode reset'],
     [\&test_creation_newer],
+    [\&test_creation_include,],
+    [\&test_creation_exclude,],
     [\&test_extraction_normal],
 );
 
@@ -292,6 +294,36 @@ sub test_extraction_normal {
     check_remote([values %files]);
 }
 
+sub test_creation_include {
+    say "TEST: extraction -- explicit include";
+
+    my @files;
+
+    for(qw(file_inc inc/b inc/c inc/dir/foo dir_ex/d zob)) {
+        my $f = File->new_remote($_);
+        $f->set_attr();
+        push @files, $f if /inc/;
+    }
+
+    smb_tar('', '-TcI', $TAR, "$DIR/file_inc", "$DIR/inc");
+    return check_tar($TAR, \@files);
+}
+
+sub test_creation_exclude {
+    say "TEST: extraction -- explicit exclude";
+
+    my @files;
+
+    for(qw(file_ex ex/b ex/c ex/dir/foo foo/bar zob)) {
+        my $f = File->new_remote($_);
+        $f->set_attr();
+        push @files, $f if !/ex/;
+    }
+
+    smb_tar('', '-TcX', $TAR, "$DIR/file_ex", "$DIR/ex");
+    return check_tar($TAR, \@files);
+}
+
 #####
 
 # IMPLEMENTATION