You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/06/03 06:28:42 UTC
git commit: [flex-utilities] [refs/heads/develop] - fix failure
message propagation
Repository: flex-utilities
Updated Branches:
refs/heads/develop e15c4a844 -> 82da62899
fix failure message propagation
Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/82da6289
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/82da6289
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/82da6289
Branch: refs/heads/develop
Commit: 82da6289941c72d3cbc507f952bfc19954ddc5b6
Parents: e15c4a8
Author: Alex Harui <ah...@apache.org>
Authored: Tue Apr 28 12:43:39 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Jun 2 21:28:32 2015 -0700
----------------------------------------------------------------------
ant_on_air/build.xml | 14 +++++
.../src/org/apache/flex/ant/tags/AntTask.as | 1 +
ant_on_air/tests/AntOnAir.mxml | 15 ++++--
ant_on_air/tests/failsubant.xml | 49 +++++++++++++++++
ant_on_air/tests/failtest.xml | 57 ++++++++++++++++++++
5 files changed, 133 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/82da6289/ant_on_air/build.xml
----------------------------------------------------------------------
diff --git a/ant_on_air/build.xml b/ant_on_air/build.xml
index 2048eff..5c74d04 100644
--- a/ant_on_air/build.xml
+++ b/ant_on_air/build.xml
@@ -178,6 +178,20 @@
<arg value="-Dexitwhendone" />
<arg value="test" />
</exec>
+ <antcall target="failuretests" />
+ </target>
+
+ <target name="failuretests" >
+ <exec executable="${AIR_HOME}/bin/${adl}" dir="${basedir}/tests" failonerror="true">
+ <arg value="-runtime" />
+ <arg value="${AIR_HOME}/runtimes/air/${runtime}" />
+ <arg value="${basedir}/tests/AntOnAir-app.xml" />
+ <arg value="--" />
+ <arg value="-f ${basedir}/tests/failtest.xml" />
+ <arg value="-Dexitwhendone" />
+ <arg value="-Dexpectfailure" />
+ <arg value="test" />
+ </exec>
</target>
<target name="debug-test" >
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/82da6289/ant_on_air/src/org/apache/flex/ant/tags/AntTask.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/AntTask.as b/ant_on_air/src/org/apache/flex/ant/tags/AntTask.as
index adffa9c..4c3b8cb 100644
--- a/ant_on_air/src/org/apache/flex/ant/tags/AntTask.as
+++ b/ant_on_air/src/org/apache/flex/ant/tags/AntTask.as
@@ -122,6 +122,7 @@ package org.apache.flex.ant.tags
event.target.removeEventListener(ProgressEvent.PROGRESS, progressEventHandler);
ant.removeEventListener(KeyboardEvent.KEY_DOWN, ant_keyDownHandler);
ant.project.status = subant.project.status;
+ ant.project.failureMessage = subant.project.failureMessage;
dispatchEvent(new Event(Event.COMPLETE));
}
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/82da6289/ant_on_air/tests/AntOnAir.mxml
----------------------------------------------------------------------
diff --git a/ant_on_air/tests/AntOnAir.mxml b/ant_on_air/tests/AntOnAir.mxml
index 7e6182c..af19555 100644
--- a/ant_on_air/tests/AntOnAir.mxml
+++ b/ant_on_air/tests/AntOnAir.mxml
@@ -115,13 +115,22 @@ limitations under the License.
private function completeHandler(event:Event):void
{
+ var failureMode:Boolean = context.expectfailure;
+ var msg:String = Ant.currentAnt.project.failureMessage;
+
+ if (failureMode && !Ant.currentAnt.project.status)
+ output(msg ? msg : "no failure message provided");
+
if (Ant.currentAnt.project.status)
- output("SUCCESS!");
+ output(failureMode ? "FAILURE" : "SUCCESS!");
else
- output("FAILURE!");
+ output(failureMode ? "SUCCESS" : "FAILURE!");
+
+ var successCode:int = failureMode ? 255 : 0;
+ var failureCode:int = failureMode ? 0 : 255;
if (context.exitwhendone)
- NativeApplication.nativeApplication.exit(Ant.currentAnt.project.status ? 0 : 255);
+ NativeApplication.nativeApplication.exit(Ant.currentAnt.project.status ? successCode : failureCode);
}
private var ant:Ant;
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/82da6289/ant_on_air/tests/failsubant.xml
----------------------------------------------------------------------
diff --git a/ant_on_air/tests/failsubant.xml b/ant_on_air/tests/failsubant.xml
new file mode 100644
index 0000000..2e09bfb
--- /dev/null
+++ b/ant_on_air/tests/failsubant.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+<project name="ant_on_air_test_subant_fail" basedir="." default="subant">
+
+ <!--load environment variables prefixed with env -->
+ <property environment="env"/>
+
+ <!--location of property file -->
+ <property file="${basedir}/../build.properties" description="Properties for Ant On AIR project" />
+
+ <!--
+ Properties are immutable so value frozen first time property is set.
+ If FLEX_HOME is not set with -DFLEX_HOME=/path/to/flex/sdk on the ant command line
+ use the environment variable, if it exists. Else if windows, use FLEX_HOME_WIN
+ else use FLEX_HOME_MAC, which are both defined in build.properties.
+ -->
+ <condition property="FLEX_HOME" value="${env.FLEX_HOME}">
+ <isset property="env.FLEX_HOME" />
+ </condition>
+
+ <target name="subant">
+ <fail message="This is a failure message." >
+ <condition>
+ <not>
+ <equals arg1="success" arg2="failure" />
+ </not>
+ </condition>
+ </fail>
+ </target>
+
+</project>
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/82da6289/ant_on_air/tests/failtest.xml
----------------------------------------------------------------------
diff --git a/ant_on_air/tests/failtest.xml b/ant_on_air/tests/failtest.xml
new file mode 100644
index 0000000..74f0dcb
--- /dev/null
+++ b/ant_on_air/tests/failtest.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+
+<project name="ant_on_air_failure_test" basedir="." default="test">
+
+ <!--load environment variables prefixed with env -->
+ <property environment="env"/>
+
+ <!--location of property file -->
+ <property file="${basedir}/../build.properties" description="Properties for Ant On AIR project" />
+
+ <!--
+ Properties are immutable so value frozen first time property is set.
+ If FLEX_HOME is not set with -DFLEX_HOME=/path/to/flex/sdk on the ant command line
+ use the environment variable, if it exists. Else if windows, use FLEX_HOME_WIN
+ else use FLEX_HOME_MAC, which are both defined in build.properties.
+ -->
+ <condition property="FLEX_HOME" value="${env.FLEX_HOME}">
+ <isset property="env.FLEX_HOME" />
+ </condition>
+
+ <condition property="theOS" value="Windows">
+ <os family="windows"/>
+ </condition>
+ <condition property="theOS" value="Mac">
+ <os family="mac"/>
+ </condition>
+ <condition property="isMac" value="Mac">
+ <os family="mac"/>
+ </condition>
+ <condition property="isWindows" value="Windows">
+ <os family="windows"/>
+ </condition>
+
+ <target name="test">
+ <ant dir="${basedir}" antfile="failsubant.xml" />
+ <echo>Test is complete</echo>
+ </target>
+
+</project>