ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Weighill Smith <phil.weighill-sm...@volantis.com>
Subject Re: starting and killing background exec or java task
Date Fri, 12 Aug 2005 15:03:38 GMT
Would be handy. I'm assuming that the "name" could create a property of
that name, set to the process ID for example. You can then just "kill"
that process using this ID...

Phil :n.

On Fri, 2005-08-12 at 15:38 +0100, Steve Loughran wrote:
> 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" 
> depends="parse,dist,compile-tests,init-codebase"
>      description="run system tests"
>      if="system.tests.enabled">
>      <parallel>
> 
>        <!-- first thread runs the daemon -->
>        <sequential>
>          <antcall target="start-daemon-if-needed"/>
>        </sequential>
> 
>        <!-- this is the next thread -->
>        <sequential>
> 
>          <!--
>            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>
>          <sf-junit
>            errorProperty="test.failed"
>            failureProperty="test.failed"
>            >
>            <classpath>
>              <path refid="tests.run.classpath"/>
>              <pathelement location="${test.classes.dir}"/>
>            </classpath>
>            <sysproperty key="org.smartfrog.codebase" value="${codebase}"/>
>            <syspropertyset>
>              <propertyref prefix="runtime"/>
>            </syspropertyset>
> 
>            <!-- #Test case isolation technique -->
>            <test name="${testcase}" if="testcase"/>
>            <batchtest todir="${test.data.dir}" unless="testcase">
>              <!-- bulk test case -->
>              <fileset dir="${test.classes.dir}">
>                <include 
> name="org/smartfrog/services/junit/test/*Test.class"/>
>              </fileset>
>            </batchtest>
>          </sf-junit>
> 
>          <!-- conditionally stop the daemon -->
>          <antcall target="conditional-daemon-exit"/>
>          <!-- end the test thread -->
>        </sequential>
>      </parallel>
>    </target>
> 
> 
> 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 
> logger.
> 
> 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?
> 
> -steve
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message