--- a/buildframework/helium/tools/common/testing.ant.xml Wed Oct 28 14:39:48 2009 +0000
+++ b/buildframework/helium/tools/common/testing.ant.xml Wed Dec 23 19:29:07 2009 +0200
@@ -24,7 +24,6 @@
<description>
Targets to test Helium itself.
</description>
- <import file="${helium.dir}/build-jar.ant.xml"/>
<fileset id="python.files" dir="${helium.dir}">
<include name="tools/**/*.py"/>
@@ -55,10 +54,23 @@
<!-- Do Python tests. -->
<target name="do-py-unittest" depends="setup-py-unittest">
- <property name="nose.args" value="nokiatest test"/>
+ <property name="nose.args" value="cpythontest nokiacpythontest nokiatest test"/>
<exec executable="python" failonerror="true">
<arg line="${python.tools}/coverage.py -x ${python.tools}/nosetests-script.py -v ${nose.args}"/>
</exec>
+ <script language="jython" setbeans="false">
+import sys
+import os
+sys.path.append(os.path.join(os.environ['HELIUM_HOME'], 'external/python/lib/common/nose-0.11.1-py2.6.egg'))
+sys.path.append(os.path.join(os.environ['HELIUM_HOME'], 'external/python/lib/common/mocker-0.10.1-py2.5.egg'))
+import nose
+args = project.getProperty('nose.args')
+if args == 'cpythontest nokiacpythontest nokiatest test':
+ nose.run(argv=['-v', os.path.join(os.environ['HELIUM_HOME'], 'tools/common/python/lib/test'), 'nokiatest'])
+elif args.startswith('nokiatest.') or args.startswith('test.'):
+ nose.run(argv=['-v', args])
+print >> sys.stderr
+ </script>
</target>
<!-- Shortcut for Python unit tests. -->
@@ -67,34 +79,34 @@
<!-- Create Python code coverage statistics. -->
<target name="py-unittest-coverage">
- <mkdir dir="${helium.dir}/build/coverage"/>
+ <mkdir dir="${helium.build.dir}/coverage"/>
<pathconvert pathsep=" " property="python.modules.coverage">
<fileset refid="python.files"/>
</pathconvert>
<exec executable="python" failonerror="true">
- <arg line="${python.tools}/coverage.py -a -d ${helium.dir}/build/coverage ${python.modules.coverage}"/>
+ <arg line="${python.tools}/coverage.py -a -d ${helium.build.dir}/coverage ${python.modules.coverage}"/>
</exec>
<!-- backup the old line coverage report and create the new one -->
- <mkdir dir="${helium.dir}/build/coverage/report"/>
+ <mkdir dir="${helium.build.dir}/coverage/report"/>
<if>
- <available file="${helium.dir}/build/coverage/report/line_coverage.txt"/>
+ <available file="${helium.build.dir}/coverage/report/line_coverage.txt"/>
<then>
- <copy file="${helium.dir}/build/coverage/report/line_coverage.txt" tofile="${helium.dir}/build/coverage/report/line_coverage_old.txt" overwrite="true"/>
+ <copy file="${helium.build.dir}/coverage/report/line_coverage.txt" tofile="${helium.build.dir}/coverage/report/line_coverage_old.txt" overwrite="true"/>
</then>
</if>
- <record name="${helium.dir}/build/coverage/report/line_coverage.txt" action="start"/>
+ <hlm:record name="${helium.build.dir}/coverage/report/line_coverage.txt" action="start"/>
<exec executable="python" failonerror="true">
<arg line="${python.tools}/coverage.py -r ${python.modules.coverage}"/>
</exec>
- <record name="${helium.dir}/build/coverage/report/line_coverage.txt" action="stop"/>
- <replace file="${helium.dir}/build/coverage/report/line_coverage.txt">
+ <hlm:record name="${helium.build.dir}/coverage/report/line_coverage.txt" action="stop"/>
+ <replace file="${helium.build.dir}/coverage/report/line_coverage.txt">
<replacetoken><![CDATA[[exec]]]></replacetoken>
<replacevalue><![CDATA[]]></replacevalue>
</replace>
<hlm:python>
-for line in open(r'${helium.dir}/build/coverage/report/line_coverage.txt'):
- if 'TOTAL' in line and '0%' in line:
+for line in open(r'${helium.build.dir}/coverage/report/line_coverage.txt'):
+ if 'TOTAL' in line and ' 0%' in line:
raise Exception('Coverage at 0%')
</hlm:python>
<delete file="${helium.dir}/.coverage"/>
@@ -108,10 +120,15 @@
<!-- Run Ant unit tests. -->
<target name="ant-unittest">
<mkdir dir="${helium.build.dir}/temp"/>
+ <mkdir dir="${helium.build.dir}/report/antunit"/>
<au:antunit>
+ <propertyset>
+ <propertyref name="cache.dir"/>
+ </propertyset>
<fileset dir="${helium.dir}" includes="tools/**/test_*.ant.xml"/>
<fileset dir="${helium.dir}" includes="extensions/nokia/tools/**/test_*.ant.xml"/>
<au:plainlistener/>
+ <au:xmllistener toDir="${helium.build.dir}/report/antunit"/>
</au:antunit>
</target>
@@ -163,10 +180,13 @@
</batchtest>
</junit>
- <emma enabled="true" >
+ <emma enabled="true">
<report>
+ <sourcepath>
+ <dirset dir="${src.classes}" />
+ </sourcepath>
<infileset dir="${build.temp.dir}" includes="*.emma" />
- <txt outfile="${build.temp.dir}/coverage.txt" />
+ <txt outfile="${build.temp.dir}/coverage.txt" depth="method" />
<html outfile="${build.temp.dir}/coverage.html" />
</report>
</emma>