Merge to trunk r1210134

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3606@1210161 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2011-12-04 18:01:31 +00:00
commit da76086430
13 changed files with 201 additions and 46 deletions

View File

@ -669,6 +669,34 @@ Bug fixes
to correctly respect deletions on reopened SegmentReaders. Factored out
FieldCacheDocIdSet to be a top-level class. (Uwe Schindler, Simon Willnauer)
Build
* LUCENE-3228: Stop downloading external javadoc package-list files:
- Added package-list files for Oracle Java javadocs and JUnit javadocs to
Lucene/Solr subversion.
- The Oracle Java javadocs package-list file is excluded from Lucene and
Solr source release packages.
- Regardless of network connectivity, javadocs built from a subversion
checkout contain links to Oracle & JUnit javadocs.
- Building javadocs from a source release package will download the Oracle
Java package-list file if it isn't already present.
- When the Oracle Java package-list file is not present and download fails,
the javadocs targets will not fail the build, though an error will appear
in the build log. In this case, the built javadocs will not contain links
to Oracle Java javadocs.
- Links from Solr javadocs to Lucene's javadocs are enabled. When building
a X.Y.Z-SNAPSHOT version, the links are to the most recently built nightly
Jenkins javadocs. When building a release version, links are to the
Lucene release javadocs for the same version.
(Steve Rowe, hossman)
======================= Lucene 3.5.0 =======================
Changes in backwards compatibility policy

View File

@ -249,6 +249,7 @@
<sources>
<!-- TODO: find a dynamic way to do include multiple source roots -->
<packageset dir="src/java"/>
<packageset dir="src/test-framework/java"/>
<!-- please keep this list up to date, and in alpha order... -->
@ -377,6 +378,10 @@
value="${dist.dir}/lucene-${version}-src.tgz"/>
<delete file="${source.package.file}"/>
<svn-export-source source.dir="."/>
<!-- Exclude javadoc package-list files under licenses incompatible with the ASL -->
<delete dir="${svn.export.dir}/src/tools/javadoc/java6"/>
<build-changes changes.src.dir="${svn.export.dir}/src/site/changes"
changes.target.dir="${svn.export.dir}/docs/changes"/>
<tar tarfile="${source.package.file}" compression="gzip" longfile="gnu">
@ -567,6 +572,8 @@
title="${Name} ${version} Test Framework API">
<sources>
<packageset dir="src/test-framework/java"/>
<link offline="true" href="${javadoc.link.junit}"
packagelistLoc="${javadoc.packagelist.dir}/junit"/>
<link href=""/>
</sources>
</invoke-javadoc>

View File

