buildframework/helium/tools/testing/ats/ats.ant.xml
changeset 179 d8ac696cc51f
parent 1 be27ed110b50
child 217 0f5e3a7fb6af
child 593 4367a1b2db65
equal deleted inserted replaced
1:be27ed110b50 179:d8ac696cc51f
    19 Description:
    19 Description:
    20 
    20 
    21 ============================================================================
    21 ============================================================================
    22 -->
    22 -->
    23 <project name="_testing.ats" xmlns:hlm="http://www.nokia.com/helium">
    23 <project name="_testing.ats" xmlns:hlm="http://www.nokia.com/helium">
    24     <var name="drop.file.counter" value="0" />
       
    25     <description>
    24     <description>
    26         ATS testing targets.
    25         ATS testing targets.
    27     </description>
    26     </description>
    28     <!-- -->
    27     <!-- -->
    29     <fileset id="reference.ats.flash.images" dir="${release.images.dir}">
    28     <fileset id="reference.ats.flash.images" dir="${release.images.dir}">
    33         <include name="**/*rnd.C00" />
    32         <include name="**/*rnd.C00" />
    34         <include name="**/*rnd.V01" />
    33         <include name="**/*rnd.V01" />
    35         <include name="**/*.fpsx" />
    34         <include name="**/*.fpsx" />
    36         <include name="**/*_rnd.fpsx" />
    35         <include name="**/*_rnd.fpsx" />
    37     </fileset>
    36     </fileset>
    38     <property environment="env" />
    37     
    39     <property name="ats.flashfiles.minlimit" value="2" />
    38     <property name="ats.flashfiles.minlimit" value="2" />
    40 
    39 
    41     <fileset id="reference.ats.sis.images" dir="${ats.sis.images.dir}">
    40     <fileset id="reference.ats.sis.images" dir="${ats.sis.images.dir}">
    42         <include name="**/*.sis" />
    41         <include name="**/*.sis" />
    43     </fileset>
    42     </fileset>
    44     <property name="ats.sisfiles.minlimit" value="1" />
    43     <property name="ats.sisfiles.minlimit" value="1" />
       
    44     
       
    45     <var name="drop.file.counter" value="0" />
    45 
    46 
    46     <!-- 
    47     <!-- 
    47     The target creates ATSDrop.zip file which also includes test.xml file; and sends the drop to ATS. 
    48     The target creates ATSDrop.zip file which also includes test.xml file; and sends the drop to ATS. 
    48     The layer definition, in system definition file, for tsrc directory should look like:
    49     The layer definition, in system definition file, for tsrc directory should look like:
    49     <pre>
    50     <pre>
    50     <layer name="name_test_layer">
    51     <layer name="name_test_layer">
    51     
       
    52         <module name="module_name">
    52         <module name="module_name">
    53         
       
    54             <unit id="unit_id" name="unti_name" bldFile="path_of_tsrc_folder_to_be_built" filter=""/>
    53             <unit id="unit_id" name="unti_name" bldFile="path_of_tsrc_folder_to_be_built" filter=""/>
    55             
       
    56         </module>
    54         </module>
    57         
       
    58     </layer>
    55     </layer>
    59     </pre>
    56     </pre>
    60     -->
    57     -->
    61 
       
    62     <target name="ats-test" if="enabled.ats">
    58     <target name="ats-test" if="enabled.ats">
    63         <hlm:filterRecordStartMacro/>
    59         <mkdir dir="${test.log.dir}"/>
    64         <runtarget target="copy-mon-sym" />
    60         <hlm:filterRecordStartMacro pattern="${ats.password}" category="ats"/>
    65         <runtarget target="ats-create-drop" />
    61         <trycatch property="exception" reference="exception">
    66         <hlm:filterRecordStopMacro pattern="${ats.password}" log="${build.log.dir}/${build.id}_ats.log" append="false"/>
    62             <try>
       
    63                 <runtarget target="ats-delta"/>
       
    64                 <antcall target="create-canonical-sysdef-file" inheritRefs="true">
       
    65                     <reference refid="ats.system.definition.files" torefid="system.definition.files" />
       
    66                 </antcall>
       
    67                 <runtarget target="copy-mon-sym" />
       
    68                 <runtarget target="ats-create-drop" />
       
    69             </try>
       
    70             <catch>
       
    71                 <if>
       
    72                     <istrue value="${ats.delta.enabled}" />
       
    73                     <then>
       
    74                         <echo message="${exception}"/>
       
    75                     </then>
       
    76                     <else>
       
    77                         <throw refid="exception"/>
       
    78                     </else>
       
    79                 </if>
       
    80             </catch>
       
    81         </trycatch>
       
    82         <hlm:filterRecordStopMacro log="${test.log.dir}/${build.id}_ats.log" append="false"/>
    67         <hlm:metadatarecord database="${metadata.dbfile}">
    83         <hlm:metadatarecord database="${metadata.dbfile}">
    68             <hlm:textmetadatainput>
    84             <hlm:textmetadatainput>
    69                 <fileset casesensitive="false" file="${build.log.dir}/${build.id}_ats.log" />
    85                 <fileset casesensitive="false" file="${test.log.dir}/${build.id}_ats.log" />
    70                 <metadatafilterset refid="filterset.ats" />
    86                 <metadatafilterset refid="filterset.ats" />
    71             </hlm:textmetadatainput>
    87             </hlm:textmetadatainput>
    72         </hlm:metadatarecord>
    88         </hlm:metadatarecord>
    73         <hlm:generateBuildStatus file="${build.id}_ats.log" />
    89         <hlm:generateBuildStatus file="${build.id}_ats.log" />
    74     </target>
    90     </target>
    75 
    91 
    76     <!-- The target creates the ATS3drop.zip file including test.xml for ATS ASTE tests. This target is executable.-->
    92     <!-- The target creates the ATSdrop.zip file including test.xml for ATS ASTE tests. This target is executable.-->
    77 
       
    78     <target name="ats-aste" if="enabled.aste">
    93     <target name="ats-aste" if="enabled.aste">
    79         <hlm:filterRecordStartMacro/>
    94         <mkdir dir="${test.log.dir}"/>
       
    95         <hlm:filterRecordStartMacro pattern="${ats.password}" category="ats"/>
    80         <runtarget target="do-ats-aste" />
    96         <runtarget target="do-ats-aste" />
    81         <hlm:filterRecordStopMacro pattern="${ats.password}" log="${build.log.dir}/${build.id}_ats.log" append="false"/>
    97         <hlm:filterRecordStopMacro log="${test.log.dir}/${build.id}_aste.log" append="false"/>
    82         <hlm:metadatarecord database="${metadata.dbfile}">
    98         <hlm:metadatarecord database="${metadata.dbfile}">
    83             <hlm:textmetadatainput>
    99             <hlm:textmetadatainput>
    84                 <fileset casesensitive="false" file="${build.log.dir}/${build.id}_ats.log" />
   100                 <fileset casesensitive="false" file="${test.log.dir}/${build.id}_aste.log" />
    85                 <metadatafilterset refid="filterset.aste" />
   101                 <metadatafilterset refid="filterset.aste" />
    86             </hlm:textmetadatainput>
   102             </hlm:textmetadatainput>
    87         </hlm:metadatarecord>
   103         </hlm:metadatarecord>
    88         <hlm:generateBuildStatus file="${build.id}_ats.log" />
   104         <hlm:generateBuildStatus file="${build.id}_aste.log" />
    89     </target>
   105     </target>
    90 
   106 
    91     <!-- The target creates the MATTI_drop.zip file including test.xml for MATTI tests. This target is executable.-->
   107     <!-- The target creates the MATTI_drop.zip file including test.xml for MATTI tests. This target is executable.-->
    92     <target name="matti-test" if="enabled.matti">
   108     <target name="matti-test" if="enabled.matti">
    93         <hlm:filterRecordStartMacro/>
   109         <mkdir dir="${test.log.dir}"/>
       
   110         <hlm:filterRecordStartMacro pattern="${ats.password}" category="ats"/>
    94         <runtarget target="do-ats-matti" />
   111         <runtarget target="do-ats-matti" />
    95         <hlm:filterRecordStopMacro pattern="${ats.password}" log="${build.log.dir}/${build.id}_matti.log" append="false"/>
   112         <hlm:filterRecordStopMacro log="${test.log.dir}/${build.id}_matti.log" append="false"/>
    96         <hlm:metadatarecord database="${metadata.dbfile}">
   113         <hlm:metadatarecord database="${metadata.dbfile}">
    97             <hlm:textmetadatainput>
   114             <hlm:textmetadatainput>
    98                 <fileset casesensitive="false" file="${build.log.dir}/${build.id}_matti.log" />
   115                 <fileset casesensitive="false" file="${test.log.dir}/${build.id}_matti.log" />
    99                 <metadatafilterset refid="filterset.matti" />
   116                 <metadatafilterset refid="filterset.matti" />
   100             </hlm:textmetadatainput>
   117             </hlm:textmetadatainput>
   101         </hlm:metadatarecord>
   118         </hlm:metadatarecord>
   102         <hlm:generateBuildStatus file="${build.id}_matti.log" />
   119         <hlm:generateBuildStatus file="${build.id}_matti.log" />
   103     </target>
   120     </target>
   104 
   121 
   105 
       
   106     <!-- Sends drop file to ATS/ASTE. Please see `ats-test` for description. -->
   122     <!-- Sends drop file to ATS/ASTE. Please see `ats-test` for description. -->
   107     <target name="do-ats-test" depends="ats-username, ats-password" unless="skip.ats.sending">
   123     <target name="do-ats-test" depends="ats-username, ats-password" unless="skip.ats.sending">
   108         <!-- Make the drop file visible to ATS3. -->
   124         <property name="ats.sending" value="true" />
   109         <mkdir dir="${ats.drop.location}" />
   125         <!-- Make the drop file visible to ATS. -->
   110         <copy file="${ats.drop.file}" tofile="${ats.drop.location.file}" />
   126         
   111         <!-- Notify ATS3 about the drop. -->
   127         <var name="ats.drop.location.file" unset="true"/>
   112         <exec executable="cscript" dir="${build.drive}/" failonerror="false">
   128         <if>
   113             <env key="ats3.username" value="${ats.username}" />
   129             <isset property="ats.drop.location" />
   114             <env key="ats3.password" value="${ats.password}" />
   130             <then>
   115             <env key="ats3.host" value="${ats.server}" />
   131                 <mkdir dir="${ats.drop.location}" />
   116             <env key="ats3.pathToDrop" value="${ats.drop.location.file}"/>
   132                 <property name="ats.drop.location.file" location="${ats.drop.location}/${ats.drop.file}" />
   117             <arg value="${helium.dir}/tools/testing/ats/${ats.wsh.testrun.file}" />
   133                 <copy file="${build.output.dir}/ats/${ats.drop.file}" tofile="${ats.drop.location.file}" />
   118         </exec>
   134             </then>
   119     </target>
   135             <else>
   120 
   136                 <property name="ats.drop.location.file" location="${build.output.dir}/ats/${ats.drop.file}" />
   121 
   137             </else>
       
   138         </if>
       
   139 
       
   140         <!-- Notify ATS about the drop. -->
       
   141         <if>
       
   142             <istrue value="${ats4.enabled}" />
       
   143             <then>
       
   144                 <hlm:python failonerror="true">
       
   145 version = r'${java.version}'
       
   146 if '1.6.0' in version:
       
   147     assert int(version.split('_')[1]) > 6, 'Java 6 u7 required'
       
   148                 </hlm:python>
       
   149                 <condition property="ats.import.arg" value="-import" else="">
       
   150                     <equals arg1="${ats.script.type}" arg2="import" />
       
   151                 </condition>
       
   152                 <java classname="com.nokia.ats.util.server.CommandLineClient" fork="true">
       
   153                     <classpath>
       
   154                         <pathelement path="${java.class.path}"/>
       
   155                     </classpath>
       
   156                     <arg line="-url http://${ats.server}/ServerService -path ${ats.drop.location.file} ${ats.import.arg}"/>
       
   157                 </java>
       
   158             </then>
       
   159             <else>
       
   160                 <condition property="ats.wsh.testrun.file" value="wshTestRunImport.vbs" else="wshTestRunX.vbs">
       
   161                     <equals arg1="${ats.script.type}" arg2="import" />
       
   162                 </condition>
       
   163                 <exec executable="cscript" dir="${build.drive}/" failonerror="false">
       
   164                     <env key="ats3.username" value="${ats.username}" />
       
   165                     <env key="ats3.password" value="${ats.password}" />
       
   166                     <env key="ats3.host" value="${ats.server}" />
       
   167                     <env key="ats3.pathToDrop" value="${ats.drop.location.file}"/>
       
   168                     <arg value="${helium.dir}/tools/testing/ats/${ats.wsh.testrun.file}" />
       
   169                 </exec>
       
   170             </else>
       
   171         </if>
       
   172     </target>
   122 
   173 
   123     <!-- The target is dependent on "ats-test", should not be called independently. The target fetches flash files location -->
   174     <!-- The target is dependent on "ats-test", should not be called independently. The target fetches flash files location -->
   124     <target name="ats-set-flash-image-path">
   175     <target name="ats-set-flash-image-path">
   125         <pathconvert pathsep="," property="ats.flash.images">
   176         <pathconvert pathsep="," property="ats.flash.images">
   126             <fileset refid="reference.ats.flash.images"/>
   177             <fileset refid="reference.ats.flash.images"/>
   127         </pathconvert>
   178         </pathconvert>
       
   179         <hlm:python failonerror="true">
       
   180 <![CDATA[
       
   181 flashfilescount = len(r'${ats.flash.images}'.split(','))
       
   182 mincount = int(r'${ats.flashfiles.minlimit}')
       
   183 if flashfilescount < mincount:
       
   184     raise Exception('Not enough flash files, check reference.ats.flash.images')
       
   185 ]]>
       
   186         </hlm:python>
   128     </target>
   187     </target>
   129 
   188 
   130     <!-- The target is dependent on "ats-test", should not be called independently. The target fetches flash files location -->
   189     <!-- The target is dependent on "ats-test", should not be called independently. The target fetches flash files location -->
   131     <target name="ats-set-sis-flash-image-path">
   190     <target name="ats-set-sis-flash-image-path">
   132         <pathconvert pathsep="," property="ats.sis.images">
   191         <pathconvert pathsep="," property="ats.sis.images">
   135     </target>
   194     </target>
   136 
   195 
   137     <!-- Sets values common for ATS, this is a dependent target and shouldn't be used as an individual target -->
   196     <!-- Sets values common for ATS, this is a dependent target and shouldn't be used as an individual target -->
   138     <target name="ats-common">
   197     <target name="ats-common">
   139         <property name="ats.config.file" value="" />
   198         <property name="ats.config.file" value="" />
       
   199         <property name="ats4.enabled" value="False" />
   140         <property name="ats.product.hwid" value="" />
   200         <property name="ats.product.hwid" value="" />
   141         <property name="ats.test.timeout" value="60" />
   201         <property name="ats.test.timeout" value="60" />
   142         <property name="ats.report.location" value="${publish.dir}/${publish.subdir}" />
   202         <property name="ats.report.location" value="${publish.dir}/${publish.subdir}" />
   143         <var name="ats.drop.file" value="${build.output.dir}/ats/ATSDrop${drop.file.counter}.zip" />
   203         <condition property="internal.ats.diamonds.arg" value="--diamonds-build-url=http://${diamonds.host}${diamonds.build.id}" else="">
   144         <if>
       
   145             <isset property="diamonds.build.url" />
   204             <isset property="diamonds.build.url" />
   146             <then>
   205         </condition>
   147                 <property name="internal.ats.diamonds.arg" value="--diamonds-build-url=http://${diamonds.host}${diamonds.build.id}" />
       
   148             </then>
       
   149             <else>
       
   150                 <property name="internal.ats.diamonds.arg" value="" />
       
   151             </else>
       
   152         </if>
       
   153     </target>
   206     </target>
   154 
   207 
   155     <!-- Sets default values for the ATS (STIF and EUnit), this is a dependent target and shouldn't be used as an individual target -->
   208     <!-- Sets default values for the ATS (STIF and EUnit), this is a dependent target and shouldn't be used as an individual target -->
   156     <target name="ats-set-defaults-stifeunit" depends="ats-common,lookup-email">
   209     <target name="ats-set-defaults-stifeunit" depends="ats-common,lookup-email">
   157         <!-- Default values for the properties -->
   210         <!-- Default values for the properties -->
   158         <property name="ats.email.list" value="${email.from}" />
   211         <property name="ats.email.list" value="${email.from}" />
   159         <property name="tsrc.data.dir" value="data" />
   212         <property name="tsrc.data.dir" value="data" />
   160         <property name="ats.plan.name" value="plan" />
   213         <property name="ats.plan.name" value="plan" />
   161         <property name="ats.testrun.name" value="${build.id}_${ats.product.name}" />
   214         <property name="ats.testrun.name" value="${build.id}_${ats.product.name}" />
   162         <property name="ats.ctc.host" value="" />
   215         <property name="ats.ctc.host" value="" />
   163         <condition property="ats.wsh.testrun.file" value="wshTestRunImport.vbs">
   216         <condition property="ats.version" value="4" else="3">
   164             <equals arg1="${ats.script.type}" arg2="import" />
   217             <istrue value="${ats4.enabled}" />
   165         </condition>
   218         </condition>
   166         <!-- if test run file is not explicitly mentioned, default is RunX-->
   219         <var name="ats.drop.file" value="ATS${ats.version}Drop${drop.file.counter}.zip" />
   167         <property name="ats.wsh.testrun.file" value="wshTestRunX.vbs" />
   220         
   168         <var name="ats.drop.file" value="ATS3Drop${drop.file.counter}.zip" />
       
   169         <property name="ats.target.platform" value="armv5 urel" />
   221         <property name="ats.target.platform" value="armv5 urel" />
   170         <property name="ats.trace.enabled" value="False" />
   222         <property name="ats.trace.enabled" value="False" />
   171         <property name="ats.ctc.enabled" value="False" />
   223         <property name="ats.ctc.enabled" value="False" />
   172         <property name="ats.multiset.enabled" value="False" />
   224         <property name="ats.multiset.enabled" value="False" />
   173         <property name="eunitexerunner.flags" value="/E S60AppEnv /R Off" />
   225         <property name="eunitexerunner.flags" value="/E S60AppEnv /R Off" />
   174         <property name="ats.obey.pkgfiles.rule" value="False" />
   226         <property name="ats.obey.pkgfiles.rule" value="False" />
   175     </target>
   227     </target>
   176 
   228 
   177     <!-- Sets default values for the ASTE, this is a dependent target and shouldn't be used as an individual target -->
   229     <!-- Sets default values for the ASTE, this is a dependent target and shouldn't be used as an individual target -->
   178     <target name="ats-set-defaults-aste" depends="ats-common">
   230     <target name="ats-set-defaults-aste" depends="ats-common">
   179         <condition property="ats.wsh.testrun.file" value="wshTestRunImport.vbs">
   231         <var name="ats.drop.file" value="ATSAsteDrop.zip" />
   180             <equals arg1="${ats.script.type}" arg2="import" />
       
   181         </condition>
       
   182         <!-- if test run file is not explicitly mentioned, default is RunX-->
       
   183         <property name="ats.wsh.testrun.file" value="wshTestRunX.vbs" />
       
   184         <property name="ats.aste.test.type" value="smoke" />
   232         <property name="ats.aste.test.type" value="smoke" />
   185         <property name="ats.aste.testasset.caseids" value="100,101,102,103,105,106,107,108,109,110,111,112,113,114,115" />
   233         <property name="ats.aste.testasset.caseids" value="100,101,102,103,105,106,107,108,109,110,111,112,113,114,115" />
   186         <property name="ats.aste.software.version" value="${build.id}" />
   234         <property name="ats.aste.software.version" value="${build.id}" />
   187         <property name="ats.aste.language" value="English" />
   235         <property name="ats.aste.language" value="English" />
   188         <property name="ats.aste.software.release" value="${build.name}" />
   236         <property name="ats.aste.software.release" value="${build.name}" />
   200     </layer>
   248     </layer>
   201     </pre>
   249     </pre>
   202     -->
   250     -->
   203     <scriptdef name="getModuleTsrcMacro" language="jython" uri="http://www.nokia.com/helium">
   251     <scriptdef name="getModuleTsrcMacro" language="jython" uri="http://www.nokia.com/helium">
   204         <attribute name="property" />
   252         <attribute name="property" />
   205         <attribute name="prefix"/>
   253         <attribute name="prefix"/>        
       
   254 import traceback
       
   255 import os
       
   256 import atsant
       
   257 from com.nokia.ant.util import Helper
       
   258 
       
   259 canonicalsysdeffile = Helper.getProperty(project, 'canonical.sysdef.file')
       
   260 modules = atsant.files_to_test(canonicalsysdeffile, project.getProperty('exclude.test.layers'), project.getProperty('ido.build.filter'), project.getProperty('build.drive'))
       
   261 
       
   262 for name in modules.keys():    
       
   263     if modules[name] == []:
       
   264         del modules[name]
       
   265     else:
       
   266         project.setProperty("%s.%s" % (attributes.get('prefix'), name), " ".join(modules[name]))
   206         
   267         
   207 import os
   268 project.setProperty(attributes.get('property'), ",".join(modules.keys()))
   208 import re
   269 project.setProperty('ats.drops.count', str(len(modules)))
   209 import sysdef.api
       
   210 import pathaddition.match
       
   211 import traceback
       
   212 ## using create-canonical-sysdef-file target, it works and gets tsrc paths
       
   213 
       
   214 if project.getProperty('canonical.sysdef.file') == None :
       
   215     raise Exception("'canonical.sysdef.file' property is not defined")
       
   216 
       
   217 try:
       
   218     sdf = sysdef.api.SystemDefinition(str(project.getProperty('canonical.sysdef.file')))
       
   219     
       
   220     modules = {}
       
   221     paths_list = []
       
   222     for la in sdf.layers:
       
   223         if re.match(r".*_test_layer$", la):
       
   224             try:
       
   225                 if re.search(r"\b%s\b" % la, project.getProperty('exclude.test.layers')):
       
   226                     continue
       
   227             except TypeError, exp:
       
   228                 pass
       
   229 
       
   230             layer = sdf.layers[la]
       
   231             for mod in layer.modules:
       
   232                 if mod.name not in modules:
       
   233                     modules[mod.name] = []
       
   234                 for unit in mod.units:
       
   235                     include_unit = True
       
   236                     if project.getProperty('ido.build.filter') != None:
       
   237                         if project.getProperty('ido.build.filter') != "":
       
   238                             include_unit = False
       
   239                             if hasattr(unit, 'filters'):
       
   240                                 if len(unit.filters) > 0:
       
   241                                     for filter in unit.filters:
       
   242                                         if re.search(r"\b%s\b" % filter, project.getProperty('ido.build.filter')):
       
   243                                             include_unit = True
       
   244                                         else:
       
   245                                             include_unit = False
       
   246                                 elif len(unit.filters) == 0:
       
   247                                     include_unit = True
       
   248                             else:
       
   249                                 include_unit = False
       
   250                         else:
       
   251                             include_unit = False
       
   252                             if hasattr(unit, 'filters'):                            
       
   253                                 if len(unit.filters) == 0:
       
   254                                     include_unit = True
       
   255                     if include_unit:
       
   256                         #if pathaddition.match.ant_match(unit.path, "**/tsrc/**", False):
       
   257                         modules[mod.name].append(os.path.join(project.getProperty('build.drive') + os.sep, unit.path))
       
   258                         #else:
       
   259                         #    project.log('tcrc not found in ' + str(unit.path))
       
   260 
       
   261             #substituting paths in the modules dictionary from path list using keys
       
   262             for name in modules.keys():
       
   263                 if not modules[name] == []:
       
   264                     project.setProperty(str("%s.%s" % (attributes.get('prefix'), name)), str(" ".join(modules[name])))
       
   265                 else:
       
   266                     del modules[name]
       
   267 
       
   268             project.setProperty(str(attributes.get('property')), str(",".join(modules.keys())))
       
   269             
       
   270 except Exception, e:
       
   271     traceback.print_exc()
       
   272     project.log("ERROR: could not generate tsrc path list. %s" % e)
       
   273     </scriptdef>
   270     </scriptdef>
   274 
   271 
   275     <!-- The target is dependent on "ats-test", should not be called individually. The target creates the ATS3drop.zip file including test:xml file -->
   272     <!-- The target is dependent on "ats-test", should not be called individually. The target creates the ATSdrop.zip file including test:xml file -->
   276     <target name="ats-create-drop" depends="create-canonical-sysdef-file, ats-set-flash-image-path">
   273     <target name="ats-create-drop" depends="ats-set-flash-image-path">
   277         <var name="ats.drop.location.file" value="${ats.drop.location}/ATS3Drop${drop.file.counter}.zip" />
       
   278         <mkdir dir="${build.output.dir}/ats" />
   274         <mkdir dir="${build.output.dir}/ats" />
   279         <hlm:getModuleTsrcMacro property="module.list" prefix="module.tsrc" />
   275         <hlm:getModuleTsrcMacro property="module.list" prefix="module.tsrc" />
   280         <if>
   276         <if>
   281             <scriptcondition language="beanshell">
   277             <scriptcondition language="beanshell">
   282                 <![CDATA[
   278                 <![CDATA[
   288                             } else {
   284                             } else {
   289                                     self.setValue(false);
   285                                     self.setValue(false);
   290                             }
   286                             }
   291                         } else {
   287                         } else {
   292                             self.log("Error: module.list not defined.");
   288                             self.log("Error: module.list not defined.");
   293                                 self.setValue(true);
   289                             self.setValue(true);
   294                         }
   290                         }
   295                             ]]>
   291                             ]]>
   296             </scriptcondition>
   292             </scriptcondition>
   297             <then>
   293             <then>
   298                 <echo message="Error: No test modules found!" />
   294                 <echo message="Error: No test modules found!" />
   299             </then>
   295             </then>
   300             <elseif>
       
   301                 <scriptcondition language="beanshell">
       
   302                     <![CDATA[
       
   303                         String flashfiles = project.getProperty("ats.flash.images");
       
   304                         String value = project.getProperty("ats.flashfiles.minlimit");
       
   305                         if (flashfiles != null && value != null) {
       
   306                             int cond = Integer.valueOf(value).intValue();
       
   307                             String[] out = flashfiles.split(",");
       
   308                             if (out.length < cond ) {
       
   309                                 self.setValue(true);
       
   310                             } else {
       
   311                                 self.setValue(false);
       
   312                             }
       
   313                         } else {
       
   314                             self.log("Error: flashfiles not defined.");
       
   315                             self.setValue(true);
       
   316                         }
       
   317                             ]]>
       
   318                 </scriptcondition>
       
   319                 <then>
       
   320                     <echo message="Error: Not enough flash files!" />
       
   321                 </then>
       
   322             </elseif>
       
   323             <else>
   296             <else>
   324                 <for list="${module.list}" delimiter="," param="module">
   297                 <for list="${module.list}" delimiter="," param="module">
   325                     <sequential>
   298                     <sequential>
   326                         <runtarget target="ats-set-defaults-stifeunit" />
   299                         <runtarget target="ats-set-defaults-stifeunit" />
   327                         <var name="ats.drop.file" value="${build.output.dir}/ats/ATS3Drop${drop.file.counter}.zip" />
       
   328                         <echo>${ats.drop.file}</echo>
   300                         <echo>${ats.drop.file}</echo>
   329                         <exec executable="python">
   301                         <exec executable="python">
   330                             <arg value="${helium.dir}/tools/common/python/lib/ats3/__init__.py" />
   302                             <arg value="${helium.dir}/tools/common/python/lib/ats3/__init__.py" />
   331                             <arg value="--device-type=${ats.product.name}" />
   303                             <arg value="--device-type=${ats.product.name}" />
   332                             <arg value="--device-hwid=${ats.product.hwid}" />
   304                             <arg value="--device-hwid=${ats.product.hwid}" />
   333                             <arg value="${internal.ats.diamonds.arg}" />
   305                             <arg value="${internal.ats.diamonds.arg}" />
   334                             <arg value="--drop-file=${ats.drop.file}" />
   306                             <arg value="--drop-file=${build.output.dir}/ats/${ats.drop.file}" />
   335                             <arg value="--report-email=${ats.email.list}" />
   307                             <arg value="--report-email=${ats.email.list}" />
   336                             <arg value="--plan-name=${ats.plan.name}" />
   308                             <arg value="--plan-name=${ats.plan.name}" />
   337                             <arg value="--testrun-name=${ats.testrun.name}_@{module}" />
   309                             <arg value="--testrun-name=${ats.testrun.name}_@{module}" />
   338                             <arg value="--flash-images=${ats.flash.images}" />
   310                             <arg value="--flash-images=${ats.flash.images}" />
   339                             <arg value="--minimum-flash-images=${ats.flashfiles.minlimit}" />
   311                             <arg value="--minimum-flash-images=${ats.flashfiles.minlimit}" />
   344                             <arg value="--trace-enabled=${ats.trace.enabled}" />
   316                             <arg value="--trace-enabled=${ats.trace.enabled}" />
   345                             <arg value="--ctc-enabled=${ats.ctc.enabled}" />
   317                             <arg value="--ctc-enabled=${ats.ctc.enabled}" />
   346                             <arg value="--multiset-enabled=${ats.multiset.enabled}" />
   318                             <arg value="--multiset-enabled=${ats.multiset.enabled}" />
   347                             <arg value="--file-store=${ats.report.location}" />
   319                             <arg value="--file-store=${ats.report.location}" />
   348                             <arg value="--eunitexerunner-flags=${eunitexerunner.flags}" />
   320                             <arg value="--eunitexerunner-flags=${eunitexerunner.flags}" />
   349                             <arg value="--ats-network-drive=${ats.ctc.host}#${ats.drop.file}" />
   321                             <arg value="--ctc-run-process-params=${ats.ctc.host}#${ats.drop.file}#${ats.drops.count}" /> <!-- Three differnt value are combined with '#' character which is later parsed inside the script -->
   350                             <arg value="--monsym-files=${ats.ctc.monsyms}" />
   322                             <arg value="--monsym-files=${ats.ctc.monsyms}" />
   351                             <arg value="--config=${ats.config.file}" />
   323                             <arg value="--config=${ats.config.file}" />
   352                             <arg value="--obey-pkgfiles=${ats.obey.pkgfiles.rule}" />
   324                             <arg value="--obey-pkgfiles=${ats.obey.pkgfiles.rule}" />
       
   325                             <arg value="--ats4-enabled=${ats4.enabled}" />
   353                             <arg value="--verbose" />
   326                             <arg value="--verbose" />
   354                             <arg line="${module.tsrc.@{module}}" />
   327                             <arg line="${module.tsrc.@{module}}" />
   355                         </exec>
   328                         </exec>
   356                         <runtarget target="do-ats-test" />
   329                         <runtarget target="do-ats-test" />
   357                         <math result="drop.file.counter" operand1="1" operation="+" operand2="${drop.file.counter}" datatype="int" />
   330                         <math result="drop.file.counter" operand1="1" operation="+" operand2="${drop.file.counter}" datatype="int" />
   362     </target>
   335     </target>
   363 
   336 
   364 
   337 
   365     <!-- Please see ats-aste for description.-->
   338     <!-- Please see ats-aste for description.-->
   366     <target name="do-ats-aste" depends="ats-set-flash-image-path, ats-set-defaults-aste" if="enabled.aste">
   339     <target name="do-ats-aste" depends="ats-set-flash-image-path, ats-set-defaults-aste" if="enabled.aste">
   367 
       
   368         <mkdir dir="${build.output.dir}/ats" />
   340         <mkdir dir="${build.output.dir}/ats" />
   369         <if>
   341         <exec executable="python">
   370             <scriptcondition language="beanshell">
   342             <arg value="${helium.dir}/tools/common/python/lib/ats3/aste.py" />
   371                 <![CDATA[
   343             <arg value="--report-email=${ats.aste.email.list}" />
   372                 String flashfiles = project.getProperty("ats.flash.images");
   344             <arg value="--device-type=${ats.product.name}" />
   373                 String value = project.getProperty("ats.flashfiles.minlimit");
   345             <arg value="--flash-images=${ats.flash.images}" />
   374                 if (flashfiles != null && value != null) {
   346             <arg value="--minimum-flash-images=${ats.flashfiles.minlimit}" />
   375                     int cond = Integer.valueOf(value).intValue();
   347             <arg value="--plan-name=${ats.aste.plan.name}" />
   376                     String[] out = flashfiles.split(",");
   348             <arg value="--testrun-name=${ats.aste.testrun.name}" />
   377                     if (out.length < cond ) {
   349             <arg value="--device-hwid=${ats.product.hwid}" />
   378                         self.setValue(true);
   350             <arg value="--test-timeout=${ats.test.timeout}" />
   379                     } else {
   351             <arg value="--build-drive=${build.drive}" />
   380                             self.setValue(false);
   352             <arg value="${internal.ats.diamonds.arg}" />
   381                     }
   353             <arg value="--drop-file=${build.output.dir}/ats/${ats.drop.file}" />
   382                 } else {
   354             <arg value="--test-type=${ats.aste.test.type}" />
   383                     self.log("Error: flashfiles not defined.");
   355             <arg value="--testasset-location=${ats.aste.testasset.location}" />
   384                     self.setValue(true);
   356             <arg value="--testasset-caseids=${ats.aste.testasset.caseids}" />
   385                 }
   357             <arg value="--software-version=${ats.aste.software.version}" />
   386                     ]]>
   358             <arg value="--device-language=${ats.aste.language}" />
   387             </scriptcondition>
   359             <arg value="--software-release=${ats.aste.software.release}" />
   388             <then>
   360             <arg value="--ats4-enabled=${ats4.enabled}" />
   389                 <echo message="Error: Not enough flash files!" />
   361             <arg value="--verbose" />
   390             </then>
   362         </exec>
   391             <else>
   363         <runtarget target="do-ats-test" />
   392                 <exec executable="python">
       
   393                     <arg value="${helium.dir}/tools/common/python/lib/ats3/aste.py" />
       
   394                     <arg value="--report-email=${ats.aste.email.list}" />
       
   395                     <arg value="--device-type=${ats.product.name}" />
       
   396                     <arg value="--flash-images=${ats.flash.images}" />
       
   397                     <arg value="--minimum-flash-images=${ats.flashfiles.minlimit}" />
       
   398                     <arg value="--plan-name=${ats.aste.plan.name}" />
       
   399                     <arg value="--testrun-name=${ats.aste.testrun.name}" />
       
   400                     <arg value="--device-hwid=${ats.product.hwid}" />
       
   401                     <arg value="--test-timeout=${ats.test.timeout}" />
       
   402                     <arg value="--build-drive=${build.drive}" />
       
   403                     <arg value="${internal.ats.diamonds.arg}" />
       
   404                     <arg value="--drop-file=${ats.drop.file}" />
       
   405                     <arg value="--test-type=${ats.aste.test.type}" />
       
   406                     <arg value="--testasset-location=${ats.aste.testasset.location}" />
       
   407                     <arg value="--testasset-caseids=${ats.aste.testasset.caseids}" />
       
   408                     <arg value="--software-version=${ats.aste.software.version}" />
       
   409                     <arg value="--device-language=${ats.aste.language}" />
       
   410                     <arg value="--software-release=${ats.aste.software.release}" />
       
   411                     <arg value="--verbose" />
       
   412                 </exec>
       
   413                 <runtarget target="do-ats-test" />
       
   414             </else>
       
   415         </if>
       
   416     </target>
   364     </target>
   417 
   365 
   418     <!--
   366     <!--
   419         This target search the mon.sym files using unit information from the canonical sysdef file.
   367         This target search the mon.sym files using unit information from the canonical sysdef file.
   420         Then it copies the discovered files under the ftp server defined by ats.ctc.host.
   368         Then it copies the discovered files under the ftp server defined by ats.ctc.host.
   421         The target url is: ftp ://[server]/ctc_helium/[diamonds_id]/mon_syms/[id]/mon.sym 
   369         The target url is: ftp ://[server]/ctc_helium/[diamonds_id]/mon_syms/[id]/mon.sym 
   422     -->
   370     -->
   423     <target name="copy-mon-sym" if="ats.ctc.enabled">
   371     <target name="copy-mon-sym">
   424         <fmpp sourceFile="${helium.dir}/tools/testing/ats/templates/monsym-file-list.txt.ftl"
   372         <if>
   425             outputFile="${temp.build.dir}/monsym-file-list.txt">
   373             <istrue value="${ats.ctc.enabled}"/>
   426             <data expandProperties="yes">
   374             <then>
   427                 data: xml(${canonical.sysdef.file})
   375                 <fmpp sourceFile="${helium.dir}/tools/testing/ats/templates/monsym-file-list.txt.ftl"
   428                 ant: antProperties()
   376                     outputFile="${temp.build.dir}/monsym-file-list.txt">
   429             </data>
   377                     <data expandProperties="yes">
   430         </fmpp>
   378                         data: xml(${canonical.sysdef.file})
   431         <hlm:path2file reference="mon.sym.list" file="${temp.build.dir}/monsym-file-list.txt" />
   379                         ant: antProperties()
   432         <script language="jython">
   380                     </data>
       
   381                 </fmpp>
       
   382                 <hlm:path2file reference="mon.sym.list" file="${temp.build.dir}/monsym-file-list.txt" />
       
   383                 <script language="jython">
   433 import os
   384 import os
   434 import ctc
   385 import ctc
   435 
   386 
   436 if not project.getProperty('ats.ctc.host'):
   387 if not project.getProperty('ats.ctc.host'):
   437     raise Exception('ats.ctc.host property is not defined.')
   388     raise Exception('ats.ctc.host property is not defined.')
   447 uploader = ctc.MonSymFTPUploader(server, path.list(), diamondsid)
   398 uploader = ctc.MonSymFTPUploader(server, path.list(), diamondsid)
   448 monsyms = uploader.upload()
   399 monsyms = uploader.upload()
   449             
   400             
   450 # Using ; to separate the path because the target script is running on windows
   401 # Using ; to separate the path because the target script is running on windows
   451 project.setNewProperty('ats.ctc.monsyms', ';'.join([ "//%s/%s" % (server, x) for x in monsyms]))
   402 project.setNewProperty('ats.ctc.monsyms', ';'.join([ "//%s/%s" % (server, x) for x in monsyms]))
   452         </script>
   403                 </script>
   453         <echo>ats.ctc.monsyms: ${ats.ctc.monsyms}</echo>
   404                 <echo>ats.ctc.monsyms: ${ats.ctc.monsyms}</echo>
       
   405             </then>
       
   406         </if>
   454     </target>
   407     </target>
   455 
   408 
   456     <!-- a dependant target please do not call directly use matti-test,
   409     <!-- a dependant target please do not call directly use matti-test,
   457     target calls the MATTI script that creates the MATTI_drop.zip file and runs the tests
   410     target calls the MATTI script that creates the MATTI_drop.zip file and runs the tests
   458     listed in test.rb.  ats-set-flash-image-path and ats-set-sis-flash-image-path look for lists of files-->
   411     listed in test.rb.  ats-set-flash-image-path and ats-set-sis-flash-image-path look for lists of files-->
   459     <target name="do-ats-matti" depends="ats-set-flash-image-path, ats-set-sis-flash-image-path" >
   412     <target name="do-ats-matti" depends="ats-set-flash-image-path, ats-set-sis-flash-image-path" >
   460         <runtarget target="ats-set-defaults-stifeunit" />
   413         <runtarget target="ats-set-defaults-stifeunit" />
   461         <!--need to set theseup for use by do-ats-test target-->
   414         <!--need to set theseup for use by do-ats-test target-->
   462         <mkdir dir="${build.output.dir}/ats" />
   415         <mkdir dir="${build.output.dir}/ats" />
   463         <var name="ats.drop.location" value="${build.output.dir}/ats" />
   416         <var name="ats.drop.file" value="ATSMattiDrop.zip" />
   464         <var name="ats.drop.file" value="${build.output.dir}/ats/ATS3Drop.zip" />
       
   465         <var name="ats.drop.location.file" value="${ats.drop.file}" />
       
   466         <if>
   417         <if>
   467             <!-- get the list of .fpsx files (and others) in the defined folder
   418             <!-- get the list of .sis files in the defined folder to pass as a list to the python script-->
   468              to pass as a list to the python script-->
       
   469             <scriptcondition language="beanshell">
   419             <scriptcondition language="beanshell">
   470                 <![CDATA[
   420                 <![CDATA[
   471                     String flashfiles = project.getProperty("ats.flash.images");
   421                     String sisfiles = project.getProperty("ats.sis.images");
   472                     String value = project.getProperty("ats.flashfiles.minlimit");
   422                     String value = project.getProperty("ats.sisfiles.minlimit");
   473                     if (flashfiles != null && value != null) {
   423                     if (sisfiles != null && value != null) {
   474                         int cond = Integer.valueOf(value).intValue();
   424                         int cond = Integer.valueOf(value).intValue();
   475                         String[] out = flashfiles.split(",");
   425                         String[] out = sisfiles.split(",");
   476                         if (out.length < cond ) {
   426                         if (out.length < cond ) {
   477                             self.setValue(true);
   427                             self.setValue(true);
   478                         } else {
   428                         } else {
   479                             self.setValue(false);
   429                             self.setValue(false);
   480                         }
   430                         }
   481                     } else {
   431                     } else {
   482                         self.log("Error: flashfiles not defined.");
   432                         self.log("Error: reference.ats.sis.images not defined.");
   483                         self.setValue(true);
   433                         self.setValue(true);
   484                     }
   434                     }
   485                         ]]>
   435                         ]]>
   486             </scriptcondition>
   436             </scriptcondition>
   487             <then>
   437             <then>
   488                 <echo message="Error: Not enough flash files!" />
   438                 <echo message="Error: Not enough sis files check reference.ats.sis.images" />
   489             </then>
   439             </then>
   490             <else>
   440             <else>
   491                 <if>
   441                 <!-- execute the MattiDrops.py script with parameters-->
   492                     <!-- get the list of .sis files in the defined folder to pass as a list to the python script-->
   442                 <exec executable="python" resultproperty="script.response">
   493                     <scriptcondition language="beanshell">
   443                     <arg value="${helium.dir}/tools/common/python/lib/ats3/matti/MattiDrops.py" />
   494                         <![CDATA[
   444                     <arg value="--build-drive=${build.drive}" />
   495                             String sisfiles = project.getProperty("ats.sis.images");
   445                     <arg value="--matti-scripts=${matti.scripts}" />
   496                             String value = project.getProperty("ats.sisfiles.minlimit");
   446                     <arg value="--flash-images=${ats.flash.images}" />
   497                             if (sisfiles != null && value != null) {
   447                     <arg value="--harness=STIF" />
   498                                 int cond = Integer.valueOf(value).intValue();
   448                     <arg value="--file-store=${ats.output.dir}" />
   499                                 String[] out = sisfiles.split(",");
   449                     <arg value="--testrun-name=${ats.testrun.name}" />
   500                                 if (out.length < cond ) {
   450                     <arg value="--device-type=${ats.product.name}" />
   501                                     self.setValue(true);
   451                     <arg value="--device-hwid=${ats.product.hwid}" />
   502                                 } else {
   452                     <arg value="--diamonds-build-url=${internal.ats.diamonds.arg}" />
   503                                     self.setValue(false);
   453                     <arg value="--drop-file=${build.output.dir}/ats/${ats.drop.file}" />
   504                                 }
   454                     <arg value="--minimum-flash-images=${ats.flashfiles.minlimit}" />
   505                             } else {
   455                     <arg value="--plan-name=${ats.plan.name}" />
   506                                 self.log("Error: sisfiles not defined.");
   456                     <arg value="--sis-files=${ats.sis.images}" />
   507                                 self.setValue(true);
   457                     <arg value="--template-loc=${template.file}" />
   508                             }
   458                 </exec>
   509                                 ]]>
   459                 <if> 
   510                     </scriptcondition>
   460                     <not>
       
   461                         <!-- if the response is not 0 then need to create the skip.ats.sending
       
   462                          flag so that do-ats-test is not run-->
       
   463                         <equals arg1="${script.response}" arg2="0" />
       
   464                     </not>
   511                     <then>
   465                     <then>
   512                         <echo message="Error: Not enough sis files!" />
   466                         <property name="skip.ats.sending" value="1" />
   513                     </then>
   467                     </then>
   514                     <else>
   468                 </if>
   515                         <!-- execute the MattiDrops.py script with parameters-->
   469                 <runtarget target="do-ats-test" />
   516                         <exec executable="python" resultproperty="script.response">
       
   517                             <arg value="${helium.dir}/tools/common/python/lib/ats3/matti/MattiDrops.py" />
       
   518                             <arg value="--build-drive=${build.drive}" />
       
   519                             <arg value="--matti-scripts=${matti.scripts}" />
       
   520                             <arg value="--flash-images=${ats.flash.images}" />
       
   521                             <arg value="--harness=STIF" />
       
   522                             <arg value="--file-store=${ats.output.dir}" />
       
   523                             <arg value="--testrun-name=${ats.testrun.name}" />
       
   524                             <arg value="--device-type=${ats.product.name}" />
       
   525                             <arg value="--device-hwid=${ats.product.hwid}" />
       
   526                             <arg value="--diamonds-build-url=${internal.ats.diamonds.arg}" />
       
   527                             <arg value="--drop-file=${ats.drop.file}" />
       
   528                             <arg value="--minimum-flash-images=${ats.flashfiles.minlimit}" />
       
   529                             <arg value="--plan-name=${ats.plan.name}" />
       
   530                             <arg value="--sis-files=${ats.sis.images}" />
       
   531                             <arg value="--template-loc=${template.file}" />
       
   532                         </exec>
       
   533                         <if> 
       
   534                             <not>
       
   535                                 <!-- if the response is not 0 then need to create the skip.ats.sending
       
   536                                  flag so that do-ats-test is not run-->
       
   537                                 <equals arg1="${script.response}" arg2="0" />
       
   538                             </not>
       
   539                             <then>
       
   540                                 <property name="skip.ats.sending" value="1" />
       
   541                             </then>
       
   542                         </if>
       
   543                         <runtarget target="do-ats-test" />
       
   544                     </else>
       
   545                 </if>    
       
   546             </else>
   470             </else>
   547         </if>    
   471         </if>
   548     </target>
   472     </target>
   549     
   473     
       
   474     <property name="ats.evalid.pre" value="${temp.build.dir}/${build.id}_atsevalidpre" />
       
   475     <property name="ats.evalid.post" value="${temp.build.dir}/${build.id}_atsevalidpost" />
       
   476     
       
   477     <!-- Call before preperation -->
       
   478     <target name="find-files-pre" if="ats.delta.enabled">
       
   479         <hlm:evalidMacro dir="${ats.evalid.pre}"/>
       
   480     </target>
       
   481     
       
   482     <!-- Call after preperation -->
       
   483     <target name="find-files-post" if="ats.delta.enabled">
       
   484         <hlm:evalidMacro dir="${ats.evalid.post}"/>
       
   485     </target>
       
   486     
       
   487     <!-- Run evalid on ido directories -->
       
   488     <macrodef name="evalidMacro" uri="http://www.nokia.com/helium">
       
   489         <attribute name="dir"/>
       
   490         <sequential>
       
   491             <runtarget target="ido-create-ado-mapping"/>
       
   492             <hlm:python>
       
   493 import delta_zip
       
   494 delta_zip.evalidAdomapping(r'${build.drive}', r'@{dir}', r'${ado.mapping.file}')
       
   495             </hlm:python>
       
   496         </sequential>
       
   497     </macrodef>
       
   498     
       
   499     <!-- Generate sysdef fileset based on evalid data -->
       
   500     <target name="ats-delta" if="ats.delta.enabled">
       
   501         <script language="jython">
       
   502 import ido
       
   503 from com.nokia.ant.util import Helper
       
   504 import delta_zip
       
   505 import os
       
   506 
       
   507 atspath = project.createDataType("path")
       
   508 i = project.getReference('system.definition.files').iterator()
       
   509 changedfiles = delta_zip.changedFiles(Helper.getProperty(project, 'ats.evalid.pre'), Helper.getProperty(project, 'ats.evalid.post'))
       
   510 while i.hasNext():
       
   511     path = i.next().toString()
       
   512     sysdefpath = os.path.abspath(os.path.join(project.getProperty('build.drive') + os.sep, ido.get_sysdef_location(path)))
       
   513     for f in changedfiles:
       
   514         if sysdefpath.lower() in os.path.abspath(f).lower():
       
   515             pe = atspath.createPathElement()
       
   516             pe.setPath(path)
       
   517             break
       
   518 project.addReference('ats.system.definition.files', atspath)
       
   519         </script>
       
   520     </target>
       
   521     
       
   522     <!-- Common target to run ats, aste and matti -->
       
   523     <target name="run-test" depends="ats-test,ats-aste,matti-test"/>
   550 </project>
   524 </project>