ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <>
Subject starting and killing background exec or java task
Date Fri, 12 Aug 2005 14:38:21 GMT

I'm just reviewing what major changes I am needing to do to my (big) 
work project to simplify stuff. One troublespot is running functional 
tests against a running system, I need to (maybe) start a program, run 
tests against it and then stop the program if I started it (but not if 
it was already running under a debugger or something). what we have 
today is nasty and brittle.

I have to start something in parallel, wait by polling a port for a 
signal that it is running, then run the tests, finally shut it down if 
we started it (broken).

   <target name="system-tests" 
     description="run system tests"

       <!-- first thread runs the daemon -->
         <antcall target="start-daemon-if-needed"/>

       <!-- this is the next thread -->

           wait ten seconds for the harness to start
           without this the first tests will fail as there is no
           sf daemon around
         <sf-waitfordaemon maxwait="10" timeoutproperty="daemon.missing"/>
         <fail if="daemon.missing">No daemon</fail>
             <path refid=""/>
             <pathelement location="${test.classes.dir}"/>
           <sysproperty key="org.smartfrog.codebase" value="${codebase}"/>
             <propertyref prefix="runtime"/>

           <!-- #Test case isolation technique -->
           <test name="${testcase}" if="testcase"/>
           <batchtest todir="${}" unless="testcase">
             <!-- bulk test case -->
             <fileset dir="${test.classes.dir}">

         <!-- conditionally stop the daemon -->
         <antcall target="conditional-daemon-exit"/>
         <!-- end the test thread -->

Life would be simpler if I could exec something in the background. Not 
spawned, which is designed to outlive ant, just in the background. 
stopping ant would stop background stuff. output would still go to the 

I would also like to be able to kill a background process by name, a 
name I assigned it earlier. My testing would then be

<java ... background="server" />

<junit ... />

<killbackground name="server" />

Nice and simple to use. To implement? I dont know, yet.

What do people think?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message