opencv/modules/java/test/build.xml
Roman Donchenko 5bb6949bd6 Fix running Java tests with run.py on everything other than Windows.
Previously, run.py would assume that the opencv_java library is in the
same directory as the tests, which is only true on Windows.

The library path depends on the build configuration, which may not be
known until the actual build (e.g. with the Visual Studio generators),
so it can't be stored in the CMake cache for run.py to read. I didn't
want to hardcode into run.py where the library is on each platform,
either. So that's why I used the current scheme with the properties
file. It also makes running the tests without run.py a little easier.
2013-10-16 19:22:01 +04:00

67 lines
1.8 KiB
XML

<project>
<property file="ant-${opencv.build.type}.properties"/>
<path id="master-classpath">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
<fileset dir="bin">
<include name="*.jar"/>
</fileset>
</path>
<target name="clean">
<delete dir="build"/>
<delete dir="testResults"/>
</target>
<target name="compile">
<mkdir dir="build/classes"/>
<javac sourcepath="" srcdir="src" destdir="build/classes" includeantruntime="false" >
<include name="**/*.java"/>
<classpath refid="master-classpath"/>
</javac>
</target>
<target name="jar">
<mkdir dir="build/jar"/>
<jar destfile="build/jar/opencv-test.jar" basedir="build/classes">
<manifest>
<attribute name="Main-Class" value="org.opencv.test.OpenCVTestRunner"/>
</manifest>
</jar>
</target>
<target name="test">
<mkdir dir="testResults"/>
<junit printsummary="true" haltonfailure="false" haltonerror="false" showoutput="false" logfailedtests="true" maxmemory="256m">
<sysproperty key="java.library.path" path="${opencv.lib.path}"/>
<env key="PATH" path="${opencv.lib.path}"/>
<classpath refid="master-classpath"/>
<classpath>
<pathelement location="build/classes"/>
</classpath>
<formatter type="xml"/>
<batchtest fork="yes" todir="testResults">
<zipfileset src="build/jar/opencv-test.jar" includes="**/*.class" excludes="**/OpenCVTest*">
<exclude name="**/*$*.class"/>
</zipfileset>
</batchtest>
</junit>
</target>
<target name="build">
<antcall target="compile"/>
<antcall target="jar"/>
</target>
<target name="buildAndTest">
<antcall target="compile"/>
<antcall target="jar"/>
<antcall target="test"/>
</target>
</project>