[tox] envlist = {py27d,py27,py37,py38d,py38,pypy,pypy3}-{thread,gevent} # ThreadSanitizer # XXX under pypy tsan does not observe the GIL lock/release(*), and this # way reports even plain T1.Py_INCREF / T2.Py_DECREF as a race. # (*) PyPy locks its GIL (see RPyGilAcquire) by manually doing atomic cmpxchg # and other games, which TSAN cannot see if PyPy itself was not compiled with # -fsanitize=thread. {py27d,py27,py37,py38d,py38 }-{thread }-tsan # XXX py*-gevent-tsan would be nice to have, but at present TSAN is not # effective with gevent, because it does not understand greenlet "thread" # switching and so perceives the program as having only one thread where races # are impossible. Disabled to save time. # {py27d,py27,py37,py38d,py38 }-{ gevent}-tsan # AddressSanitizer # XXX asan does not work with gevent: https://github.com/python-greenlet/greenlet/issues/113 {py27d,py27,py37,py38d,py38,pypy,pypy3}-{thread }-asan [testenv] basepython = py27d: python2.7-dbg py27: python2.7 py37: python3.7 py38d: python3.8-dbg py38: python3.8 pypy: pypy pypy3: pypy3 setenv = # distutils take CFLAGS for both C and C++. # distutils use CFLAGS also at link stage -> we don't need to set LDFLAGS separately. tsan: CFLAGS=-g -fsanitize=thread asan: CFLAGS=-g -fsanitize=address # XXX however distutils' try_link, which is used by numpy.distutils use only CC # as linker without CFLAGS and _without_ LDFLAGS, which fails if *.o were # compiled with -fsanitize=X and linked without that option. Work it around # with also adjusting CC. # XXX better arrange to pass CFLAGS to pygolang only, e.g. by adding --race or # --sanitize=thread to `setup.py build_ext`. tsan: CC=cc -fsanitize=thread asan: CC=cc -fsanitize=address # always compile pygolang from source and don't reuse binary pygolang wheels as # we compile each case with different CFLAGS. install_command = python -m pip install --no-binary pygolang {opts} {packages} deps = .[all_test] # gpython pre-imports installed golang, will get into conflict with # golang/ if we run pytest from pygolang worktree. Avoid that. changedir = {envsitepackagesdir} commands= {toxinidir}/trun \ thread: {envpython} \ gevent: gpython \ -m pytest \ # asan/tsan: tell pytest not to capture output - else it is not possible to see # reports from sanitizers because they crash tested process on error. # likewise for python debug builds. asan,tsan,py{27,37}d: -s \ gpython/ golang/