Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@ jobs:
lcov --remove target/filter1.info '*/json/test/*' '*/json/bench/*' \
'*/json/example/*' --output-file target/filter2.info

git diff -U0 --no-indent-heuristic --minimal --no-index \
base/boost-root/libs/json target/boost-root/libs/json | tee diff
diff -Nru0 --minimal -x '.git' base/boost-root/libs/json \
target/boost-root/libs/json | tee diff

./diff-coverage-report.py -O pages -S target/boost-root/libs/json \
-B base/filter2.info -T target/filter2.info -D diff \
-P $PWD/base/boost-root/boost $PWD/target/boost-root/libs/json/include/boost \
$PWD/target/boost-root/boost $PWD/target/boost-root/libs/json/include/boost \
$PWD/base/boost-root $PWD/target/boost-root \
a/base/boost-root $PWD/target/boost-root \
b/target/boost-root $PWD/target/boost-root
base/boost-root $PWD/target/boost-root \
target/boost-root $PWD/target/boost-root

- name: Save coverage info
uses: actions/upload-artifact@v4
Expand Down
24 changes: 20 additions & 4 deletions diff-coverage-report.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,19 +241,29 @@ def commit():
old_line = -1
new_line = -1

_, old_file = l.split(' ', 1)
old_file = l.split(' ', 1)[1]
old_file = old_file.split('\t', 1)[0]
old_file = fix_path(old_file.rstrip(), prefix_map)

elif l.startswith('+++ '):
prior_preprends = 0
_, new_file = l.split(' ', 1)
new_file = l.split(' ', 1)[1]
new_file = new_file.split('\t', 1)[0]
new_file = fix_path(new_file.rstrip(), prefix_map)
if old_file != new_file:
if old_file == '/dev/null':
old_file = new_file
elif new_file == '/dev/null':
new_file = old_file
assert old_file == new_file
if old_file != new_file:
print(
'error: diffed files have different names:\n'
f'\t{old_file}\n'
f'\t{new_file}\n'
'Did you forget to map a path prefix?',
file=sys.stderr
)
sys.exit(1)

file_data = result.get(new_file)
if file_data is None:
Expand Down Expand Up @@ -360,7 +370,13 @@ def fix_path(path: str, prefix_map) -> str:


def path_suffix(path: str, source_dir: str) -> str:
assert path.startswith(source_dir)
if not path.startswith(source_dir):
print(
f'error: file path {path} doesn\'t belong to the source directory'
f' {source_dir}.\nDid you forget to map a path prefix?',
file=sys.stderr
)
sys.exit(1)
return path[len(source_dir) + 1:]


Expand Down