You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2007/06/26 19:46:41 UTC

svn commit: r550876 - in /harmony/enhanced/buildtest/branches/2.0/scripts: cc-exec-adaptor.xml framework.xml main.xml parameters.xml publisher.xml

Author: smishura
Date: Tue Jun 26 10:46:40 2007
New Revision: 550876

URL: http://svn.apache.org/viewvc?view=rev&rev=550876
Log:
Apply patch from HARMONY-3501 that improves mail status notifications

Modified:
    harmony/enhanced/buildtest/branches/2.0/scripts/cc-exec-adaptor.xml
    harmony/enhanced/buildtest/branches/2.0/scripts/framework.xml
    harmony/enhanced/buildtest/branches/2.0/scripts/main.xml
    harmony/enhanced/buildtest/branches/2.0/scripts/parameters.xml
    harmony/enhanced/buildtest/branches/2.0/scripts/publisher.xml

Modified: harmony/enhanced/buildtest/branches/2.0/scripts/cc-exec-adaptor.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/scripts/cc-exec-adaptor.xml?view=diff&rev=550876&r1=550875&r2=550876
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/scripts/cc-exec-adaptor.xml (original)
+++ harmony/enhanced/buildtest/branches/2.0/scripts/cc-exec-adaptor.xml Tue Jun 26 10:46:40 2007
@@ -121,41 +121,72 @@
             depends="define-ant-contrib"
             if="framework.parameters.usemail"
             unless="${suite.name}.parameters.run.skipped">
+        <!-- attach execution log file in case of failure -->
+        <if>
+            <and>
+                <isfalse value="${thisbuildsuccessful}"/>
+                <not><isset 
+                    property="framewrok.parameters.usemail.suppress.exelogs"/>
+                </not>
+                <not><isset 
+                    property="${suite.name}.parameters.mail.suppress.exelogs"/>
+                </not>
+                <available file="${cc.execution.log.file}"/>
+            </and>
+        <then>
+            <delete file="${temp.files.dir}/execution_log.zip" 
+                    failonerror="false"/>
+            <zip destfile="${temp.files.dir}/execution_log.zip">
+                <fileset file="${cc.execution.log.file}"/>
+            </zip>
+            <property name="mail.execution.log" 
+                 value="${temp.files.dir}/execution_log.zip"/>
+        </then>
+        </if>
 
-        <!-- set up mail message file (if it was defined by test suite) -->
-        <get-parameter-value
-            property="mail.message.file" 
-            parameter="${suite.name}.parameters.cc.message"/>
-        <!-- set up mail message summary file
-             (if it was defined by test suite) -->
-        <get-parameter-value
-            property="mail.summary.file" 
-            parameter="${suite.name}.parameters.cc.summary"/>
-        <!-- set up mail attachments -->
-        <get-parameter-value
-            property="mail.attach.files" 
-            parameter="${suite.name}.parameters.cc.attachs"/>
-
-        <!-- compose message from CC logs (it there is no mail.message.file) -->
-        <runtarget target="-compose-message-file"/>
+        <!-- compose message from CC logs (it there is no message file
+             provided by test suite) -->
+        <if>
+            <not>
+            <or>
+                <isset property="${suite.name}.parameters.cc.message"/>
+                <isset property="${suite.name}.parameters.mail.message"/>
+            </or>
+            </not>
+        <then>
+            <runtarget target="-compose-message-file"/>
+        </then>
+        </if>
 
         <!-- do mail notifiaction -->
         <ant dir="${scripts.dir}" 
              antfile="${scripts.dir}/publisher.xml" 
              target="publish"
              inheritAll="false">
-            <!-- if there are Test Suite specific 'to' and 'from' addresses
-                 use them for mailing -->
             <propertyset>
+                <!-- use test suite specific mail parameters -->
+                <propertyref prefix="${suite.name}.parameters.mail."/>
+                <globmapper from="${suite.name}.parameters.mail.*" to="mail.*"/>
+            </propertyset>
+            <propertyset>
+                <!-- use test suite specific cc parameters -->
                 <propertyref name="${suite.name}.parameters.cc.to"/>
                 <propertyref name="${suite.name}.parameters.cc.from"/>
-                <globmapper from="${suite.name}.parameters.cc.*" to="framework.parameters.usemail.*"/>
+                <propertyref name="${suite.name}.parameters.cc.message"/>
+                <propertyref name="${suite.name}.parameters.cc.summary"/>
+                <propertyref name="${suite.name}.parameters.cc.attachs"/>
+                <globmapper from="${suite.name}.parameters.cc.*" to="mail.*"/>
+            </propertyset>
+            <propertyset>
+                <!-- use framework defined cc parameters -->
+                <propertyref prefix="framework.parameters.usemail"/>
+                <globmapper from="framework.parameters.usemail*" to="mail*"/>
             </propertyset>
             <propertyset>
                 <propertyref name="thisbuildsuccessful"/>
                 <propertyref name="lastbuildsuccessful"/>
