mirror of
https://github.com/znc/znc.git
synced 2026-06-29 22:41:39 +02:00
Fix coverage for C++ on github actions
This commit is contained in:
+22
-26
@@ -7,25 +7,17 @@ cpanm --local-lib=~/perl5 local::lib
|
||||
eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
|
||||
cpanm --notest Devel::Cover::Report::Clover
|
||||
pip3 install --user coverage
|
||||
export ZNC_MODPERL_COVERAGE=1"
|
||||
export ZNC_MODPYTHON_COVERAGE=1"
|
||||
export ZNC_MODPERL_COVERAGE=1
|
||||
#export ZNC_MODPYTHON_COVERAGE=1
|
||||
|
||||
case "$RUNNER_OS" in
|
||||
Linux)
|
||||
CXX_FOR_COV=$CXX
|
||||
case "${CC:-gcc}" in
|
||||
gcc)
|
||||
export CXXFLAGS="$CXXFLAGS --coverage"
|
||||
export LDFLAGS="$LDFLAGS --coverage"
|
||||
;;
|
||||
macOS)
|
||||
CXX_FOR_COV=clang++
|
||||
;;
|
||||
esac
|
||||
case "$CXX_FOR_COV" in
|
||||
g++)
|
||||
CXXFLAGS+=" --coverage"
|
||||
LDFLAGS+=" --coverage"
|
||||
;;
|
||||
clang++)
|
||||
CXXFLAGS+=" -fprofile-instr-generate -fcoverage-mapping"
|
||||
LDFLAGS+=" -fprofile-instr-generate"
|
||||
clang)
|
||||
export CXXFLAGS="$CXXFLAGS -fprofile-instr-generate -fcoverage-mapping"
|
||||
export LDFLAGS="$LDFLAGS -fprofile-instr-generate"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -41,16 +33,20 @@ sudo make install
|
||||
|
||||
# TODO: use DEVEL_COVER_OPTIONS for https://metacpan.org/pod/Devel::Cover
|
||||
env LLVM_PROFILE_FILE="$PWD/inttest.profraw" ZNC_MODPERL_COVERAGE_OPTS="-db,$PWD/cover_db" PYTHONWARNINGS=error make VERBOSE=1 inttest
|
||||
ls -lRa
|
||||
|
||||
case "$RUNNER_OS" in
|
||||
Linux)
|
||||
~/perl5/bin/cover --no-gcov --report=clover
|
||||
~/perl5/bin/cover --no-gcov --report=clover
|
||||
|
||||
case "${CC:-gcc}" in
|
||||
gcc)
|
||||
lcov --directory . --capture --output-file lcov-coverage.txt
|
||||
lcov --list lcov-coverage.txt
|
||||
;;
|
||||
macOS)
|
||||
xcrun llvm-profdata merge unittest.profraw -o unittest.profdata
|
||||
xcrun llvm-profdata merge inttest.profraw -o inttest.profdata
|
||||
xcrun llvm-cov show -show-line-counts-or-regions -instr-profile=unittest.profdata test/unittest_bin > unittest-cmake-coverage.txt
|
||||
xcrun llvm-cov show -show-line-counts-or-regions -instr-profile=inttest.profdata /usr/local/bin/znc > inttest-znc-coverage.txt
|
||||
find /usr/local/lib/znc -name '*.so' -or -name '*.bundle' | while read f; do xcrun llvm-cov show -show-line-counts-or-regions -instr-profile=inttest.profdata $f > inttest-$(basename $f)-coverage.txt; done
|
||||
clang)
|
||||
llvm-profdata merge unittest.profraw -o unittest.profdata
|
||||
llvm-profdata merge inttest.profraw -o inttest.profdata
|
||||
llvm-cov show -show-line-counts-or-regions -instr-profile=unittest.profdata test/unittest_bin > unittest-cmake-coverage.txt
|
||||
llvm-cov show -show-line-counts-or-regions -instr-profile=inttest.profdata /usr/local/bin/znc > inttest-znc-coverage.txt
|
||||
find /usr/local/lib/znc -name '*.so' -or -name '*.bundle' | while read f; do llvm-cov show -show-line-counts-or-regions -instr-profile=inttest.profdata $f > inttest-$(basename $f)-coverage.txt; done
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user