Skip to content

Commit c1fb21c

Browse files
authored
[#258] MCDC Verify gcda files
1 parent f405c63 commit c1fb21c

File tree

1 file changed

+6
-53
lines changed

1 file changed

+6
-53
lines changed

.github/workflows/mc_dc_coverage.yml

Lines changed: 6 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Configure Safe Directory
2626
run: git config --global --add safe.directory $GITHUB_WORKSPACE
2727

28-
- name: Install Dependencies (Including Clang 19)
28+
- name: Install Dependencies
2929
env:
3030
DEBIAN_FRONTEND: noninteractive
3131
run: |
@@ -35,31 +35,14 @@ jobs:
3535
lcov libcurl4-openssl-dev libmariadb-dev libmariadb-dev-compat \
3636
python3 python3-pip python3-venv gcovr bc pipx wget \
3737
software-properties-common
38-
# # Add the official LLVM repository and install Clang 19
39-
# wget https://apt.llvm.org/llvm.sh
40-
# chmod +x llvm.sh
41-
# ./llvm.sh 19
42-
# apt-get install -y clang-19 libclang-19-dev python3-clang-19
43-
# apt-get remove -y libclang-14-dev libclang-common-14-dev libclang1-14 libllvm14 python3-clang-14
44-
# # Ensure Clang 19 is the default
45-
# update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-19/bin/clang 100
46-
# update-alternatives --install /usr/bin/clang++ clang++ /usr/lib/llvm-19/bin/clang++ 100
47-
# pipx install --system-site-packages mcdc-checker
48-
# pipx ensurepath
49-
# - name: Verify Clang Installation
50-
# run: |
51-
# echo "Checking clang binary..."
52-
# which clang || { echo "clang not found in PATH"; exit 1; }
53-
# echo "clang version:"
54-
# clang --version
55-
# - name: Verify Clang Python Bindings
56-
# run: |
57-
# echo "Testing Clang Python bindings..."
58-
# python3 -c "import clang.cindex; print('Clang bindings are working')"
5938
- name: Build with Coverage Flags
6039
run: |
6140
export CFLAGS="-fprofile-arcs -ftest-coverage -fcondition-coverage -g"
6241
bash ${GITHUB_WORKSPACE}/support/scripts/build_internal.sh
42+
- name: Verify Coverage Files
43+
run: |
44+
echo "Verifying .gcda files..."
45+
find $GITHUB_WORKSPACE -name "*.gcda" || { echo "No coverage files found!"; exit 1; }
6346
- name: Generate Coverage Report and Badges
6447
run: |
6548
mkdir -p doc/coverage
@@ -81,37 +64,7 @@ jobs:
8164
git add doc/coverage/branch-coverage-badge.svg
8265
git commit -m "Update coverage badges" || echo "No changes to commit"
8366
git push origin HEAD
84-
- name: Run MC/DC Analysis
85-
run: |
86-
echo "Setting up environment for MC/DC Checker..."
87-
export PATH=/usr/lib/llvm-19/bin:$HOME/.local/bin:$PATH
88-
export LD_LIBRARY_PATH=/usr/lib/llvm-19/lib:$LD_LIBRARY_PATH
89-
export CC=/usr/lib/llvm-19/bin/clang
90-
export CXX=/usr/lib/llvm-19/bin/clang++
91-
92-
echo "Verifying Clang bindings..."
93-
python3 -c "
94-
import clang.cindex as cindex
95-
cindex.Config.set_library_file('/usr/lib/llvm-19/lib/libclang.so')
96-
print('Clang library file configured:', cindex.Config.library_file)
97-
"
98-
99-
echo "Running mcdc-checker..."
100-
mcdc-checker -a -j $GITHUB_WORKSPACE/doc/coverage/mcdc_report.json \
101-
-I $GITHUB_WORKSPACE/include \
102-
-I $GITHUB_WORKSPACE/test/include \
103-
$(find $GITHUB_WORKSPACE/src -type f -name '*.c' | tr '\n' ' ') \
104-
$(find $GITHUB_WORKSPACE/test -type f -name '*.c' | tr '\n' ' ') \
105-
> $GITHUB_WORKSPACE/doc/coverage/mcdc_checker_output.log 2>&1 || true
106-
107-
echo "Displaying MC/DC Checker Output:"
108-
cat $GITHUB_WORKSPACE/doc/coverage/mcdc_checker_output.log
109-
110-
- name: Display MC/DC Checker Output
111-
run: |
112-
echo "Displaying MC/DC Checker Output:"
113-
cat $GITHUB_WORKSPACE/doc/coverage/mcdc_checker_output.log
114-
67+
11568
- name: Archive Coverage Directory
11669
uses: actions/upload-artifact@v3
11770
with:

0 commit comments

Comments
 (0)