Skip to content

Commit 4b99227

Browse files
committed
Fix to tests failing in pipeline
1 parent 158d5a4 commit 4b99227

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ cmake -S . -B "$BUILD_DIR"
6868
cmake --build "$BUILD_DIR" -j"$(nproc)"
6969
```
7070

71+
If a sandboxed build fails with `ccache: error: Read-only file system`, treat
72+
that as an environment limitation rather than a repo regression and rerun the
73+
build with `CCACHE_DISABLE=1`.
74+
7175
If the task affects install layout, licensing, or packaging, also validate a temporary install prefix:
7276

7377
```bash
@@ -98,6 +102,7 @@ Notes:
98102
- A small `Qt Test` + `CTest` suite exists for config loading and audio normalization, including malformed JSON, wrong-type config inputs, and recording-normalizer edge cases
99103
- Config loading is intentionally forgiving: invalid runtime values fall back to defaults and log warnings
100104
- Use `ctest --test-dir "$BUILD_DIR" --output-on-failure` for changes that affect covered code
105+
- Keep Qt GUI or Widgets tests headless under `CTest`: set `QT_QPA_PLATFORM=offscreen` in the test registration or test properties rather than relying on the caller environment
101106
- Use `bash scripts/run-valgrind.sh "$BUILD_DIR"` or `cmake --build "$BUILD_DIR" --target valgrind` when validating memory behavior for release readiness or after fixing memory-lifetime issues
102107
- On Debian-family systems, install `libc6-dbg` if Valgrind fails at startup with a `ld-linux` / mandatory redirection error
103108
- Use `cmake --build "$BUILD_DIR" --target clang-tidy` after C++ changes when static-analysis noise is likely to matter
@@ -118,6 +123,7 @@ Notes:
118123
- Keep the Doxygen main page in `docs/mainpage.md` small and API-focused. The release-facing `README.md` may link to files outside the Doxygen input set and should not be used as the Doxygen main page unless the input set is expanded deliberately
119124
- Keep analyzer fixes targeted to `src/` and `tests/`; do not churn `third_party/` or generated Qt autogen output to satisfy tooling
120125
- Reconfigure the build directory after installing new tools so cached `find_program()` results are refreshed
126+
- When validating inside a restricted sandbox, be ready to disable `ccache` with `CCACHE_DISABLE=1` if the cache location is read-only; that is an execution-environment issue, not a Mutterkey build failure
121127
- Prefer fixing the code over weakening `.clang-tidy` or the Clazy check set; only relax tool config when the warning is clearly low-value for this repo
122128
- Do not add broad Valgrind suppressions by default; only add narrow suppressions after reproducing stable third-party noise and keep them clearly scoped
123129
- When adding tests, prefer small `Qt Test` cases that run headlessly under `CTest` and avoid microphone, clipboard, or KDE session dependencies unless the task is specifically integration-focused
@@ -209,6 +215,7 @@ Typical model location:
209215
- Treat `mutterkey-tray` as a shipped artifact once it is installed or validated in CI; keep install rules, README/setup notes, release checklist items, and workflow checks aligned with that status
210216
- Verify with a fresh CMake build when the change affects compilation or linkage
211217
- Run `ctest` when touching covered code in `src/config.*` or `src/audio/recordingnormalizer.*`, and extend the deterministic headless tests when practical
218+
- When adding or fixing Qt GUI tests, make the `CTest` registration itself headless with `QT_QPA_PLATFORM=offscreen` so CI does not try to load `xcb`
212219
- Prefer expanding tests around pure parsing, value normalization, and other environment-independent logic before adding KDE-session or device-heavy coverage
213220
- Use `-DMUTTERKEY_ENABLE_ASAN=ON` and `-DMUTTERKEY_ENABLE_UBSAN=ON` for fast iteration on memory and UB bugs, and use the repo-owned Valgrind lane as the slower release-focused confirmation step
214221
- Run `clang-tidy` and `clazy` targets for non-trivial C++/Qt changes when the tools are installed in the environment

tests/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ function(mutterkey_add_qt_test target_name)
33
target_include_directories(${target_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../src)
44
target_link_libraries(${target_name} PRIVATE Qt6::Core Qt6::Gui Qt6::Multimedia Qt6::Test Qt6::Network Qt6::Widgets)
55
add_test(NAME ${target_name} COMMAND ${target_name})
6+
set_tests_properties(${target_name} PROPERTIES
7+
ENVIRONMENT "QT_QPA_PLATFORM=offscreen"
8+
)
69
endfunction()
710

811
mutterkey_add_qt_test(configtest

0 commit comments

Comments
 (0)