generic: test MADV_POPULATE_READ with IO errors
[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 . ./common/preamble
11 _begin_fstest auto quick
12
13 # Import common functions.
14 . ./common/filter
15
16 # real QA test starts here
17
18 # Modify as appropriate.
19 _supported_fs generic
20 _require_scratch
21 _require_symlinks
22 _require_mknod
23
24 _scratch_mkfs > $seqres.full 2>&1 || _fail "Could not mkfs scratch device"
25
26 THIS_TEST_DIR=$SCRATCH_MNT/$seq.test
27
28 _create_files()
29 {
30         mknod $THIS_TEST_DIR/testnode c 1 3 2>&1 | _filter_mknod
31         mkdir $THIS_TEST_DIR/testdir
32         touch $THIS_TEST_DIR/testtarget
33         ln -s $THIS_TEST_DIR/testtarget $THIS_TEST_DIR/testlink 2>&1 | _filter_ln
34 }
35
36 _scratch_mount
37
38 rm -rf $THIS_TEST_DIR
39 mkdir $THIS_TEST_DIR || _fail "Could not create dir for test"
40
41 _create_files 2>&1 | _filter_scratch
42 _try_scratch_mount -o remount,ro || _fail "Could not remount scratch readonly"
43 _create_files 2>&1 | _filter_scratch
44
45 # success, all done
46 status=0
47 exit