[Swift-commit] r3953 - trunk/tests
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Wed Jan 12 10:22:46 CST 2011
Author: wozniak
Date: 2011-01-12 10:22:46 -0600 (Wed, 12 Jan 2011)
New Revision: 3953
Modified:
trunk/tests/nightly.sh
Log:
Allow nightly.sh to test shell scripts in addition to SwiftScripts
Modified: trunk/tests/nightly.sh
===================================================================
--- trunk/tests/nightly.sh 2011-01-12 15:51:20 UTC (rev 3952)
+++ trunk/tests/nightly.sh 2011-01-12 16:22:46 UTC (rev 3953)
@@ -85,6 +85,11 @@
# providers/<provider description>/<site>
# E.g., providers/local-pbs/PADS
+# WARNINGS
+# nightly.sh uses shopt
+
+shopt -s nullglob
+
printhelp() {
echo "nightly.sh <options> <output>"
echo ""
@@ -163,7 +168,7 @@
HTML_COMMENTS=1
fi
-# Iterations
+# Iterations per test (may want to run each test multiple times?)
ITERS_LOCAL=1
LOGCOUNT=0
@@ -185,7 +190,7 @@
SCRIPTDIR=$( cd $( dirname $0 ) ; /bin/pwd )
-SWIFTCOUNT=0
+TESTCOUNT=0
echo "RUNNING_IN: $RUNDIR"
echo "HTML_OUTPUT: $HTML"
@@ -470,7 +475,7 @@
start_row() {
html_tr testline
html_td align right width 50
- html "<b>$SWIFTCOUNT</b>"
+ html "<b>$TESTCOUNT</b>"
html " "
html_~td
html_td align right
@@ -651,7 +656,7 @@
TIMEOUT=$2 # seconds
OUTPUT=$3
- V=$SWIFTCOUNT
+ V=$TESTCOUNT
# Use background so kill/trap is immediate
sleep $TIMEOUT > /dev/null 2>&1 &
@@ -756,7 +761,7 @@
CDM=
[ -r fs.data ] && CDM="-cdm.file fs.data"
- (( SWIFTCOUNT++ ))
+ (( TESTCOUNT++ ))
TIMEOUT=$( gettimeout $GROUP/$TIMEOUTFILE )
@@ -779,6 +784,40 @@
fi
}
+# Execute shell test case w/ setup, check, clean
+script_test_case() {
+ SHELLSCRIPT=$1
+ SETUPSCRIPT=${SHELLSCRIPT%.test.sh}.setup.sh
+ CHECKSCRIPT=${SHELLSCRIPT%.test.sh}.check.sh
+ CLEANSCRIPT=${SHELLSCRIPT%.test.sh}.clean.sh
+ TIMEOUTFILE=${SHELLSCRIPT%.test.sh}.timeout
+
+ TEST_SHOULD_FAIL=0
+ if [ -x $GROUP/$SETUPSCRIPT ]; then
+ script_exec $GROUP/$SETUPSCRIPT "S"
+ fi
+
+ (( TESTCOUNT++ ))
+
+ # Not using background for script tests yet
+ # TIMEOUT=$( gettimeout $GROUP/$TIMEOUTFILE )
+
+ if [ -x $GROUP/$SETUPSCRIPT ]; then
+ script_exec $GROUP/$SETUPSCRIPT "S"
+ fi
+
+ if [ -x $GROUP/$SHELLSCRIPT ]; then
+ script_exec $SHELLSCRIPT "X"
+ fi
+
+ if [ -x $GROUP/$CHECKSCRIPT ]; then
+ script_exec $GROUP/$CHECKSCRIPT "√"
+ fi
+ if [ -x $GROUP/$CLEANSCRIPT ]; then
+ script_exec $GROUP/$CLEANSCRIPT "C"
+ fi
+}
+
# All timeouts in this script are in seconds
gettimeout() {
FILE=$1
@@ -832,12 +871,12 @@
}
# Setup coasters variables
-if which ifconfig > /dev/null; then
+if which ifconfig > /dev/null 2>&1; then
IFCONFIG=ifconfig
else
IFCONFIG=/sbin/ifconfig
fi
-$IFCONFIG > /dev/null || crash "Cannot run ifconfig!"
+$IFCONFIG > /dev/null 2>&1 || crash "Cannot run ifconfig!"
GLOBUS_HOSTNAME=$( $IFCONFIG | grep inet | head -1 | cut -d ':' -f 2 | \
awk '{print $1}' )
[ $? != 0 ] && crash "Could not obtain GLOBUS_HOSTNAME!"
@@ -907,24 +946,42 @@
group_fs_data
group_swift_properties
- SWIFTS=$( ls $GROUP/*.swift )
- checkfail "Could not ls: $GROUP"
+ SWIFTS=$( echo $GROUP/*.swift )
+ checkfail "Could not list: $GROUP"
for TEST in $SWIFTS; do
(( SKIP_COUNTER++ < SKIP_TESTS )) && continue
- TESTNAME=$( basename $TEST)
+ TESTNAME=$( basename $TEST )
cp -v $GROUP/$TESTNAME .
TESTLINK=$TESTNAME
start_row
- for ((i=0; $i<$ITERS_LOCAL; i=$i+1)); do
+ for (( i=0; $i<$ITERS_LOCAL; i=$i+1 )); do
swift_test_case $TESTNAME
- (( $SWIFTCOUNT >= $NUMBER_OF_TESTS )) && return
+ (( $TESTCOUNT >= $NUMBER_OF_TESTS )) && return
done
end_row
done
+
+ SCRIPTS=$( echo $GROUP/*.test.sh )
+ checkfail "Could not list: $GROUP"
+ for TEST in $SCRIPTS; do
+
+ (( SKIP_COUNTER++ < SKIP_TESTS )) && continue
+
+ TESTNAME=$( basename $TEST )
+ cp -v $GROUP/$TESTNAME .
+ TESTLINK=$TESTNAME
+
+ start_row
+ for ((i=0; $i<$ITERS_LOCAL; i=$i+1)); do
+ script_test_case $TESTNAME
+ (( $TESTCOUNT >= $NUMBER_OF_TESTS )) && return
+ done
+ end_row
+ done
}
if [[ $WORK == "" ]]
@@ -1004,7 +1061,7 @@
start_part "Part $GROUPCOUNT: $TITLE"
test_group
(( GROUPCOUNT++ ))
- (( $SWIFTCOUNT >= $NUMBER_OF_TESTS )) && break
+ (( $TESTCOUNT >= $NUMBER_OF_TESTS )) && break
done
if [ $GRID_TESTS == "0" ]; then
More information about the Swift-commit
mailing list