You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Jim Meyering <ji...@meyering.net> on 2006/12/08 19:03:34 UTC
[cpp] kill stray qpidd, left over from "make check"
At least twice now, I've killed a qpidd process that remained
from a "make check" run. This will make it so such processes
aren't left around for long.
2006-12-08 Jim Meyering <me...@redhat.com>
* tests/Makefile.am (run-python-tests): Depend on ../src/qpidd.
Start a background job that will kill the daemon in 5 minutes.
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am (revision 483505)
+++ tests/Makefile.am (working copy)
@@ -70,12 +70,10 @@
run-unit-tests: $(check_LTLIBRARIES)
DllPlugInTester -c -b .libs/*.so
-# TODO aconway 2006-12-01: Should also check for qpidd.
-run-python-tests: $(check_LTLIBRARIES)
- ../src/qpidd > qpidd.log 2>&1 &
+run-python-tests: $(check_LTLIBRARIES) ../src/qpidd
+ ../src/qpidd > qpidd.log 2>&1 & pid=$$!; (sleep 300; kill $$pid) &
cd ../../python ; ./run-tests -v -I cpp_failing.txt
-
include gen.mk
abs_builddir = @abs_builddir@
Re: [cpp] kill stray qpidd, left over from "make check"
Posted by Jim Meyering <ji...@meyering.net>.
Jim Meyering <ji...@meyering.net> wrote:
> 2006-12-08 Jim Meyering <me...@redhat.com>
>
> * tests/Makefile.am (run-python-tests): Kill qpidd via a trap.
> Don't let a failed/interrupted "make check" leave a running
> qpidd process.
This patch deserves a little explanation.
The dual-trap is an idiom (if you don't know it, it looks daunting):
The second one traps signals (INT, TERM, etc) and propagates the
nonzero exit code to process exit code.
The first one (the trap '...' 0) handles a normal exit,
including any signal-induced exit from the other trap.
> Index: tests/Makefile.am
> ===================================================================
> --- tests/Makefile.am (revision 484695)
> +++ tests/Makefile.am (working copy)
> @@ -71,9 +71,10 @@
> DllPlugInTester -c -b .libs/*.so
>
> run-python-tests: $(check_LTLIBRARIES) ../src/qpidd
> - ../src/qpidd > qpidd.log 2>&1 & echo $$! > qpidd.pid
> + ../src/qpidd > qpidd.log 2>&1 & pid=$$!; \
> + trap 'status=$$?; kill $$pid; exit $$status' 0; \
> + trap '(exit $$?); exit $$?' 1 2 13 15; \
> cd ../../python ; ./run-tests -v -I cpp_failing.txt
> - kill `cat qpidd.pid`
>
> include gen.mk
Re: [cpp] kill stray qpidd, left over from "make check"
Posted by Jim Meyering <ji...@meyering.net>.
Alan Conway <ac...@redhat.com> wrote:
> Good idea,but I modified it a little. I have a horror of anything that
> sleeps for some arbitrary "long enough" period. Here's what I comitted:
Hmm... what if the (long-running) test fails or is interrupted?
The qpidd process would live on :(
But you're right that my sleep-to-kill background job was a kludge.
Thanks for the prod :-)
The patch below solves this little problem properly.
> 2006-12-08 Based on a patch from Jim Meyering <me...@redhat.com>
>
> * tests/Makefile.am (run-python-tests): Depend on ../src/qpidd.
> Start a background job that will kill the daemon in 5 minutes.
No big deal, but after your change, the log comment above was
no longer accurate.
> Index: Makefile.am
> ===================================================================
> --- Makefile.am (revision 484678)
> +++ Makefile.am (working copy)
> @@ -70,11 +70,10 @@
> run-unit-tests: $(check_LTLIBRARIES)
> DllPlugInTester -c -b .libs/*.so
>
> -# TODO aconway 2006-12-01: Should also check for qpidd.
> -run-python-tests: $(check_LTLIBRARIES)
> - ../src/qpidd > qpidd.log 2>&1 &
> +run-python-tests: $(check_LTLIBRARIES) ../src/qpidd
> + ../src/qpidd > qpidd.log 2>&1 & echo $$! > qpidd.pid
> cd ../../python ; ./run-tests -v -I cpp_failing.txt
> -
> + kill `cat qpidd.pid`
2006-12-08 Jim Meyering <me...@redhat.com>
* tests/Makefile.am (run-python-tests): Kill qpidd via a trap.
Don't let a failed/interrupted "make check" leave a running
qpidd process.
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am (revision 484695)
+++ tests/Makefile.am (working copy)
@@ -71,9 +71,10 @@
DllPlugInTester -c -b .libs/*.so
run-python-tests: $(check_LTLIBRARIES) ../src/qpidd
- ../src/qpidd > qpidd.log 2>&1 & echo $$! > qpidd.pid
+ ../src/qpidd > qpidd.log 2>&1 & pid=$$!; \
+ trap 'status=$$?; kill $$pid; exit $$status' 0; \
+ trap '(exit $$?); exit $$?' 1 2 13 15; \
cd ../../python ; ./run-tests -v -I cpp_failing.txt
- kill `cat qpidd.pid`
include gen.mk