summaryrefslogtreecommitdiffstats
path: root/source3/script
diff options
context:
space:
mode:
authorAurélien Aptel <aurelien.aptel@gmail.com>2013-07-17 16:27:01 +0200
committerJim McDonough <jmcd@samba.org>2013-11-05 08:42:42 -0500
commitbd4cde803cb1c5941053e3e5b6310b6d218c1825 (patch)
tree6e3e5b608c969cf218186887826ace13de65a658 /source3/script
parentf77f63ed285fb4895a80c70f41ddc32b4e56bc6b (diff)
downloadsamba-bd4cde803cb1c5941053e3e5b6310b6d218c1825.tar.gz
samba-bd4cde803cb1c5941053e3e5b6310b6d218c1825.tar.xz
samba-bd4cde803cb1c5941053e3e5b6310b6d218c1825.zip
test_smbclient_tarmode.pl: add simple wildcard test
Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com> Reviewed-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jim McDonough <jmcd@samba.org>
Diffstat (limited to 'source3/script')
-rwxr-xr-xsource3/script/tests/test_smbclient_tarmode.pl49
1 files changed, 46 insertions, 3 deletions
diff --git a/source3/script/tests/test_smbclient_tarmode.pl b/source3/script/tests/test_smbclient_tarmode.pl
index 1695e3ca76d..7f6cb034f9d 100755
--- a/source3/script/tests/test_smbclient_tarmode.pl
+++ b/source3/script/tests/test_smbclient_tarmode.pl
@@ -84,7 +84,7 @@ my $CLEAN = 0;
my @TESTS = (
['create, normal files (no attributes)', \&test_creation_normal, 'normal'],
['create, normal nested files (no attributes)', \&test_creation_normal, 'nested'],
- ['create, normal files (interactive)', \&test_creation_normal, 'inter'],
+ ['create, normal files (interactive)', \&test_creation_normal, 'inter'],
['create, incremental with -g', \&test_creation_incremental, '-g'],
['create, incremental with tarmode', \&test_creation_incremental, 'tarmode inc'],
['create, reset archived files with -a', \&test_creation_reset, '-a'],
@@ -94,7 +94,8 @@ my @TESTS = (
['create, explicit include', \&test_creation_include],
# ['create, explicit exclude', \&test_creation_exclude],
['create, include w/ filelist (F)', \&test_creation_list],
-# ['create, wildcard and regex', \&test_creation_wildcard],
+# ['create, wildcard', \&test_creation_wildcard],
+ ['create, wildcard simple', \&test_creation_wildcard_simple],
['extract, normal files', \&test_extraction_normal],
['extract, explicit include', \&test_extraction_include],
['extract, explicit exclude', \&test_extraction_exclude],
@@ -475,6 +476,26 @@ sub test_creation_list {
return check_tar($TAR, \@inc_files);
}
+sub test_creation_wildcard_simple {
+ my @exts = qw(jpg exe);
+ my @dirs = ('', "$DIR/");
+ my @all = make_env(\@exts, \@dirs);
+ my $nb;
+ my @inc;
+ my $err = 0;
+
+ @inc = grep { $_->remotepath =~ m{^[^/]+exe$} } @all;
+ smb_tar('', '-Tc', $TAR, "*.exe");
+ $err += check_tar($TAR, \@inc);
+
+ @inc = grep { $_->remotepath =~ m{$DIR/.+exe$} } @all;
+ smb_tar('', '-Tc', $TAR, "$DIR/*.exe");
+ $err += check_tar($TAR, \@inc);
+
+ $err;
+}
+
+# NOT USED
sub test_creation_wildcard {
my @exts = qw(txt jpg exe);
my @dirs = ('', "$DIR/", "$DIR/dir/");
@@ -493,6 +514,11 @@ sub test_creation_wildcard {
}
}
+
+ smb_tar('', '-Tcr', $TAR, "file2.exe", "file2.exe");
+ check_tar($TAR, \@all);
+ return 0;
+
$nb = 0;
for my $dir (@dirs) {
for my $ext (@exts) {
@@ -689,6 +715,23 @@ sub print_res {
}
}
+sub make_env {
+ my ($exts, $dirs) = @_;
+ my @all;
+ my $nb = 0;
+ for my $dir (@$dirs) {
+ for (@$exts) {
+ my $fn = $dir . "file$nb." . $_;
+ my $f = File->new_remote($fn, 'ABSPATH');
+ $f->delete_on_destruction(1);
+ push @all, $f;
+ $nb++;
+ }
+ }
+
+ @all;
+}
+
=head3 C<combine ( \@set, $n )>
=head3 C<combine ( ['a', 'b', 'c'], 2 )>
@@ -895,7 +938,7 @@ sub check_tar {
# file that should have been in tar
@less = grep { $done{$_} == 0 } keys %done;
- for (@less) {
+ for (sort @less) {
say " - $_";
}