xfs
[Top] [All Lists]

[PATCH 02/10] xfstests: use mount point instead of device name

To: xfs@xxxxxxxxxxx
Subject: [PATCH 02/10] xfstests: use mount point instead of device name
From: Junho Ryu <jayr@xxxxxxxxxx>
Date: Tue, 10 Dec 2013 12:11:53 -0800
Cc: branto@xxxxxxxxxx, hughd@xxxxxxxxxx, tytso@xxxxxxx, Junho Ryu <jayr@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9WbB3j/rqSCasgoZI6ZANx3o0b65JhudHmMOHNFCjbk=; b=mdD/bSX8GYtdTPe8QIIFQNJaY+TztUA7nlnlR+DKIrKDrW30Va9Vv4yXLub9JmYvOw A6a7ei6soL2xdHNus9+IiI6mRFN/rqFVpXAOE23pNWBtEkvOFp6GPYXYWwni4MJDsupX mhCk/xDAFZLJhTdUSbZU+mMGC6sV+k02jJwiy40CZyJoHkoxfkUek27DvGf/2NcIQFfH udx0ox0EPLulhOnPvAHVL2CiPJ3+1LYB9zJ9DsAR/pQpsS5EmGaTR8TpifYzbYURlhr0 gonmQnwL+X15q6jD6CZs438xVbD+0MnPtwLG2qYnn6KCuDFE5bRGCwEoZ2bXKM8GIifW szog==
In-reply-to: <1386706321-15795-1-git-send-email-jayr@xxxxxxxxxx>
References: <1386706321-15795-1-git-send-email-jayr@xxxxxxxxxx>
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>
---
 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

<Prev in Thread] Current Thread [Next in Thread>