You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2013/05/20 18:51:53 UTC

svn commit: r1484524 - in /lucene/dev/trunk: build.xml dev-tools/scripts/buildAndPushRelease.py dev-tools/scripts/smokeTestRelease.py

Author: sarowe
Date: Mon May 20 16:51:52 2013
New Revision: 1484524

URL: http://svn.apache.org/r1484524
Log:
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.

Modified:
    lucene/dev/trunk/build.xml
    lucene/dev/trunk/dev-tools/scripts/buildAndPushRelease.py
    lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py

Modified: lucene/dev/trunk/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/build.xml?rev=1484524&r1=1484523&r2=1484524&view=diff
==============================================================================
--- lucene/dev/trunk/build.xml (original)
+++ lucene/dev/trunk/build.xml Mon May 20 16:51:52 2013
@@ -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}"/>

Modified: lucene/dev/trunk/dev-tools/scripts/buildAndPushRelease.py
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/dev-tools/scripts/buildAndPushRelease.py?rev=1484524&r1=1484523&r2=1484524&view=diff
==============================================================================
--- lucene/dev/trunk/dev-tools/scripts/buildAndPushRelease.py (original)
+++ lucene/dev/trunk/dev-tools/scripts/buildAndPushRelease.py Mon May 20 16:51:52 2013
@@ -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:

Modified: lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py?rev=1484524&r1=1484523&r2=1484524&view=diff
==============================================================================
--- lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py (original)
+++ lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py Mon May 20 16:51:52 2013
@@ -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, art
     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, un
     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, un
       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]
+
+  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, vers
   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...')