Fix symlink detection in userspace Makefiles
[xfstests-dev.git] / 125
1 #! /bin/sh
2 # FSQA Test No. 125
3 #
4 # ftruncate test, modified from CXFSQA tests cxfs_ftrunc and cxfs_trunc
5 #
6 #-----------------------------------------------------------------------
7 #  Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
8 #-----------------------------------------------------------------------
9 #
10 # creator
11 owner=ajones@sgi.com
12
13 seq=`basename $0`
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23     _cleanup_testdir
24 }
25
26 # get standard environment, filters and checks
27 . ./common.rc
28 . ./common.filter
29
30 # real QA test starts here
31 _supported_fs xfs udf nfs
32 _supported_os Linux
33
34 _require_user
35
36 _setup_testdir
37
38 TESTDIR=$testdir/ftrunc
39 TESTFILE=$TESTDIR/ftrunc.tmp
40
41 [ -d $TESTDIR ] && rm -r $TESTDIR
42 mkdir $TESTDIR
43
44 # ftrunc must be run as a mortal user.
45 touch $TESTFILE
46
47 chmod a+rw $TESTDIR
48 chmod a+rw $TESTFILE
49
50 su $qa_user -c "$here/src/ftrunc -f $TESTFILE"
51
52 if [ "$?" != "0" ];  then
53     echo src/ftrunc returned non 0 status!
54 fi
55
56 src/trunc -f $TESTFILE
57 if (test $? -eq 0 ) then
58     status=0
59 fi
60
61 exit