xfs: force file creation to the data device for certain layout tests
[xfstests-dev.git] / tests / generic / 087
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Red Hat, Inc.
4 #
5 # FSQA Test No. 087
6 #
7 # Check if setting the file access and modification times to the current time
8 # (t) and to a specific timestamp (T) is allowed when expected.
9 #
10 # From utime(2): Changing timestamps is permitted when: either the process has
11 # appropriate privileges, or the effective user ID equals the user ID of the
12 # file, or [the process is trying to set the timestamps to the current time]
13 # and the process has write permission for the file.
14 #
15 # Note that the last of these tests will always wrongly succeed over NFSv2.
16 # For NFSv3+, that test will wrongly succeed until kernel commit
17 # "Disable NFSv2 timestamp workaround for NFSv3+".
18 #
19 seq=`basename $0`
20 seqres=$RESULT_DIR/$seq
21 echo "QA output created by $seq"
22
23 here=`pwd`
24 tmp=/tmp/$$
25 status=1        # failure is the default!
26 trap "_cleanup; exit \$status" 0 1 2 3 15
27
28 _cleanup()
29 {
30     cd /
31 }
32
33 # get standard environment, filters and checks
34 . ./common/rc
35 . ./common/filter
36
37 # real QA test starts here
38 _supported_fs generic
39 _require_test
40 _require_chown
41
42 QA_FS_PERMS=$here/src/fs_perms
43
44 cd $TEST_DIR
45 cp $here/src/testx ./testx.file
46
47 # The owner:
48 $QA_FS_PERMS 600 99 99 99 99 t 1
49 $QA_FS_PERMS 600 99 99 99 99 T 1
50
51 # Other processes with and without write permission:
52 $QA_FS_PERMS 600 99 99 100 99 t 0
53 $QA_FS_PERMS 600 99 99 100 99 T 0
54 $QA_FS_PERMS 660 99 99 100 99 t 1
55 $QA_FS_PERMS 660 99 99 100 99 T 0
56
57 rm -f ./testx.file
58
59 status=0
60 exit