[Swift-commit] r3633 - trunk/tests

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Tue Sep 21 13:57:45 CDT 2010


Author: wozniak
Date: 2010-09-21 13:57:45 -0500 (Tue, 21 Sep 2010)
New Revision: 3633

Modified:
   trunk/tests/nightly.sh
Log:
Test line numbers, better process killing, export GROUP


Modified: trunk/tests/nightly.sh
===================================================================
--- trunk/tests/nightly.sh	2010-09-21 04:12:48 UTC (rev 3632)
+++ trunk/tests/nightly.sh	2010-09-21 18:57:45 UTC (rev 3633)
@@ -35,6 +35,8 @@
 # stdout.txt retains stdout from the previous test (for *.clean.sh)
 # output_*.txt is the HTML-linked permanent output from a test
 
+# WARNING: On timeout, this script will call killall -9 java
+
 printhelp() {
   echo "nightly.sh <options> <output>"
   echo ""
@@ -125,6 +127,8 @@
 
 SCRIPTDIR=$( dirname $0 )
 
+SWIFTCOUNT=0
+
 cd $TOPDIR
 mkdir -p $RUNDIR
 [ $? != 0 ] && echo "Could not mkdir: $RUNDIR" && exit 1
@@ -349,7 +353,7 @@
 start_part() {
   PART=$1
   html_tr part
-  html_th 2
+  html_th 3
   html "$PART"
   html_~th
   html_~tr
@@ -358,6 +362,9 @@
 start_row() {
   html_tr testline
   html_td right
+  html "<b>$SWIFTCOUNT</b>"
+  html_~td
+  html_td right
   if [[ -n $TESTLINK ]]; then
     html_a_href $TESTLINK $TESTNAME
   else
@@ -446,7 +453,13 @@
 process_exec() {
   printf "\nExecuting: $@" >>$LOG
   rm -fv $OUTPUT
-  "$@" > $OUTPUT 2>&1
+
+  "$@" > $OUTPUT 2>&1 &
+  EXEC_PID=$!
+
+  trap "process_exec_trap $EXEC_PID" SIGTERM
+
+  wait $EXEC_PID
   EXITCODE=$?
   if [ "$EXITCODE" == "127" ]; then
     echo "Command not found: $@" > $OUTPUT
@@ -457,6 +470,16 @@
   return $EXITCODE
 }
 
+# Ensure we kill the tested process and any subordinate java processes
+# in case of monitor() timeout
+# Rationale: Killing bin/swift does not kill the Swift java process
+process_exec_trap() {
+  EXEC_PID=$1
+  echo "process_exec_trap()"
+  kill -KILL $EXEC_PID
+  killall -9 java
+}
+
 # Execute as part of test set
 # Equivalent to monitored_exec() (but w/o monitoring)
 test_exec() {
@@ -489,17 +512,19 @@
   sleep $TIMEOUT
   EXITCODE=1
 
+#   /bin/kill -TERM $PID
+#   KILLCODE=$?
+#   if [ $KILLCODE == 0 ]; then
+#     echo "monitor(): killed process (TERM)"
+#     sleep 1
+#   fi
   /bin/kill -TERM $PID
   KILLCODE=$?
   if [ $KILLCODE == 0 ]; then
-    echo "monitor(): killed process (TERM)"
-    sleep 1
+    echo "monitor(): killed process_exec (TERM)"
   fi
-  /bin/kill -KILL $PID
-  if [ $KILLCODE == 0 ]; then
-    echo "monitor(): killed process (KILL)"
-  fi
 
+  sleep 1
   MSG="nightly.sh: monitor(): killed: exceeded $TIMEOUT seconds"
   echo "$MSG" >> $OUTPUT
 }
@@ -526,7 +551,7 @@
 
   # If EXITCODE != 0, monitor() may have work to do
   (( $EXITCODE != 0 )) && sleep 5
-  kill -TERM $MONITOR_PID
+  /bin/kill -TERM $MONITOR_PID
 
   echo "TOOK: $(( STOP-START ))"
 
@@ -567,6 +592,8 @@
   CDM=
   [ -r fs.data ] && CDM="-cdm.file fs.data"
 
+  (( SWIFTCOUNT++ ))
+
   monitored_exec swift -wrapperlog.always.transfer true \
                        -config swift.properties \
                        -sites.file sites.xml \
@@ -743,15 +770,19 @@
 
 SKIP_COUNTER=0
 
-GROUPLIST=( $TESTDIR/language/working \
+# GROUPLIST=( $TESTDIR/local $TESTDIR/cdm $TESTDIR/cdm/ps $TESTDIR/cdm/ps/pinned )
+
+GROUPLIST=( $TESTDIR/language-behaviour
+            $TESTDIR/language/working \
             $TESTDIR/local \
             $TESTDIR/language/should-not-work \
             $TESTDIR/cdm \
-            $TESTDIR/cdm/ps )
+            $TESTDIR/cdm/ps \
+            $TESTDIR/cdm/ps/pinned )
 
 GROUPCOUNT=1
 for G in ${GROUPLIST[@]}; do
-  GROUP=$G
+  export GROUP=$G
   TITLE=$( group_title )
   start_part "Part $GROUPCOUNT: $TITLE"
   test_group




More information about the Swift-commit mailing list