From a209c4e8c259c66b8748656207d36db623d50856 Mon Sep 17 00:00:00 2001 From: Mikhail Khludnev Date: Tue, 8 Nov 2016 13:42:35 +0300 Subject: [PATCH] LUCENE-7534: fix smokeTestRelease.py to work on Cygwin --- dev-tools/scripts/smokeTestRelease.py | 23 +++++++++++++++++------ lucene/CHANGES.txt | 2 ++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py index 9d4a2c71f23..2e38e9b4144 100644 --- a/dev-tools/scripts/smokeTestRelease.py +++ b/dev-tools/scripts/smokeTestRelease.py @@ -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: diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 1caaf86a87e..213a8f9401d 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -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