Skip to content

Commit 2ec302e

Browse files
ADKasterawesomekling
authored andcommitted
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.
1 parent dda8afc commit 2ec302e

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

.github/workflows/cmake.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
debug-macros: ['ALL_DEBUG', 'NORMAL_DEBUG']
17+
debug-options: ['ALL_DEBUG', 'NORMAL_DEBUG']
1818
os: [ubuntu-20.04]
1919
# If ccache is broken and you would like to bust the ccache cache on Github Actions, increment this:
2020
ccache-mark: [0]
@@ -93,10 +93,10 @@ jobs:
9393
# This is achieved by using the "prefix-timestamp" format,
9494
# and permitting the restore-key "prefix-" without specifying a timestamp.
9595
# For this trick to work, the timestamp *must* come last, and it *must* be missing in 'restore-keys'.
96-
key: ${{ runner.os }}-ccache-i686-v${{ matrix.ccache-mark }}-D${{ matrix.debug-macros }}-toolchain_${{steps.stamps.outputs.libc_headers}}-time${{ steps.stamps.outputs.time }}
96+
key: ${{ runner.os }}-ccache-i686-v${{ matrix.ccache-mark }}-D${{ matrix.debug-options }}-toolchain_${{steps.stamps.outputs.libc_headers}}-time${{ steps.stamps.outputs.time }}
9797
# IMPORTANT: Keep these two in sync!
9898
restore-keys: |
99-
${{ runner.os }}-ccache-i686-v${{ matrix.ccache-mark }}-D${{ matrix.debug-macros }}-toolchain_${{steps.stamps.outputs.libc_headers}}-
99+
${{ runner.os }}-ccache-i686-v${{ matrix.ccache-mark }}-D${{ matrix.debug-options }}-toolchain_${{steps.stamps.outputs.libc_headers}}-
100100
- name: Show ccache stats before build and configure
101101
run: |
102102
# We only have 5 GiB of cache available *in total*. Beyond that, GitHub deletes caches.
@@ -106,15 +106,15 @@ jobs:
106106
# Building from scratch fills the ccache cache from 0 to about 0.7 GB, so 1.5 GB is plenty.
107107
ccache -M 1500M
108108
ccache -s
109-
- name: Create build environment with debug macros
109+
- name: Create build environment with extra debug options
110110
working-directory: ${{ github.workspace }}
111-
# Build the entire project with debug macros turned on, to prevent code rot.
111+
# Build the entire project with all available debug options turned on, to prevent code rot.
112112
# However, it is unweildy and slow to run tests with them enabled, so we will build twice.
113113
run: |
114114
mkdir -p Build
115115
cd Build
116-
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
117-
if: ${{ matrix.debug-macros == 'ALL_DEBUG' }}
116+
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
117+
if: ${{ matrix.debug-options == 'ALL_DEBUG' }}
118118
- name: Create build environment
119119
working-directory: ${{ github.workspace }}
120120
# Note that this needs to run *even if* the Toolchain was built,
@@ -123,7 +123,7 @@ jobs:
123123
mkdir -p Build
124124
cd Build
125125
cmake .. -GNinja -DBUILD_LAGOM=ON -DENABLE_PCI_IDS_DOWNLOAD=OFF -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10
126-
if: ${{ matrix.debug-macros == 'NORMAL_DEBUG' }}
126+
if: ${{ matrix.debug-options == 'NORMAL_DEBUG' }}
127127

128128
# === ACTUALLY BUILD ===
129129

@@ -137,12 +137,12 @@ jobs:
137137
run: ./check-symbols.sh
138138

139139
- name: Create Serenity Rootfs
140-
if: ${{ matrix.debug-macros == 'NORMAL_DEBUG'}}
140+
if: ${{ matrix.debug-options == 'NORMAL_DEBUG'}}
141141
working-directory: ${{ github.workspace }}/Build
142142
run: ninja install && ninja image
143143

144144
- name: Run On-Target Tests
145-
if: ${{ matrix.debug-macros == 'NORMAL_DEBUG'}}
145+
if: ${{ matrix.debug-options == 'NORMAL_DEBUG'}}
146146
working-directory: ${{ github.workspace }}/Build
147147
env:
148148
SERENITY_QEMU_CPU: "max,vmx=off"
@@ -167,7 +167,7 @@ jobs:
167167

168168
- name: Print Target Logs
169169
# Extremely useful if Serenity hangs trying to run one of the tests
170-
if: ${{ !cancelled() && matrix.debug-macros == 'NORMAL_DEBUG'}}
170+
if: ${{ !cancelled() && matrix.debug-options == 'NORMAL_DEBUG'}}
171171
working-directory: ${{ github.workspace }}/Build
172172
run: '[ ! -e debug.log ] || cat debug.log'
173173

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ option(ENABLE_UNDEFINED_SANITIZER "Enable undefined behavior sanitizer testing i
2424
option(ENABLE_FUZZER_SANITIZER "Enable fuzzer sanitizer testing in clang" OFF)
2525
option(ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS "Enable -Og and -ggdb3 options for Kernel code for easier debugging" OFF)
2626
option(ENABLE_ALL_THE_DEBUG_MACROS "Enable all debug macros to validate they still compile" OFF)
27+
option(ENABLE_ALL_DEBUG_FACILITIES "Enable all noisy debug symbols and options. Not recommended for normal developer use" OFF)
2728
option(ENABLE_COMPILETIME_FORMAT_CHECK "Enable compiletime format string checks" ON)
2829
option(ENABLE_PCI_IDS_DOWNLOAD "Enable download of the pci.ids database at build time" ON)
2930
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$")
9192
add_compile_options(-Wno-overloaded-virtual -Wno-user-defined-literals)
9293
endif()
9394

95+
if (ENABLE_ALL_DEBUG_FACILITIES)
96+
set(ENABLE_ALL_THE_DEBUG_MACROS ON)
97+
set(ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS ON)
98+
endif()
99+
94100
if (ENABLE_ALL_THE_DEBUG_MACROS)
95101
include(${CMAKE_SOURCE_DIR}/Meta/CMake/all_the_debug_macros.cmake)
96102
endif(ENABLE_ALL_THE_DEBUG_MACROS)

Documentation/BuildInstructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ There are some optional features that can be enabled during compilation that are
248248
- `ENABLE_FUZZER_SANITIZER`: builds [fuzzers](https://en.wikipedia.org/wiki/Fuzzing) for various parts of the system.
249249
- `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.
250250
- `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.
251+
- `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`.
251252
- `ENABLE_COMPILETIME_FORMAT_CHECK`: checks for the validity of `std::format`-style format string during compilation. Enabled by default.
252253
- `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.
253254
- `BUILD_LAGOM`: builds [Lagom](../Meta/Lagom/ReadMe.md), which makes various SerenityOS libraries and programs available on the host system.

0 commit comments

Comments
 (0)