5 # This script is used to report the results from a sanity run to buffalo.
8 # - the target host on which you are running the test (be it
9 # a real machine or a uml session) is accessible via DSH
11 export TMP=${TMP:-"/tmp"}
12 export LOG=${LOG:-"$TMP/sanity-buffalo.log"}
13 export DMESGLOG=${DMESGLOG:-"$TMP/sanity-buffalo-dmesg.log"}
14 export OUTPUT=${OUTPUT:-"$TMP/buffalo_mail"}
15 export DSH=${DSH:-"pdsh -S -w"}
16 export LUSTRE_SRC=${LUSTRE_SRC:-"$PWD/.."}
17 export LTESTDIR=${LTESTDIR:-"$PWD/../../ltest"}
18 export TARGET=${TARGET:-"uml"}
19 export SCP=${SCP:-"scp"}
20 #export NO_SHARED_FS=0
22 # Changeable buffalo config variables.
24 # The following RECIPIENTS string sends results to the buffalo-sandbox.
25 RECIPIENTS=${RECIPIENTS:-"buffalo-sandbox@clusterfs.com"}
26 # The following RECIPIENTS string sends results to buffalo proper.
27 # RECIPIENTS=${RECIPIENTS:-"buffalo_results@clusterfs.com"}
29 export TESTNAME=${TESTNAME:-"sanity-buffalo"}
30 export TESTDESC=${TESTDESC:-"Local test in $TARGET for correctness"}
31 export TESTGROUP=${TESTGROUP:-"correctness"}
32 export LUSTRE_TAG=${LUSTRE_TAG:-`cat $PWD/CVS/Tag | cut -c 2-`}
33 export TESTARCH=${TESTARCH:-`uname -r`}
34 export NETWORKTYPE=${NETWORKTYPE:-"tcp"}
35 export MACHINENAME=${MACHINENAME:-`hostname`}
40 Usage: sanity-buffalo.sh --sender=email_address [--config=config_name] [--test=test_name] [--extra-params=extra_parameters] [--target=hostname] [--help]"
45 --sender=email_address
46 Email address of the person running the test. (Required)
49 Config type to use for lustre setup. Any of the standard script names
50 from lustre/tests are allowable:
51 lov, local, mount2lov, local-large-inode (default)
54 Name of the test script to run. Default is \"sanity.sh\".
57 The machine (or uml session) on which to run the test.
60 --extra-params=extra_parameters
61 Extra parameters to pass to the test script.
62 e.g. --extra-params=\"START=' ' CLEAN=' '\"
63 NOTE: NAME=lov should not be set here, use --config
66 Display this usage message
76 if [ -z "$SENDER" ] ; then
77 echo "Please supply a valid email address for --sender"
83 if [ -z "$CONFIG_NAME" ] ; then
84 echo "Using default config: local-large-inode"
85 CONFIG_NAME="local-large-inode"
90 if [ -z "$TESTSCRIPT" ] ; then
91 echo "Running default test: sanity.sh"
92 TESTSCRIPT="sanity.sh"
102 $DSH $TARGET "dmesg -c > /dev/null" || exit 1
107 $DSH $TARGET "cd $LUSTRE_SRC/tests && PATH=/sbin:/usr/sbin:\$PATH NAME=$CONFIG_NAME sh llmount.sh 2>&1" | dshbak -c >> $LOG
108 if ! [ $? = 0 ] ; then
109 echo "Can not mount lustre on remoute machine: $TARGET "
112 if [ $NO_SHARED_FS ]; then
113 $SCP $TARGET:$LUSTRE_SRC/tests/${CONFIG_NAME}.xml $PWD/config.xml
114 if ! [ $? = 0 ] ; then
115 echo "Can not get the config file from remoute machine: $TARGET "
120 COMMAND="cd $LUSTRE_SRC/tests && NAME=$CONFIG_NAME PATH=/sbin:/usr/sbin:\$PATH $EXTRA_PARAMS sh $TESTSCRIPT"
121 echo >> $LOG;echo "COMMAND: $COMMAND" >> $LOG;echo >> $LOG
123 $DSH $TARGET "$COMMAND 2>&1" | dshbak -c >> $LOG
130 if [ $RC -eq 0 ]; then
136 if [ "$RESULT" = "fail" ] ; then
137 $DSH $TARGET "dmesg" | dshbak -c >> $DMESGLOG
142 . $LTESTDIR/acceptance/harness/config/common/buffalo.sh
144 if [ $NO_SHARED_FS ]; then
145 CONFIG="$PWD/config.xml"
147 CONFIG="${LUSTRE_SRC}/tests/${CONFIG_NAME}.xml"
149 CONFIGDESC=${CONFIGDESC:-"${TARGET}-${CONFIG_NAME}"}
151 ### send buffalo reports
152 echo "Sending buffalo report..."
154 buffalo_format_result > $OUTPUT
155 buffalo_format_config $CONFIG >> $OUTPUT
156 buffalo_format_log $LOG >> $OUTPUT
157 buffalo_format_dmesg $DMESGLOG >> $OUTPUT
158 buffalo_send_report $OUTPUT
166 $DSH $TARGET "cd $LUSTRE_SRC/tests && NAME=$CONFIG_NAME sh llmountcleanup.sh 2>&1" | dshbak -c >> $LOG
167 if ! [ $? = 0 ] ; then
168 echo "failed to clean up lustre"
172 options=`getopt -o h --long extra-params:,target:,sender:,config:,test:,help -- "$@"`
174 if [ $? -ne 0 ] ; then
177 eval set -- "$options"
206 if [ ! -d ${LUSTRE_SRC} ]; then
207 echo "LUSTRE_SRC dir $LUSTRE_SRC doesn't exist"
211 if [ ! -d ${LTESTDIR} ]; then
212 echo "LTESTDIR dir $LTESTDIR doesn't exist"
216 # Gather some buffalo variable before we run the test.
217 export KERNEL=`$DSH $TARGET uname -r | sed "s/^.*\ //g"`
218 export LUSTRE_BUILD=`${LUSTRE_SRC}/utils/lctl lustre_build_version 2>/dev/null|grep "^lctl" | awk '/^lctl/ {print $3}'`
220 check_mail && check_config && check_test