LUCENE-8155: Add support for Java 9 in smoke tester

This commit is contained in:
Uwe Schindler 2018-02-09 18:45:10 +01:00
parent b6f683d30b
commit 1938631307
3 changed files with 59 additions and 9 deletions

View File

@ -603,13 +603,22 @@ File | Project Structure | Platform Settings | SDKs):
</subant> </subant>
</target> </target>
<target name="nightly-smoke" description="Builds an unsigned release and smoke tests it" <target name="-nightly-smoke-java9params" if="smokeTestRelease.java9">
depends="clean,resolve-groovy,resolve-markdown,install-maven-tasks"> <!-- convert path to UNIX style, so windows backslashes don't hurt escaping: -->
<pathconvert targetos="unix" property="-smokeTestRelease.java9params">
<regexpmapper from="^(.*)$" to="--test-java9 '\1'"/>
<path location="${smokeTestRelease.java9}"/>
</pathconvert>
</target>
<target name="nightly-smoke" description="Builds an unsigned release and smoke tests it (pass '-DsmokeTestRelease.java9=/path/to/jdk-9' to additionally test with Java 9 or later)"
depends="clean,resolve-groovy,resolve-markdown,install-maven-tasks,-nightly-smoke-java9params">
<fail message="To run nightly smoke, the JDK must be exactly Java 1.8, was: ${java.specification.version}"> <fail message="To run nightly smoke, the JDK must be exactly Java 1.8, was: ${java.specification.version}">
<condition> <condition>
<not><equals arg1="${java.specification.version}" arg2="1.8"/></not> <not><equals arg1="${java.specification.version}" arg2="1.8"/></not>
</condition> </condition>
</fail> </fail>
<property name="-smokeTestRelease.java9params" value=""/><!-- (if not yet defined) -->
<exec executable="${python32.exe}" failonerror="true" taskname="python32"> <exec executable="${python32.exe}" failonerror="true" taskname="python32">
<arg value="-V"/> <arg value="-V"/>
</exec> </exec>
@ -634,6 +643,7 @@ File | Project Structure | Platform Settings | SDKs):
<!-- Tell Python not to write any bytecode cache into the filesystem: --> <!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/> <arg value="-B"/>
<arg file="dev-tools/scripts/smokeTestRelease.py"/> <arg file="dev-tools/scripts/smokeTestRelease.py"/>
<arg line="${-smokeTestRelease.java9params}"/>
<arg value="--revision"/> <arg value="--revision"/>
<arg value="skip"/> <arg value="skip"/>
<!-- pass ${version.base} here to emulate a real release, without appendix like "-SNAPSHOT": --> <!-- pass ${version.base} here to emulate a real release, without appendix like "-SNAPSHOT": -->

View File

