diff options
author | Jaikiran Pai <jaikiran@apache.org> | 2023-03-02 13:05:24 +0530 |
---|---|---|
committer | Jaikiran Pai <jaikiran@apache.org> | 2023-03-02 13:05:24 +0530 |
commit | 59e456372f96b85a7f1a012f607edfc6b8f459bc (patch) | |
tree | c63ecf300286b646125e7d34d922fd644e77f530 /src/etc | |
parent | 4dbe7a2a600fde2cf4cc525f4985a81f9616fab8 (diff) | |
download | ant-59e456372f96b85a7f1a012f607edfc6b8f459bc.tar.gz |
66464: junitlauncher task's fork element now has a new optional "java" attribute to allow specifying a different Java installation to run the forked tests
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/testcases/taskdefs/optional/junitlauncher.xml | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/etc/testcases/taskdefs/optional/junitlauncher.xml b/src/etc/testcases/taskdefs/optional/junitlauncher.xml index 87b00adf0..1163dc23b 100644 --- a/src/etc/testcases/taskdefs/optional/junitlauncher.xml +++ b/src/etc/testcases/taskdefs/optional/junitlauncher.xml @@ -371,5 +371,32 @@ <listener type="legacy-brief" sendSysOut="true" useLegacyReportingName="true"/> </junitlauncher> </target> + + <target name="test-fork-different-java" depends="init"> + <!-- create a symlinked file which points to the "java" command + and use that symlink to launch the forked JVM --> + <property name="different-java" value="${java.io.tmpdir}/foobarjava"/> + <delete file="${different-java}"/> + <symlink resource="${java.home}/bin/java" link="${different-java}"/> + + <junitlauncher> + <classpath refid="test.classpath"/> + <test name="org.example.junitlauncher.vintage.ForkedTest" outputdir="${output.dir}"> + <listener classname="org.example.junitlauncher.Tracker" + outputDir="${output.dir}" + resultFile="${test-fork-different-java.tracker}" + if="test-fork-different-java.tracker"/> + + <!-- we just verify that the launch of the forked JVM works fine and the test + succeeds. There isn't a (easy) way we can actually verify the binary that was used + to launch the forked JVM --> + <fork dir="${basedir}" java="${different-java}"> + <sysproperty key="junitlauncher.test.sysprop.one" value="forked"/> + </fork> + + <listener type="legacy-xml"/> + </test> + </junitlauncher> + </target> </project> |