mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
common/rc: generalize _get_filesize()
There are some testcases use below two kind of commands to get file
size, generalize the second way as global function _get_filesize()
to simply codes.
1. ls -l $1 | $AWK_PROG '{print $5}'
2. stat -c %s $1
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ $XFS_IO_PROG -f -c 'falloc -k 0 $(($avail_begin/2))' \
|
||||
$TEST_DIR/testfile.$seq >>$seqres.full 2>&1
|
||||
|
||||
# Verify the file size, it should keep unchanged as 0 in this case
|
||||
fsize=`ls -l $TEST_DIR/testfile.$seq | awk '{print $5}'`
|
||||
fsize=`_get_filesize $TEST_DIR/testfile.$seq`
|
||||
[ "$fsize" -eq 0 ] || _fail "File size is changed to ($fsize Bytes)"
|
||||
|
||||
# Truncate the file size back to 0
|
||||
|
||||
Reference in New Issue
Block a user