fsx/fsstress: round blocksize properly
[xfstests-dev.git] / tests / ext4 / 043
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2020 SUSE Linux Products GmbH.  All Rights Reserved.
4 #
5 # FS QA Test No. 043
6 #
7 # Test file timestamps are only precise to seconds with 128-byte inodes."
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1       # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20        cd /
21        rm -f $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27
28 # remove previous $seqres.full before test
29 rm -f $seqres.full
30
31 # real QA test starts here
32 _supported_fs ext3 ext4
33
34 _require_scratch
35 _require_test_program "t_get_file_time"
36
37 echo "Silence is golden"
38
39 echo "Start test timestamps with 128 inode size one device $SCRATCH_DEV" >$seqres.full
40 _scratch_mkfs -I 128 >> $seqres.full 2>&1
41 _scratch_mount
42
43 touch "${SCRATCH_MNT}/tmp_file"
44
45 atime=`$here/src/t_get_file_time $SCRATCH_MNT/tmp_file atime nsec`
46 mtime=`$here/src/t_get_file_time $SCRATCH_MNT/tmp_file mtime nsec`
47 ctime=`$here/src/t_get_file_time $SCRATCH_MNT/tmp_file ctime nsec`
48
49 if [ $atime -ne 0 -o $mtime -ne 0 -o $ctime -ne 0 ]; then
50        echo "nsec should be zero when extended timestamps are disabled"
51        echo "atime: $atime, mtime: $mtime, ctime: $ctime"
52 fi
53
54 status=0
55 exit