mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-21 14:53:02 +01:00
Merge pull request #19821 from janisozaur/llvm-coverage
Add clang-based tests coverage
This commit is contained in:
52
.github/workflows/ci.yml
vendored
52
.github/workflows/ci.yml
vendored
@@ -118,7 +118,7 @@ jobs:
|
|||||||
name: Windows (${{ matrix.platform_name }}) using mingw
|
name: Windows (${{ matrix.platform_name }}) using mingw
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: check-code-formatting
|
needs: check-code-formatting
|
||||||
container: openrct2/openrct2-build:8-mingw
|
container: openrct2/openrct2-build:11-mingw
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -262,19 +262,19 @@ jobs:
|
|||||||
build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments" -DWITH_TESTS=off -DDISABLE_FLAC=ON -DDISABLE_VORBIS=ON
|
build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments" -DWITH_TESTS=off -DDISABLE_FLAC=ON -DDISABLE_VORBIS=ON
|
||||||
- platform: x86_64
|
- platform: x86_64
|
||||||
distro: focal
|
distro: focal
|
||||||
image: openrct2/openrct2-build:8-focal
|
image: openrct2/openrct2-build:11-focal
|
||||||
build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g1 -gz" -DWITH_TESTS=off
|
build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g1 -gz" -DWITH_TESTS=off
|
||||||
- platform: x86_64
|
- platform: x86_64
|
||||||
distro: jammy
|
distro: jammy
|
||||||
image: openrct2/openrct2-build:8-jammy
|
image: openrct2/openrct2-build:11-jammy
|
||||||
build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments"
|
build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments"
|
||||||
- platform: x86_64
|
- platform: x86_64
|
||||||
distro: bullseye
|
distro: bullseye
|
||||||
image: openrct2/openrct2-build:8-bullseye
|
image: openrct2/openrct2-build:11-bullseye
|
||||||
build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments" -DWITH_TESTS=off
|
build_flags: -DCMAKE_POSITION_INDEPENDENT_CODE=on -DCMAKE_CXX_FLAGS="-g -gz -fno-var-tracking-assignments" -DWITH_TESTS=off
|
||||||
- platform: i686
|
- platform: i686
|
||||||
distro: focal
|
distro: focal
|
||||||
image: openrct2/openrct2-build:8-focal32
|
image: openrct2/openrct2-build:11-focal32
|
||||||
build_flags: -DFORCE32=ON -DENABLE_SCRIPTING=OFF -DCMAKE_CXX_FLAGS="-m32 -g1 -gz" -DWITH_TESTS=off
|
build_flags: -DFORCE32=ON -DENABLE_SCRIPTING=OFF -DCMAKE_CXX_FLAGS="-m32 -g1 -gz" -DWITH_TESTS=off
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -312,7 +312,7 @@ jobs:
|
|||||||
name: Linux (x86_64, AppImage)
|
name: Linux (x86_64, AppImage)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: check-code-formatting
|
needs: check-code-formatting
|
||||||
container: openrct2/openrct2-build:8-focal
|
container: openrct2/openrct2-build:11-focal
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -370,7 +370,7 @@ jobs:
|
|||||||
name: Linux (Debug, [http, network, flac, vorbis OpenGL] disabled) using clang
|
name: Linux (Debug, [http, network, flac, vorbis OpenGL] disabled) using clang
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: check-code-formatting
|
needs: check-code-formatting
|
||||||
container: openrct2/openrct2-build:8-jammy
|
container: openrct2/openrct2-build:11-jammy
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -382,11 +382,47 @@ jobs:
|
|||||||
uses: ammaraskar/gcc-problem-matcher@master
|
uses: ammaraskar/gcc-problem-matcher@master
|
||||||
- name: Build OpenRCT2
|
- name: Build OpenRCT2
|
||||||
run: . scripts/setenv && build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DDISABLE_NETWORK=ON -DDISABLE_HTTP=ON -DDISABLE_FLAC=ON -DDISABLE_VORBIS=ON -DDISABLE_OPENGL=ON
|
run: . scripts/setenv && build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DDISABLE_NETWORK=ON -DDISABLE_HTTP=ON -DDISABLE_FLAC=ON -DDISABLE_VORBIS=ON -DDISABLE_OPENGL=ON
|
||||||
|
linux-clang-tests:
|
||||||
|
name: Linux (Debug) using clang, coverage enabled
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: check-code-formatting
|
||||||
|
container: openrct2/openrct2-build:11-jammy
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: ccache
|
||||||
|
uses: hendrikmuhs/ccache-action@v1
|
||||||
|
with:
|
||||||
|
key: linux-clang
|
||||||
|
- name: Install GCC problem matcher
|
||||||
|
uses: ammaraskar/gcc-problem-matcher@master
|
||||||
|
- name: Build OpenRCT2
|
||||||
|
run: . scripts/setenv && build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-instr-generate -fcoverage-mapping" -DWITH_TESTS=on
|
||||||
|
- name: Run Tests
|
||||||
|
run: . scripts/setenv -q && LLVM_PROFILE_FILE="openrct2-coverage-%p.profraw" run-tests
|
||||||
|
- name: Process coverage information
|
||||||
|
run: |
|
||||||
|
cd bin
|
||||||
|
llvm-profdata merge -sparse openrct2-coverage*profraw -o openrct2.profdata
|
||||||
|
llvm-cov export -instr-profile=openrct2.profdata ./OpenRCT2Tests > coverage.json
|
||||||
|
llvm-cov report ./OpenRCT2Tests -instr-profile=openrct2.profdata
|
||||||
|
xz -1v openrct2.profdata
|
||||||
|
xz -1v coverage.json
|
||||||
|
xz -1v OpenRCT2Tests
|
||||||
|
- name: Upload artifacts (CI)
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: OpenRCT2-${{ runner.os }}-coverage
|
||||||
|
path: |
|
||||||
|
bin/*profdata*
|
||||||
|
bin/coverage.json*
|
||||||
|
bin/OpenRCT2Tests.xz
|
||||||
|
if-no-files-found: error
|
||||||
android:
|
android:
|
||||||
name: Android
|
name: Android
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: check-code-formatting
|
needs: check-code-formatting
|
||||||
container: openrct2/openrct2-build:8-android
|
container: openrct2/openrct2-build:11-android
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|||||||
@@ -123,7 +123,15 @@ void Plugin::ThrowIfStopping() const
|
|||||||
|
|
||||||
void Plugin::Unload()
|
void Plugin::Unload()
|
||||||
{
|
{
|
||||||
|
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105937, fixed in GCC13
|
||||||
|
# if defined(__GNUC__) && !defined(__clang__)
|
||||||
|
# pragma GCC diagnostic push
|
||||||
|
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||||
|
# endif
|
||||||
_metadata.Main = {};
|
_metadata.Main = {};
|
||||||
|
# if defined(__GNUC__) && !defined(__clang__)
|
||||||
|
# pragma GCC diagnostic pop
|
||||||
|
# endif
|
||||||
_hasLoaded = false;
|
_hasLoaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user