def process_coverage(args, job):
    print('# BEGIN SUBSECTION: coverage analysis')
    coverage_file = os.path.join(args.buildspace, 'coverage.info')
    cmd = ['lcov', '--capture', '--directory', args.buildspace, '--output', str(coverage_file)]
    print(cmd)
    subprocess.run(cmd, check=True)
    cmd = ['lcov', '--remove', coverage_file, '--output', coverage_file, '/usr/*', '/home/rosbuild/*', '*/test/*', '*/tests/*', '*gtest_vendor*', '*gmock_vendor*']
    print(cmd)
    subprocess.run(cmd, check=True)
    outfile = os.path.join(args.buildspace, 'coverage.xml')
    print('Writing coverage.xml report at path {}'.format(outfile))
    cmd = ['lcov_cobertura', coverage_file, '--output', outfile]
    subprocess.run(cmd, check=True)
    print('# END SUBSECTION')
    return 0
def process_coverage(args, job):
    print('# BEGIN SUBSECTION: coverage analysis')
    coverage_file = os.path.join(args.buildspace, 'coverage.info')
    cmd = ['lcov', '--capture', '--directory', args.buildspace, '--output', str(coverage_file)]
    print(cmd)
    subprocess.run(cmd, check=True)
    cmd = ['lcov', '--remove', coverage_file, '--output', coverage_file, '/usr/*', '/home/rosbuild/*', '*/test/*', '*/tests/*', '*gtest_vendor*', '*gmock_vendor*']
    print(cmd)
    subprocess.run(cmd, check=True)
    outfile = os.path.join(args.buildspace, 'coverage.xml')
    print('Writing coverage.xml report at path {}'.format(outfile))
    cmd = ['lcov_cobertura', coverage_file, '--output', outfile]
    subprocess.run(cmd, check=True)
    print('# END SUBSECTION')
    return 0