Skip to content

Apache Lucene open-source search software

LUCENE-1769: Improve clover analysis and separate core / bw tests. Also verify that assertions are enabled.

Uwe Schindler1658315c3552
diff --git a/build.xml b/build.xml
index 05d1246164d..eb5cbd9123b 100644
--- a/build.xml
+++ b/build.xml
@@ -134,7 +134,8 @@
<!-- run tag tests against trunk jar -->
<test-macro dataDir="${tags.dir}/${tag}/src/test"
tempDir="${build.dir}/${tag}"
- junit.classpath="tag.junit.classpath"/>
+ junit.classpath="tag.junit.classpath"
+ junit.output.dir="${junit.output.dir.tag}" />
</sequential>
</target>
diff --git a/common-build.xml b/common-build.xml
index 9705f2a3a9f..632aec463b6 100644
--- a/common-build.xml
+++ b/common-build.xml
@@ -95,7 +95,9 @@
<property name="jflex.home" location="${common.dir}"/>
<property name="junit.output.dir" location="${build.dir}/test"/>
+ <property name="junit.output.dir.tag" location="${build.dir}/bw-test"/>
<property name="junit.reports" location="${build.dir}/test/reports"/>
+ <property name="junit.reports.tag" location="${build.dir}/bw-test/reports"/>
<property name="junit.includes" value="**/Test*.java,**/*Test.java"/>
<property name="junit.excludes" value=""/>
@@ -507,16 +509,22 @@
<fileset dir="src/test" id="clover.test.src.files">
<include name="**/*.java" />
</fileset>
+ <fileset dir="${build.dir}" id="clover.test.result.files">
+ <include name="**/test/TEST-*.xml" />
+ <!-- do not include BW tests -->
+ </fileset>
<clover-report>
<current outfile="${clover.report.dir}" title="${final.name}">
<format type="html"/>
<testsources refid="clover.test.src.files"/>
<testsources refid="clover.contrib.test.src.files"/>
+ <testresults refid="clover.test.result.files"/>
</current>
<current outfile="${clover.report.dir}/clover.xml" title="${final.name}">
<format type="xml"/>
<testsources refid="clover.test.src.files"/>
<testsources refid="clover.contrib.test.src.files"/>
+ <testresults refid="clover.test.result.files"/>
</current>
</clover-report>
</target>
@@ -532,6 +540,17 @@
</fileset>
<report format="frames" todir="${junit.reports}"/>
</junitreport>
+
+ <mkdir dir="${junit.reports.tag}"/>
+ <junitreport todir="${junit.output.dir.tag}">
+ <!-- this fileset let's the task work for individual contribs,
+ as well as the project as a whole
+ -->
+ <fileset dir="${build.dir}">
+ <include name="**/bw-test/TEST-*.xml"/>
+ </fileset>
+ <report format="frames" todir="${junit.reports.tag}"/>
+ </junitreport>
</target>
<target name="jar" depends="jar-core">
diff --git a/src/test/org/apache/lucene/TestAssertions.java b/src/test/org/apache/lucene/TestAssertions.java
new file mode 100644
index 00000000000..4ae4f975d73
--- /dev/null
+++ b/src/test/org/apache/lucene/TestAssertions.java
@@ -0,0 +1,32 @@
+package org.apache.lucene;
+
+/**
+ * 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.
+ */
+
+import org.apache.lucene.util.LuceneTestCase;
+
+public class TestAssertions extends LuceneTestCase {
+
+ public void test() {
+ try {
+ assert Boolean.FALSE.booleanValue();
+ fail("assertions are not enabled!");
+ } catch (AssertionError e) {
+ }
+ }
+
+}