LUCENE-5007: Add optional named -testArgs param to smokeTestRelease.py, passed through to 'ant test' invocations; add -DsmokeTestRelease.testArgs sysprop to 'ant nightly-smoke', to pass through as -testArgs param to smokeTestRelease.py.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1484524 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Steven Rowe 2013-05-20 16:51:52 +00:00
parent 946de09d26
commit 0b55aaa6a2
3 changed files with 46 additions and 19 deletions

View File

@ -268,6 +268,7 @@
<property name="fakeRelease" location="lucene/build/fakeRelease"/>
<property name="fakeReleaseTmp" location="lucene/build/fakeReleaseTmp"/>
<property name="fakeReleaseVersion" value="5.0.0"/> <!-- *not* -SNAPSHOT, the real version -->
<property name="smokeTestRelease.testArgs" value=""/>
<target name="-load-env">
<!-- load the properties only here, so not on every invocation /usr/bin/env is called: -->
@ -306,6 +307,8 @@
<arg value="${fakeReleaseVersion}"/>
<arg file="${fakeReleaseTmp}"/>
<arg value="false"/>
<arg value="-testArgs"/>
<arg value="${smokeTestRelease.testArgs}"/>
<env key="JAVA7_HOME" file="${JAVA7_HOME}"/>
</exec>
<delete dir="${fakeRelease}"/>

View File

@ -310,7 +310,7 @@ def main():
if smokeTmpDir is not None:
import smokeTestRelease
smokeTestRelease.DEBUG = False
smokeTestRelease.smokeTest(url, rev, version, smokeTmpDir, gpgKeyID is not None)
smokeTestRelease.smokeTest(url, rev, version, smokeTmpDir, gpgKeyID is not None, '')
if __name__ == '__main__':
try:

View File

