tox.ini 2.55 KB
Newer Older
1
[tox]
2
envlist =
3
    {py27d,py27,py37,py38d,py38,pypy,pypy3}-{thread,gevent}
4 5 6 7 8 9 10 11 12


# 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.
13
    {py27d,py27,py37,py38d,py38           }-{thread       }-tsan
14 15 16 17
# 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.
18
#   {py27d,py27,py37,py38d,py38           }-{       gevent}-tsan
19 20 21 22 23


# AddressSanitizer

# XXX asan does not work with gevent: https://github.com/python-greenlet/greenlet/issues/113
24
    {py27d,py27,py37,py38d,py38,pypy,pypy3}-{thread       }-asan
25 26

[testenv]
27 28 29 30
basepython =
    py27d:  python2.7-dbg
    py27:   python2.7
    py37:   python3.7
31 32
    py38d:  python3.8-dbg
    py38:   python3.8
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
    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}

55
deps    =
56
    .[all_test]
57

58 59 60 61 62
# gpython pre-imports installed golang, will get into conflict with
# golang/ if we run pytest from pygolang worktree. Avoid that.
changedir = {envsitepackagesdir}

commands=
63 64 65 66 67 68 69 70 71
    {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/