18 |
18 |
19 Description: |
19 Description: |
20 |
20 |
21 ============================================================================ |
21 ============================================================================ |
22 --> |
22 --> |
|
23 <!--* @package framework --> |
23 <project name="internal.testing" xmlns:au="org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium"> |
24 <project name="internal.testing" xmlns:au="org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium"> |
24 <description> |
25 <description> |
25 Targets to test Helium itself. |
26 Targets to test Helium itself. |
26 </description> |
27 </description> |
27 |
28 |
28 <fileset id="python.files" dir="${helium.dir}"> |
|
29 <include name="tools/**/*.py"/> |
|
30 <include name="extensions/nokia/tools/**/*.py"/> |
|
31 <exclude name="tools/startup/bootstrap/site.py"/> |
|
32 </fileset> |
|
33 |
|
34 <!-- Runs all the unit testing targets. --> |
29 <!-- Runs all the unit testing targets. --> |
35 <target name="unittest" depends="ju-unittest,check,ant-unittest,py-unittest"/> |
30 <target name="unittest" depends="ju-unittest,ant-unittest,py-unittest"/> |
36 |
31 |
37 <!-- Unit testing --> |
32 <!-- Unit testing --> |
38 |
33 |
39 <!-- Setup environment for Python unit tests --> |
34 <!-- Setup environment for Python unit tests. --> |
40 <target name="setup-py-unittest"> |
35 <target name="setup-py-unittest"> |
41 <!-- Autogenerate test data for ArchivePreBuilderTest based on ANT properties --> |
36 <!-- Autogenerate test data for ArchivePreBuilderTest based on ANT properties --> |
42 <if> |
37 <if> |
43 <available file="${helium.dir}/tests/data/archive_test.cfg.xml"/> |
38 <available file="${helium.dir}/tests/data/archive_test.cfg.xml"/> |
44 <then> |
39 <then> |
52 </copy> |
47 </copy> |
53 </target> |
48 </target> |
54 |
49 |
55 <!-- Do Python tests. --> |
50 <!-- Do Python tests. --> |
56 <target name="do-py-unittest" depends="setup-py-unittest"> |
51 <target name="do-py-unittest" depends="setup-py-unittest"> |
57 <property name="nose.args" value="cpythontest nokiacpythontest nokiatest test"/> |
52 <property name="nose.args" value="nokiacpythontest scripttests"/> |
58 <exec executable="python" failonerror="true"> |
53 <exec executable="python" failonerror="true"> |
|
54 <env key="TEST_DATA" value="${helium.dir}/tests"/> |
59 <arg line="${python.tools}/coverage.py -x ${python.tools}/nosetests-script.py -v ${nose.args}"/> |
55 <arg line="${python.tools}/coverage.py -x ${python.tools}/nosetests-script.py -v ${nose.args}"/> |
60 </exec> |
56 </exec> |
61 <script language="jython" setbeans="false"> |
57 <script language="jython" setbeans="false"> |
62 import sys |
58 import sys |
63 import os |
59 import os |
|
60 os.putenv('TEST_DATA', os.path.join(os.environ['HELIUM_HOME'], 'tests')) |
64 sys.path.append(os.path.join(os.environ['HELIUM_HOME'], 'external/python/lib/common/nose-0.11.1-py2.6.egg')) |
61 sys.path.append(os.path.join(os.environ['HELIUM_HOME'], 'external/python/lib/common/nose-0.11.1-py2.6.egg')) |
65 sys.path.append(os.path.join(os.environ['HELIUM_HOME'], 'external/python/lib/common/mocker-0.10.1-py2.5.egg')) |
62 sys.path.append(os.path.join(os.environ['HELIUM_HOME'], 'external/python/lib/common/mocker-0.10.1-py2.5.egg')) |
66 import nose |
63 import nose |
67 args = project.getProperty('nose.args') |
64 args = project.getProperty('nose.args') |
68 if args == 'cpythontest nokiacpythontest nokiatest test': |
65 if ' ' in args: |
69 nose.run(argv=['-v', os.path.join(os.environ['HELIUM_HOME'], 'tools/common/python/lib/test'), 'nokiatest']) |
66 nose.run(argv=['-v', 'scripttests']) |
70 elif args.startswith('nokiatest.') or args.startswith('test.'): |
67 elif 'cpython' not in args: |
71 nose.run(argv=['-v', args]) |
68 nose.run(argv=['-v', args]) |
72 print >> sys.stderr |
69 print >> sys.stderr |
73 </script> |
70 </script> |
74 </target> |
71 </target> |
75 |
72 |
79 |
76 |
80 <!-- Create Python code coverage statistics. --> |
77 <!-- Create Python code coverage statistics. --> |
81 <target name="py-unittest-coverage"> |
78 <target name="py-unittest-coverage"> |
82 <mkdir dir="${helium.build.dir}/coverage"/> |
79 <mkdir dir="${helium.build.dir}/coverage"/> |
83 <pathconvert pathsep=" " property="python.modules.coverage"> |
80 <pathconvert pathsep=" " property="python.modules.coverage"> |
84 <fileset refid="python.files"/> |
81 <fileset dir="${helium.dir}"> |
|
82 <include name="tools/**/*.py"/> |
|
83 <include name="extensions/nokia/tools/**/*.py"/> |
|
84 <exclude name="tools/startup/bootstrap/site.py"/> |
|
85 </fileset> |
85 </pathconvert> |
86 </pathconvert> |
86 <exec executable="python" failonerror="true"> |
87 <exec executable="python" failonerror="true"> |
87 <arg line="${python.tools}/coverage.py -a -d ${helium.build.dir}/coverage ${python.modules.coverage}"/> |
88 <arg line="${python.tools}/coverage.py -a -d ${helium.build.dir}/coverage ${python.modules.coverage}"/> |
88 </exec> |
89 </exec> |
89 |
90 |
134 |
135 |
135 |
136 |
136 <!-- Run JUnit unit tests. --> |
137 <!-- Run JUnit unit tests. --> |
137 <target name="ju-unittest" depends="build-java-src"> |
138 <target name="ju-unittest" depends="build-java-src"> |
138 <!-- Source location for test class --> |
139 <!-- Source location for test class --> |
|
140 <!-- Source location for junit test class. |
|
141 @type string |
|
142 @scope private |
|
143 --> |
139 <property name="src" location="tools/common/java/test" /> |
144 <property name="src" location="tools/common/java/test" /> |
140 <!-- Source classes location --> |
145 <!-- Source classes location --> |
|
146 <!-- Java source files location for helium library. |
|
147 @type string |
|
148 @scope private |
|
149 --> |
141 <property name="src.classes" location="tools/common/java/src" /> |
150 <property name="src.classes" location="tools/common/java/src" /> |
142 |
151 |
143 <delete dir="${build.temp.dir}/junit_classes"/> |
152 <delete dir="${build.temp.dir}/junit_classes"/> |
144 <mkdir dir="${build.temp.dir}/junit_classes" /> |
153 <mkdir dir="${build.temp.dir}/junit_classes" /> |
145 |
154 |
190 <html outfile="${build.temp.dir}/coverage.html" /> |
199 <html outfile="${build.temp.dir}/coverage.html" /> |
191 </report> |
200 </report> |
192 </emma> |
201 </emma> |
193 <loadfile property="message" srcFile="${build.temp.dir}/coverage.txt"/> |
202 <loadfile property="message" srcFile="${build.temp.dir}/coverage.txt"/> |
194 <echo message="${message}"/> |
203 <echo message="${message}"/> |
195 </target> |
204 </target> |
196 |
|
197 |
|
198 <!-- iMaker Helium feature unittesting. --> |
|
199 <target name="imaker-unittest" depends="rombuild-export-features"> |
|
200 <property name="imaker.unittest.args" value="" /> |
|
201 <for param="unittest.filename"> |
|
202 <path> |
|
203 <fileset dir="${build.drive}/epoc32/rom/config/unittest" casesensitive="yes"> |
|
204 <include name="**/test_*.mk"/> |
|
205 </fileset> |
|
206 </path> |
|
207 <sequential> |
|
208 <echo>Running @{unittest.filename}</echo> |
|
209 <exec executable="${imaker.command}" dir="${build.drive}/"> |
|
210 <arg line="${imaker.unittest.args}"/> |
|
211 <arg line="-f @{unittest.filename}"/> |
|
212 <arg value="unittest"/> |
|
213 </exec> |
|
214 </sequential> |
|
215 </for> |
|
216 </target> |
|
217 |
|
218 <!-- Validates XML files against suitable schema or DTDs. --> |
|
219 <target name="validate-xml"> |
|
220 <!--<schemavalidate fullchecking="false" noNamespaceFile="tools/common/schema/ant.xsd"> |
|
221 <Schema namespace="ant.apache.org" |
|
222 file="tools/common/schema/ant.xsd" /> |
|
223 <schema namespace="http://www.nokia.com/helium" |
|
224 file="tools/common/schema/helium_ant.xsd" /> |
|
225 <fileset dir="tools"> |
|
226 <include name="**/build.xml"/> |
|
227 <include name="**/*.ant.xml"/> |
|
228 <exclude name="**/test_*.ant.xml"/> |
|
229 </fileset> |
|
230 </schemavalidate>--> |
|
231 <schemavalidate noNamespaceFile="tools/common/schema/helium_data_model.xsd" |
|
232 file="${data.model.file}"/> |
|
233 <!--<schemavalidate noNamespaceFile="tools/common/schema/helium_config.xsd"> |
|
234 <fileset dir="testconfig"> |
|
235 <include name="**/delivery.xml"/> |
|
236 <include name="**/*.cfg.xml"/> |
|
237 <exclude name="**/test_*.ant.xml"/> |
|
238 </fileset> |
|
239 </schemavalidate>--> |
|
240 </target> |
|
241 |
|
242 |
205 |
243 </project> |
206 </project> |