buildframework/helium/tools/testing/ats/ats.ant.xml
changeset 1 be27ed110b50
child 179 d8ac696cc51f
equal deleted inserted replaced
0:044383f39525 1:be27ed110b50
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!-- 
       
     3 ============================================================================ 
       
     4 Name        : ats.ant.xml 
       
     5 Part of     : Helium 
       
     6 
       
     7 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     8 All rights reserved.
       
     9 This component and the accompanying materials are made available
       
    10 under the terms of the License "Eclipse Public License v1.0"
       
    11 which accompanies this distribution, and is available
       
    12 at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    13 
       
    14 Initial Contributors:
       
    15 Nokia Corporation - initial contribution.
       
    16 
       
    17 Contributors:
       
    18 
       
    19 Description:
       
    20 
       
    21 ============================================================================
       
    22 -->
       
    23 <project name="_testing.ats" xmlns:hlm="http://www.nokia.com/helium">
       
    24     <var name="drop.file.counter" value="0" />
       
    25     <description>
       
    26         ATS testing targets.
       
    27     </description>
       
    28     <!-- -->
       
    29     <fileset id="reference.ats.flash.images" dir="${release.images.dir}">
       
    30         <include name="**/${build.id}*.core.fpsx" />
       
    31         <include name="**/${build.id}*.rofs2.fpsx" />
       
    32         <include name="**/${build.id}*.rofs3.fpsx" />
       
    33         <include name="**/*rnd.C00" />
       
    34         <include name="**/*rnd.V01" />
       
    35         <include name="**/*.fpsx" />
       
    36         <include name="**/*_rnd.fpsx" />
       
    37     </fileset>
       
    38     <property environment="env" />
       
    39     <property name="ats.flashfiles.minlimit" value="2" />
       
    40 
       
    41     <fileset id="reference.ats.sis.images" dir="${ats.sis.images.dir}">
       
    42         <include name="**/*.sis" />
       
    43     </fileset>
       
    44     <property name="ats.sisfiles.minlimit" value="1" />
       
    45 
       
    46     <!-- 
       
    47     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     <pre>
       
    50     <layer name="name_test_layer">
       
    51     
       
    52         <module name="module_name">
       
    53         
       
    54             <unit id="unit_id" name="unti_name" bldFile="path_of_tsrc_folder_to_be_built" filter=""/>
       
    55             
       
    56         </module>
       
    57         
       
    58     </layer>
       
    59     </pre>
       
    60     -->
       
    61 
       
    62     <target name="ats-test" if="enabled.ats">
       
    63         <hlm:filterRecordStartMacro/>
       
    64         <runtarget target="copy-mon-sym" />
       
    65         <runtarget target="ats-create-drop" />
       
    66         <hlm:filterRecordStopMacro pattern="${ats.password}" log="${build.log.dir}/${build.id}_ats.log" append="false"/>
       
    67         <hlm:metadatarecord database="${metadata.dbfile}">
       
    68             <hlm:textmetadatainput>
       
    69                 <fileset casesensitive="false" file="${build.log.dir}/${build.id}_ats.log" />
       
    70                 <metadatafilterset refid="filterset.ats" />
       
    71             </hlm:textmetadatainput>
       
    72         </hlm:metadatarecord>
       
    73         <hlm:generateBuildStatus file="${build.id}_ats.log" />
       
    74     </target>
       
    75 
       
    76     <!-- The target creates the ATS3drop.zip file including test.xml for ATS ASTE tests. This target is executable.-->
       
    77 
       
    78     <target name="ats-aste" if="enabled.aste">
       
    79         <hlm:filterRecordStartMacro/>
       
    80         <runtarget target="do-ats-aste" />
       
    81         <hlm:filterRecordStopMacro pattern="${ats.password}" log="${build.log.dir}/${build.id}_ats.log" append="false"/>
       
    82         <hlm:metadatarecord database="${metadata.dbfile}">
       
    83             <hlm:textmetadatainput>
       
    84                 <fileset casesensitive="false" file="${build.log.dir}/${build.id}_ats.log" />
       
    85                 <metadatafilterset refid="filterset.aste" />
       
    86             </hlm:textmetadatainput>
       
    87         </hlm:metadatarecord>
       
    88         <hlm:generateBuildStatus file="${build.id}_ats.log" />
       
    89     </target>
       
    90 
       
    91     <!-- 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">
       
    93         <hlm:filterRecordStartMacro/>
       
    94         <runtarget target="do-ats-matti" />
       
    95         <hlm:filterRecordStopMacro pattern="${ats.password}" log="${build.log.dir}/${build.id}_matti.log" append="false"/>
       
    96         <hlm:metadatarecord database="${metadata.dbfile}">
       
    97             <hlm:textmetadatainput>
       
    98                 <fileset casesensitive="false" file="${build.log.dir}/${build.id}_matti.log" />
       
    99                 <metadatafilterset refid="filterset.matti" />
       
   100             </hlm:textmetadatainput>
       
   101         </hlm:metadatarecord>
       
   102         <hlm:generateBuildStatus file="${build.id}_matti.log" />
       
   103     </target>
       
   104 
       
   105 
       
   106     <!-- 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">
       
   108         <!-- Make the drop file visible to ATS3. -->
       
   109         <mkdir dir="${ats.drop.location}" />
       
   110         <copy file="${ats.drop.file}" tofile="${ats.drop.location.file}" />
       
   111         <!-- Notify ATS3 about the drop. -->
       
   112         <exec executable="cscript" dir="${build.drive}/" failonerror="false">
       
   113             <env key="ats3.username" value="${ats.username}" />
       
   114             <env key="ats3.password" value="${ats.password}" />
       
   115             <env key="ats3.host" value="${ats.server}" />
       
   116             <env key="ats3.pathToDrop" value="${ats.drop.location.file}"/>
       
   117             <arg value="${helium.dir}/tools/testing/ats/${ats.wsh.testrun.file}" />
       
   118         </exec>
       
   119     </target>
       
   120 
       
   121 
       
   122 
       
   123     <!-- 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">
       
   125         <pathconvert pathsep="," property="ats.flash.images">
       
   126             <fileset refid="reference.ats.flash.images"/>
       
   127         </pathconvert>
       
   128     </target>
       
   129 
       
   130     <!-- 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">
       
   132         <pathconvert pathsep="," property="ats.sis.images">
       
   133             <fileset refid="reference.ats.sis.images"/>
       
   134         </pathconvert>
       
   135     </target>
       
   136 
       
   137     <!-- Sets values common for ATS, this is a dependent target and shouldn't be used as an individual target -->
       
   138     <target name="ats-common">
       
   139         <property name="ats.config.file" value="" />
       
   140         <property name="ats.product.hwid" value="" />
       
   141         <property name="ats.test.timeout" value="60" />
       
   142         <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" />
       
   144         <if>
       
   145             <isset property="diamonds.build.url" />
       
   146             <then>
       
   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>
       
   154 
       
   155     <!-- 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">
       
   157         <!-- Default values for the properties -->
       
   158         <property name="ats.email.list" value="${email.from}" />
       
   159         <property name="tsrc.data.dir" value="data" />
       
   160         <property name="ats.plan.name" value="plan" />
       
   161         <property name="ats.testrun.name" value="${build.id}_${ats.product.name}" />
       
   162         <property name="ats.ctc.host" value="" />
       
   163         <condition property="ats.wsh.testrun.file" value="wshTestRunImport.vbs">
       
   164             <equals arg1="${ats.script.type}" arg2="import" />
       
   165         </condition>
       
   166         <!-- if test run file is not explicitly mentioned, default is RunX-->
       
   167         <property name="ats.wsh.testrun.file" value="wshTestRunX.vbs" />
       
   168         <var name="ats.drop.file" value="ATS3Drop${drop.file.counter}.zip" />
       
   169         <property name="ats.target.platform" value="armv5 urel" />
       
   170         <property name="ats.trace.enabled" value="False" />
       
   171         <property name="ats.ctc.enabled" value="False" />
       
   172         <property name="ats.multiset.enabled" value="False" />
       
   173         <property name="eunitexerunner.flags" value="/E S60AppEnv /R Off" />
       
   174         <property name="ats.obey.pkgfiles.rule" value="False" />
       
   175     </target>
       
   176 
       
   177     <!-- 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">
       
   179         <condition property="ats.wsh.testrun.file" value="wshTestRunImport.vbs">
       
   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" />
       
   185         <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}" />
       
   187         <property name="ats.aste.language" value="English" />
       
   188         <property name="ats.aste.software.release" value="${build.name}" />
       
   189         <property name="ats.aste.plan.name" value="plan" />
       
   190         <property name="ats.aste.testrun.name" value="${build.id}_${ats.product.name}_${major.version}.${minor.version}" />
       
   191         <property name="ats.aste.email.list" value="" />
       
   192     </target>
       
   193 
       
   194     <!-- This macro fetches the tsrc paths from system definition file (layers.sysdef.xml), layer defintion should look like
       
   195     <pre>
       
   196     <layer name="name_test_layer">
       
   197         <module name="module_name">
       
   198             <unit id="unit_id" name="unti_name" bldFile="path_of_tsrc_folder_to_be_built" filter="" />
       
   199         </module>
       
   200     </layer>
       
   201     </pre>
       
   202     -->
       
   203     <scriptdef name="getModuleTsrcMacro" language="jython" uri="http://www.nokia.com/helium">
       
   204         <attribute name="property" />
       
   205         <attribute name="prefix"/>
       
   206         
       
   207 import os
       
   208 import re
       
   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>
       
   274 
       
   275     <!-- The target is dependent on "ats-test", should not be called individually. The target creates the ATS3drop.zip file including test:xml file -->
       
   276     <target name="ats-create-drop" depends="create-canonical-sysdef-file, 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" />
       
   279         <hlm:getModuleTsrcMacro property="module.list" prefix="module.tsrc" />
       
   280         <if>
       
   281             <scriptcondition language="beanshell">
       
   282                 <![CDATA[
       
   283                     String value = project.getProperty("module.list");
       
   284                     if (value != null) {
       
   285                         String[] out = value.split(",");
       
   286                         if ((out == null) || (out.length == 0) || ((out.length == 1) && (out[0].length()==0))) {
       
   287                                     self.setValue(true);
       
   288                             } else {
       
   289                                     self.setValue(false);
       
   290                             }
       
   291                         } else {
       
   292                             self.log("Error: module.list not defined.");
       
   293                                 self.setValue(true);
       
   294                         }
       
   295                             ]]>
       
   296             </scriptcondition>
       
   297             <then>
       
   298                 <echo message="Error: No test modules found!" />
       
   299             </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>
       
   324                 <for list="${module.list}" delimiter="," param="module">
       
   325                     <sequential>
       
   326                         <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>
       
   329                         <exec executable="python">
       
   330                             <arg value="${helium.dir}/tools/common/python/lib/ats3/__init__.py" />
       
   331                             <arg value="--device-type=${ats.product.name}" />
       
   332                             <arg value="--device-hwid=${ats.product.hwid}" />
       
   333                             <arg value="${internal.ats.diamonds.arg}" />
       
   334                             <arg value="--drop-file=${ats.drop.file}" />
       
   335                             <arg value="--report-email=${ats.email.list}" />
       
   336                             <arg value="--plan-name=${ats.plan.name}" />
       
   337                             <arg value="--testrun-name=${ats.testrun.name}_@{module}" />
       
   338                             <arg value="--flash-images=${ats.flash.images}" />
       
   339                             <arg value="--minimum-flash-images=${ats.flashfiles.minlimit}" />
       
   340                             <arg value="--target-platform=${ats.target.platform}" />
       
   341                             <arg value="--data-dir=${tsrc.data.dir}" />
       
   342                             <arg value="--test-timeout=${ats.test.timeout}" />
       
   343                             <arg value="--build-drive=${build.drive}" />
       
   344                             <arg value="--trace-enabled=${ats.trace.enabled}" />
       
   345                             <arg value="--ctc-enabled=${ats.ctc.enabled}" />
       
   346                             <arg value="--multiset-enabled=${ats.multiset.enabled}" />
       
   347                             <arg value="--file-store=${ats.report.location}" />
       
   348                             <arg value="--eunitexerunner-flags=${eunitexerunner.flags}" />
       
   349                             <arg value="--ats-network-drive=${ats.ctc.host}#${ats.drop.file}" />
       
   350                             <arg value="--monsym-files=${ats.ctc.monsyms}" />
       
   351                             <arg value="--config=${ats.config.file}" />
       
   352                             <arg value="--obey-pkgfiles=${ats.obey.pkgfiles.rule}" />
       
   353                             <arg value="--verbose" />
       
   354                             <arg line="${module.tsrc.@{module}}" />
       
   355                         </exec>
       
   356                         <runtarget target="do-ats-test" />
       
   357                         <math result="drop.file.counter" operand1="1" operation="+" operand2="${drop.file.counter}" datatype="int" />
       
   358                     </sequential>
       
   359                 </for>
       
   360             </else>
       
   361         </if>
       
   362     </target>
       
   363 
       
   364 
       
   365     <!-- 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">
       
   367 
       
   368         <mkdir dir="${build.output.dir}/ats" />
       
   369         <if>
       
   370             <scriptcondition language="beanshell">
       
   371                 <![CDATA[
       
   372                 String flashfiles = project.getProperty("ats.flash.images");
       
   373                 String value = project.getProperty("ats.flashfiles.minlimit");
       
   374                 if (flashfiles != null && value != null) {
       
   375                     int cond = Integer.valueOf(value).intValue();
       
   376                     String[] out = flashfiles.split(",");
       
   377                     if (out.length < cond ) {
       
   378                         self.setValue(true);
       
   379                     } else {
       
   380                             self.setValue(false);
       
   381                     }
       
   382                 } else {
       
   383                     self.log("Error: flashfiles not defined.");
       
   384                     self.setValue(true);
       
   385                 }
       
   386                     ]]>
       
   387             </scriptcondition>
       
   388             <then>
       
   389                 <echo message="Error: Not enough flash files!" />
       
   390             </then>
       
   391             <else>
       
   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>
       
   417 
       
   418     <!--
       
   419         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.
       
   421         The target url is: ftp ://[server]/ctc_helium/[diamonds_id]/mon_syms/[id]/mon.sym 
       
   422     -->
       
   423     <target name="copy-mon-sym" if="ats.ctc.enabled">
       
   424         <fmpp sourceFile="${helium.dir}/tools/testing/ats/templates/monsym-file-list.txt.ftl"
       
   425             outputFile="${temp.build.dir}/monsym-file-list.txt">
       
   426             <data expandProperties="yes">
       
   427                 data: xml(${canonical.sysdef.file})
       
   428                 ant: antProperties()
       
   429             </data>
       
   430         </fmpp>
       
   431         <hlm:path2file reference="mon.sym.list" file="${temp.build.dir}/monsym-file-list.txt" />
       
   432         <script language="jython">
       
   433 import os
       
   434 import ctc
       
   435 
       
   436 if not project.getProperty('ats.ctc.host'):
       
   437     raise Exception('ats.ctc.host property is not defined.')
       
   438 if not project.getProperty('diamonds.build.id'):
       
   439     raise Exception('diamonds.build.id property is not defined.')
       
   440 
       
   441 server = project.getProperty('ats.ctc.host')
       
   442 diamondsid = os.path.basename(os.path.dirname(project.getProperty('diamonds.build.id')))
       
   443 path = project.getReference('mon.sym.list')
       
   444 if not path:
       
   445     raise Exception('mon.sym.list reference has not been set')
       
   446 
       
   447 uploader = ctc.MonSymFTPUploader(server, path.list(), diamondsid)
       
   448 monsyms = uploader.upload()
       
   449             
       
   450 # 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]))
       
   452         </script>
       
   453         <echo>ats.ctc.monsyms: ${ats.ctc.monsyms}</echo>
       
   454     </target>
       
   455 
       
   456     <!-- 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
       
   458     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" >
       
   460         <runtarget target="ats-set-defaults-stifeunit" />
       
   461         <!--need to set theseup for use by do-ats-test target-->
       
   462         <mkdir dir="${build.output.dir}/ats" />
       
   463         <var name="ats.drop.location" value="${build.output.dir}/ats" />
       
   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>
       
   467             <!-- get the list of .fpsx files (and others) in the defined folder
       
   468              to pass as a list to the python script-->
       
   469             <scriptcondition language="beanshell">
       
   470                 <![CDATA[
       
   471                     String flashfiles = project.getProperty("ats.flash.images");
       
   472                     String value = project.getProperty("ats.flashfiles.minlimit");
       
   473                     if (flashfiles != null && value != null) {
       
   474                         int cond = Integer.valueOf(value).intValue();
       
   475                         String[] out = flashfiles.split(",");
       
   476                         if (out.length < cond ) {
       
   477                             self.setValue(true);
       
   478                         } else {
       
   479                             self.setValue(false);
       
   480                         }
       
   481                     } else {
       
   482                         self.log("Error: flashfiles not defined.");
       
   483                         self.setValue(true);
       
   484                     }
       
   485                         ]]>
       
   486             </scriptcondition>
       
   487             <then>
       
   488                 <echo message="Error: Not enough flash files!" />
       
   489             </then>
       
   490             <else>
       
   491                 <if>
       
   492                     <!-- get the list of .sis files in the defined folder to pass as a list to the python script-->
       
   493                     <scriptcondition language="beanshell">
       
   494                         <![CDATA[
       
   495                             String sisfiles = project.getProperty("ats.sis.images");
       
   496                             String value = project.getProperty("ats.sisfiles.minlimit");
       
   497                             if (sisfiles != null && value != null) {
       
   498                                 int cond = Integer.valueOf(value).intValue();
       
   499                                 String[] out = sisfiles.split(",");
       
   500                                 if (out.length < cond ) {
       
   501                                     self.setValue(true);
       
   502                                 } else {
       
   503                                     self.setValue(false);
       
   504                                 }
       
   505                             } else {
       
   506                                 self.log("Error: sisfiles not defined.");
       
   507                                 self.setValue(true);
       
   508                             }
       
   509                                 ]]>
       
   510                     </scriptcondition>
       
   511                     <then>
       
   512                         <echo message="Error: Not enough sis files!" />
       
   513                     </then>
       
   514                     <else>
       
   515                         <!-- execute the MattiDrops.py script with parameters-->
       
   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>
       
   547         </if>    
       
   548     </target>
       
   549     
       
   550 </project>