LUCENE-10192: Use modules instead of classpath for binary distribution testing.

This commit is contained in:
Dawid Weiss 2021-10-31 09:25:08 +01:00
parent 01839da593
commit ded915b29b
1 changed files with 14 additions and 8 deletions

View File

@ -646,21 +646,26 @@ def testDemo(run_java, isSrc, version, jdk):
print(' test demo with %s...' % jdk)
sep = ';' if cygwin else ':'
if isSrc:
# For source release, use the classpath for each module.
classPath = ['lucene/core/build/libs/lucene-core-%s.jar' % version,
'lucene/demo/build/libs/lucene-demo-%s.jar' % version,
'lucene/analysis/common/build/libs/lucene-analyzers-common-%s.jar' % version,
'lucene/queryparser/build/libs/lucene-queryparser-%s.jar' % version]
cp = sep.join(classPath)
docsDir = 'lucene/core/src'
checkIndexCmd = 'java -ea -cp "%s" org.apache.lucene.index.CheckIndex index' % cp
indexFilesCmd = 'java -cp "%s" -Dsmoketester=true org.apache.lucene.demo.IndexFiles -index index -docs %s' % (cp, docsDir)
searchFilesCmd = 'java -cp "%s" org.apache.lucene.demo.SearchFiles -index index -query lucene' % cp
else:
classPath = ['modules/lucene-core-%s.jar' % version,
'modules/lucene-demo-%s.jar' % version,
'modules/lucene-analyzers-common-%s.jar' % version,
'modules/lucene-queryparser-%s.jar' % version]
cp = sep.join(classPath)
# For binary release, set up classpath as modules.
cp = "--module-path modules"
docsDir = 'docs'
run_java('java -cp "%s" -Dsmoketester=true org.apache.lucene.demo.IndexFiles -index index -docs %s' % (cp, docsDir), 'index.log')
run_java('java -cp "%s" org.apache.lucene.demo.SearchFiles -index index -query lucene' % cp, 'search.log')
checkIndexCmd = 'java -ea %s --module lucene.core/org.apache.lucene.index.CheckIndex index' % cp
indexFilesCmd = 'java -Dsmoketester=true %s --module lucene.demo/org.apache.lucene.demo.IndexFiles -index index -docs %s' % (cp, docsDir)
searchFilesCmd = 'java %s --module lucene.demo/org.apache.lucene.demo.SearchFiles -index index -query lucene' % cp
run_java(indexFilesCmd, 'index.log')
run_java(searchFilesCmd, 'search.log')
reMatchingDocs = re.compile('(\d+) total matching documents')
m = reMatchingDocs.search(open('search.log', encoding='UTF-8').read())
if m is None:
@ -670,8 +675,9 @@ def testDemo(run_java, isSrc, version, jdk):
if numHits < 100:
raise RuntimeError('lucene demo\'s SearchFiles found too few results: %s' % numHits)
print(' got %d hits for query "lucene"' % numHits)
print(' checkindex with %s...' % jdk)
run_java('java -ea -cp "%s" org.apache.lucene.index.CheckIndex index' % cp, 'checkindex.log')
run_java(checkIndexCmd, 'checkindex.log')
s = open('checkindex.log').read()
m = re.search(r'^\s+version=(.*?)$', s, re.MULTILINE)
if m is None: