generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / generic / 277
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2011 Fujitsu.  All Rights Reserved.
4 #
5 # FS QA Test No. 277
6 #
7 # Check if ctime update caused by chattr is written to disk
8 #
9 . ./common/preamble
10 _begin_fstest auto ioctl quick metadata
11
12 # Override the default cleanup function.
13 _cleanup()
14 {
15     rm -f $SCRATCH_MNT/tmp*
16 }
17
18 # Import common functions.
19 . ./common/filter
20 . ./common/attr
21
22 # real QA test starts here
23 _supported_fs generic
24 _require_scratch
25 _require_chattr A
26
27 _scratch_mkfs > /dev/null 2>&1
28 _scratch_mount
29
30 touch $SCRATCH_MNT/tmp
31 _scratch_cycle_mount
32 ctime1=`stat -c %z $SCRATCH_MNT/tmp`
33
34 sleep 1
35 $CHATTR_PROG +A $SCRATCH_MNT/tmp
36 $CHATTR_PROG -A $SCRATCH_MNT/tmp
37 ctime2=`stat -c %z $SCRATCH_MNT/tmp`
38
39 _scratch_cycle_mount
40 ctime3=`stat -c %z $SCRATCH_MNT/tmp`
41
42 if [ "$ctime1" == "$ctime2" ]; then
43         echo "error: ctime not updated after chattr"
44 elif [ "$ctime1" == "$ctime3" ]; then
45         echo "error: on disk ctime not updated"
46 else
47         status=0
48 fi
49
50 exit