@ -575,7 +575,7 @@ def getDirEntries(urlString):
if text == 'Parent Directory' or text == '..':
return links[(i+1):]
def unpackAndVerify(project, tmpDir, artifact, svnRevision, version):
def unpackAndVerify(project, tmpDir, artifact, svnRevision, version, testArgs):
destDir = '%s/unpack' % tmpDir
if os.path.exists(destDir):
shutil.rmtree(destDir)
@ -595,14 +595,14 @@ def unpackAndVerify(project, tmpDir, artifact, svnRevision, version):
raise RuntimeError('unpack produced entries %s; expected only %s' % (l, expected))
unpackPath = '%s/%s' % (destDir, expected)
verifyUnpacked(project, artifact, unpackPath, svnRevision, version, tmpDir)
verifyUnpacked(project, artifact, unpackPath, svnRevision, version, testArgs)
LUCENE_NOTICE = None
LUCENE_LICENSE = None
SOLR_NOTICE = None
SOLR_LICENSE = None
def verifyUnpacked(project, artifact, unpackPath, svnRevision, version, tmpDir):
def verifyUnpacked(project, artifact, unpackPath, svnRevision, version, testArgs):
global LUCENE_NOTICE
global LUCENE_LICENSE
global SOLR_NOTICE
@ -689,8 +689,8 @@ def verifyUnpacked(project, artifact, unpackPath, svnRevision, version, tmpDir):
run('%s; ant validate' % javaExe('1.7'), '%s/validate.log' % unpackPath)
if project == 'lucene':
print(' run tests w/ Java 7...')
run('%s; ant clean test' % javaExe('1.7'), '%s/test.log' % unpackPath)
print(" run tests w/ Java 7 and testArgs='%s'..." % testArgs)
run('%s; ant clean test %s' % (javaExe('1.7'), testArgs), '%s/test.log' % unpackPath)
run('%s; ant jar' % javaExe('1.7'), '%s/compile.log' % unpackPath)
testDemo(isSrc, version, '1.7')
@ -702,8 +702,8 @@ def verifyUnpacked(project, artifact, unpackPath, svnRevision, version, tmpDir):
os.chdir('solr')
# DISABLED until solr tests consistently pass
#print(' run tests w/ Java 7...')
#run('%s; ant test' % javaExe('1.7'), '%s/test.log' % unpackPath)
#print(" run tests w/ Java 7 and testArgs='%s'..." % testArgs)
#run('%s; ant clean test %s' % (javaExe('1.7'), testArgs), '%s/test.log' % unpackPath)
# test javadocs
print(' generate javadocs w/ Java 7...')
@ -1309,7 +1309,8 @@ def main():
if len(sys.argv) < 5:
print()
print('Usage python -u %s BaseURL SvnRevision version tmpDir' % sys.argv[0])
print('Usage python -u %s BaseURL SvnRevision version tmpDir [ isSigned ] [ -testArgs "-Dwhat=ever [ ... ]" ]'
% sys.argv[0])
print()
print(' example: python3.2 -u dev-tools/scripts/smokeTestRelease.py http://people.apache.org/~whoever/staging_area/lucene-solr-4.3.0-RC1-rev1469340 1469340 4.3.0 /path/to/a/tmp/dir')
print()
@ -1322,14 +1323,37 @@ def main():
if not reAllowedVersion.match(version):
raise RuntimeError('version "%s" does not match format X.Y.Z[-ALPHA|-BETA]' % version)
tmpDir = os.path.abspath(sys.argv[4])
isSigned = True
if len(sys.argv) == 6:
isSigned = (sys.argv[5] == "True")
tmpDirArgNum = 4
tmpDir = os.path.abspath(sys.argv[tmpDirArgNum])
smokeTest(baseURL, svnRevision, version, tmpDir, isSigned)
# TODO: yuck: positional-only args with more than one optional arg totally sucks
# TODO: consider naming all args
isSigned = True
testArgs = ''
lastArgNum = len(sys.argv) - 1
if lastArgNum > tmpDirArgNum:
nextArgNum = tmpDirArgNum + 1
if sys.argv[nextArgNum] == '-testArgs':
if nextArgNum == lastArgNum:
raise RuntimeError('missing expected argument to -testArgs')
else:
# TODO: should there be arg validation here? E.g. starts with '-D'?
testArgs = sys.argv[nextArgNum + 1]
nextArgNum += 2
if nextArgNum <= lastArgNum:
isSigned = (sys.argv[nextArgNum] == "True")
nextArgNum += 1
if nextArgNum <= lastArgNum and testArgs == '':
if sys.argv[nextArgNum] == '-testArgs':
if nextArgNum == lastArgNum:
raise RuntimeError('missing expected argument to -testArgs')
else:
# TODO: should there be arg validation here? E.g. starts with '-D'?
testArgs = sys.argv[nextArgNum + 1]
def smokeTest(baseURL, svnRevision, version, tmpDir, isSigned):
smokeTest(baseURL, svnRevision, version, tmpDir, isSigned, testArgs)
def smokeTest(baseURL, svnRevision, version, tmpDir, isSigned, testArgs):
startTime = datetime.datetime.now()
@ -1364,15 +1388,15 @@ def smokeTest(baseURL, svnRevision, version, tmpDir, isSigned):
print('Test Lucene...')
checkSigs('lucene', lucenePath, version, tmpDir, isSigned)
for artifact in ('lucene-%s.tgz' % version, 'lucene-%s.zip' % version):
unpackAndVerify('lucene', tmpDir, artifact, svnRevision, version)
unpackAndVerify('lucene', tmpDir, 'lucene-%s-src.tgz' % version, svnRevision, version)
unpackAndVerify('lucene', tmpDir, artifact, svnRevision, version, testArgs)
unpackAndVerify('lucene', tmpDir, 'lucene-%s-src.tgz' % version, svnRevision, version, testArgs)
print()
print('Test Solr...')
checkSigs('solr', solrPath, version, tmpDir, isSigned)
for artifact in ('solr-%s.tgz' % version, 'solr-%s.zip' % version):
unpackAndVerify('solr', tmpDir, artifact, svnRevision, version)
unpackAndVerify('solr', tmpDir, 'solr-%s-src.tgz' % version, svnRevision, version)
unpackAndVerify('solr', tmpDir, artifact, svnRevision, version, testArgs)
unpackAndVerify('solr', tmpDir, 'solr-%s-src.tgz' % version, svnRevision, version, testArgs)
print()
print('Test Maven artifacts for Lucene and Solr...')