mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 21:46:03 +03:00
Minor fixups.
This commit is contained in:
parent
abe53a8669
commit
8b229f6413
1 changed files with 20 additions and 16 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Test script for the ownCloud module of csync.
|
||||
# Test script for the ownCloud module of csync.
|
||||
# This script requires a running ownCloud instance accessible via HTTP.
|
||||
# It does quite some fancy tests and asserts the results.
|
||||
#
|
||||
|
@ -25,7 +25,7 @@ print "Hello, this is t1, a tester for csync with ownCloud.\n";
|
|||
# user => "joe",
|
||||
# passwd => "XXXXXX",
|
||||
# url => "http://localhost/oc/files/webdav.php"
|
||||
|
||||
|
||||
my $owncloud = "http://localhost/oc/files/webdav.php/";
|
||||
my $user = "joe";
|
||||
my $passwd = 'XXXXX'; # Mind to be secure.
|
||||
|
@ -52,7 +52,7 @@ sub remoteDir( $$ )
|
|||
my ($d, $dir) = @_;
|
||||
|
||||
my $url = $owncloud . $dir ;
|
||||
|
||||
|
||||
$d->open( $owncloud );
|
||||
print $d->message . "\n";
|
||||
|
||||
|
@ -81,7 +81,7 @@ sub remoteCleanup( $;$ )
|
|||
$d->open( -url => $owncloud );
|
||||
|
||||
print "Cleaning Remote!\n";
|
||||
|
||||
|
||||
my $re = $d->delete( $dir );
|
||||
|
||||
if( $re == 0 ) {
|
||||
|
@ -108,7 +108,7 @@ sub csync( $$ )
|
|||
$url =~ s#^http://##; # Remove the leading http://
|
||||
$url = "owncloud://$user:$passwd@". $url . $remote;
|
||||
print "CSync URL: $url\n";
|
||||
|
||||
|
||||
my $cmd = "LD_LIBRARY_PATH=$ld_libpath $csync $local $url";
|
||||
print "Starting: $cmd\n";
|
||||
|
||||
|
@ -116,7 +116,7 @@ sub csync( $$ )
|
|||
}
|
||||
|
||||
#
|
||||
# Check local directories if they have the same content.
|
||||
# Check local directories if they have the same content.
|
||||
#
|
||||
sub assertLocalDirs( $$ )
|
||||
{
|
||||
|
@ -135,7 +135,7 @@ sub assertLocalDirs( $$ )
|
|||
}
|
||||
|
||||
#
|
||||
# Check if a local and a remote dir have the same content
|
||||
# Check if a local and a remote dir have the same content
|
||||
#
|
||||
sub assertLocalAndRemoteDir( $$$ )
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ sub assertLocalAndRemoteDir( $$$ )
|
|||
if( my $r = $d->propfind( -url => $owncloud . $remote, -depth => 1 ) ) {
|
||||
if( $r->is_collection ) {
|
||||
print "\nXX" . $r->get_resourcelist->as_string ."\n";
|
||||
|
||||
|
||||
foreach my $res ( $r->get_resourcelist->get_resources() ) {
|
||||
print "Checking " . $res-> get_uri()->as_string ."\n";
|
||||
my $filename = $res->get_property("rel_uri");
|
||||
|
@ -156,12 +156,15 @@ sub assertLocalAndRemoteDir( $$$ )
|
|||
my $remoteModTime = $res->get_property( "lastmodifiedepoch" ) ;
|
||||
my @info = stat( "$local/$filename" );
|
||||
my $localModTime = $info[9];
|
||||
assert( $remoteModTime == $localModTime, "Modfied-Times differ: remote: $remoteModTime <-> local: $localModTime" );
|
||||
|
||||
assert( abs($remoteModTime - $localModTime) < 5, "Modfied-Times differ: remote: $remoteModTime <-> local: $localModTime" );
|
||||
|
||||
# check for the same file size
|
||||
my $localSize = $info[7];
|
||||
my $remoteSize = $res->get_property( "getcontentlength" );
|
||||
assert( $localSize == $remoteSize );
|
||||
if( $remoteSize ) { # directories do not have a contentlength
|
||||
print "Local versus Remote size: $localSize <-> $remoteSize\n";
|
||||
assert( $localSize == $remoteSize );
|
||||
}
|
||||
|
||||
# remember the files seen on the server.
|
||||
$seen{$filename} = 1;
|
||||
|
@ -169,17 +172,18 @@ sub assertLocalAndRemoteDir( $$$ )
|
|||
}
|
||||
# Now loop over the local directory content and check if all files in the dir
|
||||
# were seen on the server.
|
||||
|
||||
print "\n* Cross checking with local dir: \n";
|
||||
|
||||
print "\n* Cross checking with local dir: \n";
|
||||
print Dumper( %seen );
|
||||
opendir(my $dh, $local ) || die;
|
||||
while( readdir $dh ) {
|
||||
next if( /^\.+$/ );
|
||||
assert( -e "$local/$_" );
|
||||
assert( $seen{$_} == 1, "Filename only local, but not remte: $_\n" );
|
||||
my $f = $seen{$_} || $seen{$_ . "/"};
|
||||
assert( $f == 1, "Filename only local, but not remote: <$_>\n" );
|
||||
}
|
||||
closedir $dh;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -189,7 +193,7 @@ sub glob_put( $$$ )
|
|||
my( $d, $globber, $target ) = @_;
|
||||
|
||||
$d->open( $target );
|
||||
|
||||
|
||||
my @puts = bsd_glob( $globber );
|
||||
foreach my $lfile( @puts ) {
|
||||
if( $lfile =~ /.*\/(.+)$/g ) {
|
||||
|
|
Loading…
Reference in a new issue