summaryrefslogtreecommitdiff
path: root/tests/generic/123
blob: 43f90b46e85ced4e5365bffdc82a11134188483e (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
51
52
53
54
55
56
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
#
# FSQA Test No. 123
#
# Make sure user cannot overwrite, append, delete or move a file created by 
# root. Modified CXFSQA test 940960 and 940558.
#
. ./common/preamble
_begin_fstest perms auto quick

status=0	# success is the default!

# Override the default cleanup function.
_cleanup()
{
    cd $TEST_DIR
    rm -rf $my_test_subdir
    cd /
}

# Import common functions.
. ./common/filter

# real QA test starts here
_supported_fs generic

_require_test
_require_user
_require_unix_perm_checking

my_test_subdir=$TEST_DIR/123subdir

# create subdir with required permissions
mkdir -m 755 $my_test_subdir

echo foo > $my_test_subdir/data_coherency.txt
# check basic appending to a file
echo bar >> $my_test_subdir/data_coherency.txt

# try append
_user_do "echo goo >> $my_test_subdir/data_coherency.txt" 

# try overwrite 
_user_do "echo goo > $my_test_subdir/data_coherency.txt" 

# try delete
_user_do "rm $my_test_subdir/data_coherency.txt" 

# try move
_user_do "mv $my_test_subdir/data_coherency.txt $my_test_subdir/data_coherency2.txt" 

cat $my_test_subdir/data_coherency.txt

exit