changeset 1131:6cc69d786ebb

2008-10-19 Matthias Klose <doko@ubuntu.com> * Makefile.am (jtregcheck): Cleanup processes.
author doko@ubuntu.com
date Sun, 19 Oct 2008 18:06:54 +0200
parents eb9d7dcd692c
children a4df7fa32706
files ChangeLog Makefile.am
diffstat 2 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Oct 19 17:44:39 2008 +0200
+++ b/ChangeLog	Sun Oct 19 18:06:54 2008 +0200
@@ -1,3 +1,7 @@
+2008-10-19  Matthias Klose  <doko@ubuntu.com>
+
+	* Makefile.am (jtregcheck): Cleanup processes.
+
 2008-10-19  Matthias Klose  <doko@ubuntu.com>
 
 	* patches/icedtea-cacao-ignore-jdi-tests.patch: Ignore jdi tests,
--- a/Makefile.am	Sun Oct 19 17:44:39 2008 +0200
+++ b/Makefile.am	Sun Oct 19 18:06:54 2008 +0200
@@ -1569,12 +1569,42 @@
 	rm -rf test/hotspot test/langtools test/jdk
 	rm -f test/check-*.log test/jtreg-summary.log
 
+# FIXME: this might need some adjustment for other OS than Linux
+jtreg_processes = ps x -ww -o pid,ppid,args \
+	| awk '$$2 == 1 && $$3 ~ /^$(subst /,\/,/scratch)/' \
+	| sed 's,$(CURDIR)/$(sdkimg),<sdkimg>,g;s,$(CURDIR),<pwd>,g'
+jtreg_pids = ps x --no-headers -ww -o pid,ppid,args \
+	| awk '$$2 == 1 && $$3 ~ /^$(subst /,\/,$(CURDIR)/$(sdkimg))/ {print $$1}'
+
 jtregcheck: jtreg check-hotspot check-langtools check-jdk
 	for i in hotspot langtools jdk; do \
 	  echo "--------------- jtreg console summary for $$i ---------------"; \
 	  egrep -v '^(Passed:|Directory)' test/check-$$i.log; \
 	done | tee test/jtreg-summary.log
 
+	: # kill testsuite processes still hanging
+	@pids=$$($(jtreg_pids)); \
+	if [ -n "$$pids" ]; then \
+	  echo "killing processes..."; \
+	  $(jtreg_processes); \
+	  kill -1 $$pids; \
+	  sleep 2; \
+	  pids=$$($(jtreg_pids)); \
+	  if [ -n "$$pids" ]; then \
+	    echo "try harder..."; \
+	    $(jtreg_processes); \
+	    kill -9 $$pids; \
+	    sleep 2; \
+	  fi; \
+	else \
+	  echo "nothing to cleanup"; \
+	fi; \
+	pids=$$($(jtreg_pids)); \
+	if [ -n "$$pids" ]; then \
+	  echo "leftover processes..."; \
+	  $(jtreg_processes); \
+	fi
+
 check-local: jtregcheck
 
 # fsg-tarball