Alan Conway <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>
>
> * 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 <[EMAIL PROTECTED]>
* 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