buildframework/helium/sf/java/environment/tests/antunit/test_listener.ant.xml
changeset 628 7c4a911dc066
child 645 b8d81fa19e7d
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!-- 
       
     3 ============================================================================ 
       
     4 Name        : test_signaltask.ant.xml 
       
     5 Part of     : Helium AntLib
       
     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="test-exec-listener" xmlns:au="antlib:org.apache.ant.antunit" xmlns:hlm="http://www.nokia.com/helium">
       
    24     <description>Helium Antlib logger unittests.</description>
       
    25     
       
    26     <property environment="env" />
       
    27 
       
    28     <dirname file="${ant.file.test-exec-listener}" property="test-exec-listener.dir"/>
       
    29       
       
    30     <taskdef resource="net/sf/antcontrib/antlib.xml"/>
       
    31     
       
    32     <target name="setUp">    
       
    33         <tempfile property="temp.dir" suffix=".dir" />
       
    34         <mkdir dir="${temp.dir}" />
       
    35     </target>
       
    36     
       
    37     
       
    38     <target name="tearDown">
       
    39         <delete dir="${temp.dir}" />
       
    40     </target>
       
    41     
       
    42     
       
    43     <macrodef name="runScenario">
       
    44         <attribute name="scenario" />
       
    45         <attribute name="target" />
       
    46         <sequential>
       
    47             <trycatch property="scenario.unittest.error">
       
    48                 <try>
       
    49                     <exec osfamily="windows" executable="cmd" dir="${test-exec-listener.dir}/listener" failonerror="true" errorproperty="scenario.unittest.error.log">
       
    50                         <env key="ANT_ARGS" value="${env.ANT_ARGS} -listener com.nokia.helium.environment.ant.listener.ExecListener" />
       
    51                         <arg line="/c ..\..\build.bat @{target}" />
       
    52                         <arg value="-Dant.executor.class=com.nokia.helium.core.ant.HeliumExecutor" />
       
    53                         <arg value="-Dtemp.dir=${temp.dir}" />
       
    54                     </exec>
       
    55                     <exec osfamily="unix" executable="../../bld.sh" dir="${test-exec-listener.dir}/listener" failonerror="true" errorproperty="scenario.unittest.error.log">
       
    56                         <env key="ANT_ARGS" value="${env.ANT_ARGS} -listener com.nokia.helium.environment.ant.listener.ExecListener" />
       
    57                         <arg line="@{target}" />
       
    58                         <arg value="-Dant.executor.class=com.nokia.helium.core.ant.HeliumExecutor" />
       
    59                         <arg value="-Dtemp.dir=${temp.dir}" />
       
    60                     </exec>
       
    61                 </try>
       
    62             </trycatch>
       
    63             <au:assertTrue message="${scenario.unittest.error.log}">
       
    64                 <not>
       
    65                     <isset property="scenario.unittest.error" />
       
    66                 </not>
       
    67             </au:assertTrue>
       
    68         </sequential>
       
    69     </macrodef>
       
    70     
       
    71     
       
    72     <target name="test-exec-listener">
       
    73         <runScenario scenario="logger" target="test-exec-calls" />
       
    74         <au:assertFileExists file="listener/executables.csv"/>
       
    75         <loadfile srcfile="listener/executables.csv" property="executables.csv.text"/>
       
    76         <au:assertMatches string="${executables.csv.text}" pattern="perl" multiline="true"/>
       
    77         <au:assertMatches string="${executables.csv.text}" pattern="python" multiline="true"/>
       
    78         
       
    79         <delete file="listener/executables.csv"/>
       
    80         <delete file="listener/tools_listener.xml"/>
       
    81     </target>
       
    82 
       
    83 </project>
       
    84 
       
    85 
       
    86