-                <propertyref regex="framework.parameters.*"/>
-                <propertyref regex="mail.*"/>
+                <propertyref regex="^framework.parameters.*"/>
+                <propertyref regex="^mail.*"/>
             </propertyset>
         </ant>
         
@@ -163,27 +194,16 @@
 
     <!-- compose message from CC logs -->
     <target name="-compose-message-file"
-            unless="mail.message.file">
+            unless="mail.message">
         <property name="cc.xsl.files.dir"
                   value="${ext.cc.location}/webapps/cruisecontrol/xsl"/>
-        <property name="mail.message.file"
+        <property name="mail.message"
                   value="${temp.files.dir}/${suite.name}-email-message.txt"/>
         <xslt basedir="${scripts.dir}/xslt"
               in="${logdir}/${logfile}"
               style="${scripts.dir}/xslt/br.xsl"
-              out="${mail.message.file}"
+              out="${mail.message}"
               classpath="${ext.xalan.location}:${ext.cc.location}/lib/serializer-2.7.0.jar"/>
     </target>
-
-    <!-- places the value of the parameter to the provided property -->
-    <macrodef name="get-parameter-value">
-        <attribute name="parameter"/>
-        <attribute name="property"/>
-        <sequential>
-            <condition property="@{property}" value="${@{parameter}}">
-                <isset property="@{parameter}"/>
-            </condition>
-        </sequential>
-    </macrodef>
 
 </project>

Modified: harmony/enhanced/buildtest/branches/2.0/scripts/framework.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/scripts/framework.xml?view=diff&rev=550876&r1=550875&r2=550876
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/scripts/framework.xml (original)
+++ harmony/enhanced/buildtest/branches/2.0/scripts/framework.xml Tue Jun 26 10:46:40 2007
@@ -171,7 +171,7 @@
 
     <target name="define-tasks" depends="define-ant-contrib"/>
 
-    <target name="define-ant-contrib">
+    <target name="define-ant-contrib" depends="load-depends">
         <!-- plug in the ANTCONTRIB -->
         <taskdef resource="net/sf/antcontrib/antlib.xml">
             <classpath>

Modified: harmony/enhanced/buildtest/branches/2.0/scripts/main.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/scripts/main.xml?view=diff&rev=550876&r1=550875&r2=550876
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/scripts/main.xml (original)
+++ harmony/enhanced/buildtest/branches/2.0/scripts/main.xml Tue Jun 26 10:46:40 2007
@@ -137,16 +137,22 @@
         />
         <ant antfile="${scripts.dir}/cc-exec-adaptor.xml">
             <property name="suite.name" value="test-mail"/>
-            <property name="test-mail.parameters.cc.from" value="Test-Mail@Test.Com"/>
-            <property name="test-mail.parameters.cc.summary" 
+            <property name="test-mail.parameters.mail.from" value="Test-Mail@Test.Com"/>
+            <property name="test-mail.parameters.cc.from" value="Test@Test.Com"/>
+            <property name="test-mail.parameters.mail.summary" 
                       value="${root.dir}/.summary.txt"/>
             <property name="test-mail.parameters.cc.message" 
                       value="${root.dir}/README.txt"/>
             <property name="test-mail.parameters.cc.attachs" 
                       value="${root.dir}/README.txt,${root.dir}/build.xml"/>
+            <property name="test-mail.parameters.mail.subject.suffix" 
+                      value=" (ignore this message)"/>
+            <property name="test-mail.parameters.mail.suppress.exelogs"
+                      value="true"/>
 
             <property name="mail.execution.status" value="TEST MAIL"/>
             <property name="framework.parameters.usemail.force" value="true"/>
+            <property name="thisbuildsuccessful" value="false"/>
         </ant>
     </target>
 

Modified: harmony/enhanced/buildtest/branches/2.0/scripts/parameters.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/scripts/parameters.xml?view=diff&rev=550876&r1=550875&r2=550876
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/scripts/parameters.xml (original)
+++ harmony/enhanced/buildtest/branches/2.0/scripts/parameters.xml Tue Jun 26 10:46:40 2007
@@ -46,6 +46,7 @@
             description="Do always notify Run Status or only when status is changed"
             value="true"/>
         <to description="E-Mail address to send notifications to"/>
+        <suppress.exelogs description="Define this property to suppress the execution logs publishing."/>
         <from description="E-Mail address to send notifications from"/>
         <subject.prefix 
             description="Subject prefix of E-Mail Notifications"

Modified: harmony/enhanced/buildtest/branches/2.0/scripts/publisher.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/buildtest/branches/2.0/scripts/publisher.xml?view=diff&rev=550876&r1=550875&r2=550876
==============================================================================
--- harmony/enhanced/buildtest/branches/2.0/scripts/publisher.xml (original)
+++ harmony/enhanced/buildtest/branches/2.0/scripts/publisher.xml Tue Jun 26 10:46:40 2007
@@ -19,15 +19,15 @@
                         Status Publisher Implementation
      ====================================================================== -->
 <project name="publisher" default="publish" basedir=".">
