generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / generic / 123
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FSQA Test No. 123
6 #
7 # Make sure user cannot overwrite, append, delete or move a file created by 
8 # root. Modified CXFSQA test 940960 and 940558.
9 #
10 . ./common/preamble
11 _begin_fstest perms auto quick
12
13 status=0        # success is the default!
14
15 # Override the default cleanup function.
16 _cleanup()
17 {
18     cd $TEST_DIR
19     rm -rf $my_test_subdir
20     cd /
21 }
22
23 # Import common functions.
24 . ./common/filter
25
26 # real QA test starts here
27 _supported_fs generic
28
29 _require_test
30 _require_user
31
32 my_test_subdir=$TEST_DIR/123subdir
33
34 # create subdir with required permissions
35 mkdir -m 755 $my_test_subdir
36
37 echo foo > $my_test_subdir/data_coherency.txt
38 # check basic appending to a file
39 echo bar >> $my_test_subdir/data_coherency.txt
40
41 # try append
42 _user_do "echo goo >> $my_test_subdir/data_coherency.txt" 
43
44 # try overwrite 
45 _user_do "echo goo > $my_test_subdir/data_coherency.txt" 
46
47 # try delete
48 _user_do "rm $my_test_subdir/data_coherency.txt" 
49
50 # try move
51 _user_do "mv $my_test_subdir/data_coherency.txt $my_test_subdir/data_coherency2.txt" 
52
53 cat $my_test_subdir/data_coherency.txt
54
55 exit