fstests: btrfs: Use compressible data

/dev/urandom is incompressible and, /dev/zero is highly compressible,
so both are less effective in testing the compress code logic in btrfs.

This patch introduces a text data generator
 cat /dev/urandom | od
to populate the files where /dev/urandom is currently being used in the
btrfs test cases.

And updates the _populate_fs() with a new option -c, so to instruct
to use the compressible data to populate the file(s).

[eguan: add comments, fix indention]

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Anand Jain
2017-02-06 15:55:39 +08:00
committed by Eryu Guan
parent c7320b4cac
commit 96459fb687
8 changed files with 28 additions and 27 deletions
+3 -6
View File
@@ -81,12 +81,9 @@ run_test()
local missing_dev_id=`$BTRFS_UTIL_PROG fi show $SCRATCH_MNT | grep $missing_dev | awk '{print $2}'`
# get some data on the filesystem so there's something to replace
dd if=/dev/urandom of="$SCRATCH_MNT"/file1 bs=1M count=1 \
>>$seqres.full 2>&1
dd if=/dev/urandom of="$SCRATCH_MNT"/file2 bs=1M count=2 \
>>$seqres.full 2>&1
dd if=/dev/urandom of="$SCRATCH_MNT"/file3 bs=1M count=4 \
>>$seqres.full 2>&1
_ddt of="$SCRATCH_MNT"/file1 bs=1M count=1 >> $seqres.full 2>&1
_ddt of="$SCRATCH_MNT"/file2 bs=1M count=2 >> $seqres.full 2>&1
_ddt of="$SCRATCH_MNT"/file3 bs=1M count=4 >> $seqres.full 2>&1
# nuke a device and remount in degraded mode
_scratch_unmount