#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2013 Oracle, Inc. All Rights Reserved.
+#
# FS QA Test No. 315
#
# fallocate/truncate tests with FALLOC_FL_KEEP_SIZE option.
# to the old smaller size. Before Linux 3.10, Btrfs/OCFS2 are test
# failed in this case.
#
-#-----------------------------------------------------------------------
-# Copyright (c) 2013 Oracle, Inc. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#-----------------------------------------------------------------------
-#
-
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
$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