2001-01-27 04:07:48 +08:00
|
|
|
#! /bin/sh
|
2001-01-27 22:38:08 +08:00
|
|
|
# run the hdf5/bin/snapshot
|
|
|
|
# Usage:
|
|
|
|
# runtest run the test for the local host
|
|
|
|
# runtest <hostname> run the test for <hostname>
|
|
|
|
# runtest -all run the test for all predefined hosts
|
|
|
|
#
|
|
|
|
# Assumptions in knowing where to find the right scripts to execute.
|
|
|
|
# 1. assume we are at the top level of the hdf5 source. So, bin/* are
|
|
|
|
# where the script files are.
|
|
|
|
# 2. after the cvs update is completed, we can go to the snapshot area
|
|
|
|
# hdf5 source tree and use the bin/* there.
|
|
|
|
# 3. Cannot use the snapshot area scripts from the beginning because
|
|
|
|
# for one, the current directory is renamed as previous right after
|
|
|
|
# a snapshot release; and for another, some scripts may be changed
|
|
|
|
# by the cvs update while it is being used.
|
2001-01-27 04:07:48 +08:00
|
|
|
|
|
|
|
# local setup
|
|
|
|
DEBUGMODE=""
|
|
|
|
test -n "$DEBUGMODE" && echo "******** DEBUGMODE is $DEBUGMODE ************"
|
2001-01-27 22:38:08 +08:00
|
|
|
WHEREAMI='pwd'
|
2001-01-27 04:07:48 +08:00
|
|
|
|
|
|
|
# the name of this program
|
2001-02-26 05:23:55 +08:00
|
|
|
PROGNAME="bin/runtest $DEBUGMODE"
|
2001-01-27 04:07:48 +08:00
|
|
|
|
|
|
|
# Setup
|
2001-01-31 14:03:28 +08:00
|
|
|
HOSTNAME=`hostname | cut -f1 -d.` # no domain part
|
2001-02-28 22:49:29 +08:00
|
|
|
H5DIR=$HOME/HDF5/v_1_5/hdf5
|
2001-01-27 04:07:48 +08:00
|
|
|
TODAY=`date +%y%m%d`
|
2001-09-05 02:42:06 +08:00
|
|
|
WEEKDAY=`date +%a`
|
2001-01-27 04:07:48 +08:00
|
|
|
H5VER= # default to current CVS version
|
|
|
|
H5VERSTR= # default to current CVS version
|
|
|
|
|
|
|
|
# Default to do checkout (only once) and test, no release.
|
|
|
|
# If srcdir is not used, don't launched multiple tests
|
|
|
|
SNAPSHOT="${DEBUGMODE:+echo }bin/snapshot"
|
|
|
|
SRCDIR="srcdir"
|
2001-01-30 14:12:12 +08:00
|
|
|
# Default standard Snaptest commands
|
|
|
|
SNAPCMD="$SRCDIR test clean"
|
|
|
|
# Default Standard snaptest command options
|
|
|
|
STANDARD_OPT=""
|
2001-10-03 04:47:05 +08:00
|
|
|
ENABLE_PARALLEL="--enable-parallel"
|
2001-01-27 04:07:48 +08:00
|
|
|
|
2001-01-27 22:38:08 +08:00
|
|
|
#***************
|
|
|
|
# Various hosts
|
|
|
|
#***************
|
2001-01-27 04:07:48 +08:00
|
|
|
# DEC
|
|
|
|
# Gondolin: DEC
|
2001-02-20 10:42:26 +08:00
|
|
|
#DECHOST="skydive" # skydive is dead.
|
|
|
|
# gondolin rsh/ssh don't work. run as alone-host.
|
2001-01-27 04:07:48 +08:00
|
|
|
# HP
|
|
|
|
# sangamon: HPUX 10
|
2001-02-20 10:42:26 +08:00
|
|
|
# kelgia: HPUX 11
|
|
|
|
HPHOST="kelgia sangamon" # HPUX 10 & 11
|
|
|
|
|
2001-01-27 04:07:48 +08:00
|
|
|
# Linux
|
|
|
|
# Dangermouse, eirene: Linux
|
|
|
|
# Dangermouse used to die if gmake -j is used.
|
|
|
|
LINUXHOST=eirene
|
|
|
|
|
|
|
|
# SGI O2K
|
|
|
|
# modi4: R10K, IRIX64 6.5, default to -64,-mips4
|
|
|
|
# Testing {parallel,serial}x{-64,-n32}x
|
|
|
|
O2KHOST=modi4
|
|
|
|
# regular, unleaded, premium:
|
|
|
|
# R10K, IRIX64 6.5, default to -n32,-mips4
|
|
|
|
# impact7: R4400, IRIX 6.5, default to -n32,-mips3
|
|
|
|
# o2-N: R10K, IRIX 6.5, default to -n32,-mips4
|
|
|
|
# paz: R4400, IRIX 6.5, default to -n32,-mips3
|
|
|
|
SGIHOST="regular impact7 o2-3"
|
|
|
|
|
|
|
|
# Sun
|
|
|
|
SUNHOST="arabica baldric" # solaris 2.6 and 2.7
|
|
|
|
|
|
|
|
# FreeBSD
|
|
|
|
# AFS does not work well in hawkwind. Use NFS/local space for its
|
|
|
|
# test directory. ssh does not work for it either.
|
|
|
|
FREEBSDHOST="hawkwind"
|
|
|
|
|
|
|
|
# set up default all hosts to test
|
|
|
|
ALLHOSTS="$O2KHOST $SUNHOST $SGIHOST $HPHOST $LINUXHOST $DECHOST $FREEBSDHOST"
|
|
|
|
|
|
|
|
# test hosts
|
|
|
|
TESTHOST=""
|
|
|
|
|
|
|
|
#################################
|
|
|
|
# Function definitions
|
|
|
|
#################################
|
2001-08-22 07:41:10 +08:00
|
|
|
|
|
|
|
# Print messages to stdout
|
|
|
|
# Use this to show output heading to stdout
|
|
|
|
PRINT()
|
|
|
|
{
|
|
|
|
echo "$*"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Show seconds since midnight.
|
|
|
|
# This is used to calculate seconds elapsed
|
2001-01-27 04:07:48 +08:00
|
|
|
SecOfDay()
|
|
|
|
{
|
|
|
|
set `date '+%H %M %S'`
|
|
|
|
t_sec=`expr $1 \* 3600 + $2 \* 60 + $3`
|
|
|
|
echo $t_sec
|
|
|
|
}
|
|
|
|
|
|
|
|
# Calculated the elapsed time (in seconds) between the first
|
|
|
|
# and second time. If second time is smaller than the first,
|
|
|
|
# we assume the clock has passed midnight and calculate appropriately.
|
|
|
|
ElapsedTime()
|
|
|
|
{
|
|
|
|
if [ $2 -lt $1 ]; then
|
|
|
|
t_sec=`expr 3600 \* 24 - $1 + $2`
|
|
|
|
else
|
|
|
|
t_sec=`expr $2 - $1`
|
|
|
|
fi
|
|
|
|
echo `expr $t_sec / 60`m `expr $t_sec % 60`s
|
|
|
|
}
|
|
|
|
|
|
|
|
# Report errors
|
|
|
|
# $1--an error message to be printed
|
|
|
|
REPORT_ERR()
|
|
|
|
{
|
|
|
|
ERRMSG=$1
|
|
|
|
# print it with a banner shifted right a bit
|
2001-08-28 00:01:37 +08:00
|
|
|
PRINT " *************************************"
|
|
|
|
PRINT " `date`"
|
|
|
|
PRINT " $ERRMSG"
|
|
|
|
PRINT " *************************************"
|
2001-01-27 04:07:48 +08:00
|
|
|
# report it in the FAILED-LOG file too
|
2001-08-28 00:01:37 +08:00
|
|
|
PRINT "$ERRMSG" >> $FAILEDLOG
|
2001-01-27 04:07:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Report results of the last test done
|
|
|
|
REPORT_RESULT()
|
|
|
|
{
|
|
|
|
if [ $retcode -eq 0 ]; then
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT "PASSED ${HOSTNAME}: $TEST_TYPE" | tee -a $PASSEDLOG
|
2001-01-27 04:07:48 +08:00
|
|
|
else
|
|
|
|
# test failed.
|
2001-08-22 07:41:10 +08:00
|
|
|
REPORT_ERR "****FAILED ${HOSTNAME}: $TEST_TYPE****"
|
2001-01-27 04:07:48 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Print a blank line
|
|
|
|
PRINT_BLANK()
|
|
|
|
{
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT
|
2001-01-27 04:07:48 +08:00
|
|
|
}
|
|
|
|
|
2001-09-09 01:01:24 +08:00
|
|
|
# Print test trailer
|
|
|
|
PRINT_TEST_TRAILER()
|
2001-01-27 04:07:48 +08:00
|
|
|
{
|
2001-09-09 01:01:24 +08:00
|
|
|
PRINT "*** finished $TEST_TYPE tests for $HOSTNAME ***"
|
2001-01-27 04:07:48 +08:00
|
|
|
date; EndTime=`SecOfDay`
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT Total time = `ElapsedTime $StartTime $EndTime`
|
2001-01-27 04:07:48 +08:00
|
|
|
PRINT_BLANK
|
2001-09-09 01:01:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Print trailer summary
|
|
|
|
PRINT_TRAILER()
|
|
|
|
{
|
|
|
|
PRINT "*** finished tests in $HOSTNAME ***"
|
|
|
|
date; TotalEndTime=`SecOfDay`
|
|
|
|
PRINT Grand total tests time = `ElapsedTime $TotalStartTime $TotalEndTime`
|
|
|
|
PRINT_BLANK
|
2001-01-27 04:07:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Figure out which remote command to use to reach a host.
|
|
|
|
# Try rsh first, then ssh.
|
|
|
|
# $1--hostname to reach.
|
|
|
|
CHECK_RSH()
|
|
|
|
{
|
|
|
|
# Figure out how to use ping command in this host.
|
|
|
|
# Some hosts use "ping host count", some use "ping -c count host"
|
|
|
|
# Test "ping -c ..." style first because some '-c' machines treat
|
|
|
|
# the command 'ping localhost 3' means to ping host '3'.
|
|
|
|
if [ -z "$PING" ]; then
|
|
|
|
if ping -c 3 localhost >/dev/null 2>&1; then
|
|
|
|
PING='ping -c 3'
|
|
|
|
PINGCOUNT=
|
|
|
|
elif ping localhost 3 >/dev/null 2>&1; then
|
|
|
|
PING=ping
|
|
|
|
PINGCOUNT=3
|
2001-08-22 07:41:10 +08:00
|
|
|
else # don't know how to use ping.
|
|
|
|
PING=no_ping
|
2001-01-27 04:07:48 +08:00
|
|
|
PINGCOUNT=
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
#
|
|
|
|
host=$1
|
2001-08-22 07:41:10 +08:00
|
|
|
# Try remote command with host if it responds to ping.
|
|
|
|
# Still try it if we don't know how to do ping.
|
|
|
|
if [ no_ping = "$PING" ] || $PING $host $PINGCOUNT >/dev/null 2>&1; then
|
2001-01-27 04:07:48 +08:00
|
|
|
if rsh $host -n hostname >/dev/null 2>&1; then
|
|
|
|
RSH=rsh
|
|
|
|
elif ssh $host -n hostname >/dev/null 2>&1; then
|
|
|
|
RSH=ssh
|
|
|
|
else
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT cannot remote command with $host
|
|
|
|
RSH="NoRemoteCommand"
|
2001-01-27 04:07:48 +08:00
|
|
|
fi
|
|
|
|
else
|
2001-08-22 07:41:10 +08:00
|
|
|
RSH="NotReachable"
|
2001-01-27 04:07:48 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-13 13:27:58 +08:00
|
|
|
# Wait for a file for at most number of minutes
|
|
|
|
# $1--the file
|
|
|
|
# $2--number of minutes
|
|
|
|
# WAIT_STATUS set to:
|
|
|
|
# -1 if errors encountered
|
|
|
|
# 0 if file found within time limit
|
|
|
|
# 1 if file not found within time limit
|
|
|
|
WAITFOR()
|
|
|
|
{
|
|
|
|
wait_file=$1
|
|
|
|
nminutes=$2
|
|
|
|
if [ -z "$wait_file" -o ! "$nminutes" -ge 0 ]
|
|
|
|
then
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT "errors in argument of WAITFOR(): wait_file($1) or nminutes($2)"
|
2001-03-13 13:27:58 +08:00
|
|
|
WAIT_STATUS=-1
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
while [ ! -f $wait_file ]; do
|
|
|
|
if [ $nminutes -gt 0 ]; then
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT "Wait For $wait_file to appear"
|
2001-03-13 13:27:58 +08:00
|
|
|
sleep 60 #sleep 1 minute
|
|
|
|
else
|
|
|
|
WAIT_STATUS=1
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
nminutes=`expr $nminutes - 1`
|
|
|
|
done
|
|
|
|
WAIT_STATUS=0
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Wait till a file disappears for at most number of minutes.
|
|
|
|
# Useful to wait till a lock is removed by another process.
|
|
|
|
# $1--the file
|
|
|
|
# $2--number of minutes
|
|
|
|
# WAIT_STATUS set to:
|
|
|
|
# -1 if errors encountered
|
|
|
|
# 0 if file disappears within time limit
|
|
|
|
# 1 if file has not disappeared within time limit
|
|
|
|
WAITTILL()
|
|
|
|
{
|
|
|
|
wait_file=$1
|
|
|
|
nminutes=$2
|
|
|
|
if [ -z "$wait_file" -o ! "$nminutes" -ge 0 ]
|
|
|
|
then
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT "errors in argument of WAITTILL(): wait_file($1) or nminutes($2)"
|
2001-03-13 13:27:58 +08:00
|
|
|
WAIT_STATUS=-1
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
while [ -f $wait_file ]; do
|
|
|
|
if [ $nminutes -gt 0 ]; then
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT "Wait till $wait_file has disappeared"
|
2001-03-13 13:27:58 +08:00
|
|
|
sleep 60 #sleep 1 minute
|
|
|
|
else
|
|
|
|
WAIT_STATUS=1
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
nminutes=`expr $nminutes - 1`
|
|
|
|
done
|
|
|
|
WAIT_STATUS=0
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-01-27 04:07:48 +08:00
|
|
|
# Run one snapshot test
|
|
|
|
# $*--Types of test being run
|
|
|
|
RUNSNAPTEST()
|
|
|
|
{
|
2001-01-30 14:12:12 +08:00
|
|
|
SNAPCMD_OPT="$STANDARD_OPT" # snapshot test option
|
2001-01-27 04:07:48 +08:00
|
|
|
SRCDIRNAME=""
|
2001-01-30 14:12:12 +08:00
|
|
|
CC_SAVED="$CC"
|
2001-01-30 11:58:38 +08:00
|
|
|
PATH_SAVED=$PATH
|
|
|
|
export PATH # DEC OSF1 needs to export PATH explicitly
|
2001-01-27 04:07:48 +08:00
|
|
|
TEST_TYPE=$*
|
|
|
|
retcode=0
|
|
|
|
date
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT "*** starting $TEST_TYPE tests in $HOSTNAME ***"
|
|
|
|
PRINT "Uname -a: `uname -a`"
|
2001-01-27 04:07:48 +08:00
|
|
|
|
2001-10-03 04:47:05 +08:00
|
|
|
# Parse the test type and set options accordingly.
|
|
|
|
# See comments of SNAPTEST_CONFIG_PARSE().
|
2001-01-27 04:07:48 +08:00
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case $1 in
|
|
|
|
-n32) # want -n32 option
|
|
|
|
SRCDIRNAME=${SRCDIRNAME}-n32
|
|
|
|
CC="cc -n32"
|
|
|
|
export CC
|
|
|
|
;;
|
|
|
|
parallel) # want parallel test
|
|
|
|
SNAPCMD_OPT="$SNAPCMD_OPT $ENABLE_PARALLEL"
|
|
|
|
SRCDIRNAME=${SRCDIRNAME}-pp
|
|
|
|
;;
|
|
|
|
standard) # standard test
|
2001-10-03 04:47:05 +08:00
|
|
|
;;
|
|
|
|
--*)
|
|
|
|
# option for configure
|
|
|
|
SNAPCMD_OPT="$SNAPCMD_OPT $1"
|
2001-01-27 04:07:48 +08:00
|
|
|
;;
|
2001-02-07 01:48:21 +08:00
|
|
|
op-configure)
|
|
|
|
# option for configure
|
|
|
|
SNAPCMD_OPT="$SNAPCMD_OPT $1 $2"
|
2001-10-03 04:47:05 +08:00
|
|
|
shift
|
2001-02-07 01:48:21 +08:00
|
|
|
;;
|
2001-06-06 11:57:35 +08:00
|
|
|
setenv)
|
|
|
|
# set environment variable
|
|
|
|
shift
|
|
|
|
eval $1="$2"
|
|
|
|
export $1
|
2001-10-03 04:47:05 +08:00
|
|
|
shift
|
2001-06-06 11:57:35 +08:00
|
|
|
;;
|
2001-01-27 04:07:48 +08:00
|
|
|
*) # unknown test
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT "$0: unknown type of test ($1)"
|
2001-01-27 04:07:48 +08:00
|
|
|
retcode=1
|
|
|
|
;;
|
|
|
|
esac
|
2001-10-03 04:47:05 +08:00
|
|
|
shift
|
2001-01-27 04:07:48 +08:00
|
|
|
done
|
|
|
|
[ $retcode -ne 0 ] && errcode=$retcode && return $retcode
|
|
|
|
|
|
|
|
# Track down the HDF4 software
|
2001-02-06 12:38:57 +08:00
|
|
|
ans=`$SNAPYARD/current/bin/locate_hdf4`
|
2001-01-30 11:58:38 +08:00
|
|
|
H4_SW=`echo $ans | cut -f1 -d' '`
|
|
|
|
H4_BIN=`echo $ans | cut -f2 -s -d' '`
|
2001-01-27 04:07:48 +08:00
|
|
|
if [ -n "$H4_SW" ]; then
|
|
|
|
SNAPCMD_OPT="$SNAPCMD_OPT hdf4 $H4_SW"
|
|
|
|
fi
|
|
|
|
if [ -n "$H4_BIN" ]; then
|
|
|
|
PATH=${PATH}:${H4_BIN}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "${SRCDIRNAME}" ]; then
|
|
|
|
SNAPCMD_OPT="$SNAPCMD_OPT srcdirname ${SRCDIRNAME}"
|
|
|
|
fi
|
|
|
|
|
2001-02-26 05:23:55 +08:00
|
|
|
# Setup log file name to save test output
|
2001-01-27 04:07:48 +08:00
|
|
|
LOGFILE=${LOGBASENAME}${SRCDIRNAME}_${TODAY}
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT "Running snapshot with output saved in"
|
|
|
|
PRINT " $LOGFILE"
|
|
|
|
(date; PRINT Hostname=$HOSTNAME) >> $LOGFILE
|
2001-01-27 04:07:48 +08:00
|
|
|
|
|
|
|
(
|
2001-01-27 22:38:08 +08:00
|
|
|
cd $SNAPYARD/current
|
2001-01-27 04:07:48 +08:00
|
|
|
$SNAPSHOT $SNAPCMD $SNAPCMD_OPT
|
|
|
|
) >> $LOGFILE 2>&1
|
|
|
|
retcode=$?
|
|
|
|
[ $retcode -ne 0 ] && errcode=$retcode
|
|
|
|
|
|
|
|
date >> $LOGFILE
|
|
|
|
|
2001-01-30 11:58:38 +08:00
|
|
|
# restore CC, PATH
|
2001-01-30 14:12:12 +08:00
|
|
|
CC="$CC_SAVED"
|
2001-01-30 11:58:38 +08:00
|
|
|
PATH=$PATH_SAVED
|
2001-01-27 04:07:48 +08:00
|
|
|
}
|
|
|
|
|
2001-01-30 14:12:12 +08:00
|
|
|
|
2001-02-05 12:36:30 +08:00
|
|
|
# configuration parsing.
|
|
|
|
# Taking configuration from input.
|
|
|
|
# This should be invoke with configure file as stdin.
|
2001-09-05 02:42:06 +08:00
|
|
|
# Syntax of the configure file:
|
2001-10-03 04:47:05 +08:00
|
|
|
# All lines started with the # are comment lines and are ignored.
|
2001-10-03 15:03:12 +08:00
|
|
|
# Blank lines are ignored too.
|
|
|
|
# Each config line starts with a "Scope" followed by test types.
|
2001-10-03 04:47:05 +08:00
|
|
|
#
|
|
|
|
# Scope can be:
|
|
|
|
# standard ... # what the standard test types are.
|
|
|
|
# <host>: <test> Do <test> for <host>
|
|
|
|
# all: <test> Do <test> for all hosts.
|
|
|
|
# <weekday>/... Use this scope if the <weekday> matches.
|
|
|
|
# <weekday> can be {Mon,Tue,Wed,Thu,Fri,Sat,Sun}
|
|
|
|
# If no <host>: input for a <host>, the standard test is used.
|
|
|
|
#
|
|
|
|
# Test types:
|
|
|
|
# standard tests defined in standard scope.
|
|
|
|
# -n32 -n32 mode. Apply to 64/32 bit OS such as IRIX64.
|
|
|
|
# parallel parallel mode.
|
|
|
|
# op-configure <option> configure option
|
|
|
|
# --* configure option
|
|
|
|
# setenv <name> <value> set environment variable <name> to <value>
|
2001-02-05 12:36:30 +08:00
|
|
|
SNAPTEST_CONFIG_PARSE()
|
2001-01-30 14:12:12 +08:00
|
|
|
{
|
|
|
|
while read x y ; do
|
2001-09-05 02:42:06 +08:00
|
|
|
# Scan for entry for this weekday.
|
2001-09-06 13:27:40 +08:00
|
|
|
xd=`echo $x | cut -f1 -d/`
|
|
|
|
if [ "$xd" = ${WEEKDAY} ]; then
|
|
|
|
# strip away the weekday/ part.
|
|
|
|
x=`echo $x | cut -f2 -d/`
|
|
|
|
fi
|
2001-01-30 14:12:12 +08:00
|
|
|
case "$x" in
|
2001-10-03 15:03:12 +08:00
|
|
|
'' | '#'*)
|
|
|
|
# blank or comment lines. Continue.
|
2001-01-30 14:12:12 +08:00
|
|
|
;;
|
2001-09-05 02:42:06 +08:00
|
|
|
???/*)
|
|
|
|
# Ignore any entry not of this weekday.
|
|
|
|
;;
|
2001-02-05 12:36:30 +08:00
|
|
|
standard)
|
|
|
|
#standard configuration
|
2001-01-30 14:12:12 +08:00
|
|
|
STANDARD_OPT="$y"
|
|
|
|
;;
|
2001-02-05 12:36:30 +08:00
|
|
|
all: | ${HOSTNAME}:)
|
|
|
|
# types of test for all hosts or this host
|
|
|
|
if [ -n "$TEST_TYPES" ]; then
|
|
|
|
TEST_TYPES="$TEST_TYPES ; $y"
|
|
|
|
else
|
|
|
|
TEST_TYPES="$y"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*:) # ignore types of test for other hosts
|
|
|
|
;;
|
|
|
|
*) # unknown configuration option
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT $x $y
|
|
|
|
PRINT "***Unknown configuration option. Ignored.***"
|
2001-01-30 14:12:12 +08:00
|
|
|
;;
|
|
|
|
esac
|
2001-02-05 12:36:30 +08:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# Snap Test configuration parsing.
|
|
|
|
# If TEST_TYPES is not set, set it to do the "standard" test.
|
|
|
|
SNAPTEST_CONFIG()
|
|
|
|
{
|
|
|
|
TEST_TYPES=
|
|
|
|
STANDARD_OPT=
|
|
|
|
if [ -f $SNAPTESTCFG ]; then
|
|
|
|
SNAPTEST_CONFIG_PARSE < $SNAPTESTCFG
|
|
|
|
fi
|
|
|
|
TEST_TYPES=${TEST_TYPES:-'standard'}
|
2001-01-30 14:12:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-01-27 04:07:48 +08:00
|
|
|
# Flush the AFS files if applicable.
|
|
|
|
# Hopefully the flushing is done when the tests of this
|
|
|
|
# host are done rather than when the launching site try
|
|
|
|
# to pull them in at the same time. This way, the afs
|
|
|
|
# server updates are spread out.
|
|
|
|
FLUSH_FILES()
|
|
|
|
{
|
|
|
|
/usr/afsws/bin/fs flush $SNAPYARD
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-02-06 12:38:57 +08:00
|
|
|
# Show usage page
|
|
|
|
USAGE()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
2001-03-13 13:27:58 +08:00
|
|
|
Usage: runtest [-h] [-debug] [-r<version>] [-all] [-nocvs] [<host> ...]
|
2001-02-06 12:38:57 +08:00
|
|
|
-h
|
|
|
|
print this help page
|
2001-02-26 05:23:55 +08:00
|
|
|
-debug
|
|
|
|
turn on debug mode
|
2001-03-13 13:27:58 +08:00
|
|
|
-r<version>
|
|
|
|
do runtest for <version>
|
2001-02-06 12:38:57 +08:00
|
|
|
-all
|
|
|
|
launch tests for all pre-defined testing hosts
|
2001-03-13 13:27:58 +08:00
|
|
|
-nocvs
|
|
|
|
do not do cvs commands
|
2001-02-06 12:38:57 +08:00
|
|
|
<host>
|
|
|
|
launch tests for <host>
|
|
|
|
|
|
|
|
-all and <host> are contradictory and whichever is specified last, is
|
|
|
|
the one to take effect. If neither are given, do the test for the
|
|
|
|
local host.
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-01-27 04:07:48 +08:00
|
|
|
#################################
|
|
|
|
# Main
|
|
|
|
#################################
|
|
|
|
#################################
|
|
|
|
# Set up global variables
|
|
|
|
#################################
|
|
|
|
retcode=0 # error code of individula task
|
|
|
|
errcode=0 # error code of the whole test
|
|
|
|
|
|
|
|
|
|
|
|
#################################
|
|
|
|
# Parse options
|
|
|
|
#################################
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case "$1" in
|
2001-02-06 12:38:57 +08:00
|
|
|
-h) # help--show usage
|
|
|
|
USAGE
|
|
|
|
exit 0
|
|
|
|
;;
|
2001-02-26 05:23:55 +08:00
|
|
|
-debug*)
|
|
|
|
# set debug mode
|
|
|
|
DEBUGMODE="$1"
|
|
|
|
SNAPSHOT="echo bin/snapshot"
|
|
|
|
PROGNAME="$PROGNAME $DEBUGMODE"
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT "******** DEBUGMODE is $DEBUGMODE ************"
|
2001-02-26 05:23:55 +08:00
|
|
|
;;
|
2001-01-27 04:07:48 +08:00
|
|
|
-r*)
|
|
|
|
# the version string has a leading _ but not for H5DIR name
|
|
|
|
H5VER="$1"
|
|
|
|
H5VERSTR=_`echo $H5VER | sed -e s/-r// -e s/\\\./_/g`
|
|
|
|
H5DIR=$HOME/HDF5/v$H5VERSTR/hdf5
|
|
|
|
PROGNAME="$PROGNAME $H5VER"
|
|
|
|
;;
|
|
|
|
-all)
|
2001-07-17 22:32:17 +08:00
|
|
|
# cannot assign ALLHOSTS yet.
|
|
|
|
TESTHOST=-all
|
2001-01-27 04:07:48 +08:00
|
|
|
;;
|
2001-03-13 13:27:58 +08:00
|
|
|
-nocvs)
|
|
|
|
# do not do cvs commands
|
|
|
|
NOCVS=nocvs
|
|
|
|
;;
|
2001-02-06 12:38:57 +08:00
|
|
|
-*) # Unknow option
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT "Unknown option ($1)"
|
2001-02-06 12:38:57 +08:00
|
|
|
USAGE
|
|
|
|
exit 1
|
|
|
|
;;
|
2001-01-27 04:07:48 +08:00
|
|
|
*)
|
|
|
|
TESTHOST=$*
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
#################################
|
|
|
|
# Setup snapshot test directories
|
|
|
|
#################################
|
|
|
|
# Show the real physical path rather than the symbolic path
|
|
|
|
SNAPYARD=`cd $HOME/snapshots-hdf5${H5VERSTR} && /bin/pwd`
|
|
|
|
# Log file basename
|
|
|
|
LOGBASENAME=${SNAPYARD}/log/${HOSTNAME}
|
2001-08-14 23:54:05 +08:00
|
|
|
PASSEDLOG=${SNAPYARD}/log/PASSED_LOG_${TODAY}
|
2001-01-27 04:07:48 +08:00
|
|
|
FAILEDLOG=${SNAPYARD}/log/FAILED_LOG_${TODAY}
|
|
|
|
CVSLOG=${SNAPYARD}/log/CVS_LOG_${TODAY}
|
2001-03-13 13:27:58 +08:00
|
|
|
CVSLOG_LOCK=${SNAPYARD}/log/CVS_LOG_LOCK_${TODAY}
|
2001-01-30 14:12:12 +08:00
|
|
|
# Snap Test Configuration file
|
|
|
|
SNAPTESTCFG=${SNAPYARD}/snaptest.cfg
|
2001-01-27 04:07:48 +08:00
|
|
|
|
|
|
|
|
2001-07-17 22:32:17 +08:00
|
|
|
#################################
|
|
|
|
# Setup test host(s)
|
|
|
|
#################################
|
|
|
|
ALLHOSTSFILE=${SNAPYARD}/allhostfile
|
|
|
|
if [ -f $ALLHOSTSFILE ]; then
|
|
|
|
ALLHOSTS=`grep -v '#' $ALLHOSTSFILE`
|
|
|
|
fi
|
|
|
|
if [ "$TESTHOST" = -all ]; then
|
|
|
|
TESTHOST=$ALLHOSTS
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2001-01-27 04:07:48 +08:00
|
|
|
#################################
|
|
|
|
# Setup to print a trailer summary when exiting not via
|
|
|
|
# the normal end of the script.
|
|
|
|
#################################
|
|
|
|
trap PRINT_TRAILER 0
|
|
|
|
|
|
|
|
#
|
2001-09-09 01:01:24 +08:00
|
|
|
TotalStartTime=`SecOfDay`
|
2001-01-27 04:07:48 +08:00
|
|
|
|
2001-01-30 14:12:12 +08:00
|
|
|
# Process the configuration
|
|
|
|
SNAPTEST_CONFIG
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT STANDARD_OPT=$STANDARD_OPT
|
|
|
|
PRINT TEST_TYPES=$TEST_TYPES
|
2001-09-09 01:01:24 +08:00
|
|
|
PRINT_BLANK
|
2001-01-30 14:12:12 +08:00
|
|
|
|
2001-01-27 04:07:48 +08:00
|
|
|
# Do a checkout if one has not been done today
|
|
|
|
# Also check MANIFEST file
|
2001-03-13 13:27:58 +08:00
|
|
|
if [ -z "$NOCVS" -a ! -f $CVSLOG ]; then
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT "Running CVS checkout with output saved in"
|
|
|
|
PRINT " $CVSLOG"
|
2001-03-13 13:27:58 +08:00
|
|
|
# Set CVS lock first
|
|
|
|
touch $CVSLOG_LOCK
|
2001-01-30 14:12:12 +08:00
|
|
|
($SNAPSHOT checkout ) >> $CVSLOG 2>&1
|
2001-03-13 13:27:58 +08:00
|
|
|
# Save error code and remove the lock
|
2001-01-27 04:07:48 +08:00
|
|
|
errcode=$?
|
2001-03-13 13:27:58 +08:00
|
|
|
rm -f $CVSLOG_LOCK
|
2001-01-27 04:07:48 +08:00
|
|
|
if [ $errcode -ne 0 ]; then
|
|
|
|
# test failed.
|
2001-08-28 00:01:37 +08:00
|
|
|
REPORT_ERR "****FAILED ${HOSTNAME}: CVS checkout****"
|
2001-01-27 04:07:48 +08:00
|
|
|
exit $errcode
|
|
|
|
fi
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT Checking MAINFEST file ...
|
2001-01-30 14:12:12 +08:00
|
|
|
(cd $SNAPYARD/current; bin/chkmanifest)
|
2001-01-27 04:07:48 +08:00
|
|
|
errcode=$?
|
|
|
|
if [ $errcode -ne 0 ]; then
|
|
|
|
# test failed.
|
2001-08-28 00:01:37 +08:00
|
|
|
REPORT_ERR "****FAILED ${HOSTNAME}: MANIFEST check****"
|
2001-01-27 04:07:48 +08:00
|
|
|
fi
|
|
|
|
PRINT_BLANK
|
2001-03-13 13:27:58 +08:00
|
|
|
else
|
2001-03-17 23:20:46 +08:00
|
|
|
# make sure the cvs update, if done by another host, has completed.
|
|
|
|
# First wait for the presence of $CVSLOG which signals some host
|
|
|
|
# has started the cvs update. Then wait for the absense of $CVSLOG_LOCK
|
|
|
|
# which signals the host has completed the cvs update.
|
|
|
|
WAITFOR $CVSLOG 90
|
2001-03-13 13:27:58 +08:00
|
|
|
if [ $WAIT_STATUS -ne 0 ]; then
|
|
|
|
errcode=$WAIT_STATUS
|
2001-08-28 00:01:37 +08:00
|
|
|
REPORT_ERR "****FAILED ${HOSTNAME}: Time expired waiting CVS update to start****"
|
2001-03-13 13:27:58 +08:00
|
|
|
exit $errcode
|
|
|
|
fi
|
|
|
|
WAITTILL $CVSLOG_LOCK 10
|
|
|
|
if [ $WAIT_STATUS -ne 0 ]; then
|
|
|
|
errcode=$WAIT_STATUS
|
2001-08-28 00:01:37 +08:00
|
|
|
REPORT_ERR "****FAILED ${HOSTNAME}: Time expired waiting CVS update to finish****"
|
2001-03-13 13:27:58 +08:00
|
|
|
exit $errcode
|
|
|
|
fi
|
2001-01-27 04:07:48 +08:00
|
|
|
fi
|
|
|
|
|
2001-01-27 22:38:08 +08:00
|
|
|
# we can use the version of script in SNAPYARD/current now
|
|
|
|
PROGNAME="$SNAPYARD/current/$PROGNAME"
|
|
|
|
|
2001-01-27 04:07:48 +08:00
|
|
|
# Decide to do test for the local host or for remote hosts
|
|
|
|
if [ -n "$TESTHOST" -a $HOSTNAME != "$TESTHOST" ]; then
|
|
|
|
date
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT "*** launching tests from $HOSTNAME ***"
|
2001-01-27 04:07:48 +08:00
|
|
|
PRINT_BLANK
|
|
|
|
TEST_TYPE="launching"
|
|
|
|
cd ${SNAPYARD}/log
|
|
|
|
for h in $TESTHOST; do
|
|
|
|
TMP_OUTPUT="#$h.out"
|
2001-08-22 07:41:10 +08:00
|
|
|
(PRINT "=============="
|
|
|
|
PRINT "Testing $h"
|
|
|
|
PRINT "==============") > $TMP_OUTPUT
|
2001-01-27 04:07:48 +08:00
|
|
|
CHECK_RSH $h
|
2001-08-22 07:41:10 +08:00
|
|
|
# run the remote shell command with output to $TMP_OUTPUT
|
|
|
|
case "$RSH" in
|
|
|
|
rsh|ssh)
|
|
|
|
PRINT $RSH $h -n $PROGNAME
|
|
|
|
# launch concurrent tests only if srcdir is used
|
|
|
|
if [ -n "$SRCDIR" ]; then
|
|
|
|
$RSH $h -n $PROGNAME &
|
|
|
|
else
|
|
|
|
$RSH $h -n $PROGNAME
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
NoRemoteCommand)
|
|
|
|
PRINT $h does not accept Remote Command
|
|
|
|
;;
|
|
|
|
NotReachable)
|
|
|
|
PRINT $h is not reachable
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
PRINT "CHECK_RSH for $h returned unknow result ($RSH)"
|
|
|
|
;;
|
|
|
|
esac >> $TMP_OUTPUT 2>&1
|
2001-01-27 04:07:48 +08:00
|
|
|
done
|
|
|
|
# wait for all launched tests to finish, then cat them back out.
|
|
|
|
wait
|
|
|
|
for h in $TESTHOST; do
|
|
|
|
TMP_OUTPUT="#$h.out"
|
|
|
|
cat $TMP_OUTPUT
|
|
|
|
# Verify test script did complete by checking the last lines
|
2001-09-10 11:52:17 +08:00
|
|
|
(tail -2 $TMP_OUTPUT | grep -s '^Grand total' > /dev/null 2>&1) ||
|
2001-08-31 23:10:55 +08:00
|
|
|
(REPORT_ERR "****FAILED ${h}: snaptest did not complete****" &&
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT_BLANK)
|
2001-01-27 04:07:48 +08:00
|
|
|
rm $TMP_OUTPUT
|
|
|
|
done
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2001-02-05 12:36:30 +08:00
|
|
|
# run the test(s)
|
|
|
|
# Note that first field is cut without -s but all subsequent cut
|
|
|
|
# must use -s. If -s is not used at all, a $TEST_TYPES that has
|
|
|
|
# no ';' (only 1 test), will pass through intact in all cut. That
|
|
|
|
# results in infinite looping.
|
|
|
|
# If -s is used with the first field, it will suppress completely
|
|
|
|
# a $TYPE_TYPES that has no ';' (only 1 tst ). That results in no
|
|
|
|
# test at all.
|
|
|
|
#
|
|
|
|
n_test=1
|
|
|
|
TEST="`echo $TEST_TYPES | cut -f1 -d';'`"
|
|
|
|
while [ -n "$TEST" ]; do
|
2001-09-09 01:01:24 +08:00
|
|
|
StartTime=`SecOfDay`
|
2001-02-05 12:36:30 +08:00
|
|
|
RUNSNAPTEST $TEST
|
2001-01-27 04:07:48 +08:00
|
|
|
REPORT_RESULT
|
2001-09-09 01:01:24 +08:00
|
|
|
PRINT_TEST_TRAILER
|
2001-01-27 04:07:48 +08:00
|
|
|
|
2001-02-05 12:36:30 +08:00
|
|
|
n_test=`expr $n_test + 1`
|
|
|
|
TEST="`echo $TEST_TYPES | cut -f$n_test -s -d';'`"
|
|
|
|
done
|
2001-01-27 04:07:48 +08:00
|
|
|
|
|
|
|
FLUSH_FILES
|
|
|
|
|
2001-09-09 01:01:24 +08:00
|
|
|
PRINT_TRAILER
|
|
|
|
|
2001-01-27 04:07:48 +08:00
|
|
|
# disable trailer summary printing since all trailers have been
|
|
|
|
# printed and we are exiting normally.
|
|
|
|
trap 0
|
|
|
|
exit $errcode
|