From d07d89a11e21e51ec92a1743fb7e54a823ce4453 Mon Sep 17 00:00:00 2001 From: Aurélien Aptel Date: Fri, 28 Jun 2013 03:30:06 +0200 Subject: test_smbclient_tarmode.pl: add nested dirs test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add a test to check that the backup handles nested directories. Signed-off-by: Aurélien Aptel Reviewed-by: David Disseldorp Reviewed-by: Jim McDonough --- source3/script/tests/test_smbclient_tarmode.pl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'source3/script') diff --git a/source3/script/tests/test_smbclient_tarmode.pl b/source3/script/tests/test_smbclient_tarmode.pl index b8143e357f6..fe6e7a2f4ec 100755 --- a/source3/script/tests/test_smbclient_tarmode.pl +++ b/source3/script/tests/test_smbclient_tarmode.pl @@ -103,7 +103,8 @@ my $TAR = "$TMP/tarmode.tar"; # RUN TESTS run_test( - [\&test_creation_normal], + [\&test_creation_normal, 'normal'], + [\&test_creation_normal, 'nested'], [\&test_creation_incremental, '-g'], [\&test_creation_incremental, 'tarmode inc'], [\&test_creation_reset, '-a'], @@ -180,13 +181,15 @@ sub test_creation_reset { } sub test_creation_normal { + my ($mode) = @_; - say "TEST: creation -- normal files (no attributes)"; + say "TEST: creation -- normal files $mode (no attributes)"; + my $prefix = ($mode =~ /nest/) ? "/foo/bar/bar/" : ''; my @files; my $n = 5; for(1..$n) { - my $f = File->new_remote("file-$_"); + my $f = File->new_remote($prefix."file-$_"); $f->set_attr(); push @files, $f; } @@ -195,7 +198,6 @@ sub test_creation_normal { return check_tar($TAR, \@files); } - sub test_creation_incremental { my ($mode) = @_; @@ -425,7 +427,7 @@ sub remotepath { return undef if !$s->{remote}; if($s->{dir}) { - $main::DIR.'/'.$s->{dir}.'/'.$s->{name}; + $main::DIR.'/'.$s->{dir}.$s->{name}; } else { $main::DIR.'/'.$s->{name}; } @@ -508,6 +510,7 @@ sub new_remote { my ($file, $dir) = fileparse($path); $dir = '' if $dir eq './'; + $dir =~ s{^/}{}; my $loc = $main::LOCALPATH.'/'.$main::DIR.'/'.$dir; make_path($loc); -- cgit