Meta/CI: Add ENABLE_ALL_DEBUG_FACILITIES CMake option

This option replaces the use of ENABLE_ALL_THE_DEBUG_MACROS in CI runs,
and enables all debug options that might be broken by developers
unintentionally that are only used in specific debugging situations.
This commit is contained in:
Andrew Kaster 2021-05-23 15:33:52 -06:00 committed by Andreas Kling
parent dda8afcb90
commit 2ec302ea22
Notes: sideshowbarker 2024-07-18 17:20:23 +09:00
3 changed files with 18 additions and 11 deletions

View file

@ -14,7 +14,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
debug-macros: ['ALL_DEBUG', 'NORMAL_DEBUG'] debug-options: ['ALL_DEBUG', 'NORMAL_DEBUG']
os: [ubuntu-20.04] os: [ubuntu-20.04]
# If ccache is broken and you would like to bust the ccache cache on Github Actions, increment this: # If ccache is broken and you would like to bust the ccache cache on Github Actions, increment this:
ccache-mark: [0] ccache-mark: [0]
@ -93,10 +93,10 @@ jobs:
# This is achieved by using the "prefix-timestamp" format, # This is achieved by using the "prefix-timestamp" format,
# and permitting the restore-key "prefix-" without specifying a timestamp. # and permitting the restore-key "prefix-" without specifying a timestamp.
# For this trick to work, the timestamp *must* come last, and it *must* be missing in 'restore-keys'. # For this trick to work, the timestamp *must* come last, and it *must* be missing in 'restore-keys'.
key: ${{ runner.os }}-ccache-i686-v${{ matrix.ccache-mark }}-D${{ matrix.debug-macros }}-toolchain_${{steps.stamps.outputs.libc_headers}}-time${{ steps.stamps.outputs.time }} key: ${{ runner.os }}-ccache-i686-v${{ matrix.ccache-mark }}-D${{ matrix.debug-options }}-toolchain_${{steps.stamps.outputs.libc_headers}}-time${{ steps.stamps.outputs.time }}
# IMPORTANT: Keep these two in sync! # IMPORTANT: Keep these two in sync!
restore-keys: | restore-keys: |
${{ runner.os }}-ccache-i686-v${{ matrix.ccache-mark }}-D${{ matrix.debug-macros }}-toolchain_${{steps.stamps.outputs.libc_headers}}- ${{ runner.os }}-ccache-i686-v${{ matrix.ccache-mark }}-D${{ matrix.debug-options }}-toolchain_${{steps.stamps.outputs.libc_headers}}-
- name: Show ccache stats before build and configure - name: Show ccache stats before build and configure
run: | run: |
# We only have 5 GiB of cache available *in total*. Beyond that, GitHub deletes caches. # We only have 5 GiB of cache available *in total*. Beyond that, GitHub deletes caches.
@ -106,15 +106,15 @@ jobs:
# Building from scratch fills the ccache cache from 0 to about 0.7 GB, so 1.5 GB is plenty. # Building from scratch fills the ccache cache from 0 to about 0.7 GB, so 1.5 GB is plenty.
ccache -M 1500M ccache -M 1500M
ccache -s ccache -s
- name: Create build environment with debug macros - name: Create build environment with extra debug options
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
# Build the entire project with debug macros turned on, to prevent code rot. # Build the entire project with all available debug options turned on, to prevent code rot.
# However, it is unweildy and slow to run tests with them enabled, so we will build twice. # However, it is unweildy and slow to run tests with them enabled, so we will build twice.
run: | run: |
mkdir -p Build mkdir -p Build
cd Build cd Build
cmake .. -GNinja -DBUILD_LAGOM=ON -DENABLE_ALL_THE_DEBUG_MACROS=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 cmake .. -GNinja -DBUILD_LAGOM=ON -DENABLE_ALL_DEBUG_FACILITIES=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10
if: ${{ matrix.debug-macros == 'ALL_DEBUG' }} if: ${{ matrix.debug-options == 'ALL_DEBUG' }}
- name: Create build environment - name: Create build environment
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
# Note that this needs to run *even if* the Toolchain was built, # Note that this needs to run *even if* the Toolchain was built,
@ -123,7 +123,7 @@ jobs:
mkdir -p Build mkdir -p Build
cd Build cd Build
cmake .. -GNinja -DBUILD_LAGOM=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 cmake .. -GNinja -DBUILD_LAGOM=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10
if: ${{ matrix.debug-macros == 'NORMAL_DEBUG' }} if: ${{ matrix.debug-options == 'NORMAL_DEBUG' }}
# === ACTUALLY BUILD === # === ACTUALLY BUILD ===
@ -137,12 +137,12 @@ jobs:
run: ./check-symbols.sh run: ./check-symbols.sh
- name: Create Serenity Rootfs - name: Create Serenity Rootfs
if: ${{ matrix.debug-macros == 'NORMAL_DEBUG'}} if: ${{ matrix.debug-options == 'NORMAL_DEBUG'}}
working-directory: ${{ github.workspace }}/Build working-directory: ${{ github.workspace }}/Build
run: ninja install && ninja image run: ninja install && ninja image
- name: Run On-Target Tests - name: Run On-Target Tests
if: ${{ matrix.debug-macros == 'NORMAL_DEBUG'}} if: ${{ matrix.debug-options == 'NORMAL_DEBUG'}}
working-directory: ${{ github.workspace }}/Build working-directory: ${{ github.workspace }}/Build
env: env:
SERENITY_QEMU_CPU: "max,vmx=off" SERENITY_QEMU_CPU: "max,vmx=off"
@ -167,7 +167,7 @@ jobs:
- name: Print Target Logs - name: Print Target Logs
# Extremely useful if Serenity hangs trying to run one of the tests # Extremely useful if Serenity hangs trying to run one of the tests
if: ${{ !cancelled() && matrix.debug-macros == 'NORMAL_DEBUG'}} if: ${{ !cancelled() && matrix.debug-options == 'NORMAL_DEBUG'}}
working-directory: ${{ github.workspace }}/Build working-directory: ${{ github.workspace }}/Build
run: '[ ! -e debug.log ] || cat debug.log' run: '[ ! -e debug.log ] || cat debug.log'