@ -94,10 +94,13 @@
<property name="tests.seed" value="random" />
<property name="tests.loggingfile" value="/dev/null"/>
<property name="tests.nightly" value="false" />
<property name="tests.weekly" value="false" />
<property name="tests.slow" value="false" />
<property name="tests.cleanthreads.sysprop" value="perMethod"/>
<property name="tests.asserts.gracious" value="false"/>
<property name="tests.verbose" value="false"/>
<property name="tests.infostream" value="${tests.verbose}"/>
<property name="tests.heapsize" value="512M"/>
<property name="javac.deprecation" value="off"/>
<property name="javac.debug" value="on"/>
@ -110,6 +113,9 @@
<property name="javac.includeAntRuntime" value="${run.clover}"/>
<property name="javadoc.link" value="http://download.oracle.com/javase/6/docs/api/"/>
<property name="javadoc.link.junit" value="http://junit.sourceforge.net/javadoc/"/>
<property name="javadoc.packagelist.dir" value="${common.dir}/src/tools/javadoc"/>
<available file="${javadoc.packagelist.dir}/java6/package-list" property="javadoc.java6.packagelist.exists"/>
<property name="javadoc.access" value="protected"/>
<property name="javadoc.charset" value="utf-8"/>
<property name="javadoc.dir" value="${common.dir}/build/docs/api"/>
@ -524,8 +530,10 @@
<attribute name="tempDir" default="${build.dir}/test"/>
<attribute name="threadNum" default="1"/>
<attribute name="threadTotal" default="1"/>
<attribute name="tests.nightly" default="${tests.nightly}"/>
<attribute name="tests.multiplier" default="${tests.multiplier}"/>
<attribute name="tests.nightly" default="${tests.nightly}"/>
<attribute name="tests.weekly" default="${tests.weekly}"/>
<attribute name="tests.slow" default="${tests.slow}"/>
<attribute name="tests.multiplier" default="${tests.multiplier}"/>
<sequential>
<condition property="runall">
@ -539,7 +547,7 @@
This is very loud and obnoxious. abuse touch instead for a "quiet" mkdir
-->
<touch file="@{tempDir}/@{threadNum}/quiet.ant" verbose="false" mkdirs="true"/>
<junit printsummary="off" haltonfailure="no" maxmemory="512M" tempdir="@{tempDir}/@{threadNum}"
<junit printsummary="off" haltonfailure="no" maxmemory="${tests.heapsize}" tempdir="@{tempDir}/@{threadNum}"
errorProperty="tests.failed" failureProperty="tests.failed" forkmode="perBatch" dir="@{tempDir}/@{threadNum}">
<classpath refid="@{junit.classpath}"/>
<assertions>
@ -581,6 +589,10 @@
<sysproperty key="java.util.logging.config.file" value="${tests.loggingfile}"/>
<!-- set whether or not nightly tests should run -->
<sysproperty key="tests.nightly" value="@{tests.nightly}"/>
<!-- set whether or not weekly tests should run -->
<sysproperty key="tests.weekly" value="@{tests.weekly}"/>
<!-- set whether or not slow tests should run -->
<sysproperty key="tests.slow" value="@{tests.slow}"/>
<!-- set whether tests framework should not require java assertions enabled -->
<sysproperty key="tests.asserts.gracious" value="${tests.asserts.gracious}"/>
@ -843,6 +855,7 @@
<attribute name="title" default="${Name} ${version} API"/>
<attribute name="overview" default="${src.dir}/overview.html"/>
<sequential>
<antcall target="download-java6-javadoc-packagelist"/>
<copy todir="@{destdir}" file="${prettify.dir}/prettify.js" overwrite="false" />
<copy todir="@{destdir}" file="${prettify.dir}/prettify.css" overwrite="false" />
<record name="@{destdir}/log_javadoc.txt" action="start" append="no"/>
@ -859,7 +872,6 @@
use="true"
failonerror="true"
source="${ant.java.version}"
link="${javadoc.link}"
windowtitle="${Name} ${version} API"
doctitle="@{title}"
stylesheetfile="${prettify.dir}/stylesheet+prettify.css"
@ -870,6 +882,7 @@
<tag name="lucene.internal"
description="NOTE: This API is for internal purposes only and might change in incompatible ways in the next release."/>
<link offline="true" packagelistLoc="${javadoc.dir}"/>
<link offline="true" href="${javadoc.link}" packagelistLoc="${javadoc.packagelist.dir}/java6"/>
<header><![CDATA[
<script src="{@docRoot}/prettify.js" type="text/javascript"></script>
<script language="JavaScript">window.onload=function(){windowTitle();prettyPrint();}</script>
@ -920,6 +933,12 @@
</sequential>
</macrodef>
<target name="download-java6-javadoc-packagelist" unless="javadoc.java6.packagelist.exists">
<mkdir dir="${javadoc.packagelist.dir}/java6"/>
<get src="${javadoc.link}/package-list"
dest="${javadoc.packagelist.dir}/java6/package-list" ignoreerrors="true"/>
</target>
<!-- VALIDATION work -->
<target name="check-legal-lucene" depends="compile-tools">
@ -1028,6 +1047,7 @@
<fileset dir="@{artifacts.dir}">
<include name="**/*.jar"/>
<include name="**/*.war"/>
<include name="**/*.zip"/>
<include name="**/*.tgz"/>
<include name="**/*.pom"/>

View File

@ -83,8 +83,6 @@ Bug Fixes
======================= Lucene 3.6.0 ================
(No Changes)
Bug Fixes
* LUCENE-3600: BlockJoinQuery now supports parent docs that have no
@ -217,7 +215,7 @@ New Features
added support for simple numeric queries, such as <age:4>, in contrib
query parser (Vinicius Barros via Uwe Schindler)
Changes in runtime behavior:
Changes in runtime behavior
* LUCENE-1768: StandardQueryConfigHandler now uses NumericFieldConfigListener
to set a NumericConfig to its corresponding FieldConfig;

View File

@ -662,7 +662,7 @@ class DirectoryReader extends IndexReader implements Cloneable {
segmentInfos.setUserData(commitUserData);
// Default deleter (for backwards compatibility) is
// KeepOnlyLastCommitDeleter:
// nocommit: Decide what to do with InfoStream here? Use default or keep NO_OUTPUT?
// TODO: Decide what to do with InfoStream here? Use default or keep NO_OUTPUT?
IndexFileDeleter deleter = new IndexFileDeleter(directory,
deletionPolicy == null ? new KeepOnlyLastCommitDeletionPolicy() : deletionPolicy,
segmentInfos, InfoStream.NO_OUTPUT, null);

View File

@ -148,8 +148,12 @@ public abstract class LuceneTestCase extends Assert {
public static final int TEST_ITER_MIN = Integer.parseInt(System.getProperty("tests.iter.min", Integer.toString(TEST_ITER)));
/** Get the random seed for tests */
public static final String TEST_SEED = System.getProperty("tests.seed", "random");
/** whether or not nightly tests should run */
/** whether or not @nightly tests should run */
public static final boolean TEST_NIGHTLY = Boolean.parseBoolean(System.getProperty("tests.nightly", "false"));
/** whether or not @weekly tests should run */
public static final boolean TEST_WEEKLY = Boolean.parseBoolean(System.getProperty("tests.weekly", "false"));
/** whether or not @slow tests should run */
public static final boolean TEST_SLOW = Boolean.parseBoolean(System.getProperty("tests.slow", "false"));
/** the line file used by LineFileDocs */
public static final String TEST_LINE_DOCS_FILE = System.getProperty("tests.linedocsfile", "europarl.lines.txt.gz");
/** whether or not to clean threads between test invocations: "false", "perMethod", "perClass" */
@ -1349,6 +1353,22 @@ public abstract class LuceneTestCase extends Assert {
@Retention(RetentionPolicy.RUNTIME)
public @interface Nightly {}
/**
* Annotation for tests that should only be run during weekly builds
*/
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
public @interface Weekly{}
/**
* Annotation for tests that are slow and should be run only when specifically asked to run
*/
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
public @interface Slow{}
/**
* Annotation for test classes that should only use codecs that are not memory expensive (avoid SimpleText, MemoryCodec).
*/

View File

@ -17,6 +17,7 @@ package org.apache.lucene.util;
* limitations under the License.
*/
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
@ -26,6 +27,8 @@ import java.util.List;
import java.util.Random;
import org.apache.lucene.util.LuceneTestCase.Nightly;
import org.apache.lucene.util.LuceneTestCase.Weekly;
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.lucene.util.LuceneTestCase.UseNoMemoryExpensiveCodec;
import org.junit.Ignore;
import org.junit.Test;
@ -45,8 +48,11 @@ import static org.apache.lucene.util.LuceneTestCase.TEST_ITER_MIN;
import static org.apache.lucene.util.LuceneTestCase.TEST_METHOD;
import static org.apache.lucene.util.LuceneTestCase.TEST_SEED;
import static org.apache.lucene.util.LuceneTestCase.TEST_NIGHTLY;
import static org.apache.lucene.util.LuceneTestCase.TEST_WEEKLY;
import static org.apache.lucene.util.LuceneTestCase.TEST_SLOW;
import static org.apache.lucene.util.LuceneTestCase.VERBOSE;
/** optionally filters the tests to be run by TEST_METHOD */
public class LuceneTestCaseRunner extends BlockJUnit4ClassRunner {
private List<FrameworkMethod> testMethods;
@ -89,27 +95,13 @@ public class LuceneTestCaseRunner extends BlockJUnit4ClassRunner {
}
if (TEST_NIGHTLY == false) {
if (getTestClass().getJavaClass().isAnnotationPresent(Nightly.class)) {
/* the test class is annotated with nightly, remove all methods */
String className = getTestClass().getJavaClass().getSimpleName();
System.err.println("NOTE: Ignoring nightly-only test class '" + className + "'");
testMethods.clear();
} else {
/* remove all nightly-only methods */
for (int i = 0; i < testMethods.size(); i++) {
final FrameworkMethod m = testMethods.get(i);
if (m.getAnnotation(Nightly.class) != null) {
System.err.println("NOTE: Ignoring nightly-only test method '" + m.getName() + "'");
testMethods.remove(i--);
}
}
}
/* dodge a possible "no-runnable methods" exception by adding a fake ignored test */
if (testMethods.isEmpty()) {
try {
testMethods.add(new FrameworkMethod(LuceneTestCase.class.getMethod("alwaysIgnoredTestMethod")));
} catch (Exception e) { throw new RuntimeException(e); }
}
removeAnnotatedTests(Nightly.class, "@nightly");
}
if (TEST_WEEKLY == false) {
removeAnnotatedTests(Weekly.class, "@weekly");
}
if (TEST_SLOW == false) {
removeAnnotatedTests(Slow.class, "@slow");
}
// sort the test methods first before shuffling them, so that the shuffle is consistent
// across different implementations that might order the methods different originally.
@ -122,7 +114,31 @@ public class LuceneTestCaseRunner extends BlockJUnit4ClassRunner {
Collections.shuffle(testMethods, r);
return testMethods;
}
private void removeAnnotatedTests(Class<? extends Annotation> annotation, String userFriendlyName) {
if (getTestClass().getJavaClass().isAnnotationPresent(annotation)) {
/* the test class is annotated with the annotation, remove all methods */
String className = getTestClass().getJavaClass().getSimpleName();
System.err.println("NOTE: Ignoring " + userFriendlyName + " test class '" + className + "'");
testMethods.clear();
} else {
/* remove all methods with the annotation*/
for (int i = 0; i < testMethods.size(); i++) {
final FrameworkMethod m = testMethods.get(i);
if (m.getAnnotation(annotation) != null) {
System.err.println("NOTE: Ignoring " + userFriendlyName + " test method '" + m.getName() + "'");
testMethods.remove(i--);
}
}
}
/* dodge a possible "no-runnable methods" exception by adding a fake ignored test */
if (testMethods.isEmpty()) {
try {
testMethods.add(new FrameworkMethod(LuceneTestCase.class.getMethod("alwaysIgnoredTestMethod")));
} catch (Exception e) { throw new RuntimeException(e); }
}
}
@Override
protected void runChild(FrameworkMethod arg0, RunNotifier arg1) {
if (VERBOSE) {

View File

@ -41,11 +41,11 @@ import org.junit.Ignore;
// disk (but, should run successfully). Best to run w/
// -Dtests.codec=Standard, and w/ plenty of RAM, eg:
//
// ant compile-test
// ant test -Dtest.slow=true -Dtests.heapsize=8g
//
// java -server -Xmx8g -d64 -cp .:lib/junit-4.7.jar:./build/classes/test:./build/classes/test-framework:./build/classes/java -Dlucene.version=4.0-dev -Dtests.directory=MMapDirectory -DtempDir=build -ea org.junit.runner.JUnitCore org.apache.lucene.index.Test2BTerms
//
@LuceneTestCase.UseNoMemoryExpensiveCodec
public class Test2BTerms extends LuceneTestCase {
private final static int TOKEN_LEN = 10;
@ -140,13 +140,13 @@ public class Test2BTerms extends LuceneTestCase {
}
}
@Ignore("Takes ~4 hours to run on a fast machine!! And requires that you don't use PreFlex codec.")
@Slow
public void test2BTerms() throws IOException {
if ("Lucene3x".equals(Codec.getDefault().getName())) {
throw new RuntimeException("thist test cannot run with PreFlex codec");
throw new RuntimeException("this test cannot run with PreFlex codec");
}
System.out.println("Starting Test2B");
final long TERM_COUNT = ((long) Integer.MAX_VALUE) + 100000000;
final int TERMS_PER_DOC = _TestUtil.nextInt(random, 100000, 1000000);

View File

@ -36,6 +36,7 @@ public class FloatMagicTest extends LuceneTestCase {
for (int i = 0; i < floats.size(); i++) {
int4[i] = FloatMagic.toSortable(floats.get(i)) & 0xffffffffL;
/*
System.out.println(
String.format("raw %8s sortable %8s %8s numutils %8s %s",
Integer.toHexString(Float.floatToRawIntBits(floats.get(i))),
@ -43,6 +44,7 @@ public class FloatMagicTest extends LuceneTestCase {
Integer.toHexString(FloatMagic.unsignedOrderedToFloatBits(FloatMagic.toSortable(floats.get(i)))),
Integer.toHexString(NumericUtils.floatToSortableInt(floats.get(i))),
floats.get(i)));
*/
}
// Sort and compare. Should be identical order.
@ -52,10 +54,12 @@ public class FloatMagicTest extends LuceneTestCase {
backFromFixed.add(FloatMagic.fromSortable((int) int4[i]));
}
/*
for (int i = 0; i < int4.length; i++) {
System.out.println(
floats.get(i) + " " + FloatMagic.fromSortable((int) int4[i]));
}
*/
assertEquals(floats, backFromFixed);
}

View File

@ -87,8 +87,8 @@ public class TestSort extends LuceneTestCase {
File sorted = new File(tempDir, "sorted");
SortInfo sortInfo = sort.sort(unsorted, sorted);
System.out.println("Input size [MB]: " + unsorted.length() / (1024 * 1024));
System.out.println(sortInfo);
//System.out.println("Input size [MB]: " + unsorted.length() / (1024 * 1024));
//System.out.println(sortInfo);
assertFilesIdentical(golden, sorted);
return sortInfo;

View File

@ -305,6 +305,10 @@
value="${package.dir}/${fullnamever}-src.tgz"/>
<delete file="${source.package.file}" failonerror="false" />
<svn-export-source source.dir=".."/>
<!-- Exclude javadoc package-list files under licenses incompatible with the ASL -->
<delete dir="${svn.export.dir}/lucene/src/tools/javadoc/java6"/>
<tar destfile="${source.package.file}" compression="gzip" longfile="gnu">
<tarfileset dir="${svn.export.dir}"
prefix="${fullnamever}"
@ -430,8 +434,9 @@
<fileset dir="${common-solr.dir}/site" />
</copy>
</target>
<target name="javadocs-all" depends="prep-lucene-jars,javadocs-dep"
<target name="javadocs-all"
depends="prep-lucene-jars,javadocs-dep,lucene-javadocs-all,define-lucene-javadoc-url"
description="Generate javadoc for core, java client and contrib">
<sequential>
<mkdir dir="${dest}/docs/api"/>
@ -456,6 +461,8 @@
<invoke-javadoc destdir="${dest}/docs/api"
overview="core/src/java/overview.html">
<sources>
<link offline="true" href="${lucene.javadoc.url}"
packagelistloc="${common.dir}/build/docs/api/all/"/>
<packageset dir="core/src/java" />
<packageset dir="solrj/src/java" />
<packageset dir="contrib/analysis-extras/src/java"/>

View File

@ -25,6 +25,9 @@
<property name="Name" value="Solr" />
<property name="version" value="4.0-SNAPSHOT"/>
<condition property="version.contains.SNAPSHOT">
<contains casesensitive="true" string="${version}" substring="-SNAPSHOT"/>
</condition>
<property name="fullname" value="apache-${ant.project.name}"/>
<property name="fullnamever" value="${fullname}-${version}"/>
<property name="final.name" value="${fullnamever}"/>
@ -212,13 +215,19 @@
<copy file="${build.dir}/${fullnamever}.jar" todir="${dist}"/>
</target>
<target name="javadocs" depends="compile-core">
<target name="lucene-javadocs-all">
<ant dir="${common.dir}" target="javadocs-all" inheritall="false"/>
</target>
<target name="javadocs" depends="compile-core,lucene-javadocs-all,define-lucene-javadoc-url">
<sequential>
<mkdir dir="${javadoc.dir}"/>
<mkdir dir="${dest}/META-INF/"/>
<invoke-javadoc destdir="${javadoc.dir}"
title="${Name} ${version} ${name} API">
<sources>
<link offline="true" href="${lucene.javadoc.url}"
packagelistloc="${common.dir}/build/docs/api/all/"/>
<link href=""/>
<packageset dir="${src.dir}"/>
</sources>
@ -232,6 +241,26 @@
</sequential>
</target>
<target name="define-lucene-javadoc-url"
depends="define-lucene-javadoc-url-SNAPSHOT,define-lucene-javadoc-url-release"/>
<target name="define-lucene-javadoc-url-SNAPSHOT" if="version.contains.SNAPSHOT">
<property name="lucene.javadoc.url"
value="https://builds.apache.org/job/Lucene-3.x/javadoc/all/"/>
</target>
<target name="define-lucene-javadoc-url-release" unless="version.contains.SNAPSHOT">
<loadproperties>
<propertyresource name="version"/>
<filterchain>
<replaceregex pattern="[.]" replace="_" flags="g"/>
<prefixlines prefix="underscore.version="/>
</filterchain>
</loadproperties>
<property name="lucene.javadoc.url"
value="http://lucene.apache.org/java/${underscore.version}/api/all/"/>
</target>
<target name="jar-src" depends="init">
<jarify basedir="${src.dir}"
destfile="${build.dir}/${final.name}-src.jar"

View File

@ -39,11 +39,37 @@
</compile>
</target>
<target name="javadocs" depends="common-solr.javadocs">
<mkdir dir="${dest}/docs/api/test-framework"/>
<copy todir="${dest}/docs/api/test-framework">
<fileset dir="${javadoc.dir}"/>
</copy>
<!-- Override common-solr.javadocs to include a JUnit javadoc link -->
<!-- and to copy the built javadocs to ${dest}/docs/api/test-framework -->
<target name="javadocs"
depends="compile-core,lucene-javadocs-all,define-lucene-javadoc-url">
<sequential>
<mkdir dir="${javadoc.dir}"/>
<mkdir dir="${dest}/META-INF/"/>
<invoke-javadoc destdir="${javadoc.dir}"
title="${Name} ${version} ${name} API">
<sources>
<link offline="true" href="${lucene.javadoc.url}"
packagelistloc="${common.dir}/build/docs/api/all/"/>
<link offline="true" href="${lucene-javadoc-url}"
packagelistloc="${common.dir}/build/docs/api/all/"/>
<link offline="true" href="${javadoc.link.junit}"
packagelistLoc="${javadoc.packagelist.dir}/junit"/>
<link href=""/>
<packageset dir="${src.dir}"/>
</sources>
</invoke-javadoc>
<jarify basedir="${javadoc.dir}"
destfile="${build.dir}/${final.name}-javadoc.jar"
title="Apache Solr Search Server: ${ant.project.name}"
metainf.source.dir="${common-solr.dir}"
implementation.title="org.apache.solr"
spec.version="${solr.spec.version}"/>
<mkdir dir="${dest}/docs/api/test-framework"/>
<copy todir="${dest}/docs/api/test-framework">
<fileset dir="${javadoc.dir}"/>
</copy>
</sequential>
</target>
</project>