mirror of https://github.com/apache/lucene.git
LUCENE-10192: Use modules instead of classpath for binary distribution testing.
This commit is contained in:
parent
01839da593
commit
ded915b29b
|
@ -646,21 +646,26 @@ def testDemo(run_java, isSrc, version, jdk):
|
||||||
print(' test demo with %s...' % jdk)
|
print(' test demo with %s...' % jdk)
|
||||||
sep = ';' if cygwin else ':'
|
sep = ';' if cygwin else ':'
|
||||||
if isSrc:
|
if isSrc:
|
||||||
|
# For source release, use the classpath for each module.
|
||||||
classPath = ['lucene/core/build/libs/lucene-core-%s.jar' % version,
|
classPath = ['lucene/core/build/libs/lucene-core-%s.jar' % version,
|
||||||
'lucene/demo/build/libs/lucene-demo-%s.jar' % version,
|
'lucene/demo/build/libs/lucene-demo-%s.jar' % version,
|
||||||
'lucene/analysis/common/build/libs/lucene-analyzers-common-%s.jar' % version,
|
'lucene/analysis/common/build/libs/lucene-analyzers-common-%s.jar' % version,
|
||||||
'lucene/queryparser/build/libs/lucene-queryparser-%s.jar' % version]
|
'lucene/queryparser/build/libs/lucene-queryparser-%s.jar' % version]
|
||||||
cp = sep.join(classPath)
|
cp = sep.join(classPath)
|
||||||
docsDir = 'lucene/core/src'
|
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:
|
else:
|
||||||
classPath = ['modules/lucene-core-%s.jar' % version,
|
# For binary release, set up classpath as modules.
|
||||||
'modules/lucene-demo-%s.jar' % version,
|
cp = "--module-path modules"
|
||||||
'modules/lucene-analyzers-common-%s.jar' % version,
|
|
||||||
'modules/lucene-queryparser-%s.jar' % version]
|
|
||||||
cp = sep.join(classPath)
|
|
||||||
docsDir = 'docs'
|
docsDir = 'docs'
|
||||||
run_java('java -cp "%s" -Dsmoketester=true org.apache.lucene.demo.IndexFiles -index index -docs %s' % (cp, docsDir), 'index.log')
|
checkIndexCmd = 'java -ea %s --module lucene.core/org.apache.lucene.index.CheckIndex index' % cp
|
||||||
run_java('java -cp "%s" org.apache.lucene.demo.SearchFiles -index index -query lucene' % cp, 'search.log')
|
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')
|
reMatchingDocs = re.compile('(\d+) total matching documents')
|
||||||
m = reMatchingDocs.search(open('search.log', encoding='UTF-8').read())
|
m = reMatchingDocs.search(open('search.log', encoding='UTF-8').read())
|
||||||
if m is None:
|
if m is None:
|
||||||
|
@ -670,8 +675,9 @@ def testDemo(run_java, isSrc, version, jdk):
|
||||||
if numHits < 100:
|
if numHits < 100:
|
||||||
raise RuntimeError('lucene demo\'s SearchFiles found too few results: %s' % numHits)
|
raise RuntimeError('lucene demo\'s SearchFiles found too few results: %s' % numHits)
|
||||||
print(' got %d hits for query "lucene"' % numHits)
|
print(' got %d hits for query "lucene"' % numHits)
|
||||||
|
|
||||||
print(' checkindex with %s...' % jdk)
|
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()
|
s = open('checkindex.log').read()
|
||||||
m = re.search(r'^\s+version=(.*?)$', s, re.MULTILINE)
|
m = re.search(r'^\s+version=(.*?)$', s, re.MULTILINE)
|
||||||
if m is None:
|
if m is None:
|
||||||
|
|
Loading…
Reference in New Issue