diff --git a/build.xml b/build.xml index 5b1a95023ca..eac26db9923 100644 --- a/build.xml +++ b/build.xml @@ -268,6 +268,7 @@ + @@ -306,6 +307,8 @@ + + diff --git a/dev-tools/scripts/buildAndPushRelease.py b/dev-tools/scripts/buildAndPushRelease.py index 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 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: diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py index 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' % 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...')