tests: Also verify file contents in grow test

This commit is contained in:
Jakob Unterwurzacher 2014-11-23 16:59:17 +01:00
parent 76424a58cb
commit 1b5cde2273
3 changed files with 9 additions and 2 deletions

View File

@ -1,5 +1,6 @@
# Helper function
# Get the MD5 sum of the file open at the filehandle
use Digest::MD5 qw(md5_hex);
sub md5fh
{
my $fh_orig = shift;

View File

@ -7,7 +7,6 @@ use File::Path;
use File::Copy;
use File::Temp;
use IO::Handle;
use Digest::MD5 qw(md5_hex);
require("tests/common.inc");

View File

@ -109,12 +109,19 @@ sub grow {
my $max = 9000;
for($i=5; $i < $max; $i += 5)
{
print($pfh "wwwww") or die("write failed");
print($pfh "abcde") or die("write failed");
# autoflush should make sure the write goes to the kernel
# immediately. Just to be sure, check it here.
sizeVerify($vfh, $i) or die("unexpected plain file size");
sizeVerify($cfh, $i+8) or $ok = 0;
sizeVerify($dfh, $i) or $ok = 0;
if(md5fh($vfh) ne md5fh($dfh))
{
$ok = 0;
print("# content is different, unified diff:\n");
system("diff -u $plain/grow $decrypted/grow");
}
last unless $ok;
}