ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r1095222 - in /ant/core/trunk/src: etc/testcases/taskdefs/exec/blabla.sh etc/testcases/taskdefs/exec/blabla.xml etc/testcases/taskdefs/exec/exec.xml tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java
Date Tue, 19 Apr 2011 21:45:54 GMT
Author: antoine
Date: Tue Apr 19 21:45:54 2011
New Revision: 1095222

URL: http://svn.apache.org/viewvc?rev=1095222&view=rev
Log:
creating test for bugrep 50507 Exec task may mix the stderr and stdout output while logging
it

Added:
    ant/core/trunk/src/etc/testcases/taskdefs/exec/blabla.sh
    ant/core/trunk/src/etc/testcases/taskdefs/exec/blabla.xml
Modified:
    ant/core/trunk/src/etc/testcases/taskdefs/exec/exec.xml
    ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java

Added: ant/core/trunk/src/etc/testcases/taskdefs/exec/blabla.sh
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/etc/testcases/taskdefs/exec/blabla.sh?rev=1095222&view=auto
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/exec/blabla.sh (added)
+++ ant/core/trunk/src/etc/testcases/taskdefs/exec/blabla.sh Tue Apr 19 21:45:54 2011
@@ -0,0 +1,24 @@
+# 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.
+echo "some blablablablablablablablablablablabla error message" err>&2
+echo "some blablablablablablablablablablablabla info message" out
+echo "some blablablablablablablablablablablabla error message" err>&2
+echo "some blablablablablablablablablablablabla info message" out
+echo "some blablablablablablablablablablablabla error message" err>&2
+echo "some blablablablablablablablablablablabla info message" out
+echo "some blablablablablablablablablablablabla error message" err>&2
+echo "some blablablablablablablablablablablabla info message" out
+echo "some blablablablablablablablablablablabla error message" err>&2
+echo "some blablablablablablablablablablablabla info message" out

Added: ant/core/trunk/src/etc/testcases/taskdefs/exec/blabla.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/etc/testcases/taskdefs/exec/blabla.xml?rev=1095222&view=auto
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/exec/blabla.xml (added)
+++ ant/core/trunk/src/etc/testcases/taskdefs/exec/blabla.xml Tue Apr 19 21:45:54 2011
@@ -0,0 +1,19 @@
+<project name="blabla" default="doit">
+   <target name="blabla">
+        <exec executable="sh">
+            <arg value="blabla.sh" />
+        </exec>
+   </target>
+   <target name="doit">
+   <antcall target="blabla"/>
+   <antcall target="blabla"/>
+   <antcall target="blabla"/>
+   <antcall target="blabla"/>
+   <antcall target="blabla"/>
+   <antcall target="blabla"/>
+   <antcall target="blabla"/>
+   <antcall target="blabla"/>
+   <antcall target="blabla"/>
+   <antcall target="blabla"/>
+   </target>
+</project>

Modified: ant/core/trunk/src/etc/testcases/taskdefs/exec/exec.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/etc/testcases/taskdefs/exec/exec.xml?rev=1095222&r1=1095221&r2=1095222&view=diff
==============================================================================
--- ant/core/trunk/src/etc/testcases/taskdefs/exec/exec.xml (original)
+++ ant/core/trunk/src/etc/testcases/taskdefs/exec/exec.xml Tue Apr 19 21:45:54 2011
@@ -20,12 +20,15 @@
         <!-- this property can be overriden programatically in the Java test case -->
         <property name="timeToWait" value="10"/>
         <!-- this property can be overriden programatically in the Java test case -->
-        <property name="logFile" value="${java.io.tmpdir}/spawn.log"/>
+        <property name="output" location="${java.io.tmpdir}/testoutput"/>
+        <mkdir dir="${output}"/>
+        <property name="logFile" value="${output}/spawn.log"/>
         <property environment="env"/>
         <!-- UNIX -->
         <available file="sh" filepath="${env.PATH}" property="sh.executable"/>
         <!-- CYGWIN -->
         <available file="sh.exe" filepath="${env.PATH}" property="sh.exe.executable"/>
+        <property name="test.can.run" value="1"/>
         <condition property="test.can.run">
             <or>
                 <isset property="sh.executable"/>
@@ -42,7 +45,25 @@
         </exec>
     </target>
 
+    <target name="test-out-and-err" description="see https://issues.apache.org/bugzilla/show_bug.cgi?id=50507"
depends="init" if="test.can.run">
+        <mkdir dir="${output}" />
+        <ant antfile="blabla.xml" output="${output}/test-out-and-err.txt">
+        </ant>
+        <loadfile srcfile="${output}/test-out-and-err.txt" property="test-out-and-err">
+            <filterchain>
+                <replaceregex pattern="^\s*\[exec\] some blablablablablablablablablablablabla
error message err$" flags="m" />
+                <replaceregex pattern="^\s*\[exec\] some blablablablablablablablablablablabla
info message out$" flags="m" />
+            </filterchain>
+        </loadfile>
+        <echo>${test-out-and-err}</echo>
+        <fail message="output indicates a mixup of out and err">
+            <condition>
+                <contains string="${test-out-and-err}" substring="[exec]" />
+            </condition>
+        </fail>
+
+    </target>
+
     <target name="cleanup">
-        <delete file="${logFile}" />
     </target>
 </project>

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java?rev=1095222&r1=1095221&r2=1095222&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java (original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ExecTaskTest.java Tue Apr
19 21:45:54 2011
@@ -103,6 +103,10 @@ public class ExecTaskTest extends BuildF
         logFile = new File(logFile.getAbsolutePath());
         assertTrue("log file found after spawn", logFile.exists());
     }
+    
+    public void testOutAndErr() {
+        project.executeTarget("test-out-and-err");
+    }
 
     private static class MonitoredBuild implements Runnable {
         private Thread worker;



Mime
View raw message