|
1 <!-- |
|
2 # |
|
3 # Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 # All rights reserved. |
|
5 # This component and the accompanying materials are made available |
|
6 # under the terms of "Eclipse Public License v1.0" |
|
7 # which accompanies this distribution, and is available |
|
8 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
9 # |
|
10 # Initial Contributors: |
|
11 # Nokia Corporation - initial contribution. |
|
12 # |
|
13 # Contributors: |
|
14 # |
|
15 # Description: |
|
16 # |
|
17 --> |
|
18 |
|
19 <project name="EmmaUtilities"> |
|
20 |
|
21 <import file="properties.xml"/> |
|
22 |
|
23 <!-- |
|
24 Steps to generate emma coverage report in Linux: |
|
25 |
|
26 1) Build component with emma instrumentation from component build dir: |
|
27 |
|
28 cd component_build_dir |
|
29 make -f $JAVA_SRC_ROOT/build/Makefile.comp clean |
|
30 make -f $JAVA_SRC_ROOT/build/Makefile.comp EMMA=1 |
|
31 |
|
32 Note that you can also instrument the whole build if necessary: |
|
33 |
|
34 cd $JAVA_SRC_ROOT |
|
35 make reallyclean |
|
36 make EMMA=1 |
|
37 |
|
38 2) Run the tests from component test build dir: |
|
39 |
|
40 cd component_tsrc_build_dir |
|
41 ant run |
|
42 |
|
43 3) Generate coverage report from component build dir: |
|
44 |
|
45 cd component_build_dir |
|
46 make -f $JAVA_SRC_ROOT/build/Makefile.comp emmareport |
|
47 |
|
48 Reports are generated into /tmp/coverage/coverage.txt |
|
49 and /tmp/coverage/coverage.html files. To view the html report |
|
50 in firefox issue command: |
|
51 |
|
52 firefox /tmp/coverage/coverage.html & |
|
53 |
|
54 The reason why report generation should be made from component build |
|
55 directory is that to generate reports with code line level details, |
|
56 the implementation source files are needed during report generation. |
|
57 The report can be generated also from other directories (e.g. from |
|
58 $JAVA_BIN_ROOT), but the generated report will not be as detailed. |
|
59 |
|
60 4) To reset coverage measurement, remove all other files from |
|
61 /tmp/coverage except metadata.emma. |
|
62 |
|
63 --> |
|
64 |
|
65 <!-- Begin definitions for emma. --> |
|
66 |
|
67 <!-- Location for emma.jar, emma_ant.jar and emma.properties files. --> |
|
68 <property name="emma.dir" value="${java.src.root}/tools/emma"/> |
|
69 <!-- Directory for emma coverage data. --> |
|
70 <property name="emma.coverage.dir" location="/tmp/coverage"/> |
|
71 <!-- Properties file for emma. --> |
|
72 <property name="emma.properties" value="${env.JAVA_BIN_ROOT}/emma.properties"/> |
|
73 |
|
74 <!-- Define ant tasks for emma. --> |
|
75 <path id="emma.lib"> |
|
76 <pathelement location="${emma.dir}/emma.jar"/> |
|
77 <pathelement location="${emma.dir}/emma_ant.jar"/> |
|
78 </path> |
|
79 <taskdef resource="emma_ant.properties" classpathref="emma.lib"/> |
|
80 |
|
81 <!-- Defines emma.enabled to be true for enabling emma tasks |
|
82 and some properties which depend on dynamic properties |
|
83 defined in properties.xml. --> |
|
84 <target name="emma" depends="init.properties" if="set.emma.enabled"> |
|
85 <property name="emma.enabled" value="true"/> |
|
86 <!-- Directory for emma instrumented classes. --> |
|
87 <property name="emma.instr.dir" location="${classes.dir}/emmainstr"/> |
|
88 <!-- Implementation sources for emma coverage report generation. --> |
|
89 <property name="emma.src.dir" value="../ignorethisdir,${java.src.paths},${java.src.second.paths},${javasrc.platform.specific},${javasrc.platform.specific.cdc}"/> |
|
90 </target> |
|
91 |
|
92 <!-- Copy emma.jar and emma.properties to correct places. --> |
|
93 <target name="emma.deploy" if="set.emma.enabled"> |
|
94 <copy file="${emma.dir}/emma.jar" todir="${vm.extension.directory}"/> |
|
95 <copy file="${emma.dir}/emma.properties" tofile="${emma.properties}"/> |
|
96 </target> |
|
97 |
|
98 <!-- Make emma instrumentation. --> |
|
99 <target name="emma.instr" depends="emma, emma.deploy" if="set.emma.enabled"> |
|
100 <!-- echo message="Instrumenting from ${dst.dir} to ${emma.instr.dir}"/ --> |
|
101 <delete dir="${emma.instr.dir}"/> |
|
102 <mkdir dir="${emma.instr.dir}"/> |
|
103 <emma enabled="${emma.enabled}" properties="${emma.properties}"> |
|
104 <instr instrpath="${dst.dir}" destdir="${emma.instr.dir}"/> |
|
105 </emma> |
|
106 <!-- Copy instrumented classes back to destination dir so that they |
|
107 are processed through the rest of the build chain. --> |
|
108 <copy todir="${dst.dir}" overwrite="true"> |
|
109 <fileset dir="${emma.instr.dir}" includes="**/*.class"/> |
|
110 </copy> |
|
111 </target> |
|
112 |
|
113 <!-- Generate emma coverage report. --> |
|
114 <target name="emma.report" depends="emma"> |
|
115 <emma enabled="${emma.enabled}" properties="${emma.properties}"> |
|
116 <report sourcepath="${emma.src.dir}"> |
|
117 <fileset dir="${emma.coverage.dir}" includes="*.emma"/> |
|
118 <txt/> |
|
119 <html/> |
|
120 </report> |
|
121 </emma> |
|
122 </target> |
|
123 |
|
124 <!-- Clean emma related files. --> |
|
125 <target name="emma.clean"> |
|
126 <delete file="${vm.extension.directory}/emma.jar"/> |
|
127 <delete file="${emma.properties}"/> |
|
128 <delete dir="${emma.coverage.dir}"/> |
|
129 </target> |
|
130 |
|
131 <!-- End definitions for emma. --> |
|
132 |
|
133 </project> |