Skip to content

Commit

Permalink
Port C coverage fix to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Jul 26, 2024
1 parent 223eab5 commit b59b9a9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
36 changes: 25 additions & 11 deletions .github/workflows/cplusplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,17 @@ jobs:
matrix:
# compiler: ["llvm", "gcc"]
# # compiler targets (ideally): clang, gcc, MSVCC, icc,
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
# include:
os: [windows-latest, macos-latest, macos-13]
compiler: ['all']
include:
- os: ubuntu-latest
compiler: clang
- os: ubuntu-latest
compiler: gcc
- os: ubuntu-latest
compiler: tcc
- os: ubuntu-latest
compiler: pcc
# - os: windows-latest
# compiler: msvc
# - os: windows-latest
Expand All @@ -61,15 +70,20 @@ jobs:
compiler: msvc
vcvarsall: true

# - name: Set up MinGW
# if: ${{ contains(matrix.os, 'windows') }}
# uses: egor-tensin/setup-mingw@v2
# with:
# platform: x64
- name: Run tests (ubuntu-latest)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: make c_test COV=true COMPILER_OVERRIDE=${{ matrix.compiler }} NO_CLEANUP=true

- name: Run tests (linux)
if: ${{ contains(matrix.os, 'ubuntu') }}
run: make cp_test COV=true
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
# if: ${{ matrix.os == 'ubuntu-latest' }}
# with:
# ## limits ssh access and adds the ssh public key for the user which triggered the workflow
# limit-access-to-actor: true

- name: Run tests (ubuntu lts)
if: ${{ contains(matrix.os, 'ubuntu') && matrix.os != 'ubuntu-latest' }}
run: make c_test_auto

- name: Run tests (windows)
if: ${{ contains(matrix.os, 'windows') }}
Expand All @@ -84,7 +98,7 @@ jobs:

- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
if: ${{ contains(matrix.os, 'ubuntu') }}
if: ${{ matrix.compiler == 'ubuntu-latest' && (matrix.compiler == 'pcc' || matrix.compiler == 'tcc') }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: Cpp
6 changes: 3 additions & 3 deletions cplusplus/test_euler.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@
GCC_TEMPLATE = "{} {{}} -O2 -lstdc++ -lm -Wall -Werror -Wno-deprecated-declarations -std={} -march=native -flto -fwhole-program -o {{}}"
CLANG_TEMPLATE = "{} {{}} -O2 -lstdc++ {} {} -Wall -Werror -Wno-deprecated-declarations -std={} {} -o {{}}"
if environ.get('COV') == 'true':
GCC_TEMPLATE += ' -ftest-coverage -fprofile-arcs'
CLANG_TEMPLATE = CLANG_TEMPLATE.replace('-O2', '-O1') + ' -ftest-coverage'
GCC_TEMPLATE = GCC_TEMPLATE.replace('-O2', '-O1') + ' --coverage'
CLANG_TEMPLATE = CLANG_TEMPLATE.replace('-O2', '-O1') + ' --coverage'

templates = {}
for std in STANDARDS:
Expand All @@ -169,7 +169,7 @@

@register
def cleanup():
if 'PYTEST_XDIST_WORKER' not in environ:
if 'PYTEST_XDIST_WORKER' not in environ and environ.get('NO_CLEANUP', 'false') != 'true':
rmtree(BUILD_FOLDER)


Expand Down

0 comments on commit b59b9a9

Please sign in to comment.