Parcourir la source

HDFS-584. Fail the fault-inject build if any advices are mis-bound. Contributed by Konstantin Boudnik

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hdfs/trunk@829258 13f79535-47bb-0310-9956-ffa450edef68
Konstantin Boudnik il y a 15 ans
Parent
commit
768aabe659
2 fichiers modifiés avec 20 ajouts et 2 suppressions
  1. 2 0
      CHANGES.txt
  2. 18 2
      build.xml

+ 2 - 0
CHANGES.txt

@@ -311,6 +311,8 @@ Release 0.21.0 - Unreleased
 
 
     HDFS-616. Create functional tests for new design of the block report. (cos)
     HDFS-616. Create functional tests for new design of the block report. (cos)
     
     
+    HDFS-584. Fail the fault-inject build if any advices are mis-bound. (cos)
+    
   BUG FIXES
   BUG FIXES
 
 
     HDFS-76. Better error message to users when commands fail because of 
     HDFS-76. Better error message to users when commands fail because of 

+ 18 - 2
build.xml

@@ -307,6 +307,7 @@
   	Later on one can run 'ant jar-fault-inject' to create
   	Later on one can run 'ant jar-fault-inject' to create
   	Hadoop jar file with instrumented classes
   	Hadoop jar file with instrumented classes
   -->
   -->
+  <property name="compile-inject.output" value="${build-fi.dir}/compile-fi.log"/>
   <target name="compile-fault-inject" depends="compile-core, compile-hdfs-test">
   <target name="compile-fault-inject" depends="compile-core, compile-hdfs-test">
     <!-- AspectJ task definition -->
     <!-- AspectJ task definition -->
     <taskdef
     <taskdef
@@ -327,11 +328,26 @@
       deprecation="${javac.deprecation}">
       deprecation="${javac.deprecation}">
       <classpath refid="test.classpath"/>
       <classpath refid="test.classpath"/>
     </iajc>
     </iajc>
+    <loadfile property="injection.failure" srcfile="${compile-inject.output}">
+      <filterchain>
+        <linecontainsregexp>
+          <regexp pattern='iajc.*warning'/>
+        </linecontainsregexp>
+      </filterchain>
+    </loadfile>
+    <fail if="injection.failure">
+      Broken binding of advises: ${line.separator}${injection.failure}
+    </fail>
     <echo message="Weaving of aspects is finished"/>
     <echo message="Weaving of aspects is finished"/>
   </target>
   </target>
 
 
-  <target name="injectfaults" description="Instrument HDFS classes with faults and other AOP advices">
-    <subant buildpath="${basedir}" target="compile-fault-inject">
+  <target name="injectfaults"
+          description="Instrument HDFS classes with faults and other AOP advices">
+    <!--mkdir to prevent <subant> failure in case the folder has been removed-->
+    <mkdir dir="${build-fi.dir}"/>
+    <delete file="${compile-inject.output}"/>
+    <subant buildpath="${basedir}" target="compile-fault-inject"
+            output="${compile-inject.output}">
       <property name="build.dir" value="${build-fi.dir}"/>
       <property name="build.dir" value="${build-fi.dir}"/>
     </subant>
     </subant>
   </target>
   </target>