buildframework/helium/sf/java/legacy/tests/antunit/run-scenario.ant.xml
author wbernard
Fri, 13 Aug 2010 14:59:05 +0300
changeset 628 7c4a911dc066
permissions -rw-r--r--
helium_11.0.0-e00f171ca185

<?xml version="1.0" encoding="UTF-8"?>
<!-- 
============================================================================ 
Name        : test_signaltask.ant.xml 
Part of     : Helium AntLib

Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved.
This component and the accompanying materials are made available
under the terms of the License "Eclipse Public License v1.0"
which accompanies this distribution, and is available
at the URL "http://www.eclipse.org/legal/epl-v10.html".

Initial Contributors:
Nokia Corporation - initial contribution.

Contributors:

Description:

============================================================================
-->
<project name="run-scenario" xmlns:ac="antlib:net.sf.antcontrib" xmlns:au="antlib:org.apache.ant.antunit">
    <description>Helium Antlib feature enabler macro.</description>

    <target name="setUp">    
        <tempfile property="temp.dir" suffix=".dir" />
        <mkdir dir="${temp.dir}" />
    </target>
    
    <target name="tearDown">
        <delete dir="${temp.dir}" />
    </target>
    
    <macrodef name="runScenario">
        <attribute name="scenario" />
        <attribute name="target" />
        <attribute name="cmdline" default=""/>
        <sequential>
            <ac:trycatch property="scenario.unittest.error">
                <try>
                    <exec osfamily="windows" executable="cmd" dir="${ant.file.run-scenario}/../../scenarii/@{scenario}" failonerror="true" errorproperty="scenario.unittest.error.log">
                        <env key="ANT_ARGS" value="${env.ANT_ARGS} -logger com.nokia.ant.HeliumLogger" />
                        <arg line="/c ..\build.bat @{target}" />
                        <arg value="-Dant.executor.class=com.nokia.helium.core.ant.HeliumExecutor" />
                        <arg value="-Dtemp.dir=${temp.dir}" />
                        <arg value="-Dhelium.dir=${ant.file.run-scenario}/../../scenarii/property" />
                    </exec>
                    <exec osfamily="unix" executable="../bld.sh" dir="${ant.file.run-scenario}/../../scenarii/@{scenario}" failonerror="true" errorproperty="scenario.unittest.error.log">
                        <env key="ANT_ARGS" value="${env.ANT_ARGS} -logger com.nokia.ant.HeliumLogger" />
                        <arg value="-Dant.executor.class=com.nokia.helium.core.ant.HeliumExecutor" />
                        <arg line="@{target}" />
                        <arg value="-Dtemp.dir=${temp.dir}" />
                        <arg line="@{cmdline}" />
                        <arg value="-Dhelium.dir=${ant.file.run-scenario}/../../scenarii/property" />
                    </exec>
                </try>
            </ac:trycatch>
            <!--<loadfile property="scenario.unittest.error.log" srcFile="${temp.dir}/scenario.log" />-->
            <au:assertTrue message="${scenario.unittest.error.log}">
                <not>
                    <isset property="scenario.unittest.error" />
                </not>
            </au:assertTrue>
        </sequential>
    </macrodef>

</project>