xfstests 241: run parallel dbench
[xfstests-dev.git] / 236
1 #! /bin/bash
2 # FS QA Test No. 236
3 #
4 # Check ctime updated or not if file linked
5 # See also http://marc.info/?l=linux-btrfs&m=127434439020230&w=2
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2010 FUJITSU LIMITED. All Rights Reserved.
9 #
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
13 #
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22 #
23 #-----------------------------------------------------------------------
24 #
25 # creator
26 owner=shiwh@cn.fujitsu.com
27
28 seq=`basename $0`
29 echo "QA output created by $seq"
30
31 _cleanup()
32 {
33         rm -f $TEST_DIR/ouch*
34 }
35
36 here=`pwd`
37 status=1        # failure is the default!
38 trap "_cleanup; exit \$status" 0 1 2 3 15
39
40 # get standard environment, filters and checks
41 . ./common.rc
42
43 # real QA test starts here
44 _supported_fs generic
45 # only Linux supports fallocate
46 _supported_os Linux
47
48 rm -f $TEST_DIR/ouch*
49
50 # create a file and get its ctime
51 touch $TEST_DIR/ouch
52 ctime=`stat -c %Z $TEST_DIR/ouch`
53 sleep 1
54
55 # create a link to a file and get existing file's ctime
56 link $TEST_DIR/ouch $TEST_DIR/ouch2
57 ctime2=`stat -c %Z $TEST_DIR/ouch`
58
59 # check ctime updated
60 if [ $ctime2 -le $ctime ]; then
61         echo "ctime: $ctime -> $ctime2 "
62         echo "Fatal error: ctime not updated after link"
63         _cleanup
64         exit 1
65 fi
66
67 echo "Test over."
68 # success, all done
69 status=0
70 exit