use `ccache` for sanitizer builds / do not use precompiled headers with `ccache` (#4910)

* added CMake option `DISABLE_DMAKE` to disable `run-dmake` dependencies

* tools/CMakeLists.txt: added TODO

* use `ccache` for sanitizer builds

* aligned selfcheck between sanitizer workflows and disabled some currently unnecessary steps

* CI-unixish.yml: do not use precompiled headers with `ccache`
This commit is contained in:
Oliver Stöneberg 2023-04-01 09:40:10 +02:00 committed by GitHub
parent 01a22159b8
commit 5ec0ad6bed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 60 additions and 14 deletions

View File

@ -18,7 +18,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env: env:
# TODO: files are cached but are still cache misses on platforms other than ubuntu-22.04 # TODO: figure out why there are cache misses with PCH enabled
CCACHE_SLOPPINESS: pch_defines,time_macros CCACHE_SLOPPINESS: pch_defines,time_macros
steps: steps:
@ -45,13 +45,13 @@ jobs:
- name: CMake build on ubuntu (with GUI / system tinyxml2) - name: CMake build on ubuntu (with GUI / system tinyxml2)
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
run: | run: |
cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build cmake.output.tinyxml2 -- -j$(nproc) cmake --build cmake.output.tinyxml2 -- -j$(nproc)
- name: CMake build on macos (with GUI / system tinyxml2) - name: CMake build on macos (with GUI / system tinyxml2)
if: contains(matrix.os, 'macos') if: contains(matrix.os, 'macos')
run: | run: |
cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5 cmake -S . -B cmake.output.tinyxml2 -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5
cmake --build cmake.output.tinyxml2 -- -j$(nproc) cmake --build cmake.output.tinyxml2 -- -j$(nproc)
- name: Run CMake test (system tinyxml2) - name: Run CMake test (system tinyxml2)
@ -68,7 +68,7 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env: env:
# TODO: files are cached but are still cache misses # TODO: figure out why there are cache misses with PCH enabled
CCACHE_SLOPPINESS: pch_defines,time_macros CCACHE_SLOPPINESS: pch_defines,time_macros
steps: steps:
@ -95,13 +95,13 @@ jobs:
- name: CMake build on ubuntu (with GUI) - name: CMake build on ubuntu (with GUI)
if: contains(matrix.os, 'ubuntu') if: contains(matrix.os, 'ubuntu')
run: | run: |
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build cmake.output -- -j$(nproc) cmake --build cmake.output -- -j$(nproc)
- name: CMake build on macos (with GUI) - name: CMake build on macos (with GUI)
if: contains(matrix.os, 'macos') if: contains(matrix.os, 'macos')
run: | run: |
cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5 cmake -S . -B cmake.output -G "Unix Makefiles" -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5
cmake --build cmake.output -- -j$(nproc) cmake --build cmake.output -- -j$(nproc)
- name: Run CMake test - name: Run CMake test

View File

@ -15,10 +15,17 @@ jobs:
env: env:
QT_VERSION: 5.15.2 QT_VERSION: 5.15.2
ASAN_OPTIONS: detect_stack_use_after_return=1 ASAN_OPTIONS: detect_stack_use_after_return=1
# TODO: figure out why there are cache misses with PCH enabled
CCACHE_SLOPPINESS: pch_defines,time_macros
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Set up Python 3.11 - name: Set up Python 3.11
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
@ -37,6 +44,7 @@ jobs:
sudo ./llvm.sh 16 sudo ./llvm.sh 16
- name: Install Qt ${{ env.QT_VERSION }} - name: Install Qt ${{ env.QT_VERSION }}
if: false
uses: jurplel/install-qt-action@v3 uses: jurplel/install-qt-action@v3
with: with:
version: ${{ env.QT_VERSION }} version: ${{ env.QT_VERSION }}
@ -45,7 +53,7 @@ jobs:
- name: CMake - name: CMake
run: | run: |
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DUSE_MATCHCOMPILER=Verify -DANALYZE_ADDRESS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=Off -DWITH_QCHART=Off -DUSE_MATCHCOMPILER=Verify -DANALYZE_ADDRESS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=Off -DDISABLE_DMAKE=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
env: env:
CC: clang-16 CC: clang-16
CXX: clang++-16 CXX: clang++-16
@ -62,6 +70,7 @@ jobs:
run: ./cmake.output/bin/testrunner run: ./cmake.output/bin/testrunner
- name: Generate dependencies - name: Generate dependencies
if: false
run: | run: |
# make sure auto-generated GUI files exist # make sure auto-generated GUI files exist
make -C cmake.output autogen make -C cmake.output autogen

View File

@ -13,11 +13,19 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
env: env:
QT_VERSION: 5.15.2
TSAN_OPTIONS: halt_on_error=1 TSAN_OPTIONS: halt_on_error=1
# TODO: figure out why there are cache misses with PCH enabled
CCACHE_SLOPPINESS: pch_defines,time_macros
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Set up Python 3.11 - name: Set up Python 3.11
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
@ -35,9 +43,17 @@ jobs:
chmod +x llvm.sh chmod +x llvm.sh
sudo ./llvm.sh 16 sudo ./llvm.sh 16
- name: Install Qt ${{ env.QT_VERSION }}
if: false
uses: jurplel/install-qt-action@v3
with:
version: ${{ env.QT_VERSION }}
modules: 'qtcharts'
cache: true
- name: CMake - name: CMake
run: | run: |
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DUSE_MATCHCOMPILER=Verify -DANALYZE_THREAD=On -DUSE_THREADS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=Off -DWITH_QCHART=Off -DUSE_MATCHCOMPILER=Verify -DANALYZE_THREAD=On -DUSE_THREADS=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=Off -DDISABLE_DMAKE=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
env: env:
CC: clang-16 CC: clang-16
CXX: clang++-16 CXX: clang++-16
@ -53,6 +69,13 @@ jobs:
- name: Run tests - name: Run tests
run: ./cmake.output/bin/testrunner run: ./cmake.output/bin/testrunner
- name: Generate dependencies
if: false
run: |
# make sure auto-generated GUI files exist
make -C cmake.output autogen
make -C cmake.output gui-build-deps triage-build-ui-deps
# TODO: disabled for now as it takes around 40 minutes to finish # TODO: disabled for now as it takes around 40 minutes to finish
# set --error-exitcode=0 so we only fail on sanitizer issues - since it uses threads for execution it will exit the whole process on the first issue # set --error-exitcode=0 so we only fail on sanitizer issues - since it uses threads for execution it will exit the whole process on the first issue
- name: Self check - name: Self check
@ -61,7 +84,7 @@ jobs:
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ --error-exitcode=0 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings" selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ --error-exitcode=0 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings"
ec=0 ec=0
./cmake.output/bin/cppcheck $selfcheck_options --addon=naming.json -DCHECK_INTERNAL cli lib || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options --addon=naming.json -DCHECK_INTERNAL cli lib || ec=1
./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Igui/temp -Igui gui/*.cpp gui/temp/*.cpp || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1
./cmake.output/bin/cppcheck $selfcheck_options -Icli test/*.cpp tools/*.cpp || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options -Icli test/*.cpp tools/*.cpp || ec=1
./cmake.output/bin/cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt -Itools/triage/temp -Igui tools/triage/*.cpp tools/triage/temp/*.cpp || ec=1 ./cmake.output/bin/cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1
exit $ec exit $ec

View File

@ -15,10 +15,17 @@ jobs:
env: env:
QT_VERSION: 5.15.2 QT_VERSION: 5.15.2
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:report_error_type=1 UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:report_error_type=1
# TODO: figure out why there are cache misses with PCH enabled
CCACHE_SLOPPINESS: pch_defines,time_macros
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.os }}
- name: Set up Python 3.11 - name: Set up Python 3.11
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
@ -45,7 +52,7 @@ jobs:
- name: CMake - name: CMake
run: | run: |
cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DUSE_MATCHCOMPILER=Verify -DANALYZE_UNDEFINED=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On cmake -S . -B cmake.output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=ON -DWITH_QCHART=ON -DUSE_MATCHCOMPILER=Verify -DANALYZE_UNDEFINED=On -DENABLE_CHECK_INTERNAL=On -DUSE_BOOST=On -DCPPCHK_GLIBCXX_DEBUG=Off -DCMAKE_DISABLE_PRECOMPILE_HEADERS=On -DCMAKE_GLOBAL_AUTOGEN_TARGET=On -DDISABLE_DMAKE=On -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
env: env:
CC: clang-16 CC: clang-16
CXX: clang++-16 CXX: clang++-16

View File

@ -64,7 +64,9 @@ endif()
add_dependencies(cppcheck copy_cfg) add_dependencies(cppcheck copy_cfg)
add_dependencies(cppcheck copy_addons) add_dependencies(cppcheck copy_addons)
add_dependencies(cppcheck copy_platforms) add_dependencies(cppcheck copy_platforms)
add_dependencies(cppcheck run-dmake) if (NOT DISABLE_DMAKE)
add_dependencies(cppcheck run-dmake)
endif()
install(TARGETS cppcheck install(TARGETS cppcheck
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}

View File

@ -38,6 +38,7 @@ endif()
option(BUILD_TESTS "Build tests" OFF) option(BUILD_TESTS "Build tests" OFF)
option(REGISTER_TESTS "Register tests in CTest" ON) option(REGISTER_TESTS "Register tests in CTest" ON)
option(ENABLE_CHECK_INTERNAL "Enable internal checks" OFF) option(ENABLE_CHECK_INTERNAL "Enable internal checks" OFF)
option(DISABLE_DMAKE "Disable run-dmake dependencies" OFF)
option(BUILD_GUI "Build the qt application" OFF) option(BUILD_GUI "Build the qt application" OFF)
option(WITH_QCHART "Enable QtCharts usage in the GUI" OFF) option(WITH_QCHART "Enable QtCharts usage in the GUI" OFF)

View File

@ -47,6 +47,7 @@ if(BUILD_TESTS)
message( STATUS "REGISTER_TESTS = ${REGISTER_TESTS}" ) message( STATUS "REGISTER_TESTS = ${REGISTER_TESTS}" )
endif() endif()
message( STATUS "ENABLE_CHECK_INTERNAL = ${ENABLE_CHECK_INTERNAL}" ) message( STATUS "ENABLE_CHECK_INTERNAL = ${ENABLE_CHECK_INTERNAL}" )
message( STATUS "DISABLE_DMAKE = ${DISABLE_DMAKE}" )
message( STATUS ) message( STATUS )
message( STATUS "BUILD_GUI = ${BUILD_GUI}" ) message( STATUS "BUILD_GUI = ${BUILD_GUI}" )
if (BUILD_GUI) if (BUILD_GUI)

View File

@ -43,7 +43,9 @@ if (BUILD_TESTS)
add_dependencies(testrunner copy_cfg) add_dependencies(testrunner copy_cfg)
add_dependencies(testrunner copy_addons) add_dependencies(testrunner copy_addons)
add_dependencies(testrunner copy_platforms) add_dependencies(testrunner copy_platforms)
if (NOT DISABLE_DMAKE)
add_dependencies(testrunner run-dmake) add_dependencies(testrunner run-dmake)
endif()
if (LIBXML2_XMLLINT_EXECUTABLE) if (LIBXML2_XMLLINT_EXECUTABLE)
# TODO: run the CMake implementation of the tests # TODO: run the CMake implementation of the tests

View File

@ -1,3 +1,4 @@
# TODO: when using ccache and matchcompiler this will accessed before the file was generated and thus the build fails
set(srcs_lib pathmatch.cpp path.cpp) set(srcs_lib pathmatch.cpp path.cpp)
foreach(file ${srcs_lib}) foreach(file ${srcs_lib})
if (NOT USE_MATCHCOMPILER_OPT STREQUAL "Off") if (NOT USE_MATCHCOMPILER_OPT STREQUAL "Off")