View file

@ -24,6 +24,7 @@ option(ENABLE_UNDEFINED_SANITIZER "Enable undefined behavior sanitizer testing i
option(ENABLE_FUZZER_SANITIZER "Enable fuzzer sanitizer testing in clang" OFF) option(ENABLE_FUZZER_SANITIZER "Enable fuzzer sanitizer testing in clang" OFF)
option(ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS "Enable -Og and -ggdb3 options for Kernel code for easier debugging" OFF) option(ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS "Enable -Og and -ggdb3 options for Kernel code for easier debugging" OFF)
option(ENABLE_ALL_THE_DEBUG_MACROS "Enable all debug macros to validate they still compile" OFF) option(ENABLE_ALL_THE_DEBUG_MACROS "Enable all debug macros to validate they still compile" OFF)
option(ENABLE_ALL_DEBUG_FACILITIES "Enable all noisy debug symbols and options. Not recommended for normal developer use" OFF)
option(ENABLE_COMPILETIME_FORMAT_CHECK "Enable compiletime format string checks" ON) option(ENABLE_COMPILETIME_FORMAT_CHECK "Enable compiletime format string checks" ON)
option(ENABLE_PCI_IDS_DOWNLOAD "Enable download of the pci.ids database at build time" ON) option(ENABLE_PCI_IDS_DOWNLOAD "Enable download of the pci.ids database at build time" ON)
option(BUILD_LAGOM "Build parts of the system targeting the host OS for fuzzing/testing" OFF) option(BUILD_LAGOM "Build parts of the system targeting the host OS for fuzzing/testing" OFF)
@ -91,6 +92,11 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
add_compile_options(-Wno-overloaded-virtual -Wno-user-defined-literals) add_compile_options(-Wno-overloaded-virtual -Wno-user-defined-literals)
endif() endif()
if (ENABLE_ALL_DEBUG_FACILITIES)
set(ENABLE_ALL_THE_DEBUG_MACROS ON)
set(ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS ON)
endif()
if (ENABLE_ALL_THE_DEBUG_MACROS) if (ENABLE_ALL_THE_DEBUG_MACROS)
include(${CMAKE_SOURCE_DIR}/Meta/CMake/all_the_debug_macros.cmake) include(${CMAKE_SOURCE_DIR}/Meta/CMake/all_the_debug_macros.cmake)
endif(ENABLE_ALL_THE_DEBUG_MACROS) endif(ENABLE_ALL_THE_DEBUG_MACROS)

View file

@ -248,6 +248,7 @@ There are some optional features that can be enabled during compilation that are
- `ENABLE_FUZZER_SANITIZER`: builds [fuzzers](https://en.wikipedia.org/wiki/Fuzzing) for various parts of the system. - `ENABLE_FUZZER_SANITIZER`: builds [fuzzers](https://en.wikipedia.org/wiki/Fuzzing) for various parts of the system.
- `ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS`: sets -Og and -ggdb3 compile options for building the Kernel. Allows for easier debugging of Kernel code. By default, the Kernel is built with -Os instead. - `ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS`: sets -Og and -ggdb3 compile options for building the Kernel. Allows for easier debugging of Kernel code. By default, the Kernel is built with -Os instead.
- `ENABLE_ALL_THE_DEBUG_MACROS`: used for checking whether debug code compiles on CI. This should not be set normally, as it clutters the console output and makes the system run very slowly. Instead, enable only the needed debug macros, as described below. - `ENABLE_ALL_THE_DEBUG_MACROS`: used for checking whether debug code compiles on CI. This should not be set normally, as it clutters the console output and makes the system run very slowly. Instead, enable only the needed debug macros, as described below.
- `ENABLE_ALL_DEBUG_FACILITIES`: used for checking whether debug code compiles on CI. Enables both `ENABLE_ALL_THE_DEBUG_MACROS` and `ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS`.
- `ENABLE_COMPILETIME_FORMAT_CHECK`: checks for the validity of `std::format`-style format string during compilation. Enabled by default. - `ENABLE_COMPILETIME_FORMAT_CHECK`: checks for the validity of `std::format`-style format string during compilation. Enabled by default.
- `ENABLE_PCI_IDS_DOWNLOAD`: downloads the [`pci.ids` database](https://pci-ids.ucw.cz/) that contains information about PCI devices at build time, if not already present. Enabled by default. - `ENABLE_PCI_IDS_DOWNLOAD`: downloads the [`pci.ids` database](https://pci-ids.ucw.cz/) that contains information about PCI devices at build time, if not already present. Enabled by default.
- `BUILD_LAGOM`: builds [Lagom](../Meta/Lagom/ReadMe.md), which makes various SerenityOS libraries and programs available on the host system. - `BUILD_LAGOM`: builds [Lagom](../Meta/Lagom/ReadMe.md), which makes various SerenityOS libraries and programs available on the host system.