HBASE-13611 update clover profile to work with clover 4.x and maven 3.
* change pom to use a maven 3 compat version of clover * add clover to javadoc plugin deps so that instrumented doclet works * modify IA annotation test to filter out clover instrumentation * make splitlog counters check for atomiclong before casting
This commit is contained in:
parent
8e5a183256
commit
9aeafe30b7
|
@ -198,6 +198,29 @@ public class TestInterfaceAudienceAnnotations {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects classes that appear to be source instrumentation from Clover.
|
||||||
|
* Clover generates instrumented code in order to calculate coverage. Part of the
|
||||||
|
* generated source is a static inner class on each source class.
|
||||||
|
*
|
||||||
|
* - has an enclosing class
|
||||||
|
* - enclosing class is not an interface
|
||||||
|
* - name starts with "__CLR"
|
||||||
|
*/
|
||||||
|
class CloverInstrumentationFilter implements ClassFinder.ClassFilter {
|
||||||
|
@Override
|
||||||
|
public boolean isCandidateClass(Class<?> clazz) {
|
||||||
|
boolean clover = false;
|
||||||
|
final Class<?> enclosing = clazz.getEnclosingClass();
|
||||||
|
if (enclosing != null) {
|
||||||
|
if (!(enclosing.isInterface())) {
|
||||||
|
clover = clazz.getSimpleName().startsWith("__CLR");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return clover;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether all the classes in client and common modules contain
|
* Checks whether all the classes in client and common modules contain
|
||||||
* {@link InterfaceAudience} annotations.
|
* {@link InterfaceAudience} annotations.
|
||||||
|
@ -212,6 +235,7 @@ public class TestInterfaceAudienceAnnotations {
|
||||||
// NOT test classes
|
// NOT test classes
|
||||||
// AND NOT generated classes
|
// AND NOT generated classes
|
||||||
// AND are NOT annotated with InterfaceAudience
|
// AND are NOT annotated with InterfaceAudience
|
||||||
|
// AND are NOT from Clover rewriting sources
|
||||||
ClassFinder classFinder = new ClassFinder(
|
ClassFinder classFinder = new ClassFinder(
|
||||||
new MainCodeResourcePathFilter(),
|
new MainCodeResourcePathFilter(),
|
||||||
new Not((FileNameFilter)new TestFileNameFilter()),
|
new Not((FileNameFilter)new TestFileNameFilter()),
|
||||||
|
@ -219,7 +243,8 @@ public class TestInterfaceAudienceAnnotations {
|
||||||
new Not(new TestClassFilter()),
|
new Not(new TestClassFilter()),
|
||||||
new Not(new GeneratedClassFilter()),
|
new Not(new GeneratedClassFilter()),
|
||||||
new Not(new IsInterfaceStabilityClassFilter()),
|
new Not(new IsInterfaceStabilityClassFilter()),
|
||||||
new Not(new InterfaceAudienceAnnotatedClassFilter()))
|
new Not(new InterfaceAudienceAnnotatedClassFilter()),
|
||||||
|
new Not(new CloverInstrumentationFilter()))
|
||||||
);
|
);
|
||||||
|
|
||||||
Set<Class<?>> classes = classFinder.findClasses(false);
|
Set<Class<?>> classes = classFinder.findClasses(false);
|
||||||
|
|
|
@ -88,7 +88,10 @@ public class SplitLogCounters {
|
||||||
public static void resetCounters() throws Exception {
|
public static void resetCounters() throws Exception {
|
||||||
Class<?> cl = SplitLogCounters.class;
|
Class<?> cl = SplitLogCounters.class;
|
||||||
for (Field fld : cl.getDeclaredFields()) {
|
for (Field fld : cl.getDeclaredFields()) {
|
||||||
if (!fld.isSynthetic()) ((AtomicLong)fld.get(null)).set(0);
|
/* Guard against source instrumentation. */
|
||||||
|
if ((!fld.isSynthetic()) && (AtomicLong.class.isAssignableFrom(fld.getType()))) {
|
||||||
|
((AtomicLong)fld.get(null)).set(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
22
pom.xml
22
pom.xml
|
@ -1166,7 +1166,7 @@
|
||||||
<zookeeper.version>3.4.6</zookeeper.version>
|
<zookeeper.version>3.4.6</zookeeper.version>
|
||||||
<slf4j.version>1.7.7</slf4j.version>
|
<slf4j.version>1.7.7</slf4j.version>
|
||||||
<hadoop-snappy.version>0.0.1-SNAPSHOT</hadoop-snappy.version>
|
<hadoop-snappy.version>0.0.1-SNAPSHOT</hadoop-snappy.version>
|
||||||
<clover.version>2.6.3</clover.version>
|
<clover.version>4.0.3</clover.version>
|
||||||
<jamon-runtime.version>2.3.1</jamon-runtime.version>
|
<jamon-runtime.version>2.3.1</jamon-runtime.version>
|
||||||
<jettison.version>1.3.3</jettison.version>
|
<jettison.version>1.3.3</jettison.version>
|
||||||
<netty.version>4.0.23.Final</netty.version>
|
<netty.version>4.0.23.Final</netty.version>
|
||||||
|
@ -2572,9 +2572,8 @@
|
||||||
<!-- Profile for running clover. You need to have a clover license under ~/.clover.license for ${clover.version}
|
<!-- Profile for running clover. You need to have a clover license under ~/.clover.license for ${clover.version}
|
||||||
or you can provide the license with -Dmaven.clover.licenseLocation=/path/to/license. Committers can find
|
or you can provide the license with -Dmaven.clover.licenseLocation=/path/to/license. Committers can find
|
||||||
the license under https://svn.apache.org/repos/private/committers/donated-licenses/clover/
|
the license under https://svn.apache.org/repos/private/committers/donated-licenses/clover/
|
||||||
Note that clover 2.6.3 does not run with maven 3, so you have to use maven2. The report will be generated
|
The report will be generated under target/site/clover/index.html when you run
|
||||||
under target/site/clover/index.html when you run
|
MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=512m" mvn clean package -Pclover site -->
|
||||||
MAVEN_OPTS=-Xmx2048m mvn clean test -Pclover site -->
|
|
||||||
<profile>
|
<profile>
|
||||||
<id>clover</id>
|
<id>clover</id>
|
||||||
<activation>
|
<activation>
|
||||||
|
@ -2585,10 +2584,23 @@
|
||||||
</activation>
|
</activation>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.clover.licenseLocation>${user.home}/.clover.license</maven.clover.licenseLocation>
|
<maven.clover.licenseLocation>${user.home}/.clover.license</maven.clover.licenseLocation>
|
||||||
<clover.version>2.6.3</clover.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<!-- When Clover is active, we need to add it as a dependency for the javadoc plugin, or
|
||||||
|
our instrumented classes for the doclet will fail
|
||||||
|
-->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.atlassian.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-clover2-plugin</artifactId>
|
||||||
|
<version>${clover.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.atlassian.maven.plugins</groupId>
|
<groupId>com.atlassian.maven.plugins</groupId>
|
||||||
<artifactId>maven-clover2-plugin</artifactId>
|
<artifactId>maven-clover2-plugin</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue