| 1 | #!/bin/sh |
|---|
| 2 | |
|---|
| 3 | # i'm not married to bash. just wanted to get things prototyped |
|---|
| 4 | |
|---|
| 5 | # prereqs: |
|---|
| 6 | # - $user needs to be in the sudoers file |
|---|
| 7 | # - $user needs to be able to sudo w/o prompting |
|---|
| 8 | # - please don't cheat and run this as root: will not catch permissions bugs |
|---|
| 9 | |
|---|
| 10 | # you can override these settings in nightly-tests.cfg |
|---|
| 11 | export PVFS2_DEST=/tmp/pvfs2-nightly |
|---|
| 12 | export PVFS2_MOUNTPOINT=/pvfs2-nightly |
|---|
| 13 | export EXTRA_TESTS=${HOME}/src/benchmarks |
|---|
| 14 | #export EXTRA_TESTS=/tmp/src/benchmarks |
|---|
| 15 | export URL=http://devorange.clemson.edu/pvfs |
|---|
| 16 | export BENCHMARKS=benchmarks-20060512.tar.gz |
|---|
| 17 | |
|---|
| 18 | # look for a 'nightly-test.cfg' in the same directory as this script |
|---|
| 19 | if [ -f /tmp/$USER/nightly-tests.cfg ] ; then |
|---|
| 20 | . /tmp/$USER/nightly-tests.cfg |
|---|
| 21 | fi |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | # need to make this a command line arugment: |
|---|
| 25 | export CVS_TAG="${CVS_TAG:-HEAD}" |
|---|
| 26 | |
|---|
| 27 | # no need to modify these. they make their own gravy |
|---|
| 28 | STARTTIME=`date +%s` |
|---|
| 29 | TINDERSCRIPT=$(cd `dirname $0`; pwd)/tinder-pvfs2-status |
|---|
| 30 | SYSINT_SCRIPTS=~+/sysint-tests.d |
|---|
| 31 | VFS_SCRIPTS=~+/vfs-tests.d |
|---|
| 32 | VFS_SCRIPT="dbench" |
|---|
| 33 | MPIIO_DRIVER=${PVFS2_DEST}/pvfs2-${CVS_TAG}/test/automated/testscrpt-mpi.sh |
|---|
| 34 | REPORT_LOG=${PVFS2_DEST}/alltests-${CVS_TAG}.log |
|---|
| 35 | BENCHMARKS=benchmarks-20060512.tar.gz |
|---|
| 36 | |
|---|
| 37 | # for debugging and testing, you might need to set the above to your working |
|---|
| 38 | # direcory.. .unless you like checking in broken scripts |
|---|
| 39 | #SYSINT_SCRIPTS=$(cd `dirname $0`; pwd)/sysint-tests.d |
|---|
| 40 | #VFS_SCRIPTS=$(cd `dirname $0`; pwd)/vfs-tests.d |
|---|
| 41 | MPIIO_DRIVER=$(cd `dirname $0`; pwd)/testscrpt-mpi.sh |
|---|
| 42 | |
|---|
| 43 | TESTNAME="`hostname -s`-nightly" |
|---|
| 44 | |
|---|
| 45 | # before starting any client apps, we need to deal with the possiblity that we |
|---|
| 46 | # might have built with shared libraries |
|---|
| 47 | export LD_LIBRARY_PATH=${PVFS2_DEST}/INSTALL-pvfs2-${CVS_TAG}/lib:${LD_LIBRARY_PATH} |
|---|
| 48 | |
|---|
| 49 | # we only have a few hosts that meet all the earlier stated prereqs |
|---|
| 50 | VFS_HOSTS="devorange2" |
|---|
| 51 | |
|---|
| 52 | # |
|---|
| 53 | # Detect basic heap corruption |
|---|
| 54 | # |
|---|
| 55 | export MALLOC_CHECK_=2 |
|---|
| 56 | |
|---|
| 57 | # takes one argument: a tag or branch in CVS |
|---|
| 58 | pull_and_build_pvfs2 () { |
|---|
| 59 | # debugging aide... when we run this script repeatedly, we don't |
|---|
| 60 | # really need to build everything again |
|---|
| 61 | [ -n "$SKIP_BUILDING_PVFS2" ] && return 0 |
|---|
| 62 | |
|---|
| 63 | mkdir -p $PVFS2_DEST |
|---|
| 64 | with_kernel="" |
|---|
| 65 | if [ $do_vfs -eq 1 ] ; then |
|---|
| 66 | with_kernel="-k /lib/modules/`uname -r`/build" |
|---|
| 67 | fi |
|---|
| 68 | # a bit of gross shell hackery, but cuts down on the number of |
|---|
| 69 | # variables we have to set. Assumes we ran this script out of a |
|---|
| 70 | # checked out pvfs2 tree |
|---|
| 71 | $(cd `dirname $0`;pwd)/../../maint/build/pvfs2-build.sh -t -v $1 \ |
|---|
| 72 | $with_kernel -r $PVFS2_DEST |
|---|
| 73 | |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | pull_and_build_mpich2 () { |
|---|
| 77 | # just to make debugging less painful |
|---|
| 78 | [ -n "${SKIP_BUILDING_MPICH2}" ] && return 0 |
|---|
| 79 | [ -d ${PVFS2_DEST} ] || mkdir ${PVFS2_DEST} |
|---|
| 80 | cd ${PVFS2_DEST} |
|---|
| 81 | rm -rf mpich2-latest.tar.gz |
|---|
| 82 | wget --passive-ftp --quiet 'ftp://ftp.mcs.anl.gov/pub/mpi/misc/mpich2snap/mpich2-snap-*' -O mpich2-latest.tar.gz |
|---|
| 83 | rm -rf mpich2-snap-* |
|---|
| 84 | tar xzf mpich2-latest.tar.gz |
|---|
| 85 | cd mpich2-snap-* |
|---|
| 86 | mkdir build |
|---|
| 87 | cd build |
|---|
| 88 | ../configure -q --prefix=${PVFS2_DEST}/soft/mpich2 \ |
|---|
| 89 | --enable-romio --with-file-system=ufs+nfs+testfs+pvfs2 \ |
|---|
| 90 | --with-pvfs2=${PVFS2_DEST}/INSTALL-pvfs2-${CVS_TAG} \ |
|---|
| 91 | --enable-g=dbg --without-mpe \ |
|---|
| 92 | --disable-f77 >mpich2config-${CVS_TAG}.log &&\ |
|---|
| 93 | make >/dev/null && make install >/dev/null |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | teardown_vfs() { |
|---|
| 98 | sudo umount $PVFS2_MOUNTPOINT |
|---|
| 99 | sudo killall pvfs2-client |
|---|
| 100 | sleep 1 |
|---|
| 101 | sudo /sbin/rmmod pvfs2 |
|---|
| 102 | # let teardown alway ssucceed. pvfs2-client might already be killed |
|---|
| 103 | # and pvfs2 kernel module might not be loaded yet |
|---|
| 104 | return 0 |
|---|
| 105 | } |
|---|
| 106 | |
|---|
| 107 | setup_vfs() { |
|---|
| 108 | sudo dmesg -c >/dev/null |
|---|
| 109 | sudo /sbin/insmod ${PVFS2_DEST}/INSTALL-pvfs2-${CVS_TAG}/lib/modules/`uname -r`/kernel/fs/pvfs2/pvfs2.ko |
|---|
| 110 | # sudo LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ${PVFS2_DEST}/INSTALL-pvfs2-${CVS_TAG}/sbin/pvfs2-client \ |
|---|
| 111 | # -p ${PVFS2_DEST}/INSTALL-pvfs2-${CVS_TAG}/sbin/pvfs2-client-core \ |
|---|
| 112 | # -L ${PVFS2_DEST}/pvfs2-client-${CVS_TAG}.log |
|---|
| 113 | # sudo screen -d -m cgdb -x ${PVFS2_DEST}/.gdbinit --args ${PVFS2_DEST}/INSTALL-pvfs2-${CVS_TAG}/sbin/pvfs2-client-core -L ${PVFS2_DEST}/pvfs2-client-${CVS_TAG}.log |
|---|
| 114 | #sudo valgrind --log-file=${PVFS2_DEST}/pvfs2-client.vg ${PVFS2_DEST}/INSTALL-pvfs2-${CVS_TAG}/sbin/pvfs2-client-core -L ${PVFS2_DEST}/pvfs2-client-${CVS_TAG}.log & |
|---|
| 115 | sudo ${PVFS2_DEST}/INSTALL-pvfs2-${CVS_TAG}/sbin/pvfs2-client -p ${PVFS2_DEST}/INSTALL-pvfs2-${CVS_TAG}/sbin/pvfs2-client-core -L ${PVFS2_DEST}/pvfs2-client-${CVS_TAG}.log |
|---|
| 116 | sudo chmod 644 ${PVFS2_DEST}/pvfs2-client-${CVS_TAG}.log |
|---|
| 117 | sudo mount -t pvfs2 tcp://`hostname -s`:3399/pvfs2-fs ${PVFS2_MOUNTPOINT} |
|---|
| 118 | } |
|---|
| 119 | |
|---|
| 120 | setup_pvfs2() { |
|---|
| 121 | cd $PVFS2_DEST |
|---|
| 122 | rm -f fs.conf |
|---|
| 123 | INSTALL-pvfs2-${CVS_TAG}/bin/pvfs2-genconfig fs.conf \ |
|---|
| 124 | --protocol tcp \ |
|---|
| 125 | --iospec="`hostname -s`:{3396-3399}" \ |
|---|
| 126 | --metaspec="`hostname -s`:{3396-3399}" \ |
|---|
| 127 | --storage ${PVFS2_DEST}/STORAGE-pvfs2-${CVS_TAG} \ |
|---|
| 128 | --logfile=${PVFS2_DEST}/pvfs2-server-${CVS_TAG}.log --quiet |
|---|
| 129 | # clean up any artifacts from earlier runs |
|---|
| 130 | rm -rf ${PVFS2_DEST}/STORAGE-pvfs2-${CVS_TAG}* |
|---|
| 131 | rm -f ${PVFS2_DEST}/pvfs2-server-${CVS_TAG}.log* |
|---|
| 132 | failure_logs="${PVFS2_DEST}/pvfs2-server-${CVS_TAG}.log* $failure_logs" |
|---|
| 133 | for alias in `grep 'Alias ' fs.conf | cut -d ' ' -f 2`; do |
|---|
| 134 | INSTALL-pvfs2-${CVS_TAG}/sbin/pvfs2-server \ |
|---|
| 135 | -p `pwd`/pvfs2-server-${alias}.pid \ |
|---|
| 136 | -f fs.conf -a $alias |
|---|
| 137 | INSTALL-pvfs2-${CVS_TAG}/sbin/pvfs2-server \ |
|---|
| 138 | -p `pwd`/pvfs2-server-${alias}.pid \ |
|---|
| 139 | fs.conf $server_conf -a $alias |
|---|
| 140 | done |
|---|
| 141 | |
|---|
| 142 | echo "tcp://`hostname -s`:3399/pvfs2-fs ${PVFS2_MOUNTPOINT} pvfs2 defaults 0 0" > ${PVFS2_DEST}/pvfs2tab |
|---|
| 143 | # do we need to use our own pvfs2tab file? If we will mount pvfs2, we |
|---|
| 144 | # can fall back to /etc/fstab |
|---|
| 145 | grep -q 'pvfs2-nightly' /etc/fstab |
|---|
| 146 | if [ $? -ne 0 -a $do_vfs -eq 0 ] ; then |
|---|
| 147 | export PVFS2TAB_FILE=${PVFS2_DEST}/pvfs2tab |
|---|
| 148 | fi |
|---|
| 149 | #turn on degging on each server |
|---|
| 150 | INSTALL-pvfs2-${CVS_TAG}/bin/pvfs2-set-debugmask -m ${PVFS2_MOUNTPOINT} "all" |
|---|
| 151 | } |
|---|
| 152 | |
|---|
| 153 | teardown_pvfs2() { |
|---|
| 154 | for pidfile in ${PVFS2_DEST}/pvfs2-server*.pid ; do |
|---|
| 155 | [ ! -f $pidfile ] && continue |
|---|
| 156 | |
|---|
| 157 | kill `cat $pidfile` |
|---|
| 158 | # occasionally the server ends up in a hard-to-kill state. |
|---|
| 159 | # server has atexit(3) remove .pid file |
|---|
| 160 | sleep 3 |
|---|
| 161 | if [ -f $pidfile ] ; then |
|---|
| 162 | kill -9 `cat $pidfile` |
|---|
| 163 | fi |
|---|
| 164 | done |
|---|
| 165 | |
|---|
| 166 | # let teardown always succeed. pvfs2-server.pid could be stale |
|---|
| 167 | return 0 |
|---|
| 168 | } |
|---|
| 169 | |
|---|
| 170 | buildfail() { |
|---|
| 171 | echo "Failure in build process" |
|---|
| 172 | cat ${PVFS2_DEST}/configure-${CVS_TAG}.log \ |
|---|
| 173 | ${PVFS2_DEST}/make-extracted-${CVS_TAG}.log \ |
|---|
| 174 | ${PVFS2_DEST}/make-install-${CVS_TAG}.log \ |
|---|
| 175 | ${PVFS2_DEST}/make-${CVS_TAG}.log \ |
|---|
| 176 | ${PVFS2_DEST}/make-test-${CVS_TAG}.log | \ |
|---|
| 177 | ${TINDERSCRIPT} ${TESTNAME}-${CVS_TAG} build_failed $STARTTIME |
|---|
| 178 | exit 1 |
|---|
| 179 | } |
|---|
| 180 | |
|---|
| 181 | setupfail() { |
|---|
| 182 | echo "Failure in setup" |
|---|
| 183 | dmesg > ${PVFS2_DEST}/dmesg |
|---|
| 184 | cat ${PVFS2_DEST}/dmesg ${PVFS2_DEST}/pvfs2-client-${CVS_TAG}.log \ |
|---|
| 185 | ${PVFS2_DEST}/pvfs2-server-${CVS_TAG}.log* | \ |
|---|
| 186 | ${TINDERSCRIPT} ${TESTNAME}-${CVS_TAG} test_failed $STARTTIME |
|---|
| 187 | exit 1 |
|---|
| 188 | } |
|---|
| 189 | |
|---|
| 190 | tinder_report() { |
|---|
| 191 | eval cat $REPORT_LOG $failure_logs |\ |
|---|
| 192 | ${TINDERSCRIPT} ${TESTNAME}-${CVS_TAG} $1 $STARTTIME \ |
|---|
| 193 | "$nr_failed of $(( $nr_failed + $nr_passed)) failed" |
|---|
| 194 | } |
|---|
| 195 | |
|---|
| 196 | testfail() { |
|---|
| 197 | echo "Failure in testing" |
|---|
| 198 | tinder_report test_failed |
|---|
| 199 | exit 1 |
|---|
| 200 | } |
|---|
| 201 | |
|---|
| 202 | # idea stolen from debian: for a given directory, run every executable file |
|---|
| 203 | run_parts() { |
|---|
| 204 | cd $1 |
|---|
| 205 | for f in *; do |
|---|
| 206 | # skip CVS |
|---|
| 207 | [ -d $f ] && continue |
|---|
| 208 | if [ -x $f ] ; then |
|---|
| 209 | echo -n "====== `date` == running $f ..." |
|---|
| 210 | ./$f > ${PVFS2_DEST}/${f}-${CVS_TAG}.log |
|---|
| 211 | if [ $? -eq 0 ] ; then |
|---|
| 212 | nr_passed=$((nr_passed + 1)) |
|---|
| 213 | echo "OK" |
|---|
| 214 | else |
|---|
| 215 | nr_failed=$((nr_failed + 1)) |
|---|
| 216 | failure_logs="$failure_logs ${PVFS2_DEST}/${f}-${CVS_TAG}.log" |
|---|
| 217 | echo "FAILED" |
|---|
| 218 | fi |
|---|
| 219 | fi |
|---|
| 220 | done |
|---|
| 221 | } |
|---|
| 222 | |
|---|
| 223 | #run only one script |
|---|
| 224 | run_one() { |
|---|
| 225 | cd $1 |
|---|
| 226 | echo -n "===== `date` == running ${1}/${2} ..." |
|---|
| 227 | ${1}/${2} > ${PVFS2_DEST}/${2}-${CVS_TAG}.log |
|---|
| 228 | if [ $? -eq 0 ] ; then |
|---|
| 229 | nr_passed=$((nr_passed + 1)) |
|---|
| 230 | echo "OK" |
|---|
| 231 | else |
|---|
| 232 | nr_failed=$((nr_failed + 1)) |
|---|
| 233 | failure_logs="$failure_logs ${PVFS2_DEST}/${2}-${CVS_TAG}.log" |
|---|
| 234 | echo "FAILED" |
|---|
| 235 | fi |
|---|
| 236 | } |
|---|
| 237 | ### |
|---|
| 238 | ### entry point for script |
|---|
| 239 | ### |
|---|
| 240 | |
|---|
| 241 | # show that we're doing something |
|---|
| 242 | ${TINDERSCRIPT} ${TESTNAME}-${CVS_TAG} building $STARTTIME </dev/null |
|---|
| 243 | |
|---|
| 244 | # will we be able to do VFS-related tests? |
|---|
| 245 | do_vfs=0 |
|---|
| 246 | for s in $(echo $VFS_HOSTS); do |
|---|
| 247 | if [ `hostname -s` = $s ] ; then |
|---|
| 248 | do_vfs=1 |
|---|
| 249 | break |
|---|
| 250 | fi |
|---|
| 251 | done |
|---|
| 252 | |
|---|
| 253 | # "install" benchmark software, if EXTRA_TESTS is not null |
|---|
| 254 | if [ $EXTRA_TESTS ] |
|---|
| 255 | then |
|---|
| 256 | echo "Installing benchmark software...." |
|---|
| 257 | my_cwd=`pwd` |
|---|
| 258 | |
|---|
| 259 | #create directory, if not already there |
|---|
| 260 | mkdir -p $EXTRA_TESTS |
|---|
| 261 | if [ $? != 0 ] |
|---|
| 262 | then |
|---|
| 263 | echo "benchmarks: mkdir failed" |
|---|
| 264 | setupfail |
|---|
| 265 | fi |
|---|
| 266 | |
|---|
| 267 | #remove existing tar file and/or subdirectories |
|---|
| 268 | cd $EXTRA_TESTS/.. |
|---|
| 269 | sudo /bin/rm -rf * |
|---|
| 270 | |
|---|
| 271 | #get new tar file |
|---|
| 272 | wget ${URL}/${BENCHMARKS} |
|---|
| 273 | if [ $? != 0 ] |
|---|
| 274 | then |
|---|
| 275 | echo "benchmarks: wget failed" |
|---|
| 276 | setupfail |
|---|
| 277 | fi |
|---|
| 278 | |
|---|
| 279 | #untar the file |
|---|
| 280 | tar -xzf ${BENCHMARKS} |
|---|
| 281 | if [ $? != 0 ] |
|---|
| 282 | then |
|---|
| 283 | echo "benchmarks: tar failed" |
|---|
| 284 | setupfail |
|---|
| 285 | fi |
|---|
| 286 | |
|---|
| 287 | #go back to original working directory |
|---|
| 288 | cd $my_cwd |
|---|
| 289 | fi |
|---|
| 290 | |
|---|
| 291 | echo "pull_and_build_pvfs2" |
|---|
| 292 | pull_and_build_pvfs2 $CVS_TAG || buildfail |
|---|
| 293 | |
|---|
| 294 | echo "setup_pvfs2" |
|---|
| 295 | teardown_pvfs2 && setup_pvfs2 |
|---|
| 296 | |
|---|
| 297 | if [ $? != 0 ] ; then |
|---|
| 298 | echo "setup failed" |
|---|
| 299 | setupfail |
|---|
| 300 | fi |
|---|
| 301 | |
|---|
| 302 | if [ $do_vfs -eq 1 ] ; then |
|---|
| 303 | echo "setup_vfs" |
|---|
| 304 | teardown_vfs && setup_vfs |
|---|
| 305 | |
|---|
| 306 | if [ $? != 0 ] ; then |
|---|
| 307 | echo "setup failed" |
|---|
| 308 | setupfail |
|---|
| 309 | fi |
|---|
| 310 | fi |
|---|
| 311 | |
|---|
| 312 | # at this point we've got |
|---|
| 313 | # - pvfs2 servers running |
|---|
| 314 | # on hosts in our whitelist |
|---|
| 315 | # - an entry in /etc/fstab (that was a prerequisite for this script after all) |
|---|
| 316 | # - the VFS mounted at $PVFS2_MOUNTPOINT |
|---|
| 317 | |
|---|
| 318 | nr_passed=0 |
|---|
| 319 | nr_failed=0 |
|---|
| 320 | |
|---|
| 321 | # save file descriptors for later |
|---|
| 322 | exec 6<&1 |
|---|
| 323 | exec 7<&2 |
|---|
| 324 | |
|---|
| 325 | exec 1> ${REPORT_LOG} |
|---|
| 326 | exec 2>&1 |
|---|
| 327 | echo "running sysint scripts" |
|---|
| 328 | run_parts ${SYSINT_SCRIPTS} |
|---|
| 329 | |
|---|
| 330 | if [ $do_vfs -eq 1 ] ; then |
|---|
| 331 | echo "running vfs scripts" |
|---|
| 332 | export VFS_SCRIPTS |
|---|
| 333 | run_parts ${VFS_SCRIPTS} |
|---|
| 334 | # run_one ${VFS_SCRIPTS} ${VFS_SCRIPT} |
|---|
| 335 | fi |
|---|
| 336 | |
|---|
| 337 | # down the road (as we get our hands on more clusters) we'll need a more |
|---|
| 338 | # generic way of submitting jobs. for now assume all the world has pbs |
|---|
| 339 | which qsub >/dev/null 2>&1 |
|---|
| 340 | if [ $? -eq 0 ] ; then |
|---|
| 341 | # go through the hassle of downloading/building mpich2 only if we are |
|---|
| 342 | # actually going to use it |
|---|
| 343 | pull_and_build_mpich2 || buildfail |
|---|
| 344 | . $MPIIO_DRIVER |
|---|
| 345 | fi |
|---|
| 346 | |
|---|
| 347 | # restore file descriptors and close temporary fds |
|---|
| 348 | exec 1<&6 6<&- |
|---|
| 349 | exec 2<&7 7<&- |
|---|
| 350 | |
|---|
| 351 | if [ -f $PVFS2_DEST/pvfs2-built-with-warnings -o \ |
|---|
| 352 | -f ${PVFS2_DEST}/pvfs2-test-built-with-warnings ] ; then |
|---|
| 353 | tinder_report successwarn |
|---|
| 354 | rm -f $PVFS2_DEST/pvfs2-built-with-warnings |
|---|
| 355 | rm -f ${PVFS2_DEST}/pvfs2-test-built-with-warnings |
|---|
| 356 | |
|---|
| 357 | elif [ $nr_failed -gt 0 ]; then |
|---|
| 358 | tinder_report test_failed |
|---|
| 359 | else |
|---|
| 360 | tinder_report success |
|---|
| 361 | fi |
|---|
| 362 | |
|---|
| 363 | #[ $do_vfs -eq 1 ] && teardown_vfs |
|---|
| 364 | #teardown_pvfs2 |
|---|