tox.ini 2.8 KB
Newer Older
1
[tox]
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
envlist =
    {      py27,py36,py37d,py37,pypy,pypy3}-{thread,gevent}
# XXX gevent fails to install with python2-dbg (https://github.com/gevent/gevent/issues/1461)
    {py27d                                }-{thread       }


# 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.
    {      py27,py36,py37d,py37           }-{thread       }-tsan
# XXX see ^^^ about gevent vs python2-dbg
    {py27d                                }-{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.
#   {      py27,py36,py37d,py37           }-{       gevent}-tsan


# AddressSanitizer

# XXX asan does not work with gevent: https://github.com/python-greenlet/greenlet/issues/113
    {py27d,py27,py36,py37d,py37,pypy,pypy3}-{thread       }-asan
29 30

[testenv]
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
basepython =
    py27d:  python2.7-dbg
    py27:   python2.7
    py36:   python3.6
    py37d:  python3.7-dbg
    py37:   python3.7
    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}

59
deps    =
60
    .[all]
61

62 63 64 65 66
# gpython pre-imports installed golang, will get into conflict with
# golang/ if we run pytest from pygolang worktree. Avoid that.
changedir = {envsitepackagesdir}

commands=
67 68 69 70 71 72 73 74 75
    {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/