You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/09/26 17:55:27 UTC
svn commit: r1390581 - in /lucene/dev/trunk: ./ dev-tools/
dev-tools/scripts/smokeTestRelease.py
Author: mikemccand
Date: Wed Sep 26 15:55:27 2012
New Revision: 1390581
URL: http://svn.apache.org/viewvc?rev=1390581&view=rev
Log:
when tests fail, print the output to stdout in addition to the log file
Modified:
lucene/dev/trunk/ (props changed)
lucene/dev/trunk/dev-tools/ (props changed)
lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py
Modified: lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py?rev=1390581&r1=1390580&r2=1390581&view=diff
==============================================================================
--- lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py (original)
+++ lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py Wed Sep 26 15:55:27 2012
@@ -35,6 +35,7 @@ import platform
import checkJavaDocs
import checkJavadocLinks
import io
+import codecs
# This tool expects to find /lucene and /solr off the base URL. You
# must have a working gpg, tar, unzip in your path. This has been
@@ -389,6 +390,23 @@ def run(command, logFile):
if cygwin: command = cygwinifyPaths(command)
if os.system('%s > %s 2>&1' % (command, logFile)):
logPath = os.path.abspath(logFile)
+ print('\ncommand "%s" failed:' % command)
+
+ # Assume log file was written in system's default encoding, but
+ # even if we are wrong, we replace errors ... the ASCII chars
+ # (which is what we mostly care about eg for the test seed) should
+ # still survive:
+ txt = codecs.open(logPath, 'r', encoding=sys.getdefaultencoding(), errors='replace').read()
+
+ # Encode to our output encoding (likely also system's default
+ # encoding):
+ bytes = txt.encode(sys.stdout.encoding, errors='replace')
+
+ # Decode back to string and print... we should hit no exception here
+ # since all errors have been replaced:
+ print(codecs.getdecoder(sys.stdout.encoding)(bytes)[0])
+ print()
+
raise RuntimeError('command "%s" failed; see log file %s' % (command, logPath))
def verifyDigests(artifact, urlString, tmpDir):
@@ -1191,6 +1209,7 @@ def smokeTest(baseURL, version, tmpDir,
print('\nSUCCESS!\n')
if __name__ == '__main__':
+ print('NOTE: output encoding is %s' % sys.stdout.encoding)
try:
main()
except:
Re: svn commit: r1390581 - in /lucene/dev/trunk: ./ dev-tools/ dev-tools/scripts/smokeTestRelease.py
Posted by Robert Muir <rc...@gmail.com>.
awesome! thank you. hopefully no more mysteries
On Wed, Sep 26, 2012 at 11:55 AM, <mi...@apache.org> wrote:
> Author: mikemccand
> Date: Wed Sep 26 15:55:27 2012
> New Revision: 1390581
>
> URL: http://svn.apache.org/viewvc?rev=1390581&view=rev
> Log:
> when tests fail, print the output to stdout in addition to the log file
>
> Modified:
> lucene/dev/trunk/ (props changed)
> lucene/dev/trunk/dev-tools/ (props changed)
> lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py
>
> Modified: lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py
> URL: http://svn.apache.org/viewvc/lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py?rev=1390581&r1=1390580&r2=1390581&view=diff
> ==============================================================================
> --- lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py (original)
> +++ lucene/dev/trunk/dev-tools/scripts/smokeTestRelease.py Wed Sep 26 15:55:27 2012
> @@ -35,6 +35,7 @@ import platform
> import checkJavaDocs
> import checkJavadocLinks
> import io
> +import codecs
>
> # This tool expects to find /lucene and /solr off the base URL. You
> # must have a working gpg, tar, unzip in your path. This has been
> @@ -389,6 +390,23 @@ def run(command, logFile):
> if cygwin: command = cygwinifyPaths(command)
> if os.system('%s > %s 2>&1' % (command, logFile)):
> logPath = os.path.abspath(logFile)
> + print('\ncommand "%s" failed:' % command)
> +
> + # Assume log file was written in system's default encoding, but
> + # even if we are wrong, we replace errors ... the ASCII chars
> + # (which is what we mostly care about eg for the test seed) should
> + # still survive:
> + txt = codecs.open(logPath, 'r', encoding=sys.getdefaultencoding(), errors='replace').read()
> +
> + # Encode to our output encoding (likely also system's default
> + # encoding):
> + bytes = txt.encode(sys.stdout.encoding, errors='replace')
> +
> + # Decode back to string and print... we should hit no exception here
> + # since all errors have been replaced:
> + print(codecs.getdecoder(sys.stdout.encoding)(bytes)[0])
> + print()
> +
> raise RuntimeError('command "%s" failed; see log file %s' % (command, logPath))
>
> def verifyDigests(artifact, urlString, tmpDir):
> @@ -1191,6 +1209,7 @@ def smokeTest(baseURL, version, tmpDir,
> print('\nSUCCESS!\n')
>
> if __name__ == '__main__':
> + print('NOTE: output encoding is %s' % sys.stdout.encoding)
> try:
> main()
> except:
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org