generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / generic / 125
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. 125
6 #
7 # ftruncate test, modified from CXFSQA tests cxfs_ftrunc and cxfs_trunc
8 #
9 . ./common/preamble
10 _begin_fstest other pnfs
11
12 # Import common functions.
13 . ./common/filter
14
15 # real QA test starts here
16 _supported_fs generic
17
18 _require_test
19 _require_user
20 _require_odirect
21 _require_chmod
22
23 TESTDIR=$TEST_DIR/ftrunc
24 TESTFILE=$TESTDIR/ftrunc.tmp
25
26 [ -d $TESTDIR ] && rm -r $TESTDIR
27 mkdir $TESTDIR
28
29 # ftrunc must be run as a mortal user.
30 touch $TESTFILE
31
32 chmod a+rw $TESTDIR
33 chmod a+rw $TESTFILE
34
35 # don't use $here/src/ftrunc, as we're running it as a regular user, and $here
36 # may contain path component that a regular user doesn't have search permission
37 su $qa_user -c "./src/ftrunc -f $TESTFILE"
38
39 if [ "$?" != "0" ];  then
40     echo src/ftrunc returned non 0 status!
41 fi
42
43 $here/src/trunc -f $TESTFILE
44 if (test $? -eq 0 ) then
45     status=0
46 fi
47
48 exit