-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from ckormanyos/coverage
Add coverage support
- Loading branch information
Showing
2 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Copyright Christopher Kormanyos 2024. | ||
# Distributed under the Boost Software License, | ||
# Version 1.0. (See accompanying file LICENSE_1_0.txt | ||
# or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
# | ||
|
||
# cd /mnt/c/Users/ckorm/Documents/Ks/PC_Software/Fortran/gamma/.gcov/make | ||
# ./cover.sh | ||
|
||
if [[ "$1" != "" ]]; then | ||
STD="$1" | ||
else | ||
STD=f2018 | ||
fi | ||
|
||
echo 'clean and create temporary directories' | ||
echo | ||
mkdir -p bin | ||
mkdir -p obj | ||
|
||
rm -rf bin | ||
rm -rf obj | ||
|
||
mkdir -p bin | ||
mkdir -p obj | ||
|
||
echo | ||
echo 'compile and link bin/gamma' | ||
echo | ||
g++ -O0 -std=$STD -x f77 -c -fprofile-arcs -ftest-coverage ../../gamma.f -o obj/gamma.o | ||
g++ -x none -fprofile-arcs -ftest-coverage obj/gamma.o -lquadmath -lgfortran -o bin/gamma | ||
|
||
echo | ||
echo 'verify existence of bin/gamma' | ||
echo | ||
ls -la bin/gamma | ||
res_00=$? | ||
|
||
echo | ||
echo 'execute bin/gamma' | ||
echo | ||
bin/gamma | ||
res_01=$? | ||
|
||
echo | ||
echo 'run gcov, lcov and htmlgen' | ||
echo | ||
gcov obj/gamma.f | ||
lcov --capture --directory . --output-file coverage.info | ||
genhtml coverage.info --output-directory bin/report | ||
res_02=$? | ||
|
||
|
||
result_total=$((res_00+res_01+res_02)) | ||
|
||
echo | ||
echo "res_00 : " "$res_00" | ||
echo "res_01 : " "$res_01" | ||
echo "res_02 : " "$res_02" | ||
echo "result_total : " "$result_total" | ||
echo "gamma_tests" | ||
echo | ||
|
||
exit $result_total |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# ------------------------------------------------------------------------------ | ||
# Copyright Christopher Kormanyos 2024. | ||
# Distributed under the Boost Software License, | ||
# Version 1.0. (See accompanying file LICENSE_1_0.txt | ||
# or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
# ------------------------------------------------------------------------------ | ||
|
||
name: gamma_f77_codecov | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
gnumake-gcc-gcov-native: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
standard: [ f2018 ] | ||
compiler: [ g++ ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
- name: update-tools | ||
run: sudo apt install lcov | ||
- name: gnumake-gcc-gcov-native | ||
run: | | ||
cd .gcov/make | ||
echo "build and run gcov/lcov/genhtml" | ||
./cover.sh | ||
echo | ||
echo "return to gamma_f77 root directory" | ||
cd ../.. | ||
- name: upload-codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
plugin: gcov | ||
file: ${{ runner.workspace }}/gamma_f77/.gcov/make/coverage.info | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: true | ||
verbose: false |