-
+    
     <!-- check whether we should send notification or not -->
     <condition property="do.mail">
         <and>
             <!-- if framework was configured to send notifications -->
-            <isset property="framework.parameters.usemail"/>
+            <isset property="mail"/>
             <or>
                 <!-- and it was configured to always notify about run status -->
-                <istrue value="${framework.parameters.usemail.always}"/>
+                <istrue value="${mail.always}"/>
                 <!-- or, in case of run-status change -->
                 <not>
                     <equals arg1="${thisbuildsuccessful}"
@@ -37,7 +37,7 @@
         </and>
     </condition>
     <condition property="do.mail">
-        <isset property="framework.parameters.usemail.force"/>
+        <isset property="mail.force"/>
     </condition>
 
     <condition property="mail.execution.status"
@@ -46,45 +46,65 @@
         <istrue value="${thisbuildsuccessful}"/>
     </condition>
 
+    <!-- architecture name -->
+    <condition property="mail.os.arch" value="x86">
+        <or>
+            <os arch="x86"/>
+            <os arch="i386"/>
+        </or>
+    </condition>
+    <condition property="mail.os.arch" value="x86_64">
+        <or>
+            <os arch="x86_64"/>
+            <os arch="amd64"/>
+            <os arch="em64t"/>
+        </or>
+    </condition>
+    <property name="mail.os.arch" value="${os.arch}"/>
+
+    <!-- compose subject line -->
+    <property name="mail.subject.suffix" value=""/>
     <property name="mail.subject.line"
-              value="${framework.parameters.usemail.subject.prefix} ${mail.execution.status} ${os.name} ${os.arch}: ${suite.name}"/>
+              value="${mail.subject.prefix} ${mail.execution.status} ${os.name} ${mail.os.arch}: ${suite.name}${mail.subject.suffix}"/>
 
     <!-- implement publisher interface -->
     <target name="publish" if="do.mail">
         <log message=""/>
         <log message="    Sending mail notification:"/>
-        <log message="        smtp: '${framework.parameters.usemail}'"/>
-        <log message="        to: '${framework.parameters.usemail.to}'"/>
-        <log message="        from: '${framework.parameters.usemail.from}'"/>
-        <log message="    Files to attach: ${mail.attach.files}"/>
+        <log message="        smtp: '${mail}'"/>
+        <log message="        to: '${mail.to}'"/>
+        <log message="        from: '${mail.from}'"/>
+        <log message="    Files to attach: ${mail.attachs}"/>
+        <log message="    Execution logs file: ${mail.execution.log}"/>
         <log message=""/>
 
         <trycatch property="mail.sending.exception">
         <try>
             <if>
-                <available file="${mail.summary.file}"/>
+                <available file="${mail.summary}"/>
             <then>
                 <!-- 'if' suppresses 'nonexistence' warning -->
-                <loadfile property="mail.summary" 
-                          srcFile="${mail.summary.file}" 
+                <loadfile property="mail.summary.content"
+                          srcFile="${mail.summary}"
                           failonerror="false"/>
             </then>
             </if>
-            <!-- summary by default -->
-            <property name="mail.summary" value=""/>
-            <loadfile property="mail.message" 
-                      srcFile="${mail.message.file}" 
+            <property name="mail.summary.content" value=""/>
+            <loadfile property="mail.message.content"
+                      srcFile="${mail.message}"
                       failonerror="false"/>
             <!-- empty message by default -->
-            <property name="mail.message" value=""/>
+            <property name="mail.message.content" value=""/>
+            <!-- no execution logs to send by default -->
+            <property name="mail.execution.log" value=""/> 
             <!-- no attachments by default -->
-            <property name="mail.attach.files" value=""/>
-            <mail mailhost="${framework.parameters.usemail}"
-                  tolist="${framework.parameters.usemail.to}"
-                  from="${framework.parameters.usemail.from}"
+            <property name="mail.attachs" value=""/>
+            <mail mailhost="${mail}"
+                  tolist="${mail.to}"
+                  from="${mail.from}"
                   subject="${mail.subject.line}"
-                  files="${mail.attach.files}">
-                <message>${mail.summary}${mail.message}</message>
+                  files="${mail.attachs},${mail.execution.log}">
+                <message>${mail.summary.content}${mail.message.content}</message>
             </mail>
         </try>
         <catch>
@@ -108,9 +128,9 @@
     <macrodef name="error-notify">
         <text name="text"/>
         <sequential>
-            <mail mailhost="${framework.parameters.usemail}"
-                  tolist="${framework.parameters.usemail.to}"
-                  from="${framework.parameters.usemail.from}"
+            <mail mailhost="${mail}"
+                  tolist="${mail.to}"
+                  from="${mail.from}"
                   subject="${mail.subject.line}">
                 <message>
 @{text}