@ -726,6 +726,16 @@ def verifyUnpacked(java, project, artifact, unpackPath, gitRevision, version, te
java.run_java8('ant javadocs', '%s/javadocs.log' % unpackPath) java.run_java8('ant javadocs', '%s/javadocs.log' % unpackPath)
checkJavadocpathFull('%s/build/docs' % unpackPath) checkJavadocpathFull('%s/build/docs' % unpackPath)
if java.run_java9:
print(" run tests w/ Java 9 and testArgs='%s'..." % testArgs)
java.run_java9('ant clean test %s' % testArgs, '%s/test.log' % unpackPath)
java.run_java9('ant jar', '%s/compile.log' % unpackPath)
testDemo(java.run_java9, isSrc, version, '9')
print(' generate javadocs w/ Java 9...')
java.run_java9('ant javadocs', '%s/javadocs.log' % unpackPath)
checkJavadocpathFull('%s/build/docs' % unpackPath)
else: else:
os.chdir('solr') os.chdir('solr')
@ -741,6 +751,18 @@ def verifyUnpacked(java, project, artifact, unpackPath, gitRevision, version, te
java.run_java8('ant clean server', '%s/antexample.log' % unpackPath) java.run_java8('ant clean server', '%s/antexample.log' % unpackPath)
testSolrExample(unpackPath, java.java8_home, True) testSolrExample(unpackPath, java.java8_home, True)
if java.run_java9:
print(" run tests w/ Java 9 and testArgs='%s'..." % testArgs)
java.run_java9('ant clean test -Dtests.slow=false %s' % testArgs, '%s/test.log' % unpackPath)
print(' generate javadocs w/ Java 9...')
java.run_java9('ant clean javadocs', '%s/javadocs.log' % unpackPath)
checkJavadocpathFull('%s/solr/build/docs' % unpackPath, False)
print(' test solr example w/ Java 9...')
java.run_java9('ant clean example', '%s/antexample.log' % unpackPath)
testSolrExample(unpackPath, java.java9_home, True)
os.chdir('..') os.chdir('..')
print(' check NOTICE') print(' check NOTICE')
testNotice(unpackPath) testNotice(unpackPath)
@ -751,6 +773,8 @@ def verifyUnpacked(java, project, artifact, unpackPath, gitRevision, version, te
if project == 'lucene': if project == 'lucene':
testDemo(java.run_java8, isSrc, version, '1.8') testDemo(java.run_java8, isSrc, version, '1.8')
if java.run_java9:
testDemo(java.run_java9, isSrc, version, '9')
print(' check Lucene\'s javadoc JAR') print(' check Lucene\'s javadoc JAR')
checkJavadocpath('%s/docs' % unpackPath) checkJavadocpath('%s/docs' % unpackPath)
@ -765,6 +789,16 @@ def verifyUnpacked(java, project, artifact, unpackPath, gitRevision, version, te
print(' test solr example w/ Java 8...') print(' test solr example w/ Java 8...')
testSolrExample(java8UnpackPath, java.java8_home, False) testSolrExample(java8UnpackPath, java.java8_home, False)
if java.run_java9:
print(' copying unpacked distribution for Java 9 ...')
java9UnpackPath = '%s-java9' % unpackPath
if os.path.exists(java9UnpackPath):
shutil.rmtree(java9UnpackPath)
shutil.copytree(unpackPath, java9UnpackPath)
os.chdir(java9UnpackPath)
print(' test solr example w/ Java 9...')
testSolrExample(java9UnpackPath, java.java9_home, False)
os.chdir(unpackPath) os.chdir(unpackPath)
testChangesText('.', version, project) testChangesText('.', version, project)
@ -1218,7 +1252,7 @@ def crawl(downloadedFiles, urlString, targetDir, exclusions=set()):
downloadedFiles.append(path) downloadedFiles.append(path)
sys.stdout.write('.') sys.stdout.write('.')
def make_java_config(parser, java8_home): def make_java_config(parser, java9_home):
def _make_runner(java_home, version): def _make_runner(java_home, version):
print('Java %s JAVA_HOME=%s' % (version, java_home)) print('Java %s JAVA_HOME=%s' % (version, java_home))
if cygwin: if cygwin:
@ -1227,7 +1261,7 @@ def make_java_config(parser, java8_home):
(java_home, java_home, java_home) (java_home, java_home, java_home)
s = subprocess.check_output('%s; java -version' % cmd_prefix, s = subprocess.check_output('%s; java -version' % cmd_prefix,
shell=True, stderr=subprocess.STDOUT).decode('utf-8') shell=True, stderr=subprocess.STDOUT).decode('utf-8')
if s.find(' version "%s.' % version) == -1: if s.find(' version "%s' % version) == -1:
parser.error('got wrong version for java %s:\n%s' % (version, s)) parser.error('got wrong version for java %s:\n%s' % (version, s))
def run_java(cmd, logfile): def run_java(cmd, logfile):
run('%s; %s' % (cmd_prefix, cmd), logfile) run('%s; %s' % (cmd_prefix, cmd), logfile)
@ -1236,9 +1270,12 @@ def make_java_config(parser, java8_home):
if java8_home is None: if java8_home is None:
parser.error('JAVA_HOME must be set') parser.error('JAVA_HOME must be set')
run_java8 = _make_runner(java8_home, '1.8') run_java8 = _make_runner(java8_home, '1.8')
run_java9 = None
if java9_home is not None:
run_java9 = _make_runner(java9_home, '9')
jc = namedtuple('JavaConfig', 'run_java8 java8_home') jc = namedtuple('JavaConfig', 'run_java8 java8_home run_java9 java9_home')
return jc(run_java8, java8_home) return jc(run_java8, java8_home, run_java9, java9_home)
version_re = re.compile(r'(\d+\.\d+\.\d+(-ALPHA|-BETA)?)') version_re = re.compile(r'(\d+\.\d+\.\d+(-ALPHA|-BETA)?)')
revision_re = re.compile(r'rev([a-f\d]+)') revision_re = re.compile(r'rev([a-f\d]+)')
@ -1258,8 +1295,8 @@ def parse_config():
help='GIT revision number that release was built with, defaults to that in URL') help='GIT revision number that release was built with, defaults to that in URL')
parser.add_argument('--version', metavar='X.Y.Z(-ALPHA|-BETA)?', parser.add_argument('--version', metavar='X.Y.Z(-ALPHA|-BETA)?',
help='Version of the release, defaults to that in URL') help='Version of the release, defaults to that in URL')
parser.add_argument('--test-java8', metavar='JAVA8_HOME', parser.add_argument('--test-java9', metavar='JAVA9_HOME',
help='Path to Java8 home directory, to run tests with if specified') help='Path to Java9 home directory, to run tests with if specified')
parser.add_argument('url', help='Url pointing to release to test') parser.add_argument('url', help='Url pointing to release to test')
parser.add_argument('test_args', nargs=argparse.REMAINDER, parser.add_argument('test_args', nargs=argparse.REMAINDER,
help='Arguments to pass to ant for testing, e.g. -Dwhat=ever.') help='Arguments to pass to ant for testing, e.g. -Dwhat=ever.')
@ -1281,7 +1318,7 @@ def parse_config():
c.revision = revision_match.group(1) c.revision = revision_match.group(1)
print('Revision: %s' % c.revision) print('Revision: %s' % c.revision)
c.java = make_java_config(parser, c.test_java8) c.java = make_java_config(parser, c.test_java9)
if c.tmp_dir: if c.tmp_dir:
c.tmp_dir = os.path.abspath(c.tmp_dir) c.tmp_dir = os.path.abspath(c.tmp_dir)

View File

@ -186,6 +186,9 @@ Other
Spatial4j 0.7 is compatible with JTS 1.15.0 and not any prior version. JTS 1.15.0 is Spatial4j 0.7 is compatible with JTS 1.15.0 and not any prior version. JTS 1.15.0 is
dual-licensed to include BSD; prior versions were LGPL. (David Smiley) dual-licensed to include BSD; prior versions were LGPL. (David Smiley)
* LUCENE-8155: Add back support in smoke tester to run against later Java versions.
(Uwe Schindler)
======================= Lucene 7.2.1 ======================= ======================= Lucene 7.2.1 =======================
Bug Fixes Bug Fixes