summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pool <mbp@sourcefrog.net>2004-09-10 03:07:17 +0000
committerMartin Pool <mbp@sourcefrog.net>2004-09-10 03:07:17 +0000
commitbeca5854e443e0406f03d71db4fa845f53c7765c (patch)
tree12c8d97d57adb8494f47481bf9e7c42f77005138
parenta770b0d695be1ef730a15442730d7b37d4772d4f (diff)
downloadlibrsync-beca5854e443e0406f03d71db4fa845f53c7765c.tar.gz
Take options to specify the file size and block len. The defaults are
as before.
-rwxr-xr-xcheck-rdiff18
1 files changed, 13 insertions, 5 deletions
diff --git a/check-rdiff b/check-rdiff
index ca3ff58..eb6f9b8 100755
--- a/check-rdiff
+++ b/check-rdiff
@@ -2,8 +2,16 @@
# Creates a pair of semi-random files and check if rdiff
# correctlys updates the first to the second.
-$size=5*1024*1024*1024;
-$runlen=2000;
+# script is "./g"
+
+$size = 5 << 30;
+$blocklen = 6000;
+
+use Getopt::Long;
+GetOptions("size=i" => \$size,
+ "blocklen=i" => \$blocklen);
+
+$runlen = $blocklen / 3;
sub makefile { # Make a moderately random $size-byte file
($fname,$size)=@_;
@@ -26,9 +34,9 @@ sub run {
srand(0);
makefile('old',$size);
makefile('new',$size);
-run("rdiff signature -b 6000 old old.sig");
-run("rdiff delta -s old.sig new delta");
-run("rdiff patch -s old delta new2");
+run("time rdiff signature -b $blocklen old old.sig");
+run("time rdiff delta -s old.sig new delta");
+run("time rdiff patch -s old delta new2");
print "Comparing MD5 hashes...\n";
$sum1 = `md5sum < new`; die 'Failed 1' unless $?==0; print $sum1;
$sum2 = `md5sum < new2`; die 'Failed 2' unless $?==0; print $sum2;