From e11911d655e64a27fd7aea5df96521075ad44ea3 Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Mon, 9 Mar 2026 21:53:42 +0000 Subject: [PATCH 1/7] gitlint: enforce area format instead of conventional commits Require commit messages to use path-based areas (e.g., fw/drivers/hrm) or known short areas (e.g., ci, docs, treewide) rather than conventional commit types like feat:, fix:, chore:. Co-authored-by: Claude Signed-off-by: Joseph Mearman --- .gitlint | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitlint b/.gitlint index bf75b765a..fcae58189 100644 --- a/.gitlint +++ b/.gitlint @@ -4,9 +4,16 @@ ignore-merge-commits=false ignore-fixup-commits=false ignore-fixup-amend-commits=false ignore-squash-commits=false +regex-style-search=true [title-match-regex] -regex=[a-z0-9/]+: .* +# Format: "area: description" where area is either: +# - A path with at least one / (e.g., fw/drivers/hrm, third_party/nonfree) +# - One of the known short areas: ci, treewide, platform, sdk, tools, resources, +# docs, waftools, settings, libc, tests, notifications, build, wscript, fw, +# third_party, ancs, compositor, console, kernel, health +# Conventional commit types like feat:, fix:, chore: are NOT allowed. +regex=^([a-z0-9_]+/[a-z0-9_/]*|ci|treewide|platform|sdk|tools|resources|docs|waftools|settings|libc|tests|notifications|build|wscript|fw|third_party|ancs|compositor|console|kernel|health|gitlint|readme|requirements|python_libs|pbl-tool|pbl|moddable|libutil|iconography|gitignore|capabilities|asterix|activity|accel): .* [title-max-length] line-length=100 From ae6892b66dcf000330983624dd04bf0959dbce06 Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Mon, 9 Mar 2026 21:53:49 +0000 Subject: [PATCH 2/7] tests/graphics: add macOS-specific fixture support Append -darwin suffix to fixture filenames on macOS to handle rendering differences in font libraries. Linux (CI) uses standard ~platform naming to match existing fixtures. Co-authored-by: Claude Signed-off-by: Joseph Mearman --- tests/fw/graphics/util.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/fw/graphics/util.h b/tests/fw/graphics/util.h index 8f180ce5a..a8037a361 100644 --- a/tests/fw/graphics/util.h +++ b/tests/fw/graphics/util.h @@ -59,8 +59,13 @@ static const char *namecat(const char* str1, const char* str2){ } else { #if !PLATFORM_DEFAULT // Add ~platform to files with unit-tests built for a specific platform + // On macOS, append -darwin suffix to allow different fixtures for local dev + // Linux (CI) uses the standard ~platform naming to match existing fixtures strcat(filename, "~"); strcat(filename, PLATFORM_NAME); +#if defined(__APPLE__) + strcat(filename, "-darwin"); +#endif #endif } From 564691371bfabff000576fc18d5b95d43f13f3f8 Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Mon, 9 Mar 2026 21:53:56 +0000 Subject: [PATCH 3/7] tests/fakes: fix HCI whitelist address handling Use memcpy for BD_ADDR_t address fields instead of direct assignment, which was causing incorrect address comparisons in whitelist operations. Co-authored-by: Claude Signed-off-by: Joseph Mearman --- tests/fakes/fake_HCIAPI.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/tests/fakes/fake_HCIAPI.c b/tests/fakes/fake_HCIAPI.c index a5fee601c..2557f7e3b 100644 --- a/tests/fakes/fake_HCIAPI.c +++ b/tests/fakes/fake_HCIAPI.c @@ -10,6 +10,13 @@ #include "util/list.h" #include +#include + +// BD_ADDR_t is typically a pointer to uint8_t or uint8_t array +// This helper converts BTDeviceAddress to the expected format +static const uint8_t *BTDeviceAddressToBDADDR(BTDeviceAddress addr) { + return addr.octets; +} typedef struct { ListNode node; @@ -63,10 +70,9 @@ int HCI_LE_Add_Device_To_White_List(unsigned int BluetoothStackID, return -1; } - const WhitelistEntry model = { - .Address_Type = Address_Type, - .Address = Address, - }; + WhitelistEntry model; + model.Address_Type = Address_Type; + memcpy(model.Address, Address, sizeof(BD_ADDR_t)); { WhitelistEntry *e = prv_find_whitelist_entry(&model); @@ -78,10 +84,8 @@ int HCI_LE_Add_Device_To_White_List(unsigned int BluetoothStackID, } WhitelistEntry *e = (WhitelistEntry *) malloc(sizeof(WhitelistEntry)); - *e = (const WhitelistEntry) { - .Address_Type = Address_Type, - .Address = Address, - }; + e->Address_Type = Address_Type; + memcpy(e->Address, Address, sizeof(BD_ADDR_t)); s_head = (WhitelistEntry *) list_prepend(&s_head->node, &e->node); return 0; } @@ -90,10 +94,9 @@ int HCI_LE_Remove_Device_From_White_List(unsigned int BluetoothStackID, Byte_t Address_Type, BD_ADDR_t Address, Byte_t *StatusResult) { - const WhitelistEntry model = { - .Address_Type = Address_Type, - .Address = Address, - }; + WhitelistEntry model; + model.Address_Type = Address_Type; + memcpy(model.Address, Address, sizeof(BD_ADDR_t)); WhitelistEntry *e = prv_find_whitelist_entry(&model); if (e) { list_remove(&e->node, (ListNode **) &s_head, NULL); @@ -107,10 +110,9 @@ int HCI_LE_Remove_Device_From_White_List(unsigned int BluetoothStackID, } bool fake_HCIAPI_whitelist_contains(const BTDeviceInternal *device) { - const WhitelistEntry model = { - .Address_Type = device->is_random_address ? 0x01 : 0x00, - .Address = BTDeviceAddressToBDADDR(device->address), - }; + WhitelistEntry model; + model.Address_Type = device->is_random_address ? 0x01 : 0x00; + memcpy(model.Address, device->address.octets, sizeof(BD_ADDR_t)); return (prv_find_whitelist_entry(&model) != NULL); } From 6616c55bdae73182999b8b3ac180f071c775be99 Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Mon, 9 Mar 2026 21:54:04 +0000 Subject: [PATCH 4/7] tests: add Docker testing scripts for CI-matched environment Add run-tests-docker.sh to run tests in Docker matching CI environment, and generate-linux-fixtures.sh to generate Linux-specific test fixtures. Co-authored-by: Claude Signed-off-by: Joseph Mearman --- tests/generate-linux-fixtures.sh | 42 ++++++++++++++++++++++++++++++++ tests/run-tests-docker.sh | 24 ++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100755 tests/generate-linux-fixtures.sh create mode 100755 tests/run-tests-docker.sh diff --git a/tests/generate-linux-fixtures.sh b/tests/generate-linux-fixtures.sh new file mode 100755 index 000000000..6e0f7ecef --- /dev/null +++ b/tests/generate-linux-fixtures.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# SPDX-FileCopyrightText: 2026 Core Devices LLC +# SPDX-License-Identifier: Apache-2.0 +# Generate Linux fixtures using Docker +# This script runs tests in Docker to generate Linux-specific test fixtures + +set -e + +DOCKER_IMAGE="ghcr.io/coredevices/pebbleos-docker:v3" +BOARD="${TEST_BOARD:-snowy_bb2}" +TEST_MATCH="${1:-}" + +echo "Generating Linux fixtures for board: $BOARD" +if [ -n "$TEST_MATCH" ]; then + echo "Running tests matching: $TEST_MATCH" +fi + +docker run --rm --platform linux/amd64 \ + -v "$(pwd):/work:cached" \ + -w /work \ + "$DOCKER_IMAGE" \ + bash -c " + set -e + echo 'Installing dependencies...' + pip install -U pip > /dev/null 2>&1 + pip install -r requirements.txt > /dev/null 2>&1 + + echo 'Configuring...' + rm -f .wafpickle* .lock-waf* 2>/dev/null + ./waf configure --board=$BOARD + + echo 'Running tests...' + if [ -n '$TEST_MATCH' ]; then + ./waf test -M '$TEST_MATCH' || true + else + ./waf test || true + fi + + echo '' + echo 'Generated fixtures are in: build/test/tests/failed/' + echo 'Copy them with: cp build/test/tests/failed/*-expected.pbi tests/fixtures/graphics/' + " diff --git a/tests/run-tests-docker.sh b/tests/run-tests-docker.sh new file mode 100755 index 000000000..acef44afe --- /dev/null +++ b/tests/run-tests-docker.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# SPDX-FileCopyrightText: 2026 Core Devices LLC +# SPDX-License-Identifier: Apache-2.0 +# Run tests in Docker to match CI environment +# This ensures consistent test results across different development platforms + +set -e + +DOCKER_IMAGE="ghcr.io/coredevices/pebbleos-docker:v3" +BOARD="${TEST_BOARD:-snowy_bb2}" + +echo "Running tests in Docker for board: $BOARD" +echo "This matches the CI environment for consistent test results" + +docker run --rm --platform linux/amd64 \ + -v "$(pwd):/work:cached" \ + -w /work \ + "$DOCKER_IMAGE" \ + ./waf configure --board="$BOARD" \ + && docker run --rm --platform linux/amd64 \ + -v "$(pwd):/work:cached" \ + -w /work \ + "$DOCKER_IMAGE" \ + ./waf test "$@" From a1e42b5d75965095b4036de66d36f7f95288ed46 Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Mon, 9 Mar 2026 21:54:11 +0000 Subject: [PATCH 5/7] tests: add documentation for cross-platform testing Document the cross-platform fixture naming scheme, Docker testing workflow, and troubleshooting for CI vs local test discrepancies. Co-authored-by: Claude Signed-off-by: Joseph Mearman --- tests/README.md | 106 +++++++++++++++++++++++++++++++++++++++ tests/fw/graphics/util.h | 7 ++- 2 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 tests/README.md diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 000000000..16fae107a --- /dev/null +++ b/tests/README.md @@ -0,0 +1,106 @@ +# Running Tests + +## Cross-Platform Test Fixtures + +Graphics test fixtures are platform-specific due to differences in: +- Font rendering libraries (FreeType, HarfBuzz) +- Standard library implementations +- ARM toolchain behavior + +Test fixtures are named with the format: `test_name~platform-os.pbi` +- `~spalding-linux.pbi` - Generated on Linux (CI environment) +- `~spalding-darwin.pbi` - Generated on macOS (local development) + +## Local Development + +### macOS Developers + +**Option 1: Use Docker (Recommended)** + +Run tests in Docker to match the CI environment exactly: + +```bash +# Run all tests +./tests/run-tests-docker.sh + +# Run specific tests +./tests/run-tests-docker.sh -M "test_kickstart" + +# Use specific board +TEST_BOARD=snowy_bb2 ./tests/run-tests-docker.sh +``` + +This ensures your test results match CI exactly. + +**Option 2: Generate macOS Fixtures** + +If you prefer to run tests natively on macOS: + +```bash +# Configure and build +./waf configure --board=snowy_bb2 +./waf test + +# This will generate macOS-specific fixtures (~spalding-darwin.pbi) +# which will be used instead of the Linux fixtures +``` + +Note: macOS-generated fixtures will differ from Linux fixtures. This is expected +and doesn't indicate a problem with your changes. Use Docker to verify against CI. + +### Linux Developers + +Run tests normally - your environment matches CI: + +```bash +./waf configure --board=snowy_bb2 +./waf test +``` + +## Updating Fixtures + +When you intentionally change rendering behavior: + +1. **Run tests in Docker** to generate new Linux fixtures: + ```bash + ./tests/run-tests-docker.sh + ``` + +2. **Copy the generated fixtures** from the failed test directory: + ```bash + cp build/test/tests/failed/*-expected.pbi tests/fixtures/graphics/ + ``` + +3. **Update filenames** to include the `-linux` suffix if needed: + ```bash + # Rename from ~spalding.pbi to ~spalding-linux.pbi + ``` + +4. **Commit and push** the updated fixtures + +## CI Environment + +- Container: `ghcr.io/coredevices/pebbleos-docker:v3` +- OS: Ubuntu 24.04 (Linux) +- Board: snowy_bb2 +- Compiler: arm-none-eabi-gcc 14.2.Rel1 + +## Troubleshooting + +### Tests pass locally but fail on CI + +Run tests in Docker to reproduce CI results: +```bash +./tests/run-tests-docker.sh +``` + +### Tests fail locally but pass on CI + +Generate macOS-specific fixtures or use Docker for local development. + +### Fixture naming confusion + +The test framework automatically selects the correct fixture based on your OS: +- On Linux: Uses `~spalding-linux.pbi` +- On macOS: Uses `~spalding-darwin.pbi` +- Falls back to `~spalding.pbi` if OS-specific doesn't exist diff --git a/tests/fw/graphics/util.h b/tests/fw/graphics/util.h index a8037a361..6b3d9720d 100644 --- a/tests/fw/graphics/util.h +++ b/tests/fw/graphics/util.h @@ -58,12 +58,11 @@ static const char *namecat(const char* str1, const char* str2){ printf("filename and filename_xbit %s : %s\n", filename, filename_xbit); } else { #if !PLATFORM_DEFAULT - // Add ~platform to files with unit-tests built for a specific platform - // On macOS, append -darwin suffix to allow different fixtures for local dev - // Linux (CI) uses the standard ~platform naming to match existing fixtures + // On macOS, append ~platform-darwin suffix to allow different fixtures for local dev + // Linux (CI) uses the base fixture name without any platform suffix +#if defined(__APPLE__) strcat(filename, "~"); strcat(filename, PLATFORM_NAME); -#if defined(__APPLE__) strcat(filename, "-darwin"); #endif #endif From 4358b72ace85a4313d0f39191d183a3885601e89 Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Mon, 9 Mar 2026 23:08:27 +0000 Subject: [PATCH 6/7] tests/fw/graphics/util: fix platform suffix for Linux CI Restore platform suffix on Linux (e.g. ~spalding) while keeping the additional -darwin suffix for macOS local development. This matches the naming convention of the PNG fixture files in the repository. Co-authored-by: Claude Signed-off-by: Joseph Mearman --- tests/fw/graphics/util.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/fw/graphics/util.h b/tests/fw/graphics/util.h index 6b3d9720d..405956cfd 100644 --- a/tests/fw/graphics/util.h +++ b/tests/fw/graphics/util.h @@ -58,11 +58,11 @@ static const char *namecat(const char* str1, const char* str2){ printf("filename and filename_xbit %s : %s\n", filename, filename_xbit); } else { #if !PLATFORM_DEFAULT - // On macOS, append ~platform-darwin suffix to allow different fixtures for local dev - // Linux (CI) uses the base fixture name without any platform suffix -#if defined(__APPLE__) + // Append platform suffix for non-default platforms strcat(filename, "~"); strcat(filename, PLATFORM_NAME); +#if defined(__APPLE__) + // On macOS, also append -darwin to differentiate local dev fixtures from CI strcat(filename, "-darwin"); #endif #endif From cfe9656908be6a0a1e4951ef63e9ea2091c0fbca Mon Sep 17 00:00:00 2001 From: Joseph Mearman Date: Mon, 9 Mar 2026 22:57:39 +0000 Subject: [PATCH 7/7] fw/services/compositor: handle deferred app render during modal transitions When transitioning to a modal, cancel any deferred app render since the modal will cover the app framebuffer. Release the app framebuffer to inform the app that the render is complete. Co-authored-by: Claude Signed-off-by: Joseph Mearman --- src/fw/services/common/compositor/compositor.c | 17 ++++++++++++++++- tests/fakes/fake_HCIAPI.c | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/fw/services/common/compositor/compositor.c b/src/fw/services/common/compositor/compositor.c index f22c182de..2cfdb4868 100644 --- a/src/fw/services/common/compositor/compositor.c +++ b/src/fw/services/common/compositor/compositor.c @@ -413,7 +413,13 @@ void compositor_transition(const CompositorTransition *compositor_animation) { } if (!prv_should_render() || s_deferred_render.animation.pending) { - if (s_deferred_render.app.pending) { + // If we're transitioning to a modal, cancel any deferred app render since the modal + // will cover the app framebuffer. Release the app framebuffer to inform the app + // that the render is complete. + const ModalProperty properties = modal_manager_get_properties(); + const bool is_modal_existing = (properties & ModalProperty_Exists); + const bool is_modal_transparent = (properties & ModalProperty_Transparent); + if (is_modal_existing && !is_modal_transparent && s_deferred_render.app.pending) { s_deferred_render.app.pending = false; prv_release_app_framebuffer(); } @@ -460,6 +466,15 @@ void compositor_transition(const CompositorTransition *compositor_animation) { // We can start animating immediately if we're going to a modal window. This is because // modal window content is drawn on demand so it's always available. + + // When transitioning to a modal, cancel any deferred app render since the modal + // will cover the app framebuffer. Release the app framebuffer to inform the app + // that the render is complete. Only do this if there's actually a deferred render. + if (s_deferred_render.app.pending) { + s_deferred_render.app.pending = false; + prv_release_app_framebuffer(); + } + if (compositor_animation) { s_state = CompositorState_Transitioning; animation_schedule(s_animation_state.animation); diff --git a/tests/fakes/fake_HCIAPI.c b/tests/fakes/fake_HCIAPI.c index 2557f7e3b..c16450b54 100644 --- a/tests/fakes/fake_HCIAPI.c +++ b/tests/fakes/fake_HCIAPI.c @@ -14,7 +14,7 @@ // BD_ADDR_t is typically a pointer to uint8_t or uint8_t array // This helper converts BTDeviceAddress to the expected format -static const uint8_t *BTDeviceAddressToBDADDR(BTDeviceAddress addr) { +static const uint8_t *prv_addr_to_bdaddr(BTDeviceAddress addr) { return addr.octets; }