Skip to content

Commit

Permalink
C# native extension coverage on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
jtattermusch committed Oct 28, 2015
1 parent 61c3a83 commit bdf4b2e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tools/run_tests/build_csharp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

set -ex

if [ "$CONFIG" = "dbg" ]
if [ "$CONFIG" = "dbg" ] || [ "$CONFIG" = "gcov" ]
then
MSBUILD_CONFIG="Debug"
else
Expand Down
18 changes: 14 additions & 4 deletions tools/run_tests/run_csharp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ CONFIG=${CONFIG:-opt}

NUNIT_CONSOLE="mono packages/NUnit.Runners.2.6.4/tools/nunit-console.exe"

if [ "$CONFIG" = "dbg" ]
if [ "$CONFIG" = "dbg" ] || [ "$CONFIG" = "gcov" ]
then
MSBUILD_CONFIG="Debug"
else
Expand All @@ -45,10 +45,20 @@ fi
cd $(dirname $0)/../..

root=`pwd`
cd src/csharp

export LD_LIBRARY_PATH=$root/libs/$CONFIG

$NUNIT_CONSOLE -labels "$1/bin/$MSBUILD_CONFIG/$1.dll"
if [ "$CONFIG" = "gcov" ]
then
(cd src/csharp; $NUNIT_CONSOLE -labels "Grpc.Core.Tests/bin/$MSBUILD_CONFIG/Grpc.Core.Tests.dll")

gcov objs/gcov/src/csharp/ext/*.o
lcov --base-directory . --directory . -c -o coverage.info
lcov -e coverage.info '**/src/csharp/ext/*' -o coverage.info
genhtml -o reports/csharp_ext_coverage --num-spaces 2 \
-t 'gRPC C# native extension test coverage' coverage.info \
--rc genhtml_hi_limit=95 --rc genhtml_med_limit=80 --no-prefix
else
(cd src/csharp; $NUNIT_CONSOLE -labels "$1/bin/$MSBUILD_CONFIG/$1.dll")
fi


8 changes: 4 additions & 4 deletions tools/run_tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,10 @@ def test_specs(self, config, travis):
else:
cmd = 'tools/run_tests/run_csharp.sh'

if config.build_config == 'gcov' and self.platform == 'windows':
# For C# code coverage we need to:
# 1) Run all tests as one suite.
# 2) Need to be on Windows.
if config.build_config == 'gcov':
# On Windows, we only collect C# code coverage.
# On Linux, we only collect coverage for native extension.
# For code coverage all tests need to run as one suite.
return [config.job_spec([cmd], None,
environ=_FORCE_ENVIRON_FOR_WRAPPERS)]
else:
Expand Down

0 comments on commit bdf4b2e

Please sign in to comment.