Skip to content

Commit

Permalink
A few minor changes need to generate 'clean' coverage report for
Browse files Browse the repository at this point in the history
sandesh cpp library.

Change-Id: I51c1c40440239f09fa42f3cc999ca14c1cd5eae0
Closes-Bug: #1483438
  • Loading branch information
Raj Reddy committed Aug 10, 2015
1 parent be43d3e commit 90e2637
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion library/c/test/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ env.Depends(sandesh_c_test, env.Alias('src/sandesh:sandesh_pre_c_test'))
test_suite = [sandesh_pre_c_test,
sandesh_c_test]

test = env.TestSuite('sandesh-test', test_suite)
test = env.TestSuite('sandesh-c-test', test_suite)
env.Alias('sandesh:ctest', test)
Return('test_suite')
17 changes: 12 additions & 5 deletions library/cpp/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ env.Install(env['TOP_INCLUDE'] + '/sandesh/transport', 'transport/TBufferTranspo

test_suite = SandeshEnv.SConscript('test/SConscript', exports='SandeshEnv SandeshTraceGenSrcs', duplicate = 0)

import copy
test_suite_cpp = copy.copy(test_suite)

def code_coverage(target, source, env):
# rm -rf sandesh/library/cpp/test_coverage
import shutil
Expand All @@ -152,17 +155,21 @@ def code_coverage(target, source, env):
import subprocess
ShEnv = {env['ENV_SHLIB_PATH']: 'build/lib'}

for test in test_suite:
for test in test_suite_cpp:
cmd = test[0].path
logfile = open(cmd + '.log', 'w')
subprocess.call([cmd], stdout=logfile, env=ShEnv)

# lcov --base-directory $ROOT -- directory . -c -o bgp_test.info
# lcov --base-directory $ROOT -- directory . -c -o sandesh_cpp_test_intermediate.info
os.system('lcov --base-directory . --directory ' + Dir('.').path +
' -c -o sandesh_cpp_test.info')
' -c -o sandesh_cpp_test_intermediate.info')

os.system('lcov -e sandesh_cpp_test_intermediate.info ' +
Dir('#').abspath + '/tools/sandesh/library/cpp/*' +
' -o sandesh_cpp_test.info')

# genhtml -o bgp/test_coverage sandesh_cpp_test.info
os.system('genhtml -o ' + target[0].path +
# genhtml -o tools/sandesh/library/cpp/test_coverage sandesh_cpp_test.info
os.system('genhtml --no-branch-coverage -o ' + target[0].path +
' -t "test coverage" --num-spaces 4 sandesh_cpp_test.info')

if env['OPT'] == 'coverage':
Expand Down
2 changes: 1 addition & 1 deletion library/python/pysandesh/test/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ _deps = []
_deps += env.venv_add_pip_pkg(venv, pip_pkgs)
_deps += env.venv_add_build_pkg(venv, map(lambda x: Dir(x).abspath, sandesh_pkgs))

pysandesh_ut = env.PyTestSuite('sandesh-test', test_modules, venv=env['env_venv'])
pysandesh_ut = env.PyTestSuite('sandesh-py-test', test_modules, venv=env['env_venv'])
for d in _deps:
env.Requires(pysandesh_ut, d.name)
env.Depends(pysandesh_ut, test_depend_modules_rules)
Expand Down

0 comments on commit 90e2637

Please sign in to comment.