generic: test MADV_POPULATE_READ with IO errors
[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 . ./common/preamble
20 _begin_fstest perms auto quick
21
22 # Override the default cleanup function.
23 _cleanup()
24 {
25     cd /
26 }
27
28 # Import common functions.
29 . ./common/filter
30
31 # real QA test starts here
32 _supported_fs generic
33 _require_test
34 _require_chown
35
36 QA_FS_PERMS=$here/src/fs_perms
37
38 cd $TEST_DIR
39 cp $here/src/testx ./testx.file
40
41 # The owner:
42 $QA_FS_PERMS 600 99 99 99 99 t 1
43 $QA_FS_PERMS 600 99 99 99 99 T 1
44
45 # Other processes with and without write permission:
46 $QA_FS_PERMS 600 99 99 100 99 t 0
47 $QA_FS_PERMS 600 99 99 100 99 T 0
48 $QA_FS_PERMS 660 99 99 100 99 t 1
49 $QA_FS_PERMS 660 99 99 100 99 T 0
50
51 rm -f ./testx.file
52
53 status=0
54 exit