Whamcloud - gitweb
Some racy problems happened when sanity-quota.sh run on buffalo.
[fs/lustre-release.git] / lustre / tests / liblustre_sanity_uml.sh
1 #!/bin/bash
2
3 # liblustre sanity test. specially written for UML for now
4
5 LCONF=${LCONF:-../utils/lconf}
6
7 LLIP=127.0.0.1
8
9 LTREE_KERNEL=${LTREE_KERNEL:-../../lustre}
10 LTREE_USER=${LTREE_USER:-../../lustre-lib}
11 HOSTNAME=`hostname`
12
13 # checking
14 if [ ! -e $LTREE_KERNEL ]; then
15         echo "$LTREE_KERNEL dosen't exits"
16         exit 1
17 fi
18
19 if [ ! -e $LTREE_USER ]; then
20         echo "$LTREE_USER dosen't exits"
21         exit 1
22 fi
23
24 if [ ! -e $LTREE_USER/liblustre/lltest ]; then
25         echo "$LTREE_USER/liblustre/lltest dosen't exits"
26         exit 1
27 fi
28
29 workdir=`pwd`
30
31 cleanup()
32 {
33         curdir=`pwd`
34         cd $LTREE_KERNEL/tests
35         $LCONF --node $HOSTNAME --cleanup --force $LTREE_USER/tests/$configfile 2>&1 > /dev/null
36         cd $curdir
37 }
38
39 configfile=liblustre_sanity_uml.xml
40
41 # generate config file
42 rm -f $configfile
43 MDSNODE=$HOSTNAME OSTNODES=$HOSTNAME CLIENTS=$LLIP sh uml.sh $configfile
44 if [ ! -e $configfile ]; then
45         echo "fail to generate config file $configfile"
46         exit 1
47 fi
48
49 # generate dump file
50 rm -f /tmp/DUMP_FILE
51 $LCONF --lctl_dump /tmp/DUMP_FILE --node $LLIP $configfile
52 if [ ! -e /tmp/DUMP_FILE ]; then
53         echo "error creating dumpfile"
54         exit 1
55 fi
56
57 #setup lustre server
58 cd $LTREE_KERNEL/tests
59 $LCONF --node $HOSTNAME --reformat $LTREE_USER/tests/$configfile
60 rc=$?
61 if [ $rc -ne 0 ]; then
62         echo "setup lustre server: error $rc"
63         cleanup
64         exit 1
65 fi
66 cd $workdir
67
68 #do liblustre testing
69 $LTREE_USER/liblustre/lltest
70 rc=$?
71 if [ $rc -ne 0 ]; then
72         echo "liblustre test error $rc"
73         cleanup
74         exit 1
75 fi
76
77 echo "===== liblustre sanity test complete sucessfully ====="
78
79 echo -n "===== cleanup... "; cleanup; echo "done ====="
80
81 cd $workdir
82
83 exit 0