generic: Verify the inheritance behavior of FS_XFLAG_DAX flag in various combinations
[xfstests-dev.git] / tests / generic / 294
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2012 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 294
6 #
7 # Tests for EEXIST (not EROFS) for inode creations, if
8 # we ask to create an already-existing entity on an RO filesystem
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21     cd /
22     rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28
29 # real QA test starts here
30
31 # Modify as appropriate.
32 _supported_fs generic
33 _supported_os Linux
34 _require_scratch
35 _require_symlinks
36 _require_mknod
37
38 rm -f $seqres.full
39 _scratch_mkfs > $seqres.full 2>&1 || _fail "Could not mkfs scratch device"
40
41 THIS_TEST_DIR=$SCRATCH_MNT/$seq.test
42
43 _create_files()
44 {
45         mknod $THIS_TEST_DIR/testnode c 1 3 2>&1 | _filter_mknod
46         mkdir $THIS_TEST_DIR/testdir
47         touch $THIS_TEST_DIR/testtarget
48         ln -s $THIS_TEST_DIR/testtarget $THIS_TEST_DIR/testlink 2>&1 | _filter_ln
49 }
50
51 _scratch_mount
52
53 rm -rf $THIS_TEST_DIR
54 mkdir $THIS_TEST_DIR || _fail "Could not create dir for test"
55
56 _create_files 2>&1 | _filter_scratch
57 _try_scratch_mount -o remount,ro || _fail "Could not remount scratch readonly"
58 _create_files 2>&1 | _filter_scratch
59
60 # success, all done
61 status=0
62 exit