This seems to be a long known issue .
The problem is that in Windows Ant, Ctrl + C , as you saw, does not apply to child virtual machines. What you might think:
- Break the test into smaller parts and use
timeout to kill everything that hangs. This will limit the data lost for one test that is hanging. - In the test run, add the listener thread, which waits for the shutdown signal (possibly the flag file) and organizes the configuration of this signal using Ant upon command from the console if a freeze is detected.
It seems complicated, but it may be worth it. You will need to combine Ant parallel and input tasks to run the tests in one thread and wait for input from the console in the second thread. When an interrupt is selected, a signal file is written, this is detected in the listener test run, as a result of which it ends. Any other input will result in a clean shutdown. The problem is that if the test is successful, you are left with Ant waiting for user input, but you can set a common timeout for this. (I did not give an example of how test run code can detect a signal file.)
Psuedo- Ant:
<property name="signal.abort" value="stop.txt" /> <target name="runner"> <delete file="${signal.abort}" /> <parallel timeout="86400000"> <sequential> </sequential> <sequential> <input validargs="y,n" message="Abort the test (y/n)?" addproperty="abort.test" /> <condition property="do.abort"> <equals arg1="y" arg2="${abort.test}"/> </condition> <ant target="terminator" /> </sequential> </parallel> </target> <target name="terminator" if="do.abort"> <echo message="abort" file="${signal.abort}" /> </target>
source share