2001-01-27 04:07:48 +08:00
|
|
|
#! /bin/sh
|
2002-06-13 19:52:22 +08:00
|
|
|
#
|
2007-02-15 06:25:02 +08:00
|
|
|
# Copyright by The HDF Group.
|
2002-06-13 19:52:22 +08:00
|
|
|
# Copyright by the Board of Trustees of the University of Illinois.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
# terms governing use, modification, and redistribution, is contained in
|
|
|
|
# the files COPYING and Copyright.html. COPYING can be found at the root
|
|
|
|
# of the source code distribution tree; Copyright.html can be found at the
|
|
|
|
# root level of an installed copy of the electronic HDF5 document set and
|
|
|
|
# is linked from the top-level documents page. It can also be found at
|
2007-02-15 06:25:02 +08:00
|
|
|
# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
|
|
|
|
# access to either file, you may request a copy from help@hdfgroup.org.
|
2002-06-13 19:52:22 +08:00
|
|
|
#
|
|
|
|
|
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'
|
2003-11-20 12:48:25 +08:00
|
|
|
CMD=
|
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
|
2007-04-29 12:13:23 +08:00
|
|
|
TODAY=`date +%m%d%a`
|
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
|
2002-03-06 08:55:31 +08:00
|
|
|
H5VERSION= # default to current CVS version
|
2006-01-10 21:17:14 +08:00
|
|
|
n_test=0 # Number of tests ran
|
|
|
|
n_pass=0 # Number of tests passed
|
|
|
|
n_fail=0 # Number of tests failed
|
|
|
|
n_skip=0 # Number of tests skipped
|
2001-01-27 04:07:48 +08:00
|
|
|
|
|
|
|
# Default to do checkout (only once) and test, no release.
|
2002-03-09 07:36:59 +08:00
|
|
|
# Will run test only if there is significant differences from previous version.
|
2001-01-27 04:07:48 +08:00
|
|
|
# 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"
|
2003-04-01 03:05:41 +08:00
|
|
|
CONFIGNAME=$HOSTNAME # Name used in the SNAPTESTCFG file
|
2001-01-27 04:07:48 +08:00
|
|
|
|
2001-10-25 02:06:50 +08:00
|
|
|
# test host default as local host.
|
2001-01-27 04:07:48 +08:00
|
|
|
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
|
2003-03-27 06:14:35 +08:00
|
|
|
if [ $skiptest = yes ]; then
|
2006-01-08 13:04:47 +08:00
|
|
|
n_skip=`expr $n_skip + 1`
|
2003-12-16 11:30:34 +08:00
|
|
|
PRINT "SKIPPED ${HOSTNAME}: $TEST_TYPE" | tee -a $SKIPPEDLOG
|
2003-03-27 06:14:35 +08:00
|
|
|
else
|
2006-01-08 13:04:47 +08:00
|
|
|
n_pass=`expr $n_pass + 1`
|
2003-03-27 06:14:35 +08:00
|
|
|
PRINT "PASSED ${HOSTNAME}: $TEST_TYPE" | tee -a $PASSEDLOG
|
|
|
|
fi
|
2001-01-27 04:07:48 +08:00
|
|
|
else
|
|
|
|
# test failed.
|
2006-01-08 13:04:47 +08:00
|
|
|
n_fail=`expr $n_fail + 1`
|
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`
|
2006-01-10 21:17:14 +08:00
|
|
|
PRINT "${HOSTNAME}: Ran $n_test($n_pass/$n_fail/$n_skip) $runtest_type, Grand total test time = " \
|
2003-03-19 23:22:22 +08:00
|
|
|
"`ElapsedTime $TotalStartTime $TotalEndTime`" | tee -a $TIMELOG
|
2001-09-09 01:01:24 +08:00
|
|
|
PRINT_BLANK
|
2001-01-27 04:07:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Figure out which remote command to use to reach a host.
|
2006-05-23 23:06:23 +08:00
|
|
|
# Try ssh first, then rsh since fewer machines support rsh exec.
|
2001-01-27 04:07:48 +08:00
|
|
|
# $1--hostname to reach.
|
|
|
|
CHECK_RSH()
|
|
|
|
{
|
|
|
|
# Figure out how to use ping command in this host.
|
2003-09-19 01:22:54 +08:00
|
|
|
# Some hosts use "ping host count", some use "ping -c count host".
|
|
|
|
# Test "ping -c 3 -w 5" since it has timeout feature.
|
|
|
|
# Test "ping -c ..." style before "ping host 3" because some machines
|
|
|
|
# that recognize -c treat 'ping localhost 3' as to ping host '3'.
|
2001-01-27 04:07:48 +08:00
|
|
|
if [ -z "$PING" ]; then
|
2003-03-30 01:36:35 +08:00
|
|
|
if ping -c 3 -w 5 localhost >/dev/null 2>&1; then
|
|
|
|
PING='ping -c 3 -w 5'
|
2001-01-27 04:07:48 +08:00
|
|
|
PINGCOUNT=
|
2003-09-19 01:22:54 +08:00
|
|
|
elif ping -c 3 localhost >/dev/null 2>&1; then
|
|
|
|
PING='ping -c 3'
|
|
|
|
PINGCOUNT=
|
2001-01-27 04:07:48 +08:00
|
|
|
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
|
2006-05-23 23:06:23 +08:00
|
|
|
if ssh $host -n hostname >/dev/null 2>&1; then
|
2001-01-27 04:07:48 +08:00
|
|
|
RSH=ssh
|
2006-05-23 23:06:23 +08:00
|
|
|
elif rsh $host -n hostname >/dev/null 2>&1; then
|
|
|
|
RSH=rsh
|
2001-01-27 04:07:48 +08:00
|
|
|
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
|
2004-04-19 12:04:16 +08:00
|
|
|
SRCDIRNAME=${HOSTNAME}
|
2003-03-27 06:14:35 +08:00
|
|
|
# restore CC, PATH in case they were changed in the last test.
|
|
|
|
CC="$CC_SAVED"
|
|
|
|
PATH=$PATH_SAVED
|
2001-01-30 11:58:38 +08:00
|
|
|
export PATH # DEC OSF1 needs to export PATH explicitly
|
2001-01-27 04:07:48 +08:00
|
|
|
TEST_TYPE=$*
|
|
|
|
retcode=0
|
2003-03-27 06:14:35 +08:00
|
|
|
skiptest=no
|
2001-01-27 04:07:48 +08:00
|
|
|
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
|
|
|
|
;;
|
2006-05-30 05:46:11 +08:00
|
|
|
-64) # want -64 option
|
|
|
|
SRCDIRNAME=${SRCDIRNAME}-64
|
|
|
|
CC="cc -64"
|
|
|
|
export CC
|
|
|
|
;;
|
2001-01-27 04:07:48 +08:00
|
|
|
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
|
|
|
;;
|
2003-08-22 07:42:50 +08:00
|
|
|
op-snapshot)
|
|
|
|
# option for snapshot
|
|
|
|
shift
|
|
|
|
SNAPCMD_OPT="$SNAPCMD_OPT $1"
|
|
|
|
;;
|
2001-06-06 11:57:35 +08:00
|
|
|
setenv)
|
2004-07-22 04:15:59 +08:00
|
|
|
# pass them along to snapshot set environment variable
|
2001-06-06 11:57:35 +08:00
|
|
|
shift
|
2004-07-22 04:15:59 +08:00
|
|
|
SNAPCMD_OPT="$SNAPCMD_OPT setenv $1 $2"
|
2001-10-03 04:47:05 +08:00
|
|
|
shift
|
2001-06-06 11:57:35 +08:00
|
|
|
;;
|
2003-08-28 12:41:11 +08:00
|
|
|
setenvN)
|
|
|
|
# set environment variable with $1 values
|
|
|
|
# e.g., setenvN 3 x a b c is same as setenv x="a b c".
|
2004-07-22 04:15:59 +08:00
|
|
|
# pass them along to snapshot set environment variable
|
2003-08-28 12:41:11 +08:00
|
|
|
shift
|
|
|
|
envN=$1
|
|
|
|
shift
|
|
|
|
envname=$1
|
2004-07-22 04:15:59 +08:00
|
|
|
SNAPCMD_OPT="$SNAPCMD_OPT setenvN $envN $envname"
|
2003-08-28 12:41:11 +08:00
|
|
|
envalue=
|
|
|
|
while test $envN -gt 0; do
|
|
|
|
shift
|
|
|
|
envalue="$envalue $1"
|
|
|
|
envN=`expr $envN - 1`
|
|
|
|
done
|
2004-07-22 04:15:59 +08:00
|
|
|
SNAPCMD_OPT="$SNAPCMD_OPT $envalue"
|
2003-08-28 12:41:11 +08:00
|
|
|
;;
|
2003-03-27 06:14:35 +08:00
|
|
|
skip)
|
|
|
|
# skip this test
|
|
|
|
skiptest=yes
|
|
|
|
;;
|
2003-12-17 05:34:24 +08:00
|
|
|
srcdirname)
|
2004-04-19 12:04:16 +08:00
|
|
|
# Use this before using parallel and -n32 since this overrides
|
|
|
|
# the others.
|
2003-12-17 05:34:24 +08:00
|
|
|
shift
|
|
|
|
SRCDIRNAME=$1
|
|
|
|
;;
|
2004-12-19 06:47:29 +08:00
|
|
|
deploy)
|
|
|
|
# deploy the built binary.
|
|
|
|
shift
|
|
|
|
SNAPCMD_OPT="$SNAPCMD_OPT deploy $1"
|
|
|
|
;;
|
2004-12-24 13:55:16 +08:00
|
|
|
deploydir)
|
|
|
|
# default directory for deployment.
|
|
|
|
shift
|
|
|
|
SNAPCMD_OPT="$SNAPCMD_OPT deploydir $1"
|
|
|
|
;;
|
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
|
2003-03-27 07:08:24 +08:00
|
|
|
|
2003-03-27 06:14:35 +08:00
|
|
|
if [ $retcode -ne 0 -o $skiptest = yes ]; then
|
|
|
|
errcode=$retcode
|
|
|
|
return $retcode
|
|
|
|
fi
|
2001-01-27 04:07:48 +08:00
|
|
|
|
2002-06-13 19:52:22 +08:00
|
|
|
# Track down the zlib software
|
|
|
|
ans=`$SNAPYARD/current/bin/locate_sw zlib`
|
|
|
|
if [ $? = 0 ]; then
|
|
|
|
Z_INC=`echo $ans | cut -f1 -d,`
|
|
|
|
Z_LIB=`echo $ans | cut -f2 -d,`
|
|
|
|
SNAPCMD_OPT="$SNAPCMD_OPT zlib $Z_INC,$Z_LIB"
|
|
|
|
else
|
|
|
|
# cannot locate zlib software.
|
|
|
|
# continue the test, maybe configure can find it.
|
|
|
|
:
|
2001-01-27 04:07:48 +08:00
|
|
|
fi
|
2002-06-13 19:52:22 +08:00
|
|
|
|
2001-01-27 04:07:48 +08:00
|
|
|
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
|
2002-02-28 23:10:30 +08:00
|
|
|
THIS_MINUTE=`date +%H%M`
|
2004-04-19 12:04:16 +08:00
|
|
|
LOGFILE=${LOGBASENAME}/${SRCDIRNAME}_${TODAY}_${THIS_MINUTE}
|
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
|
2005-02-24 10:57:53 +08:00
|
|
|
if [ $retcode -ne 0 ]; then
|
2005-02-25 06:12:10 +08:00
|
|
|
# Dump the first 10 lines and the last 30 lines of the LOGFILE.
|
2005-04-06 00:31:41 +08:00
|
|
|
( ntail=30
|
2005-02-27 05:41:16 +08:00
|
|
|
echo =========================
|
2005-02-28 07:29:44 +08:00
|
|
|
echo "Dumping logfile of ${HOSTNAME}: $TEST_TYPE"
|
2005-04-06 00:31:41 +08:00
|
|
|
echo "Last $ntail lines of $LOGFILE"
|
2005-02-27 05:41:16 +08:00
|
|
|
echo =========================
|
2005-02-25 06:12:10 +08:00
|
|
|
tail -$ntail $LOGFILE
|
2005-02-27 05:41:16 +08:00
|
|
|
echo =========================
|
|
|
|
echo Dumping done
|
|
|
|
echo =========================
|
|
|
|
echo ""
|
2005-02-25 06:12:10 +08:00
|
|
|
) >> $FAILEDDETAIL
|
2005-02-24 10:57:53 +08:00
|
|
|
fi
|
2001-01-27 04:07:48 +08:00
|
|
|
}
|
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
TIMELIMIT_PARSE()
|
|
|
|
{
|
|
|
|
# Function returns timeparam for timekeeper via standard out -
|
|
|
|
# any debug statements should be 'echo "Debug string" >&2' or timekeeper
|
|
|
|
# will declare timeparam to be non-numeric and ignore it.
|
|
|
|
while read x y ; do
|
|
|
|
# Scan for entry for this weekday.
|
|
|
|
xd=`echo $x | cut -f1 -d/`
|
|
|
|
if [ "$xd" = ${WEEKDAY} ]; then
|
|
|
|
# strip away the weekday/ part.
|
|
|
|
timeparam=`echo $x | cut -f2 -d/`
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
case "$x" in
|
|
|
|
'' | '#'*)
|
|
|
|
# blank or comment lines. Continue.
|
|
|
|
;;
|
|
|
|
???/*)
|
|
|
|
# Ignore any entry not of this weekday.
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
timeparam="$x"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
echo $timeparam
|
|
|
|
return
|
|
|
|
}
|
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
|
2003-08-22 07:42:50 +08:00
|
|
|
# op-snapshot <option> snapshot option
|
2001-10-03 04:47:05 +08:00
|
|
|
# --* configure option
|
|
|
|
# setenv <name> <value> set environment variable <name> to <value>
|
2004-07-22 04:15:59 +08:00
|
|
|
# Pass along to snapshot
|
|
|
|
# setenvN <N> <name> <value> ...
|
2003-12-12 04:28:03 +08:00
|
|
|
# set environment variable with <N> values
|
|
|
|
# e.g., setenvN 3 x a b c is same as setenv x="a b c".
|
2004-07-22 04:15:59 +08:00
|
|
|
# Pass along to snapshot.
|
2003-03-27 06:14:35 +08:00
|
|
|
# skip skip this test
|
2003-12-17 05:34:24 +08:00
|
|
|
# srcdirname <name> use <name> as the build-directory.
|
2004-12-19 06:47:29 +08:00
|
|
|
# deploy <name> deploy the built binary at directory <name>.
|
2004-12-24 13:55:16 +08:00
|
|
|
# deploydir <name> use <name> as the default directory for deployment.
|
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"
|
|
|
|
;;
|
2003-04-01 03:05:41 +08:00
|
|
|
all: | ${CONFIGNAME}:)
|
2001-02-05 12:36:30 +08:00
|
|
|
# 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-02-06 12:38:57 +08:00
|
|
|
# Show usage page
|
|
|
|
USAGE()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
2002-03-11 11:49:16 +08:00
|
|
|
Usage: runtest [-h] [-debug] [-r<version>] [-all] [-nocvs] [-nodiff] [<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
|
2002-03-11 11:49:16 +08:00
|
|
|
-nodiff
|
|
|
|
do not do diff commands
|
2003-11-20 12:48:25 +08:00
|
|
|
-setup
|
|
|
|
setup the directory structure for snapshot test
|
2003-04-01 03:05:41 +08:00
|
|
|
-configname <name>
|
|
|
|
use <name> as hostname in the parsing of the snaptest configure file
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-11-20 12:48:25 +08:00
|
|
|
# Verify if directory ($1) exists. If not, create it.
|
|
|
|
CHECK_DIR()
|
|
|
|
{
|
|
|
|
dir=$1
|
|
|
|
if test ! -e $1; then
|
|
|
|
echo mkdir $1
|
|
|
|
mkdir $1
|
|
|
|
errcode=$?
|
|
|
|
elif test ! -d $1; then
|
|
|
|
echo $1 is not a directory
|
|
|
|
errcode=1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
2003-03-27 06:14:35 +08:00
|
|
|
skiptest=no # if test is skipped
|
|
|
|
CC_SAVED="$CC" # CC & PATH maybe changed within a test.
|
|
|
|
PATH_SAVED=$PATH # These save the original values.
|
2008-05-01 03:51:13 +08:00
|
|
|
timelimit=300 # default time limit (minutes) for the timekeeper
|
2001-01-27 04:07:48 +08:00
|
|
|
|
|
|
|
#################################
|
|
|
|
# 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*)
|
2002-03-06 08:55:31 +08:00
|
|
|
# version string
|
2001-01-27 04:07:48 +08:00
|
|
|
H5VER="$1"
|
|
|
|
;;
|
|
|
|
-all)
|
2001-10-25 02:06:50 +08:00
|
|
|
# Test all hosts.
|
2001-07-17 22:32:17 +08:00
|
|
|
TESTHOST=-all
|
2001-01-27 04:07:48 +08:00
|
|
|
;;
|
2001-03-13 13:27:58 +08:00
|
|
|
-nocvs)
|
2003-12-16 03:06:24 +08:00
|
|
|
# do not do cvs commands.
|
2001-03-13 13:27:58 +08:00
|
|
|
NOCVS=nocvs
|
|
|
|
;;
|
2002-03-11 11:49:16 +08:00
|
|
|
-nodiff)
|
2003-12-16 03:06:24 +08:00
|
|
|
# do not do diff commands.
|
2002-03-11 11:49:16 +08:00
|
|
|
NODIFF=nodiff
|
|
|
|
;;
|
2003-04-01 03:05:41 +08:00
|
|
|
-configname)
|
2003-12-16 03:06:24 +08:00
|
|
|
# use <name> as hostname in the parsing of the snaptest configure file.
|
2003-04-01 03:05:41 +08:00
|
|
|
shift
|
|
|
|
CONFIGNAME=$1
|
|
|
|
;;
|
2003-11-20 12:48:25 +08:00
|
|
|
-setup)
|
2003-12-16 03:06:24 +08:00
|
|
|
# setup the directory structure for snapshot test.
|
2003-11-20 12:48:25 +08:00
|
|
|
CMD=setup
|
|
|
|
;;
|
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
|
|
|
|
|
2002-03-06 08:55:31 +08:00
|
|
|
# setup H5VER if not set yet
|
|
|
|
if [ -z "$H5VER" -a -f bin/snapshot_version ]
|
|
|
|
then
|
|
|
|
. bin/snapshot_version
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$H5VER" ]
|
|
|
|
then
|
|
|
|
H5VERSION=hdf5_`echo $H5VER | sed -e s/-r// -e s/\\\./_/g`
|
|
|
|
PROGNAME="$PROGNAME $H5VER"
|
|
|
|
else
|
|
|
|
H5VERSION=hdf5
|
|
|
|
fi
|
|
|
|
|
2001-01-27 04:07:48 +08:00
|
|
|
#################################
|
|
|
|
# Setup snapshot test directories
|
|
|
|
#################################
|
2003-07-08 01:03:08 +08:00
|
|
|
BASEDIR=${HOME}/snapshots-${H5VERSION}
|
2003-11-20 12:48:25 +08:00
|
|
|
# initial processing of setup option if requested
|
|
|
|
if test x-$CMD = x-setup; then
|
|
|
|
CHECK_DIR $BASEDIR
|
|
|
|
test $errcode -ne 0 && exit 1
|
|
|
|
elif [ ! -d ${BASEDIR} ]; then
|
2003-07-08 01:03:08 +08:00
|
|
|
echo "BASEDIR ($BASEDIR) does not exist"
|
|
|
|
exit 1
|
|
|
|
fi
|
2001-01-27 04:07:48 +08:00
|
|
|
# Show the real physical path rather than the symbolic path
|
2003-07-08 01:03:08 +08:00
|
|
|
SNAPYARD=`cd $BASEDIR && /bin/pwd`
|
2001-01-27 04:07:48 +08:00
|
|
|
# Log file basename
|
2003-11-20 12:48:25 +08:00
|
|
|
LOGDIR=${SNAPYARD}/log
|
2004-04-19 12:04:16 +08:00
|
|
|
LOGBASENAME=${LOGDIR}
|
2003-11-20 12:48:25 +08:00
|
|
|
PASSEDLOG=${LOGDIR}/PASSED_LOG_${TODAY}
|
|
|
|
FAILEDLOG=${LOGDIR}/FAILED_LOG_${TODAY}
|
2005-02-24 10:57:53 +08:00
|
|
|
FAILEDDETAIL=${LOGDIR}/FAILED_DETAIL_${TODAY}
|
2003-12-16 11:30:34 +08:00
|
|
|
SKIPPEDLOG=${LOGDIR}/SKIPPED_LOG_${TODAY}
|
2003-11-20 12:48:25 +08:00
|
|
|
TIMELOG=${LOGDIR}/TIME_LOG_${TODAY}
|
2004-12-26 01:18:24 +08:00
|
|
|
TIMEKEEPERLOG=${LOGDIR}/TIMEKEEPER_LOG_${TODAY}
|
2003-11-20 12:48:25 +08:00
|
|
|
CVSLOG=${LOGDIR}/CVS_LOG_${TODAY}
|
|
|
|
CVSLOG_LOCK=${LOGDIR}/CVS_LOG_LOCK_${TODAY}
|
|
|
|
DIFFLOG=${LOGDIR}/DIFF_LOG_${TODAY}
|
2005-09-27 00:14:02 +08:00
|
|
|
COPYRIGHT_ERR=${LOGDIR}/COPYRIGHT_ERR_${TODAY}
|
2003-11-20 12:48:25 +08:00
|
|
|
# Snap Test hosts and Configuration files
|
|
|
|
ALLHOSTSFILE=${SNAPYARD}/allhostfile
|
2001-01-30 14:12:12 +08:00
|
|
|
SNAPTESTCFG=${SNAPYARD}/snaptest.cfg
|
2005-05-29 05:07:16 +08:00
|
|
|
TIMELIMIT=${SNAPYARD}/timelimit
|
2005-04-22 12:40:09 +08:00
|
|
|
TMPFILE="${LOGDIR}/#runtest.${TODAY}.$$"
|
2001-01-27 04:07:48 +08:00
|
|
|
|
2003-11-20 12:48:25 +08:00
|
|
|
# more processing of setup option if requested
|
|
|
|
if test x-$CMD = x-setup; then
|
|
|
|
CHECK_DIR $LOGDIR
|
|
|
|
test $errcode -ne 0 && exit 1
|
|
|
|
CHECK_DIR $LOGDIR/OLD
|
|
|
|
test $errcode -ne 0 && exit 1
|
|
|
|
CHECK_DIR $SNAPYARD/TestDir
|
|
|
|
test $errcode -ne 0 && exit 1
|
|
|
|
# create empty test hosts or configure files if non-existing
|
|
|
|
for f in $ALLHOSTSFILE $SNAPTESTCFG; do
|
2003-12-04 01:09:21 +08:00
|
|
|
if test ! -f $f; then
|
|
|
|
echo Creating $f
|
|
|
|
touch $f
|
|
|
|
fi
|
2003-11-20 12:48:25 +08:00
|
|
|
done
|
2003-12-04 01:09:21 +08:00
|
|
|
# create or update the current source.
|
|
|
|
echo update current source
|
|
|
|
$SNAPSHOT checkout
|
2003-11-20 12:48:25 +08:00
|
|
|
# setup completed. Exit.
|
|
|
|
exit 0
|
|
|
|
fi
|
2001-01-27 04:07:48 +08:00
|
|
|
|
2005-10-15 04:37:52 +08:00
|
|
|
#################################
|
|
|
|
# Show some host status numbers
|
|
|
|
#################################
|
2005-10-17 06:52:34 +08:00
|
|
|
# df sometimes hangs due to file system problems. Invoke it as background
|
|
|
|
# process and give it 10 seconds to finish. If it hangs, just continue.
|
2005-10-15 04:37:52 +08:00
|
|
|
uptime
|
2005-10-17 06:52:34 +08:00
|
|
|
df &
|
|
|
|
sleep 10
|
2005-10-15 04:37:52 +08:00
|
|
|
|
2001-07-17 22:32:17 +08:00
|
|
|
#################################
|
|
|
|
# Setup test host(s)
|
|
|
|
#################################
|
|
|
|
if [ "$TESTHOST" = -all ]; then
|
2001-10-25 02:06:50 +08:00
|
|
|
if [ -f $ALLHOSTSFILE ]; then
|
2007-03-20 12:26:19 +08:00
|
|
|
TESTHOST=`sed -e '/^#/d;/^ *$/d' $ALLHOSTSFILE`
|
2001-10-25 02:06:50 +08:00
|
|
|
else
|
|
|
|
PRINT "could not access the all-hosts-file ($ALLHOSTSFILE)"
|
|
|
|
USAGE
|
|
|
|
exit 1
|
|
|
|
fi
|
2001-07-17 22:32:17 +08:00
|
|
|
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
|
|
|
|
2005-09-27 00:14:02 +08:00
|
|
|
# Do a checkout if one has not been done today.
|
|
|
|
# Then check MANIFEST file and copyrights noitces.
|
2004-09-30 03:18:49 +08:00
|
|
|
if [ -z "$NOCVS" ]; 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
|
2005-09-27 00:14:02 +08:00
|
|
|
# ===================
|
|
|
|
# Check MANIFEST file
|
|
|
|
# ===================
|
2001-08-22 07:41:10 +08:00
|
|
|
PRINT Checking MAINFEST file ...
|
2005-04-06 00:55:27 +08:00
|
|
|
(cd $SNAPYARD/current; bin/chkmanifest) > $TMPFILE 2>&1
|
2001-01-27 04:07:48 +08:00
|
|
|
errcode=$?
|
2005-04-06 00:55:27 +08:00
|
|
|
if [ $errcode -eq 0 ]; then
|
|
|
|
# test passed.
|
|
|
|
cat $TMPFILE
|
|
|
|
else
|
2001-01-27 04:07:48 +08:00
|
|
|
# test failed.
|
2001-08-28 00:01:37 +08:00
|
|
|
REPORT_ERR "****FAILED ${HOSTNAME}: MANIFEST check****"
|
2005-04-06 00:55:27 +08:00
|
|
|
( echo =========================
|
|
|
|
echo "MANIFEST checking failed output"
|
|
|
|
echo =========================
|
|
|
|
cat $TMPFILE
|
|
|
|
echo =========================
|
|
|
|
echo "MANIFEST checking failed output done"
|
|
|
|
echo =========================
|
|
|
|
echo ""
|
|
|
|
) >> $FAILEDDETAIL
|
2001-01-27 04:07:48 +08:00
|
|
|
fi
|
2005-04-06 00:55:27 +08:00
|
|
|
rm $TMPFILE
|
2001-01-27 04:07:48 +08:00
|
|
|
PRINT_BLANK
|
2006-04-08 01:46:03 +08:00
|
|
|
# No copyright checking until what need copyright is decided. 2006/4/7.
|
|
|
|
if false; then
|
2005-09-27 00:14:02 +08:00
|
|
|
# ======================
|
|
|
|
# Check Copyright notice
|
|
|
|
# ======================
|
|
|
|
PRINT Checking Copyrights notices ...
|
2005-10-31 11:23:33 +08:00
|
|
|
if (cd $SNAPYARD/current; bin/chkcopyright) > $TMPFILE 2>&1 ; then
|
2005-09-27 00:14:02 +08:00
|
|
|
echo Passed.
|
|
|
|
else
|
|
|
|
# Save the output and report some of it.
|
|
|
|
# Do not report it as failed for runtest yet.
|
|
|
|
# Send a separate report mail via hardcoding.
|
|
|
|
# Need fixes/cleanup later.
|
|
|
|
echo "Failed. See detail in another report mail"
|
|
|
|
cp $TMPFILE $COPYRIGHT_ERR
|
2005-10-31 11:23:33 +08:00
|
|
|
nheadlines=300
|
|
|
|
ntaillines=5 # Number of lines in report summary.
|
|
|
|
(
|
2005-09-27 00:14:02 +08:00
|
|
|
echo =========================
|
2005-10-31 11:23:33 +08:00
|
|
|
echo "Copyright checking failed. Showing first $nheadlines lines of output."
|
2005-09-27 00:14:02 +08:00
|
|
|
echo "Complete output is in file $COPYRIGHT_ERR"
|
|
|
|
echo =========================
|
2005-10-31 11:23:33 +08:00
|
|
|
nreportlines=`wc -l < $COPYRIGHT_ERR`
|
|
|
|
if [ $nreportlines -le `expr $nheadlines + $ntaillines` ]; then
|
|
|
|
# Just print the whole file.
|
|
|
|
cat $COPYRIGHT_ERR
|
|
|
|
else
|
|
|
|
# Show the first $nheadlines plus report summary
|
|
|
|
head -$nheadlines $COPYRIGHT_ERR
|
|
|
|
echo ...
|
|
|
|
tail -$ntaillines $COPYRIGHT_ERR
|
|
|
|
fi
|
2006-01-08 13:04:47 +08:00
|
|
|
) | Mail -s "${H5VERSION} Copyrights check Failed" hdf5lib
|
2005-09-27 00:14:02 +08:00
|
|
|
fi
|
|
|
|
rm $TMPFILE
|
|
|
|
PRINT_BLANK
|
2006-04-08 01:46:03 +08:00
|
|
|
fi
|
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
|
|
|
|
|
2002-03-09 07:36:59 +08:00
|
|
|
# run a snapshot diff to see if any significant differences between
|
|
|
|
# the current and previous versions
|
2002-03-11 11:49:16 +08:00
|
|
|
if [ -z "$NODIFF" ]; then
|
|
|
|
$SNAPSHOT diff >> $DIFFLOG 2>&1
|
|
|
|
errcode=$?
|
2003-03-19 23:22:22 +08:00
|
|
|
# check the errcode only if NOT in DEBUG MODE
|
|
|
|
if [ -z "$DEBUGMODE" -a $errcode -eq 0 ]; then
|
2002-03-11 11:49:16 +08:00
|
|
|
# no need to run test
|
|
|
|
PRINT "NO TEST: no significant differences between current and previous versions" |
|
|
|
|
tee -a $PASSEDLOG
|
|
|
|
exit 0
|
|
|
|
fi
|
2002-03-09 07:36:59 +08:00
|
|
|
fi
|
|
|
|
|
2003-12-16 03:06:24 +08:00
|
|
|
# we can use the version of script in SNAPYARD/current now.
|
2004-09-30 03:18:49 +08:00
|
|
|
# Don't do the diff or cvs update any more.
|
|
|
|
PROGNAME="$SNAPYARD/current/$PROGNAME -nodiff -nocvs"
|
2001-01-27 22:38:08 +08:00
|
|
|
|
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
|
2004-12-24 04:52:13 +08:00
|
|
|
# Fork off timekeeper if concurrent tests will be used.
|
|
|
|
if [ -n "$SRCDIR" ]; then
|
2008-05-01 03:51:13 +08:00
|
|
|
timelimit=`TIMELIMIT_PARSE < $TIMELIMIT`
|
2004-12-26 01:18:24 +08:00
|
|
|
($SNAPYARD/current/bin/timekeeper $timelimit > $TIMEKEEPERLOG 2>&1 &)
|
2004-12-24 07:42:57 +08:00
|
|
|
PRINT " Fork off timekeeper $timelimit"
|
2004-12-24 04:52:13 +08:00
|
|
|
fi
|
2003-03-19 23:22:22 +08:00
|
|
|
runtest_type="hosts"
|
2001-01-27 04:07:48 +08:00
|
|
|
for h in $TESTHOST; do
|
2004-09-26 05:48:51 +08:00
|
|
|
# Must do CONFIGNAME before $h got changed by the second cut.
|
|
|
|
# cut returns the whole string if there is no / in the string
|
|
|
|
# at all. But that works okay for the CONFIGNAME too.
|
|
|
|
CONFIGNAME=`echo $h | cut -f2 -d/`
|
|
|
|
h=`echo $h | cut -f1 -d/`
|
2003-03-19 23:22:22 +08:00
|
|
|
n_test=`expr $n_test + 1`
|
2005-05-28 11:46:30 +08:00
|
|
|
TMP_OUTPUT="#${h}_${CONFIGNAME}.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)
|
2004-09-26 05:48:51 +08:00
|
|
|
CMD="$RSH $h -n $PROGNAME -configname $CONFIGNAME"
|
2003-04-01 03:05:41 +08:00
|
|
|
PRINT $CMD
|
2001-10-20 07:53:46 +08:00
|
|
|
|
2001-08-22 07:41:10 +08:00
|
|
|
# launch concurrent tests only if srcdir is used
|
|
|
|
if [ -n "$SRCDIR" ]; then
|
2008-05-01 03:51:13 +08:00
|
|
|
$CMD || REPORT_ERR "****FAILED ${h}: Abnormal exit from runtest****" && PRINT_BLANK &
|
2005-05-28 11:46:30 +08:00
|
|
|
echo $! > PID.${h}_${CONFIGNAME}
|
2001-08-22 07:41:10 +08:00
|
|
|
else
|
2008-05-01 03:51:13 +08:00
|
|
|
$CMD || REPORT_ERR "****FAILED ${h}: Abnormal exit from runtest****" && PRINT_BLANK
|
2001-08-22 07:41:10 +08:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
NoRemoteCommand)
|
2005-01-09 05:25:18 +08:00
|
|
|
PRINT $h does not accept Remote Command "(`date`)"
|
2001-08-22 07:41:10 +08:00
|
|
|
;;
|
|
|
|
NotReachable)
|
2005-01-09 05:25:18 +08:00
|
|
|
PRINT $h is not reachable "(`date`)"
|
2001-08-22 07:41:10 +08:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
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
|
2005-01-09 05:25:18 +08:00
|
|
|
# Pause a moment in case the timekeeper is terminating processes.
|
|
|
|
wait 30
|
2001-01-27 04:07:48 +08:00
|
|
|
for h in $TESTHOST; do
|
2005-05-28 11:46:30 +08:00
|
|
|
CONFIGNAME=`echo $h | cut -f2 -d/`
|
2004-09-26 05:48:51 +08:00
|
|
|
h=`echo $h | cut -f1 -d/`
|
2005-05-28 11:46:30 +08:00
|
|
|
TMP_OUTPUT="#${h}_${CONFIGNAME}.out"
|
2001-01-27 04:07:48 +08:00
|
|
|
cat $TMP_OUTPUT
|
|
|
|
# Verify test script did complete by checking the last lines
|
2008-05-01 03:51:13 +08:00
|
|
|
(tail -5 $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)
|
2005-05-28 11:46:30 +08:00
|
|
|
rm -f $TMP_OUTPUT PID.${h}_${CONFIGNAME}
|
2001-01-27 04:07:48 +08:00
|
|
|
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.
|
2003-03-27 07:08:24 +08:00
|
|
|
# Note that n_test must start as 1.
|
2001-02-05 12:36:30 +08:00
|
|
|
#
|
2003-03-27 07:08:24 +08:00
|
|
|
n_test=1
|
2003-03-19 23:22:22 +08:00
|
|
|
runtest_type="tests"
|
2003-03-27 07:08:24 +08:00
|
|
|
TEST="`echo $TEST_TYPES | cut -f$n_test -d';'`"
|
2001-02-05 12:36:30 +08:00
|
|
|
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
|
2003-03-27 07:08:24 +08:00
|
|
|
# dec n_test to show the actual number of tests ran.
|
|
|
|
n_test=`expr $n_test - 1`
|
2001-01-27 04:07:48 +08:00
|
|
|
|
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
|