Apache Lucene open-source search software
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.
Steven Rowe0b55aaa6a2d0
diff --git a/build.xml b/build.xmlindex 5b1a95023ca..eac26db9923 100644--- a/build.xml+++ b/build.xml@@ -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}"/>diff --git a/dev-tools/scripts/buildAndPushRelease.py b/dev-tools/scripts/buildAndPushRelease.pyindex 1847ea61a97..82b046dc255 100644--- a/dev-tools/scripts/buildAndPushRelease.py+++ b/dev-tools/scripts/buildAndPushRelease.py@@ -310,7 +310,7 @@ def main():if smokeTmpDir is not None:import smokeTestReleasesmokeTestRelease.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:diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.pyindex ab8f944f377..11e8ef7ac35 100644--- a/dev-tools/scripts/smokeTestRelease.py+++ b/dev-tools/scripts/smokeTestRelease.py@@ -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' % tmpDirif 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 = NoneLUCENE_LICENSE = NoneSOLR_NOTICE = NoneSOLR_LICENSE = None-def verifyUnpacked(project, artifact, unpackPath, svnRevision, version, tmpDir):+def verifyUnpacked(project, artifact, unpackPath, svnRevision, version, testArgs):global LUCENE_NOTICEglobal LUCENE_LICENSEglobal 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 javadocsprint(' 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])++ # 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]- smokeTest(baseURL, svnRevision, version, tmpDir, isSigned)+ smokeTest(baseURL, svnRevision, version, tmpDir, isSigned, testArgs)-def smokeTest(baseURL, svnRevision, version, tmpDir, isSigned):+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...')