Merge "Switch the csit-verify-1node to use job prefix"
[releng/builder.git] / jjb / integration / integration-start-cluster-run-test.sh
index 8c5fc0fce267c050a0db5960806b1abe80845645..4ce0682170e8090514dd09e8a31506b231b22180 100644 (file)
@@ -34,9 +34,11 @@ while true; do
         netstat -pnatu
         exit 1
     else
-        COUNT=\$(( \${COUNT} + 5 ))
-        sleep 5
-        echo waiting \$COUNT secs...
+        COUNT=\$(( \${COUNT} + 1 ))
+        sleep 1
+        if [[ \$((\$COUNT % 5)) == 0 ]]; then
+            echo already waited \${COUNT} seconds...
+        fi
     fi
 done
 
@@ -87,8 +89,10 @@ do
     CONTROLLERIP=ODL_SYSTEM_${i}_IP
     odl_variables=${odl_variables}" -v ${CONTROLLERIP}:${!CONTROLLERIP}"
     echo "Lets's take the karaf thread dump"
-    KARAF_PID=$(ssh ${!CONTROLLERIP} "ps aux | grep ${KARAF_ARTIFACT} | grep -v grep | tr -s ' ' | cut -f2 -d' '")
-    ssh ${!CONTROLLERIP} "jstack $KARAF_PID"> ${WORKSPACE}/karaf_${i}_threads_before.log || true
+    ssh ${!CONTROLLERIP} "sudo ps aux" > ${WORKSPACE}/ps_before.log
+    pid=$(grep org.apache.karaf.main.Main ${WORKSPACE}/ps_before.log | grep -v grep | tr -s ' ' | cut -f2 -d' ')
+    echo "karaf main: org.apache.karaf.main.Main, pid:${pid}"
+    ssh ${!CONTROLLERIP} "jstack ${pid}" > ${WORKSPACE}/karaf_${i}_${pid}_threads_before.log || true
 done
 
 echo "Generating mininet variables..."
@@ -108,7 +112,22 @@ echo "Changing the testplan path..."
 cat "${testplan_filepath}" | sed "s:integration:${WORKSPACE}:" > testplan.txt
 cat testplan.txt
 
-SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '`
+# Use the testplan if specific SUITES are not defined.
+if [ -z "${SUITES}" ]; then
+    SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '`
+else
+    newsuites=""
+    workpath="${WORKSPACE}/test/csit/suites"
+    for suite in ${SUITES}; do
+        fullsuite="${workpath}/${suite}"
+        if [ -z "${newsuites}" ]; then
+            newsuites+=${fullsuite}
+        else
+            newsuites+=" "${fullsuite}
+        fi
+    done
+    SUITES=${newsuites}
+fi
 
 echo "Starting Robot test suites ${SUITES} ..."
 pybot -N ${TESTPLAN} --removekeywords wuks -c critical -e exclude -e skip_if_${DISTROSTREAM} -v BUNDLEFOLDER:${BUNDLEFOLDER} \
@@ -134,8 +153,10 @@ for i in `seq 1 ${NUM_ODL_SYSTEM}`
 do
     CONTROLLERIP=ODL_SYSTEM_${i}_IP
     echo "Lets's take the karaf thread dump again"
-    KARAF_PID=$(ssh ${!CONTROLLERIP} "ps aux | grep ${KARAF_ARTIFACT} | grep -v grep | tr -s ' ' | cut -f2 -d' '")
-    ssh ${!CONTROLLERIP} "jstack $KARAF_PID"> ${WORKSPACE}/karaf_${i}_threads_after.log || true
+    ssh ${!CONTROLLERIP} "sudo ps aux" > ${WORKSPACE}/ps_after.log
+    pid=$(grep org.apache.karaf.main.Main ${WORKSPACE}/ps_after.log | grep -v grep | tr -s ' ' | cut -f2 -d' ')
+    echo "karaf main: org.apache.karaf.main.Main, pid:${pid}"
+    ssh ${!CONTROLLERIP} "jstack ${pid}" > ${WORKSPACE}/karaf_${i}_${pid}_threads_after.log || true
     echo "killing karaf process..."
     ssh "${!CONTROLLERIP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh'
 done