aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2011-10-24 10:17:15 +0000
committerLeif Åstrand <leif@vaadin.com>2011-10-24 10:17:15 +0000
commite731c5f25adc4218b0087cbe164f2c5ba5d61ca5 (patch)
tree83b33e255297abd80205d9760ecd62fd87498990
parent9ee198b24e36a377fea070e2858d4fc2d9e1d08c (diff)
downloadvaadin-framework-e731c5f25adc4218b0087cbe164f2c5ba5d61ca5.tar.gz
vaadin-framework-e731c5f25adc4218b0087cbe164f2c5ba5d61ca5.zip
Improved integration server shutdown
svn changeset:21785/svn branch:6.7
-rw-r--r--tests/integration_base_files/base.xml10
-rw-r--r--tests/integration_base_files/cleanup.sh8
-rw-r--r--tests/integration_base_files/lock_age.sh7
3 files changed, 19 insertions, 6 deletions
diff --git a/tests/integration_base_files/base.xml b/tests/integration_base_files/base.xml
index 5e4ff6d176..c27f3589b3 100644
--- a/tests/integration_base_files/base.xml
+++ b/tests/integration_base_files/base.xml
@@ -9,6 +9,7 @@
<property name="JAVA_HOME" value="/usr/lib/jvm/default-java" />
<property name="waitMinutes" value="3" />
<property name="waitUrl" value="http://localhost:${serverPort}/demo/VAADIN/themes/reindeer/styles.css" />
+ <property name="shutdownWait" value="10" />
<target name="afterDeploy">
@@ -66,7 +67,11 @@
<exec executable="./stop.sh" >
<env key="JAVA_HOME" value="${JAVA_HOME}" />
</exec>
- <sleep seconds="15" />
+ <sleep seconds="${shutdownWait}" />
+ </target>
+
+ <target name="force-shutdown">
+ <exec executable="./cleanup.sh" />
</target>
<target name="check-port">
@@ -112,7 +117,6 @@
<target name="startup-and-deploy" depends="check-lock,check-port,unpack-server,deploy,startup" />
- <target name="shutdown-and-cleanup" depends="shutdown,clean,release-lock" />
-
+ <target name="shutdown-and-cleanup" depends="shutdown,clean,release-lock,force-shutdown" />
</project>
diff --git a/tests/integration_base_files/cleanup.sh b/tests/integration_base_files/cleanup.sh
index d2d5445070..2ee8968aae 100644
--- a/tests/integration_base_files/cleanup.sh
+++ b/tests/integration_base_files/cleanup.sh
@@ -1,6 +1,10 @@
echo checking and killing open servers
-
-ps x | grep -E bin/java | grep -v grep | grep -v get-lock | awk '{print $1}' > temp
+
+# Find all java processes, except
+# * grep, as we're running it
+# * get-lock, as that one is just waiting for this cleanup to happen
+# * shutdown-and-cleanup, as that could be the one we're running from
+ps x | grep -E bin/java | grep -v grep | grep -v get-lock | grep -v shutdown-and-cleanup | awk '{print $1}' > temp
#Read and kill processes marked to temp
while read line
diff --git a/tests/integration_base_files/lock_age.sh b/tests/integration_base_files/lock_age.sh
index 1808ec05df..6b78acb590 100644
--- a/tests/integration_base_files/lock_age.sh
+++ b/tests/integration_base_files/lock_age.sh
@@ -1,7 +1,9 @@
#! /bin/bash
-if [ -a /home/integration/deploy/lock.file ]
+if lockfile -r0 -! /home/integration/deploy/lock.file &> /dev/null
then
+ # If we could not get the lock, check how old the lock file is
DATE=$(date +%s)
+ # What if the file is not there any more?
LOCK_AGE=$(stat -c %Z /home/integration/deploy/lock.file)
AGE=$[($DATE - $LOCK_AGE)/60]
@@ -13,4 +15,7 @@ if [ -a /home/integration/deploy/lock.file ]
# else
# echo lock.file is $AGE min old.
fi
+ else
+ # If we got the lock, do a cleanup (releasing the lock) just in case something has still been left running
+ ./cleanup.sh &> /dev/null
fi