summaryrefslogtreecommitdiff
path: root/tests/generic/277
blob: 7920332731ad1a171694997ca60d3b8ede65ed22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2011 Fujitsu.  All Rights Reserved.
#
# FS QA Test No. 277
#
# Check if ctime update caused by chattr is written to disk
#
. ./common/preamble
_begin_fstest auto ioctl quick metadata

# Override the default cleanup function.
_cleanup()
{
    rm -f $SCRATCH_MNT/tmp*
}

# Import common functions.
. ./common/filter
. ./common/attr

# real QA test starts here
_supported_fs generic
_require_scratch
_require_chattr A

_scratch_mkfs > /dev/null 2>&1
_scratch_mount

touch $SCRATCH_MNT/tmp
_scratch_cycle_mount
ctime1=`stat -c %z $SCRATCH_MNT/tmp`

sleep 1
$CHATTR_PROG +A $SCRATCH_MNT/tmp
$CHATTR_PROG -A $SCRATCH_MNT/tmp
ctime2=`stat -c %z $SCRATCH_MNT/tmp`

_scratch_cycle_mount
ctime3=`stat -c %z $SCRATCH_MNT/tmp`

if [ "$ctime1" == "$ctime2" ]; then
	echo "error: ctime not updated after chattr"
elif [ "$ctime1" == "$ctime3" ]; then
	echo "error: on disk ctime not updated"
else
	status=0
fi

exit