[Swift-commit] r5170 - in trunk: bin tests

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Sat Sep 24 23:24:00 CDT 2011


Author: davidk
Date: 2011-09-24 23:24:00 -0500 (Sat, 24 Sep 2011)
New Revision: 5170

Modified:
   trunk/bin/gensites
   trunk/tests/suite.sh
Log:
Integrating more changes from 0.93 to trunk


Modified: trunk/bin/gensites
===================================================================
--- trunk/bin/gensites	2011-09-25 03:58:06 UTC (rev 5169)
+++ trunk/bin/gensites	2011-09-25 04:24:00 UTC (rev 5170)
@@ -133,19 +133,22 @@
 fi
 
 # Ensure a properties file exists
-if [ ! -f "$PROPERTIES_FILE" ]; then
-   PROPERTIES_FILE="./swift.properties"
-   if [ ! -f "$PROPERTIES_FILE" ]; then
+if [ -z "$PROPERTIES_FILE" ]; then
+   if [ -f "./swift.properties" ]; then
+      PROPERTIES_FILE="./swift.properties"
+   elif [ -f "$HOME/.swift/swift.properties" ]; then
       PROPERTIES_FILE="$HOME/.swift/swift.properties"
    fi
 fi
 
 # Setup for creating a TC file
-if [ -n "`grep -e app $PROPERTIES_FILE`" ]; then
-   if [ -f "tc.data" ]; then
-      mv tc.data tc.data.old
+if [ -f "$PROPERTIES_FILE" ]; then
+   if [ -n "`grep -e app $PROPERTIES_FILE`" ]; then
+      if [ -f "tc.data" ]; then
+         mv tc.data tc.data.old
+      fi
+      HOSTS=`grep -i "pool handle" $TEMPLATE_PATH|grep -v "^[[:space:]]*#"|cut -d'"' -f2`
    fi
-   HOSTS=`grep -i "pool handle" $TEMPLATE_PATH|grep -v "^[[:space:]]*#"|cut -d'"' -f2`
 fi
 
 # Parse values into variables for later sed processing

Modified: trunk/tests/suite.sh
===================================================================
--- trunk/tests/suite.sh	2011-09-25 03:58:06 UTC (rev 5169)
+++ trunk/tests/suite.sh	2011-09-25 04:24:00 UTC (rev 5170)
@@ -155,16 +155,9 @@
 
 TESTDIR=$TOPDIR/cog/modules/swift/tests
 
-# Ensure all given variables are set
+# Gensites will now check the variables as needed 
 checkvars() {
-  while (( ${#*} ))
-   do
-   VAR=$1
-   V=$( eval "echo \${${VAR}+1}" )
-   [[ $V == 1 ]] || crash "Not set: $VAR"
-   shift
-  done
-  return 0
+ return
 }
 
 checkfail() {
@@ -952,18 +945,6 @@
   output_report package "swift-$DATE.tar.gz"
 }
 
-# Generate the sites.sed file
-make_sites_sed() {
-  {
-    echo "s at _WORK_@$WORK@"
-    echo "s at _HOST_@$GLOBUS_HOSTNAME@"
-    echo "s at _PROJECT_@$PROJECT@"
-    echo "s at _QUEUE_@$QUEUE@"
-    echo "s at _EXECUTION_URL_@$EXECUTION_URL@"
-  } > $RUNDIR/sites.sed
-  return 0
-}
-
 # Setup coasters variables
 if which ifconfig > /dev/null 2>&1; then
   IFCONFIG=ifconfig
@@ -977,20 +958,40 @@
 
 # Generate sites.xml
 group_sites_xml() {
-  TEMPLATE=$GROUP/sites.template.xml
-  if [ -f $TEMPLATE ]; then
-    sed -f $RUNDIR/sites.sed < $TEMPLATE > sites.xml
-    [ $? != 0 ] && crash "Could not create sites.xml!"
-    echo "Using: $GROUP/sites.template.xml"
+
+  # Determine template
+  if [ -f "$GROUP/sites.template.xml" ]; then
+     TEMPLATE="$GROUP/sites.template.xml"
+  elif [ -f "$GROUP/gensites.template" ]; then
+     TEMPLATE=`cat $GROUP/gensites.template`
   else
-    sed "s at _WORK_@$PWD/work@" < $TESTDIR/sites/localhost.xml > sites.xml
-    [ $? != 0 ] && crash "Could not create sites.xml!"
-    echo "Using: $TESTDIR/sites/localhost.xml"
+     TEMPLATE="$TESTDIR/sites/localhost.xml"
   fi
+
+  # Give default to _WORK_ if undefined in swift.properties
+  if [ -z "$WORK" ]
+  then
+     export WORK=$TOPDIR/work
+  fi
+
+  # Call gensites
+  TEMPLATE_DIRNAME=`dirname $TEMPLATE`
+  TEMPLATE=`basename $TEMPLATE`
+  if [ "$TEMPLATE_DIRNAME" != "." ]; then
+     gensites -L $TEMPLATE_DIRNAME $TEMPLATE > sites.xml
+  else
+     gensites $TEMPLATE > sites.xml
+  fi
 }
 
 # Generate tc.data
 group_tc_data() {
+
+  # Gensites will create a tc.data file if it is being used
+  if [ -f "$GROUP/gensites.template" ]; then
+     return
+  fi
+
   if [ -f $GROUP/tc.template.data ]; then
     sed "s at _DIR_@$GROUP@" < $GROUP/tc.template.data > tc.data
     [ $? != 0 ] && crash "Could not create tc.data!"
@@ -1097,13 +1098,20 @@
 
     cp $GROUP/$TESTNAME .
     TESTLINK=$TESTNAME
-    start_row
+
+   # Use repeat.txt to determine number of test iterations
+    SCRIPT_BASENAME=`basename $TESTNAME .swift`
+    if [ -f "$GROUP/$SCRIPT_BASENAME.repeat" ]; then
+      ITERS_LOCAL=`cat $GROUP/$SCRIPT_BASENAME.repeat`
+    fi
+
     for (( i=0; $i<$ITERS_LOCAL; i=$i+1 )); do
+      start_row
       swift_test_case $TESTNAME
       (( $TESTCOUNT >= $NUMBER_OF_TESTS )) && return
       (( $SHUTDOWN )) && return
+      end_row
     done
-     end_row
   done
     group_statistics
     TOTAL_TIME=0
@@ -1134,13 +1142,7 @@
 
 }
 
-
-if [[ $WORK == "" ]]
-then
-  WORK=$TOPDIR/work
-fi
-
-checkvars GROUPARG
+#checkvars GROUPARG
 echo "GROUP ARGUMENT: $GROUPARG"
 if [[ $GROUPARG != /* ]]; then
   # Adjust relative path
@@ -1164,8 +1166,6 @@
 
 date > $LOG
 
-make_sites_sed
-
 # Here the report starts.
 # Call to function header()
 header




More information about the Swift-commit mailing list