LUCENE-7534: fix smokeTestRelease.py to work on Cygwin

This commit is contained in:
Mikhail Khludnev 2016-11-08 13:42:35 +03:00
parent 86a515789f
commit a209c4e8c2
2 changed files with 19 additions and 6 deletions

View File

@ -793,7 +793,7 @@ def testSolrExample(unpackPath, javaPath, isSrc):
logFile = '%s/solr-example.log' % unpackPath
if isSrc:
os.chdir(unpackPath+'/solr')
subprocess.call(['chmod','+x',unpackPath+'/solr/bin/solr'])
subprocess.call(['chmod','+x',unpackPath+'/solr/bin/solr', unpackPath+'/solr/bin/solr.cmd', unpackPath+'/solr/bin/solr.in.cmd'])
else:
os.chdir(unpackPath)
@ -805,13 +805,20 @@ def testSolrExample(unpackPath, javaPath, isSrc):
# Stop Solr running on port 8983 (in case a previous run didn't shutdown cleanly)
try:
subprocess.call(['bin/solr','stop','-p','8983'])
if not cygwin:
subprocess.call(['bin/solr','stop','-p','8983'])
else:
subprocess.call('env "PATH=`cygpath -S -w`:$PATH" bin/solr.cmd stop -p 8983', shell=True)
except:
print(' Stop failed due to: '+sys.exc_info()[0])
print(' Running techproducts example on port 8983 from %s' % unpackPath)
try:
runExampleStatus = subprocess.call(['bin/solr','-e','techproducts'])
if not cygwin:
runExampleStatus = subprocess.call(['bin/solr','-e','techproducts'])
else:
runExampleStatus = subprocess.call('env "PATH=`cygpath -S -w`:$PATH" bin/solr.cmd -e techproducts', shell=True)
if runExampleStatus != 0:
raise RuntimeError('Failed to run the techproducts example, check log for previous errors.')
@ -830,7 +837,11 @@ def testSolrExample(unpackPath, javaPath, isSrc):
os.chdir(unpackPath+'/solr')
else:
os.chdir(unpackPath)
subprocess.call(['bin/solr','stop','-p','8983'])
if not cygwin:
subprocess.call(['bin/solr','stop','-p','8983'])
else:
subprocess.call('env "PATH=`cygpath -S -w`:$PATH" bin/solr.cmd stop -p 8983', shell=True)
if isSrc:
os.chdir(unpackPath+'/solr')
@ -1176,7 +1187,7 @@ def make_java_config(parser, java8_home):
def _make_runner(java_home, version):
print('Java %s JAVA_HOME=%s' % (version, java_home))
if cygwin:
java_home = subprocess.check_output('cygpath -u "%s"' % java_home).read().decode('utf-8').strip()
java_home = subprocess.check_output('cygpath -u "%s"' % java_home, shell=True).decode('utf-8').strip()
cmd_prefix = 'export JAVA_HOME="%s" PATH="%s/bin:$PATH" JAVACMD="%s/bin/java"' % \
(java_home, java_home, java_home)
s = subprocess.check_output('%s; java -version' % cmd_prefix,
@ -1290,7 +1301,7 @@ def confirmAllReleasesAreTestedForBackCompat(smokeVersion, unpackPath):
if p.returncode is not 0:
# Not good: the test failed!
raise RuntimeError('%s failed:\n%s' % (command, stdout))
stdout = stdout.decode('utf-8')
stdout = stdout.decode('utf-8',errors='replace').replace('\r\n','\n')
if stderr is not None:
# Should not happen since we redirected stderr to stdout:

View File

@ -90,6 +90,8 @@ Other
* LUCENE-7546: Fixed references to benchmark wikipedia data and the Jenkins line-docs file
(David Smiley)
* LUCENE-7534: fix smokeTestRelease.py to run on Cygwin (Mikhail Khludnev)
======================= Lucene 6.3.0 =======================
API Changes