Whamcloud - gitweb
- merge 0.7rc1 from b_devel to HEAD (20030612 merge point)
[fs/lustre-release.git] / lustre / tests / sanityN.sh
1 #!/bin/bash
2
3 set -e
4
5 PATH=$PATH:.
6
7 CHECKSTAT=${CHECKSTAT:-"checkstat -v"}
8 MOUNT1=${MOUNT1:-/mnt/lustre1}
9 MOUNT2=${MOUNT2:-/mnt/lustre2}
10 export NAME=${NAME:-mount2}
11
12 clean() {
13         echo -n "cln.."
14         sh llmountcleanup.sh > /dev/null
15 }
16
17 CLEAN=${CLEAN:-clean}
18 start() {
19         echo -n "mnt.."
20         sh llrmount.sh > /dev/null
21         echo -n "done"
22 }
23 START=${START:-start}
24
25 error () { 
26     echo FAIL
27     exit 1
28 }
29
30 pass() { 
31     echo PASS
32 }
33
34 mkdir -p $MOUNT2
35 mount | grep $MOUNT1 || sh llmount.sh
36
37 echo -n "test 1: check create on 2 mtpt's..."
38 touch $MOUNT1/f1
39 [ -f $MOUNT2/f1 ] || error
40 pass
41
42 echo "test 2: check attribute updates on 2 mtpt's..."
43 chmod 777 $MOUNT2/f1
44 $CHECKSTAT -t file -p 0777 $MOUNT1/f1 || error
45 pass
46
47 echo "test 2b: check cached attribute updates on 2 mtpt's..."
48 touch $MOUNT1/f2b
49 ls -l $MOUNT2/f2b
50 chmod 777 $MOUNT2/f2b
51 $CHECKSTAT -t file -p 0777 $MOUNT1/f2b || error
52 pass
53
54 echo "test 2c: check cached attribute updates on 2 mtpt's..."
55 touch $MOUNT1/f2c
56 ls -l $MOUNT2/f2c
57 chmod 777 $MOUNT1/f2c
58 $CHECKSTAT -t file -p 0777 $MOUNT2/f2c || error
59 pass
60
61 echo "test 3: check after remount attribute updates on 2 mtpt's..."
62 chmod a-x $MOUNT2/f1
63 $CLEAN
64 $START
65 $CHECKSTAT -t file -p 0666 $MOUNT1/f1 || error
66 pass
67
68 echo "test 4: unlink on one mountpoint removes file on other..."
69 rm $MOUNT2/f1
70 $CHECKSTAT -a $MOUNT1/f1 || error
71 pass
72
73 echo -n "test 5: symlink on one mtpt, readlink on another..."
74 ( cd $MOUNT1 ; ln -s this/is/good lnk )
75
76 [ "this/is/good" = "`perl -e 'print readlink("/mnt/lustre2/lnk");'`" ] || error
77 pass
78
79 echo -n "test 6: fstat validation on multiple mount points..."
80 ./multifstat $MOUNT1/f6 $MOUNT2/f6
81 pass
82
83 if [ -n "$BUG_1365" ]; then
84 echo -n "test 7: create a file on one mount, truncate it on the other..."
85 mcreate $MOUNT1/f1
86 truncate $MOUNT2/f1 100
87 rm $MOUNT1/f1
88 pass
89 else
90 echo "Skipping test for 1365: set \$BUG_1365 to run it (and crash, likely)."
91 fi
92
93 echo "test 9: remove of open file on other node..."
94 ./openunlink $MOUNT1/f9 $MOUNT2/f9 || error
95 pass
96
97 echo "test 9b: remove of open directory on other node..."
98 ./opendirunlink $MOUNT1/dir1 $MOUNT2/dir1 || error
99 pass
100
101 #echo "test 9c: remove of open special file on other node..."
102 #./opendevunlink $MOUNT1/dev1 $MOUNT2/dev1 || error
103 #pass
104
105 echo -n "test 10: append of file with sub-page size on multiple mounts..."
106 MTPT=1
107 > $MOUNT2/f10
108 for C in a b c d e f g h i j k l; do
109         MOUNT=`eval echo \\$MOUNT$MTPT`
110         echo -n $C >> $MOUNT/f10
111         [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
112 done
113 [ "`cat $MOUNT1/f10`" = "abcdefghijkl" ] && pass || error
114         
115 echo -n "test 11: write of file with sub-page size on multiple mounts..."
116 MTPT=1
117 OFFSET=0
118 > $MOUNT2/f11
119 for C in a b c d e f g h i j k l; do
120         MOUNT=`eval echo \\$MOUNT$MTPT`
121         echo -n $C | dd of=$MOUNT/f11 bs=1 seek=$OFFSET count=1
122         [ "$MTPT" -eq 1 ] && MTPT=2 || MTPT=1
123         OFFSET=`expr $OFFSET + 1`
124 done
125 [ "`cat $MOUNT1/f11`" = "abcdefghijkl" ] && pass || error
126         
127 rm -f $MOUNT1/f[0-9]* $MOUNT1/lnk
128
129 $CLEAN
130
131 exit