Whamcloud - gitweb
b=22312 sanity test 33c has problems parsing llobdstat when write_bytes is large
[fs/lustre-release.git] / lustre / tests / acceptance-small.sh
1 #!/bin/bash
2 # script which _must_ complete successfully (at minimum) before checkins to
3 # the CVS HEAD are allowed.
4 #set -vx
5 set -e
6
7 export MSKIPPED=0
8 export OSKIPPED=0
9
10 # This is the default set of tests to run.
11 DEFAULT_SUITES="runtests sanity sanity-benchmark sanityn lfsck liblustre
12                 runracer replay-single conf-sanity recovery-small
13                 replay-ost-single replay-dual insanity sanity-quota sanity-sec
14                 sanity-gss performance-sanity large-scale recovery-mds-scale 
15                 recovery-double-scale recovery-random-scale parallel-scale 
16                 lustre_rsync-test metadata-updates ost-pools lnet-selftest"
17
18 if [[ -n $@ ]]; then
19     ACC_SM_ONLY="${ACC_SM_ONLY} $@"
20 fi
21
22 [ "$SIZE" ] || SIZE=$((RAMKB * 2))
23 [ "$RSIZE" ] || RSIZE=512
24 [ "$UID" ] || UID=1000
25 [ "$MOUNT" ] || MOUNT=/mnt/lustre
26 [ "$MOUNT2" ] || MOUNT2=${MOUNT}2
27 [ "$TMP" ] || TMP=/tmp
28 [ "$COUNT" ] || COUNT=1000
29 [ "$DEBUG_LVL" ] || DEBUG_LVL=0
30 [ "$DEBUG_OFF" ] || DEBUG_OFF="eval lctl set_param debug=\"$DEBUG_LVL\""
31 [ "$DEBUG_ON" ] || DEBUG_ON="eval lctl set_param debug=0x33f0484"
32
33 if [ "$ACC_SM_ONLY" ]; then
34     for O in $DEFAULT_SUITES; do
35         O=$(echo $O | tr "-" "_" | tr "[:lower:]" "[:upper:]")
36         export ${O}="no"
37     done
38     for O in $ACC_SM_ONLY; do
39         O=`echo ${O%.sh} | tr "-" "_"`
40         O=`echo $O | tr "[:lower:]" "[:upper:]"`
41         export ${O}="yes"
42     done
43 fi
44 LFSCK="no" # bug 13698
45
46 STARTTIME=`date +%s`
47
48 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
49 . $LUSTRE/tests/test-framework.sh
50 init_test_env
51
52 if $GSS; then
53     # liblustre doesn't support GSS
54     export LIBLUSTRE=no
55 else
56     export SANITY_GSS="no"
57 fi
58
59 SETUP=${SETUP:-setupall}
60 FORMAT=${FORMAT:-formatall}
61 CLEANUP=${CLEANUP:-stopall}
62
63 setup_if_needed() {
64     nfs_client_mode && return
65
66     local MOUNTED=$(mounted_lustre_filesystems)
67     if $(echo $MOUNTED | grep -w -q $MOUNT); then
68         check_config_clients $MOUNT
69         init_facets_vars
70         init_param_vars
71         return
72     fi
73
74     echo "Lustre is not mounted, trying to do setup SETUP=$SETUP ... "
75     [ "$REFORMAT" ] && $FORMAT
76     $SETUP
77
78     MOUNTED=$(mounted_lustre_filesystems)
79     if ! $(echo $MOUNTED | grep -w -q $MOUNT); then
80         echo "Lustre is not mounted after setup! SETUP=$SETUP"
81         exit 1
82     fi
83 }
84
85 find_in_path() {
86     target=$1
87     for dir in $(tr : " " <<< $PATH); do
88       if [ -e $dir/$target ]; then
89           echo "$dir/$target found in PATH"
90           return 0
91       fi
92     done
93     return 1
94 }
95
96 title() {
97     # update titlebar if stdin is attaached to an xterm
98     if ${UPDATE_TITLEBAR:-false}; then
99         if tty -s; then
100             case $TERM in 
101                 xterm*)
102                     echo -ne "\033]2; acceptance-small: $* \007" >&0
103                     ;;
104             esac
105         fi
106     fi 
107     log "-----============= acceptance-small: "$*" ============----- `date`"
108 }
109
110 is_sanity_benchmark() {
111     local benchmarks="dbench bonnie iozone fsx"
112     local suite=$1
113     for b in $benchmarks; do
114         if [ "$b" == "$suite" ]; then
115             return 0
116         fi
117     done
118     return 1
119 }
120
121 run_suite() {
122     local suite_name=$(echo ${1%.sh} | tr "[:upper:]_" "[:lower:]-" )
123     local suite=$(echo ${suite_name} | tr "[:lower:]-" "[:upper:]_")
124     local suite_only=ONLY # Change to ${suite}_ONLY after fixing YALA
125
126     if is_sanity_benchmark ${suite_name}; then
127         suite_only=suite_name
128         suite_script=$LUSTRE/tests/sanity-benchmark.sh
129     elif [ -e $LUSTRE/tests/${suite_name}.sh ]; then
130         suite_script=$LUSTRE/tests/${suite_name}.sh
131     elif [ -e $LUSTRE/tests/$suite_name ]; then
132         suite_script=$LUSTRE/tests/$suite_name
133     elif find_in_path $suite_name; then
134         suite_script=${suite_name}
135     elif find_in_path ${suite_name}.sh; then
136         suite_script=${suite_name}.sh
137     else
138         echo "Can't find test script for $suite_name"
139         return 1
140     fi
141
142     echo "$suite_script located."
143     if [[ ${!suite} != no ]]; then
144         title $suite_name
145         log_test $suite_name
146         bash $suite_script ${!suite_only}
147         $CLEANUP
148         $SETUP
149         eval ${suite}="done"
150     else
151         echo "Skipping $suite_name"
152     fi
153 }
154
155 run_suites() {
156     for suite in $*; do
157         run_suite $suite
158     done
159 }
160
161 export NAME MOUNT START CLEAN
162 . $LUSTRE/tests/cfg/$NAME.sh
163
164 assert_env mds_HOST MDS_MKFS_OPTS 
165 assert_env ost_HOST OST_MKFS_OPTS OSTCOUNT
166 assert_env FSNAME MOUNT MOUNT2
167
168 setup_if_needed
169 init_logging
170
171 run_suites ${ACC_SM_ONLY:-$DEFAULT_SUITES}
172
173 RC=$?
174 title FINISHED
175 echo "Finished at `date` in $((`date +%s` - $STARTTIME))s"
176 print_summary
177 [ "$MSKIPPED" = 1 ] && log "FAIL: remote MDS tests skipped" && RC=1
178 [ "$OSKIPPED" = 1 ] && log "FAIL: remote OST tests skipped" && RC=1
179 echo "$0: completed with rc $RC" && exit $RC