Skip to content

Commit 6c33cd8

Browse files
committed
add LLVM-based coverage generation support and integrate with CI pipeline
1 parent b1ddc16 commit 6c33cd8

File tree

4 files changed

+240
-257
lines changed

4 files changed

+240
-257
lines changed

.clang-tidy

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -32,60 +32,60 @@ WarningsAsErrors: "*"
3232
HeaderFilterRegex: '.*/(modules|tasks)/.*'
3333

3434
CheckOptions:
35-
- key: readability-identifier-naming.ClassCase
36-
value: CamelCase
37-
- key: readability-identifier-naming.ClassMemberCase
38-
value: lower_case
39-
- key: readability-identifier-naming.ConstexprVariableCase
40-
value: CamelCase
41-
- key: readability-identifier-naming.ConstexprVariablePrefix
42-
value: k
43-
- key: readability-identifier-naming.EnumCase
44-
value: CamelCase
45-
- key: readability-identifier-naming.EnumConstantCase
46-
value: CamelCase
47-
- key: readability-identifier-naming.EnumConstantPrefix
48-
value: k
49-
- key: readability-identifier-naming.FunctionCase
50-
value: CamelCase
51-
- key: readability-identifier-naming.GlobalConstantCase
52-
value: CamelCase
53-
- key: readability-identifier-naming.GlobalConstantPrefix
54-
value: k
55-
- key: readability-identifier-naming.StaticConstantCase
56-
value: CamelCase
57-
- key: readability-identifier-naming.StaticConstantPrefix
58-
value: k
59-
- key: readability-identifier-naming.StaticVariableCase
60-
value: lower_case
61-
- key: readability-identifier-naming.MacroDefinitionCase
62-
value: UPPER_CASE
63-
- key: readability-identifier-naming.MacroDefinitionIgnoredRegexp
64-
value: '^[A-Z]+(_[A-Z]+)*_$'
65-
- key: readability-identifier-naming.MemberCase
66-
value: lower_case
67-
- key: readability-identifier-naming.PrivateMemberSuffix
68-
value: _
69-
- key: readability-identifier-naming.PublicMemberSuffix
70-
value: ''
71-
- key: readability-identifier-naming.NamespaceCase
72-
value: lower_case
73-
- key: readability-identifier-naming.ParameterCase
74-
value: lower_case
75-
- key: readability-identifier-naming.TypeAliasCase
76-
value: CamelCase
77-
- key: readability-identifier-naming.TypedefCase
78-
value: CamelCase
79-
- key: readability-identifier-naming.VariableCase
80-
value: lower_case
81-
- key: readability-identifier-naming.IgnoreMainLikeFunctions
82-
value: 1
35+
- key: readability-identifier-naming.ClassCase
36+
value: CamelCase
37+
- key: readability-identifier-naming.ClassMemberCase
38+
value: lower_case
39+
- key: readability-identifier-naming.ConstexprVariableCase
40+
value: CamelCase
41+
- key: readability-identifier-naming.ConstexprVariablePrefix
42+
value: k
43+
- key: readability-identifier-naming.EnumCase
44+
value: CamelCase
45+
- key: readability-identifier-naming.EnumConstantCase
46+
value: CamelCase
47+
- key: readability-identifier-naming.EnumConstantPrefix
48+
value: k
49+
- key: readability-identifier-naming.FunctionCase
50+
value: CamelCase
51+
- key: readability-identifier-naming.GlobalConstantCase
52+
value: CamelCase
53+
- key: readability-identifier-naming.GlobalConstantPrefix
54+
value: k
55+
- key: readability-identifier-naming.StaticConstantCase
56+
value: CamelCase
57+
- key: readability-identifier-naming.StaticConstantPrefix
58+
value: k
59+
- key: readability-identifier-naming.StaticVariableCase
60+
value: lower_case
61+
- key: readability-identifier-naming.MacroDefinitionCase
62+
value: UPPER_CASE
63+
- key: readability-identifier-naming.MacroDefinitionIgnoredRegexp
64+
value: '^[A-Z]+(_[A-Z]+)*_$'
65+
- key: readability-identifier-naming.MemberCase
66+
value: lower_case
67+
- key: readability-identifier-naming.PrivateMemberSuffix
68+
value: _
69+
- key: readability-identifier-naming.PublicMemberSuffix
70+
value: ''
71+
- key: readability-identifier-naming.NamespaceCase
72+
value: lower_case
73+
- key: readability-identifier-naming.ParameterCase
74+
value: lower_case
75+
- key: readability-identifier-naming.TypeAliasCase
76+
value: CamelCase
77+
- key: readability-identifier-naming.TypedefCase
78+
value: CamelCase
79+
- key: readability-identifier-naming.VariableCase
80+
value: lower_case
81+
- key: readability-identifier-naming.IgnoreMainLikeFunctions
82+
value: 1
8383
# Functions with scores beyond 15 are typically flagged as potentially problematic (empirically)
84-
- key: readability-function-cognitive-complexity.Threshold
85-
value: 15 # default: 25
86-
- key: readability-identifier-length.MinimumVariableNameLength
87-
value: 1
88-
- key: readability-identifier-length.MinimumParameterNameLength
89-
value: 1
84+
- key: readability-function-cognitive-complexity.Threshold
85+
value: 15 # default: 25
86+
- key: readability-identifier-length.MinimumVariableNameLength
87+
value: 1
88+
- key: readability-identifier-length.MinimumParameterNameLength
89+
value: 1
9090
- key: misc-include-cleaner.IgnoreHeaders
9191
value: '(__chrono/.*|stdlib\.h|3rdparty/.*)'

