mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
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:
parent
dda8afcb90
commit
2ec302ea22
Notes:
sideshowbarker
2024-07-18 17:20:23 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/2ec302ea221 Pull-request: https://github.com/SerenityOS/serenity/pull/7429 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/bgianfo ✅
3 changed files with 18 additions and 11 deletions
22
.github/workflows/cmake.yml
vendored
22
.github/workflows/cmake.yml
vendored
|
@ -14,7 +14,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
debug-macros: ['ALL_DEBUG', 'NORMAL_DEBUG']
|
||||
debug-options: ['ALL_DEBUG', 'NORMAL_DEBUG']
|
||||
os: [ubuntu-20.04]
|
||||
# If ccache is broken and you would like to bust the ccache cache on Github Actions, increment this:
|
||||
ccache-mark: [0]
|
||||
|
@ -93,10 +93,10 @@ jobs:
|
|||
# This is achieved by using the "prefix-timestamp" format,
|
||||
# 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'.
|
||||
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!
|
||||
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
|
||||
run: |
|
||||
# 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.
|
||||
ccache -M 1500M
|
||||
ccache -s
|
||||
- name: Create build environment with debug macros
|
||||
- name: Create build environment with extra debug options
|
||||
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.
|
||||
run: |
|
||||
mkdir -p 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
|
||||
if: ${{ matrix.debug-macros == 'ALL_DEBUG' }}
|
||||
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-options == 'ALL_DEBUG' }}
|
||||
- name: Create build environment
|
||||
working-directory: ${{ github.workspace }}
|
||||
# Note that this needs to run *even if* the Toolchain was built,
|
||||
|
@ -123,7 +123,7 @@ jobs:
|
|||
mkdir -p Build
|
||||
cd Build
|
||||
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 ===
|
||||
|
||||
|
@ -137,12 +137,12 @@ jobs:
|
|||
run: ./check-symbols.sh
|
||||
|
||||
- name: Create Serenity Rootfs
|
||||
if: ${{ matrix.debug-macros == 'NORMAL_DEBUG'}}
|
||||
if: ${{ matrix.debug-options == 'NORMAL_DEBUG'}}
|
||||
working-directory: ${{ github.workspace }}/Build
|
||||
run: ninja install && ninja image
|
||||
|
||||
- name: Run On-Target Tests
|
||||
if: ${{ matrix.debug-macros == 'NORMAL_DEBUG'}}
|
||||
if: ${{ matrix.debug-options == 'NORMAL_DEBUG'}}
|
||||
working-directory: ${{ github.workspace }}/Build
|
||||
env:
|
||||
SERENITY_QEMU_CPU: "max,vmx=off"
|
||||
|
@ -167,7 +167,7 @@ jobs:
|
|||
|
||||
- name: Print Target Logs
|
||||
# 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
|
||||
run: '[ ! -e debug.log ] || cat debug.log'
|
||||
|
||||
|
|
|
@ -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_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_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_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)
|
||||
|
@ -91,6 +92,11 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")
|
|||
add_compile_options(-Wno-overloaded-virtual -Wno-user-defined-literals)
|
||||
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)
|
||||
include(${CMAKE_SOURCE_DIR}/Meta/CMake/all_the_debug_macros.cmake)
|
||||
endif(ENABLE_ALL_THE_DEBUG_MACROS)
|
||||
|
|
|
@ -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_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_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_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.
|
||||
|
|
Loading…
Reference in a new issue