From: Hugh Dickins <hughd@xxxxxxxxxx>
A tmpfs mount does not involve any block device, its $SCRATCH_DEV is
nothing but a place-holder, so apply 'df' or 'stat' to its mount point
$SCRATCH_MNT instead of to $SCRATCH_DEV.
It also fixes a bug in generic/256: "stat -f $SCRATCH_DEV" returning the
block size of the root file system, but not the test file system.
$ df | grep sda
/dev/sda1 233191 62959 157791 29% /boot
$ sudo dumpe2fs -h /dev/sda1 | grep "Block size"
Block size: 1024
$ stat -f /dev/sda1 | grep "Block size"
Block size: 4096 Fundamental block size: 4096
$ stat -f /boot | grep "Block size"
Block size: 1024 Fundamental block size: 1024
Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>
Signed-off-by: Junho Ryu <jayr@xxxxxxxxxx>
---
v3: same as v1
v2: same as v1
tests/generic/256 | 2 +-
tests/generic/273 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/generic/256 b/tests/generic/256
index cfe7237..c6c8f2f 100755
--- a/tests/generic/256
+++ b/tests/generic/256
@@ -170,7 +170,7 @@ _scratch_mount
# Test must be able to write files with non-root permissions
chmod 777 $SCRATCH_MNT
-block_size=`stat -f $SCRATCH_DEV | grep "Block size" | cut -d " " -f3`
+block_size=`stat -f $SCRATCH_MNT | grep "Block size" | cut -d " " -f3`
_test_full_fs_punch $(( $block_size * 2 )) $block_size 500 $SCRATCH_MNT/252.$$
$block_size
status=0 ; exit
diff --git a/tests/generic/273 b/tests/generic/273
index 8e121a2..dc87a92 100755
--- a/tests/generic/273
+++ b/tests/generic/273
@@ -68,7 +68,7 @@ _file_create()
cd $SCRATCH_MNT/origin
- _disksize=`$DF_PROG --block-size=1 $SCRATCH_DEV | tail -1 | awk '{
print $5 }'`
+ _disksize=`$DF_PROG --block-size=1 $SCRATCH_MNT | tail -1 | awk '{
print $5 }'`
_disksize=$(($_disksize / 3))
_num=$(($_disksize / $count / $threads / 4096))
_count=$count
--
1.8.5.1
|