.github/workflows/ubuntu.yml

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -352,51 +352,20 @@ jobs:
352352
- name: Build project
353353
run: |
354354
cmake --build build --parallel
355-
- name: Run tests (MPI)
356-
run: scripts/run_tests.py --running-type="processes" --additional-mpi-args="--oversubscribe"
357-
env:
358-
PPC_NUM_PROC: 2
359-
PPC_NUM_THREADS: 2
360-
OMPI_ALLOW_RUN_AS_ROOT: 1
361-
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
362-
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
363-
- name: Run tests (threads)
364-
run: scripts/run_tests.py --running-type="threads" --counts 1 2 3 4
365-
env:
366-
PPC_NUM_PROC: 1
367-
LLVM_PROFILE_FILE: "coverage-%p-%m.profraw"
368-
- name: Generate LLVM Coverage Data
369-
run: |
370-
mkdir cov-report
371-
cd build
372-
# Merge all raw profiles into a single indexed profile
373-
llvm-profdata-20 merge -sparse $(find . -name "*.profraw") -o coverage.profdata
374-
# Find all test executables
375-
BINARIES=$(find bin -type f -executable | tr '\n' ' ')
376-
# Generate coverage report in LCOV format for Codecov
377-
llvm-cov-20 export \
378-
$BINARIES \
379-
--format=lcov \
380-
--ignore-filename-regex='.*3rdparty/.*|/usr/.*|.*tests/.*|.*tasks/.*|.*modules/runners/.*|.*modules/util/include/perf_test_util.hpp|.*modules/util/include/func_test_util.hpp|.*modules/util/src/func_test_util.cpp' \
381-
--instr-profile=coverage.profdata \
382-
> ../coverage.lcov
383-
# Generate HTML report
384-
llvm-cov-20 show \
385-
$BINARIES \
386-
--format=html \
387-
--output-dir=../cov-report \
388-
--ignore-filename-regex='.*3rdparty/.*|/usr/.*|.*tests/.*|.*tasks/.*|.*modules/runners/.*|.*modules/util/include/perf_test_util.hpp|.*modules/util/include/func_test_util.hpp|.*modules/util/src/func_test_util.cpp' \
389-
--instr-profile=coverage.profdata
355+
- name: Run tests and generate coverage
356+
run: >
357+
python3 scripts/run_tests.py --running-type processes_coverage
358+
--additional-mpi-args "--oversubscribe" --llvm-version 20
390359
- name: Upload coverage reports to Codecov
391360
uses: codecov/[email protected]
392361
with:
393-
files: coverage.lcov
362+
files: build/coverage/coverage.lcov
394363
- name: Upload coverage report artifact
395364
id: upload-cov
396365
uses: actions/upload-artifact@v4
397366
with:
398367
name: cov-report
399-
path: 'cov-report'
368+
path: 'build/coverage/html'
400369
- name: Comment coverage report link
401370
# TODO: Support PRs from forks and handle cases with insufficient write permissions
402371
continue-on-error: true

scripts/generate_llvm_coverage.py

Lines changed: 0 additions & 162 deletions
This file was deleted.

0 commit comments

Comments
 (0)