Whamcloud - gitweb
land v0.9.1 on HEAD, in preparation for a 1.0.x branch
[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
12 # checking
13 if [ ! -e $LTREE_KERNEL ]; then
14         echo "$LTREE_KERNEL dosen't exits"
15         exit 1
16 fi
17
18 if [ ! -e $LTREE_USER ]; then
19         echo "$LTREE_USER dosen't exits"
20         exit 1
21 fi
22
23 if [ ! -e $LTREE_USER/liblustre/lltest ]; then
24         echo "$LTREE_USER/liblustre/lltest dosen't exits"
25         exit 1
26 fi
27
28 workdir=`pwd`
29
30 cleanup()
31 {
32         curdir=`pwd`
33         cd $LTREE_KERNEL/tests
34         $LCONF --node localhost --cleanup --force $LTREE_USER/tests/$configfile 2>&1 > /dev/null
35         cd $curdir
36 }
37
38 configfile=liblustre_sanity_uml.xml
39
40 # generate config file
41 rm -f $configfile
42 MDSNODE=localhost OSTNODES=localhost CLIENTS=$LLIP sh uml.sh $configfile
43 if [ ! -e $configfile ]; then
44         echo "fail to generate config file $configfile"
45         exit 1
46 fi
47
48 # generate dump file
49 rm -f /tmp/DUMP_FILE
50 $LCONF --lctl_dump /tmp/DUMP_FILE --node $LLIP $configfile
51 if [ ! -e /tmp/DUMP_FILE ]; then
52         echo "error creating dumpfile"
53         exit 1
54 fi
55
56 #setup lustre server
57 cd $LTREE_KERNEL/tests
58 $LCONF --node localhost --reformat $LTREE_USER/tests/$configfile
59 rc=$?
60 if [ $rc -ne 0 ]; then
61         echo "setup lustre server: error $rc"
62         cleanup
63         exit 1
64 fi
65 cd $workdir
66
67 #do liblustre testing
68 $LTREE_USER/liblustre/lltest
69 rc=$?
70 if [ $rc -ne 0 ]; then
71         echo "liblustre test error $rc"
72         cleanup
73         exit 1
74 fi
75
76 echo "===== liblustre sanity test complete sucessfully ====="
77
78 echo -n "===== cleanup... "; cleanup; echo "done ====="
79
80 cd $workdir
81
82 exit 0