Could you use the JUnit TemporaryFolder rule? That appears to be rather threadsafe.
On 23 March 2014 11:28, Antoine Levy Lambert <anto...@gmx.de> wrote: > Hi, > > Thanks to John Elion for this contribution. > > I have tried it on the Ant test cases. This makes the execution of the > test cases shorter by 3 minutes with 2 threads [ not sure what is the total > time because I also run the antunit tests ]. > > Some of our test cases do not support parallelism because they are > creating and dropping temporary directories and files which have the same > names. > > this makes errors looking like this one : > [junit] Testcase: > testNoAddNewLine(org.apache.tools.ant.filters.NoNewLineTest): Caused an > ERROR > [junit] Warning: Could not find file > /Users/antoine/dev/asf/ant-core/src/etc/testcases/filters/result/nonl to > copy. > [junit] > /Users/antoine/dev/asf/ant-core/src/etc/testcases/filters/build.xml:111: > Warning: Could not find file > /Users/antoine/dev/asf/ant-core/src/etc/testcases/filters/result/nonl to > copy. > [junit] at > org.apache.tools.ant.taskdefs.Copy.copySingleFile(Copy.java:639) > > Does someone have a suggestion about how to adapt the test cases to > support parallelism. > > I was thinking of adding somewhere in the Ant codebase a utility class or > method to get the PID of the currently running process > and add the PID somewhere in the name of temporary folders created for > tests. > > Any thoughts on that ? > > see > http://stackoverflow.com/questions/35842/how-can-a-java-program-get-its-own-process-id > > > Regards, > > Antoine > On Mar 23, 2014, at 12:18 PM, anto...@apache.org wrote: > > > Author: antoine > > Date: Sun Mar 23 16:18:29 2014 > > New Revision: 1580520 > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org > For additional commands, e-mail: dev-h...@ant.apache.org > > -- Matt Sicker <boa...@gmail.com>