blob: 872578ea4ba1209ac1487b75809f3c8fce2d07a1 [file] [log] [blame]
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2020 SUSE Linux Products GmbH. All Rights Reserved.
#
# FS QA Test No. 043
#
# Test file timestamps are only precise to seconds with 128-byte inodes."
#
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
here=`pwd`
tmp=/tmp/$$
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
rm -f $tmp.*
}
# get standard environment, filters and checks
. ./common/rc
. ./common/filter
# remove previous $seqres.full before test
rm -f $seqres.full
# real QA test starts here
_supported_fs ext3 ext4
_require_scratch
_require_test_program "t_get_file_time"
echo "Silence is golden"
echo "Start test timestamps with 128 inode size one device $SCRATCH_DEV" >$seqres.full
_scratch_mkfs -I 128 >> $seqres.full 2>&1
_scratch_mount
touch "${SCRATCH_MNT}/tmp_file"
atime=`$here/src/t_get_file_time $SCRATCH_MNT/tmp_file atime nsec`
mtime=`$here/src/t_get_file_time $SCRATCH_MNT/tmp_file mtime nsec`
ctime=`$here/src/t_get_file_time $SCRATCH_MNT/tmp_file ctime nsec`
if [ $atime -ne 0 -o $mtime -ne 0 -o $ctime -ne 0 ]; then
echo "nsec should be zero when extended timestamps are disabled"
echo "atime: $atime, mtime: $mtime, ctime: $ctime"
fi
status=0
exit