From 5e60e0e3af85f22aa0afe8bf0ecf85619afacfeb Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 22 Aug 2013 16:39:52 -0400 Subject: Imported Upstream version 0.6.0.12 --- misc/build_helpers/run_trial.py | 55 ---------------- misc/build_helpers/show-tool-versions.py | 90 +++++++++++++++++--------- misc/coding_helpers/python.supp | 105 ++++++++++++++++++++++--------- 3 files changed, 136 insertions(+), 114 deletions(-) delete mode 100644 misc/build_helpers/run_trial.py (limited to 'misc') diff --git a/misc/build_helpers/run_trial.py b/misc/build_helpers/run_trial.py deleted file mode 100644 index eb9c63a..0000000 --- a/misc/build_helpers/run_trial.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python - -import os, sys, re - -modulename = None -for i in xrange(1, len(sys.argv)): - if not sys.argv[i].startswith('-'): - modulename = sys.argv[i] - break - -if modulename is None: - raise AssertionError("no test module specified") - -__import__(modulename) -srcfile = sys.modules[modulename].__file__ -srcdir = os.path.dirname(os.path.realpath(srcfile)) -for i in modulename.split('.'): - srcdir = os.path.dirname(srcdir) - -if os.path.normcase(srcdir).endswith('.egg'): - srcdir = os.path.dirname(srcdir) -elif os.path.normcase(os.path.basename(srcdir)) == 'site-packages': - srcdir = os.path.dirname(srcdir) - if re.search(r'python.+\..+', os.path.normcase(os.path.basename(srcdir))): - srcdir = os.path.dirname(srcdir) - if os.path.normcase(os.path.basename(srcdir)) == 'lib': - srcdir = os.path.dirname(srcdir) - -srcdir = os.path.normcase(os.path.normpath(srcdir)) -cwd = os.path.normcase(os.path.normpath(os.getcwd())) - -same = (srcdir == cwd) -if not same: - try: - same = os.path.samefile(srcdir, cwd) - except AttributeError, e: - e # hush pyflakes - -if not same: - msg = ("We seem to be testing the code at %r\n" - "(according to the source filename %r),\n" - "but expected to be testing the code at %r.\n" - % (srcdir, srcfile, cwd)) - if (not isinstance(cwd, unicode) and - cwd.decode(sys.getfilesystemencoding(), 'replace') != os.path.normcase(os.path.normpath(os.getcwdu()))): - msg += ("However, this may be a false alarm because the current directory path\n" - "is not representable in the filesystem encoding. This script needs to be\n" - "run from the source directory to be tested, at a non-Unicode path.") - else: - msg += "This script needs to be run from the source directory to be tested." - - raise AssertionError(msg) - -from twisted.scripts.trial import run -run() \ No newline at end of file diff --git a/misc/build_helpers/show-tool-versions.py b/misc/build_helpers/show-tool-versions.py index c7b05b6..2733e78 100644 --- a/misc/build_helpers/show-tool-versions.py +++ b/misc/build_helpers/show-tool-versions.py @@ -1,17 +1,22 @@ #! /usr/bin/env python -import os, subprocess, sys, traceback +import errno, locale, os, platform, subprocess, sys, traceback -def foldlines(s): - return s.replace("\n", " ").replace("\r", "") +def foldlines(s, numlines=None): + lines = s.split("\n") + if numlines is not None: + lines = lines[:numlines] + return " ".join(lines).replace("\r", "") def print_platform(): - print try: import platform out = platform.platform() print - print "platform:", out.replace("\n", " ") + print "platform:", foldlines(out) + print "machine: ", platform.machine() + if hasattr(platform, 'linux_distribution'): + print "linux_distribution:", repr(platform.linux_distribution()) except EnvironmentError: sys.stderr.write("Got exception using 'platform'. Exception follows\n") traceback.print_exc(file=sys.stderr) @@ -19,26 +24,52 @@ def print_platform(): pass def print_python_ver(): - print print "python:", foldlines(sys.version) print 'maxunicode: ' + str(sys.maxunicode) -def print_stdout(cmdlist, label=None): - print +def print_python_encoding_settings(): + print 'filesystem.encoding: ' + str(sys.getfilesystemencoding()) + print 'locale.getpreferredencoding: ' + str(locale.getpreferredencoding()) + try: + print 'locale.defaultlocale: ' + str(locale.getdefaultlocale()) + except ValueError, e: + print 'got exception from locale.getdefaultlocale(): ', e + print 'locale.locale: ' + str(locale.getlocale()) + +def print_stdout(cmdlist, label=None, numlines=None): + if label is None: + label = cmdlist[0] try: res = subprocess.Popen(cmdlist, stdin=open(os.devnull), stdout=subprocess.PIPE).communicate()[0] - if label is None: - label = cmdlist[0] + print label + ': ' + foldlines(res, numlines) + except EnvironmentError, e: + if isinstance(e, OSError) and e.errno == errno.ENOENT: + print str(label) + ': ' + str(cmdlist[0]) + ': no such file or directory' + return + sys.stderr.write("\n%s: Got exception invoking '%s'. Exception follows.\n" % (label, cmdlist[0],)) + traceback.print_exc(file=sys.stderr) + sys.stderr.flush() + pass + +def print_stderr(cmdlist, label=None): + if label is None: + label = cmdlist[0] + try: + res = subprocess.Popen(cmdlist, stdin=open(os.devnull), + stderr=subprocess.PIPE).communicate()[1] print label + ': ' + foldlines(res) - except EnvironmentError: - sys.stderr.write("\nGot exception invoking '%s'. Exception follows.\n" % (cmdlist[0],)) + except EnvironmentError, e: + if isinstance(e, OSError) and e.errno == errno.ENOENT: + print str(label) + ': ' + str(cmdlist[0]) + ': no such file or directory' + return + sys.stderr.write("\n%s: Got exception invoking '%s'. Exception follows.\n" % (label, cmdlist[0],)) traceback.print_exc(file=sys.stderr) sys.stderr.flush() pass + def print_as_ver(): - print if os.path.exists('a.out'): print "WARNING: a file named a.out exists, and getting the version of the 'as' assembler writes to that filename, so I'm not attempting to get the version of 'as'." return @@ -55,7 +86,6 @@ def print_as_ver(): pass def print_setuptools_ver(): - print try: import pkg_resources out = str(pkg_resources.require("setuptools")) @@ -65,11 +95,13 @@ def print_setuptools_ver(): traceback.print_exc(file=sys.stderr) sys.stderr.flush() pass + except pkg_resources.DistributionNotFound: + print 'setuptools: DistributionNotFound' + pass def print_py_pkg_ver(pkgname, modulename=None): if modulename is None: modulename = pkgname - print try: import pkg_resources @@ -81,9 +113,7 @@ def print_py_pkg_ver(pkgname, modulename=None): sys.stderr.flush() pass except pkg_resources.DistributionNotFound: - sys.stderr.write("\npkg_resources reported no %s package installed. Exception follows.\n" % (pkgname,)) - traceback.print_exc(file=sys.stderr) - sys.stderr.flush() + print pkgname + ': DistributionNotFound' pass try: __import__(modulename) @@ -98,16 +128,20 @@ def print_py_pkg_ver(pkgname, modulename=None): pass print_platform() - +print print_python_ver() - +print +print_stdout(['locale']) +print_python_encoding_settings() +print print_stdout(['buildbot', '--version']) -print_stdout(['cl']) -print_stdout(['g++', '--version']) +print_stdout(['buildslave', '--version']) +if 'windows' in platform.system().lower(): + print_stderr(['cl']) +print_stdout(['g++', '--version'], numlines=1) print_stdout(['cryptest', 'V']) -print_stdout(['darcs', '--version']) -print_stdout(['darcs', '--exact-version'], label='darcs-exact-version') -print_stdout(['7za']) +print_stdout(['git', '--version']) +print_stdout(['openssl', 'version']) print_stdout(['flappclient', '--version']) print_stdout(['valgrind', '--version']) @@ -116,9 +150,7 @@ print_as_ver() print_setuptools_ver() print_py_pkg_ver('coverage') -print_py_pkg_ver('trialcoverage') -print_py_pkg_ver('setuptools_trial') -print_py_pkg_ver('setuptools_darcs') -print_py_pkg_ver('darcsver') +print_py_pkg_ver('pyflakes') print_py_pkg_ver('Twisted', 'twisted') print_py_pkg_ver('TwistedCore', 'twisted.python') +print_py_pkg_ver('pyOpenSSL', 'OpenSSL') diff --git a/misc/coding_helpers/python.supp b/misc/coding_helpers/python.supp index a2e37bb..102e2ec 100644 --- a/misc/coding_helpers/python.supp +++ b/misc/coding_helpers/python.supp @@ -1,33 +1,78 @@ -# -# This is a valgrind suppression file that should be used when using valgrind. -# -# --------------------------------------------------------------------------- -# Debian note: -# The file Misc/valgrind-python.supp is placed in an modified form into the -# directory /usr/lib/valgrind as python.supp. There's no need to to add it -# with the --suppressions option. -# The unmodified file is found in /usr/share/doc/python2.4/ -# -# The python2.4-dbg build has been compiled with -DPy_USING_MEMORY_DEBUGGER -# so you can safely comment out the suppressions for PyObject_Free and -# PyObject_Realloc. -# --------------------------------------------------------------------------- - -# Here's an example of running valgrind: -# -# cd python/dist/src -# valgrind --tool=memcheck --suppressions=Misc/valgrind-python.supp \ -# ./python -E -tt ./Lib/test/regrtest.py -u bsddb,network -# -# You must edit Objects/obmalloc.c and uncomment Py_USING_MEMORY_DEBUGGER -# to use the preferred suppressions with Py_ADDRESS_IN_RANGE. -# -# If you do not want to recompile Python, you can uncomment -# suppressions for PyObject_Free and PyObject_Realloc. -# -# See /usr/share/doc/python2.4/README.valgrind for more information. - -# all tool names: Addrcheck,Memcheck,cachegrind,helgrind,massif +# generated on buildbot.rubenkerkhof.com, which had, according to Ruben +# Fedora's package "openssl-1.0.1-0.1.beta2.fc17.x86_64" +{ + buildbot.rubenkerkhof.com cond fips openssl 1 + Memcheck:Cond + fun:bcmp + fun:fips_get_entropy + fun:FIPS_drbg_instantiate + fun:RAND_init_fips + fun:OPENSSL_init_library + fun:SSL_library_init + fun:init_hashlib +} + +{ + buildbot.rubenkerkhof.com cond fips openssl 2 + Memcheck:Cond + fun:fips_get_entropy + fun:FIPS_drbg_instantiate + fun:RAND_init_fips + fun:OPENSSL_init_library + fun:SSL_library_init + fun:init_hashlib +} + +{ + buildbot.rubenkerkhof.com val _x86_64_AES_encrypt_compact + Memcheck:Value8 + fun:_x86_64_AES_encrypt_compact + fun:AES_encrypt +} + +# generated on buildbot.rubenkerkhof.com Jakub Jellinek guessed that this was +# a false alarm due to index knowing that pointers are 4-byte aligned and +# valgrind not taking that into account: +# https://bugzilla.redhat.com/show_bug.cgi?id=159701 +{ + buildbot.rubenkerkhof.com cond index + Memcheck:Cond + fun:index + fun:expand_dynamic_string_token + fun:_dl_map_object + fun:map_doit + fun:_dl_catch_error +} + +# generated on luther sid +# e.g. https://tahoe-lafs.org/buildbot-pycryptopp/builders/luther%20sid/builds/38/steps/double%20load%20valgrind/logs/valgrind +{ + luther sid addr4 realloc + Memcheck:Addr4 + fun:PyObject_Realloc.part.0.20700 +} + +{ + luther sid cond realloc + Memcheck:Cond + fun:PyObject_Realloc.part.0.20700 +} + +{ + luther sid value4 realloc + Memcheck:Value4 + fun:PyObject_Realloc.part.0.20700 +} + +# glibc was apparently changed to avoid this: http://sources.redhat.com/bugzilla/show_bug.cgi?id=4306 +{ + use (not really, according to Ulrich Drepper) of uninitailised bytes by glibc in utimes() + Memcheck:Param + utimes(tvp[1]) + fun:utimes + obj:/usr/lib/libpython2.4.so.1.0 +} + { ADDRESS_IN_RANGE/Invalid read of size 4 Memcheck:Addr4 -- cgit v1.2.3