mirror of
https://github.com/vgough/encfs.git
synced 2025-04-02 20:36:55 +02:00
tests: Also verify file contents in grow test
This commit is contained in:
parent
76424a58cb
commit
1b5cde2273
@ -1,5 +1,6 @@
|
|||||||
# Helper function
|
# Helper function
|
||||||
# Get the MD5 sum of the file open at the filehandle
|
# Get the MD5 sum of the file open at the filehandle
|
||||||
|
use Digest::MD5 qw(md5_hex);
|
||||||
sub md5fh
|
sub md5fh
|
||||||
{
|
{
|
||||||
my $fh_orig = shift;
|
my $fh_orig = shift;
|
||||||
|
@ -7,7 +7,6 @@ use File::Path;
|
|||||||
use File::Copy;
|
use File::Copy;
|
||||||
use File::Temp;
|
use File::Temp;
|
||||||
use IO::Handle;
|
use IO::Handle;
|
||||||
use Digest::MD5 qw(md5_hex);
|
|
||||||
|
|
||||||
require("tests/common.inc");
|
require("tests/common.inc");
|
||||||
|
|
||||||
|
@ -109,12 +109,19 @@ sub grow {
|
|||||||
my $max = 9000;
|
my $max = 9000;
|
||||||
for($i=5; $i < $max; $i += 5)
|
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
|
# autoflush should make sure the write goes to the kernel
|
||||||
# immediately. Just to be sure, check it here.
|
# immediately. Just to be sure, check it here.
|
||||||
sizeVerify($vfh, $i) or die("unexpected plain file size");
|
sizeVerify($vfh, $i) or die("unexpected plain file size");
|
||||||
sizeVerify($cfh, $i+8) or $ok = 0;
|
sizeVerify($cfh, $i+8) or $ok = 0;
|
||||||
sizeVerify($dfh, $i) 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;
|
last unless $ok;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user