Whamcloud - gitweb
b=3031
[fs/lustre-release.git] / lustre / tests / lov-sanity.sh
1 #!/bin/sh
2 export OSTCOUNT=6
3 export OSTSIZE=81919
4 export NAME=lov
5 export MOUNTPT=${MOUNTPT:-"/mnt/lustre"}
6 export LCONF=${LCONF:-"../utils/lconf"}
7 export CONFIG=${CONFIG:-"$NAME.xml"}
8 export MCREATE=${MCREATE:-"mcreate"}
9 export LFS=${LFS:-"/usr/sbin/lfs"}
10 export SETSTRIPE_SIZE=${SETSTRIPE_SIZE:-"131072"}
11 export OPENFILE=${OPENFILE:-"./openfile"}
12 fail()
13 {
14     echo "ERROR $@"
15     exit 1
16 }
17 lustre_mount()
18 {
19     . ./llmount.sh || fail "Mount lustre failed"
20 }
21 test_0()
22 {
23     echo "test 0 IO after open file"
24     mkdir $MOUNTPT/d0 
25     $OPENFILE -f O_RDWR:O_CREAT -m 0755  $MOUNTPT/d0/f       || fail "open file failed."
26     ls -lR >> $MOUNTPT/d0/f                                  || fail "IO after open failed."
27     rm -fr  $MOUNTPT/d0                                      || fail "Unable to ereas dir."
28     echo "test 0 success."
29 }
30 test_1()
31 {
32     echo "test 1 IO after mcreate "
33     mkdir $MOUNTPT/d1
34     $MCREATE $MOUNTPT/d1/f    || fail "mcreate file failed."
35     ls -lR >> $MOUNTPT/d1/f   || fail "IO after mcreate failed."
36     rm -fr  $MOUNTPT/d1       || fail "Unable to ereas the file."
37     echo "test 1 success."
38 }
39 test_2()
40 {
41     echo "test 2 IO after mcreate with strip 1 "
42     mkdir $MOUNTPT/d2
43     $MCREATE $MOUNTPT/d2/f                             || fail "mcreate file failed."
44     $LFS setstripe $MOUNTPT/d2/f $SETSTRIPE_SIZE 0 1   || fail "setstipe to stripe 1 failed"
45     ls -lR >> $MOUNTPT/d2/f                            || fail "IO after mcreate failed."
46     rm -fr  $MOUNTPT/d2                                || fail "Unable to ereas the file."
47     echo "test 2 success."
48 }
49
50 test_3()
51 {
52     echo "test 2 IO after mcreate with strip 4 "
53     mkdir $MOUNTPT/d3
54     $MCREATE $MOUNTPT/d3/f                             || fail "mcreate file failed."
55     $LFS setstripe $MOUNTPT/d3/f $SETSTRIPE_SIZE 0 4   || fail "setstipe to stripe 4 failed"
56     ls -lR >> $MOUNTPT/d3/f                            || fail "IO after mcreate failed."
57     rm -fr  $MOUNTPT/d3                                || fail "Unable to ereas the file."
58     echo "test 3 success."
59 }
60 test_4()
61 {
62     echo "test 4 IO after mcreate with strip 6 "
63     mkdir $MOUNTPT/d3
64     $MCREATE $MOUNTPT/d3/f                             || fail "mcreate file failed."
65     $LFS setstripe $MOUNTPT/d3/f $SETSTRIPE_SIZE 0 6   || fail "setstipe to stripe 6 failed"
66     ls -lR >> $MOUNTPT/d3/f                            || fail "IO after mcreate failed."
67     rm -fr  $MOUNTPT/d3                                || fail "Unable to ereas the file."
68     echo "test 4 success."
69 }
70
71 lustre_clean()
72 {
73     echo "clean up lustre"
74     cd $CURRENT
75     $LCONF --cleanup  $CONFIG  || fail "Unable to clean up lustre."
76     echo "clean up lustre success"
77 }
78 run_all()
79 {
80     lustre_mount 
81     test_0       
82     test_1
83     test_2
84     test_3
85     test_4
86     lustre_clean 
87 }
88 run_all 
89