Skip to content

Commit

Permalink
Merge pull request grpc#5690 from soltanmm/merp
Browse files Browse the repository at this point in the history
Don't set linetrace unless testing coverage
  • Loading branch information
soltanmm committed Mar 10, 2016
2 parents 01dd7fe + 68a94c8 commit 8831d4c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,13 @@

def cython_extensions(package_names, module_names, extra_sources, include_dirs,
libraries, define_macros, build_with_cython=False):
# Set compiler directives linetrace argument only if we care about tracing;
# this is due to Cython having different behavior between linetrace being
# False and linetrace being unset. See issue #5689.
cython_compiler_directives = {}
if ENABLE_CYTHON_TRACING:
define_macros = define_macros + [('CYTHON_TRACE_NOGIL', 1)]
cython_compiler_directives['linetrace'] = True
file_extension = 'pyx' if build_with_cython else 'c'
module_files = [os.path.join(PYTHON_STEM,
name.replace('.', '/') + '.' + file_extension)
Expand All @@ -129,7 +134,7 @@ def cython_extensions(package_names, module_names, extra_sources, include_dirs,
return Cython.Build.cythonize(
extensions,
include_path=include_dirs,
compiler_directives={'linetrace': bool(ENABLE_CYTHON_TRACING)})
compiler_directives=cython_compiler_directives)
else:
return extensions

Expand Down
6 changes: 5 additions & 1 deletion tools/run_tests/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ export PATH=$ROOT/bins/$CONFIG:$ROOT/bins/$CONFIG/protobuf:$PATH
export CFLAGS="-I$ROOT/include -std=gnu99"
export LDFLAGS="-L$ROOT/libs/$CONFIG"
export GRPC_PYTHON_BUILD_WITH_CYTHON=1
export GRPC_PYTHON_ENABLE_CYTHON_TRACING=1

if [ "$CONFIG" = "gcov" ]
then
export GRPC_PYTHON_ENABLE_CYTHON_TRACING=1
fi

tox --notest

Expand Down
2 changes: 1 addition & 1 deletion tools/run_tests/run_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ export PATH=$ROOT/bins/$CONFIG:$ROOT/bins/$CONFIG/protobuf:$PATH
export CFLAGS="-I$ROOT/include -std=c89"
export LDFLAGS="-L$ROOT/libs/$CONFIG"
export GRPC_PYTHON_BUILD_WITH_CYTHON=1
export GRPC_PYTHON_ENABLE_CYTHON_TRACING=1

if [ "$CONFIG" = "gcov" ]
then
export GRPC_PYTHON_ENABLE_CYTHON_TRACING=1
tox
else
$ROOT/.tox/py27/bin/python $ROOT/setup.py test_lite
Expand Down

0 comments on commit 8831d4c

Please sign in to comment.