tracefw/tracecompiler/test/group/build.xml
changeset 41 838cdffd57ce
equal deleted inserted replaced
36:813b186005b6 41:838cdffd57ce
       
     1 <project name="OstTraceCompilerTest" default="build" basedir="..">
       
     2 
       
     3 <condition property="isLinux">
       
     4     <os name="linux"/>
       
     5 </condition>
       
     6 
       
     7 <condition property="isWindows">
       
     8 	<not>
       
     9 		<os name="linux"/>
       
    10 	</not>
       
    11 </condition>
       
    12 
       
    13 <!-- EMMA configuration -->
       
    14 <path id="emma.lib" >
       
    15 	<pathelement location="${ant.home}/lib/emma.jar" />
       
    16 	<pathelement location="${ant.home}/lib/emma_ant.jar" />
       
    17 </path>
       
    18 
       
    19 <taskdef resource="emma_ant.properties" classpathref="emma.lib" />
       
    20 
       
    21 <target name="init_windows_epocroot" if="isWindows">
       
    22 	<property environment="env" />
       
    23 	<echo message="Init Windows epocroot"/>
       
    24 	<property name="epoc.root" value="${env.EPOCROOT}"/>
       
    25 </target>
       
    26 
       
    27 <target name="init_linux_epocroot" if="isLinux">
       
    28 	<property environment="env" />
       
    29 	<echo message="Init Linux epocroot"/>
       
    30 	<property name="epoc.root" value="${env.EPOCROOT}//" />
       
    31 </target>
       
    32 
       
    33 <target name="init" depends="init_windows_epocroot, init_linux_epocroot">
       
    34 	<property name="src.dir" value="src" />
       
    35 	<property name="build.dir" value="build" />
       
    36 	<property name="jar.dir" value="jar" />
       
    37 	<property name="instr.dir" location="instr"/>
       
    38 	<property name="testdata.dir" location="${epoc.root}testdata"/>
       
    39 	<property name="reports.dir" value="${epoc.root}testdata/reports" />	
       
    40 	<property name="emma.dir" location="${epoc.root}testdata/reports/emma"/>
       
    41 	<property name="tools.dir" location="${epoc.root}epoc32/tools"/>
       
    42 </target>
       
    43 
       
    44 <target name="clean" depends="init">
       
    45 	<echo>Cleaning the ${build.dir}</echo>
       
    46 	<delete dir="${build.dir}"/>
       
    47 	<echo>Creating the ${build.dir} directory</echo>
       
    48 	<mkdir dir="${build.dir}"/>
       
    49 	<echo>Cleaning the ${reports.dir}</echo>
       
    50 	<delete dir="${reports.dir}"/>
       
    51 	<echo>Creating the ${reports.dir} directory</echo>
       
    52 	<mkdir dir="${reports.dir}"/>
       
    53 	<echo>Cleaning the ${instr.dir}</echo>
       
    54 	<delete dir="${instr.dir}"/>
       
    55 	<echo>Creating the ${instr.dir} directory</echo>
       
    56 	<mkdir dir="${instr.dir}"/>
       
    57 	<echo>Deleting test exports</echo>
       
    58 	<delete file="${epoc.root}epoc32/include/platform/test_opensystemtrace_types.h"/>
       
    59 	<delete file="${epoc.root}epoc32/build/buildlog_tc.txt"/>
       
    60 	<delete file="${epoc.root}epoc32/build/parsedlogs_tc.txt"/>
       
    61 	<delete file="${epoc.root}epoc32/build/buildlog_sbs.txt"/>
       
    62 	<delete file="${epoc.root}epoc32/build/parsedlogs_sbs.txt"/>
       
    63 	<delete file="${epoc.root}epoc32/build/buildlog_mult_cpp.txt"/>
       
    64 	<delete file="${epoc.root}epoc32/build/parsedlogs_mult_cpp.txt"/>
       
    65 	<delete file="${epoc.root}epoc32/build/buildlog_mult_mmp.txt"/>
       
    66 	<delete file="${epoc.root}epoc32/build/parsedlogs_mult_mmp.txt"/>	
       
    67 	<delete dir="${testdata.dir}/TraceErrorApp"/>
       
    68 	<delete dir="${testdata.dir}/MultipleCppTraceErrorApp"/>
       
    69 	<delete dir="${testdata.dir}/MultipleMmpTraceErrorApps"/>
       
    70 	<delete dir="${testdata.dir}/FixedIdDefinitionsTestApp"/>
       
    71 	<delete dir="${testdata.dir}/MultipleMmpTestCases"/>
       
    72 	<delete dir="${epoc.root}testdata/MultipleMmpTestCases"/>
       
    73 	<delete dir="${testdata.dir}TracesInHeadersApps"/>
       
    74 	<delete dir="${epoc.root}epoc32/build/testdata/MultipleMmpTestCases"/>
       
    75 	<delete dir="${epoc.root}epoc32/build/testdata/MultipleCppTraceErrorApp"/>
       
    76 	<delete dir="${epoc.root}epoc32/build/testdata/TracesInHeadersApps"/>
       
    77 </target>
       
    78 
       
    79 <target name="build" depends="clean">
       
    80 	<property name="classpath" value="${build.dir}:lib/junit-4.7.jar:../jar/tracecompiler.jar" />
       
    81 	<copy todir="${epoc.root}epoc32/include/platform">
       
    82 		<fileset dir="testdata"/>
       
    83 	</copy>
       
    84 	<copy todir="${epoc.root}testdata/TraceErrorApp">
       
    85 		<fileset dir="TraceErrorApp"/>
       
    86 	</copy>	
       
    87 	<copy todir="${epoc.root}testdata/MultipleCppTraceErrorApp">
       
    88 		<fileset dir="MultipleCppTraceErrorApp"/>
       
    89 	</copy>	
       
    90 	<copy todir="${epoc.root}testdata/MultipleMmpTraceErrorApps">
       
    91 		<fileset dir="MultipleMmpTraceErrorApps"/>
       
    92 	</copy>
       
    93 	<copy todir="${epoc.root}testdata/FixedIdDefinitionsTestApp">
       
    94 		<fileset dir="FixedIdDefinitionsTestApp"/>
       
    95 	</copy>			
       
    96 	<copy todir="${epoc.root}testdata/MultipleMmpTestCases">
       
    97 		<fileset dir="MultipleMmpTestCases"/>
       
    98 	</copy>
       
    99     	<copy todir="${epoc.root}testdata/TracesInHeadersApps">
       
   100 		<fileset dir="TracesInHeadersApps"/>
       
   101 	</copy>
       
   102 	<javac  classpath="${classpath}" srcdir="${src.dir}" destdir="${build.dir}" debug="false" target="1.5" >
       
   103 	</javac>
       
   104 </target>
       
   105 
       
   106 <target name="run" depends="build" description="run the junit tests">
       
   107 
       
   108 	<echo>---- Note ANT 1.7 or greater is required for the junit task ----</echo>
       
   109 
       
   110 	<!-- generate classpath -->
       
   111 	<path id="lib.path.ref">
       
   112 		<pathelement location="build"/>
       
   113    		<fileset dir="lib" includes="*.jar"/>
       
   114    		<fileset dir="../jar" includes="*.jar"/>
       
   115  	</path>
       
   116 	
       
   117 	<junit printsummary="yes" haltonfailure="yes">		
       
   118 	 	<classpath path="${toString:lib.path.ref}"/>
       
   119 	 	<formatter type="plain"/>
       
   120 	
       
   121 		<!--complete test code should be in the $src.dir so run all of them except ErrorLogsTestBase.java-->
       
   122 		<!--that is the base class of ErrorLogsTestUnit.java and ErrorLogsTestSystem.java-->	 	 	
       
   123 	 	<batchtest fork="yes" todir="${reports.dir}">
       
   124 	 		<fileset dir="${src.dir}">
       
   125 	      		<include name="*.java"/>
       
   126 	      		<exclude name="ErrorLogsTestBase.java"/>
       
   127 	 		</fileset>
       
   128 	 	</batchtest>	
       
   129 	</junit>
       
   130 
       
   131 </target>
       
   132 
       
   133 <!-- Instrumentation target, depends on JAR -->
       
   134 <target name="instr" depends="build">
       
   135 	<!-- Instrument the source code -->
       
   136 	<emma>
       
   137 		<instr instrpath="${tools.dir}/tracecompiler" metadatafile="${emma.dir}/metadata.emma" merge="true" mode="overwrite"/>
       
   138 	</emma>
       
   139 </target>
       
   140 
       
   141 <!--target to execute pure unit tests and measure test coverage-->		 
       
   142 <target name="run_unit_emma" depends="instr" description="run the TraceCompiler unit tests and measure test coverage">
       
   143 	<echo>---- Note ANT 1.7 or greater is required for the junit task ----</echo>
       
   144 
       
   145 	<!-- generate classpath -->
       
   146 	<path id="lib.path.ref">
       
   147 		<!-- Instrumented class files -->
       
   148 		<pathelement location="${epoc.root}epoc32/tools/tracecompiler"/>
       
   149 		<pathelement location="build"/>
       
   150 		<fileset dir="${instr.dir}" includes="*.class"/>
       
   151 		<fileset dir="lib" includes="*.jar"/>
       
   152 
       
   153 		<!-- EMMA -->
       
   154 		<pathelement path="${ant.home}/lib/emma.jar"/>
       
   155  	</path>
       
   156 	
       
   157 	<echo>${toString:lib.path.ref}</echo> 
       
   158 	
       
   159 	<junit printsummary="yes" haltonfailure="yes">		
       
   160 	 	<classpath path="${toString:lib.path.ref}"/>
       
   161 	 	<formatter type="plain"/>
       
   162 		<formatter type="xml"/>
       
   163 
       
   164 		<!-- Instrumentation arguments to JVM -->
       
   165 		<jvmarg value="-Demma.coverage.out.file=${emma.dir}/coverage.emma" />
       
   166 		<jvmarg value="-Demma.coverage.out.merge=true" />
       
   167 
       
   168 		<!--complete test code should be in the $src.dir so run all of them except ErrorLogsTestSystem.java, MultipleMmpTest.java and-->
       
   169 		<!--ErrorLogsTestBase.java that is the base class of ErrorLogsTestUnit.java and ErrorLogsTestSystem.java-->		 	
       
   170 	 	<batchtest fork="yes" todir="${reports.dir}">
       
   171 	 		<fileset dir="${src.dir}">
       
   172 	      		<include name="*.java"/>
       
   173 	      		<exclude name="ErrorLogsTestSystem.java"/>
       
   174 	      		<exclude name="ErrorLogsTestBase.java"/>
       
   175 	      		<exclude name="MultipleMmpTest.java"/>
       
   176 	      		<exclude name="TracesInHeadersTest.java"/>	      		
       
   177                 <exclude name="TraceHeadersLicenceTest.java"/>
       
   178 	 		</fileset>
       
   179 		</batchtest>
       
   180 	</junit>
       
   181 		
       
   182 	<!-- Create EMMA report -->
       
   183 	<emma>
       
   184 		<report sourcepath="src/" >
       
   185 			<fileset dir="${emma.dir}" >
       
   186 				<include name="*.emma" />
       
   187 			</fileset>
       
   188 			<xml outfile="${emma.dir}/coverage.xml" />
       
   189 		</report>
       
   190 	</emma>
       
   191 </target>
       
   192 
       
   193 <!--target to execute pure unit tests-->		 
       
   194 <target name="run_unit" depends="build" description="run the TraceCompiler unit tests">
       
   195 
       
   196 	<echo>---- Note ANT 1.7 or greater is required for the junit task ----</echo>
       
   197 
       
   198 	<!-- generate classpath -->
       
   199 	<path id="lib.path.ref">
       
   200 		<pathelement location="build"/>
       
   201    		<fileset dir="lib" includes="*.jar"/>
       
   202    		<fileset dir="../jar" includes="*.jar"/>
       
   203  	</path>
       
   204 	
       
   205 	<junit printsummary="yes" haltonfailure="yes">		
       
   206 	 	<classpath path="${toString:lib.path.ref}"/>
       
   207 	 	<formatter type="plain"/>
       
   208 	 	<formatter type="xml"/>
       
   209 	
       
   210 		<!--complete test code should be in the $src.dir so run all of them except ErrorLogsTestBase.java-->
       
   211 		<!--that is the base class of ErrorLogsTestUnit.java and ErrorLogsTestSystem.java-->	 	 	
       
   212 	 	<batchtest fork="yes" todir="${reports.dir}">
       
   213 	 		<fileset dir="${src.dir}">
       
   214 	      		<include name="*.java"/>
       
   215 	      		<exclude name="ErrorLogsTestSystem.java"/>
       
   216 	      		<exclude name="ErrorLogsTestBase.java"/>
       
   217 	      		<exclude name="MultipleMmpTest.java"/>
       
   218 	      		<exclude name="TracesInHeadersTest.java"/>	 
       
   219 	      		<exclude name="TraceHeadersLicenceTest.java"/>                
       
   220 	 		</fileset>
       
   221 	 	</batchtest>	
       
   222 	</junit>
       
   223 
       
   224 </target>
       
   225 
       
   226 <target name="jar" depends="build">
       
   227 	<mkdir dir="${jar.dir}"/>
       
   228         <jar destfile="${jar.dir}/tests.jar" basedir="${build.dir}">
       
   229             <manifest>
       
   230                 <attribute name="Main-Class" value="GroupNamesTest"/>
       
   231             </manifest>
       
   232         </jar>
       
   233 </target>
       
   234 
       
   235 </project>