generic/395: remove workarounds for wrong error codes
[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 _require_scratch
34 _require_symlinks
35 _require_mknod
36
37 rm -f $seqres.full
38 _scratch_mkfs > $seqres.full 2>&1 || _fail "Could not mkfs scratch device"
39
40 THIS_TEST_DIR=$SCRATCH_MNT/$seq.test
41
42 _create_files()
43 {
44         mknod $THIS_TEST_DIR/testnode c 1 3 2>&1 | _filter_mknod
45         mkdir $THIS_TEST_DIR/testdir
46         touch $THIS_TEST_DIR/testtarget
47         ln -s $THIS_TEST_DIR/testtarget $THIS_TEST_DIR/testlink 2>&1 | _filter_ln
48 }
49
50 _scratch_mount
51
52 rm -rf $THIS_TEST_DIR
53 mkdir $THIS_TEST_DIR || _fail "Could not create dir for test"
54
55 _create_files 2>&1 | _filter_scratch
56 _try_scratch_mount -o remount,ro || _fail "Could not remount scratch readonly"
57 _create_files 2>&1 | _filter_scratch
58
59 # success, all done
60 status=0
61 exit