test: enable BLE tests with comprehensive fakes and stubs#6
Open
test: enable BLE tests with comprehensive fakes and stubs#6
Conversation
Move agent guidelines content into AGENTS.md as the canonical file and make .claude/CLAUDE.md a symlink to it, since the content is not Claude-specific. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Joshua Jun <joshuajun@proton.me>
When airplane mode is toggled off, bt_pairability_init() is called after the BLE advertising infrastructure has been fully torn down and rebuilt. However, the cached s_last_ble_discoverable_state was not being reset, causing evaluate_pairing_refcount() to skip calling gap_le_slave_set_discoverable(true) since it believed discovery advertising was already active. This left an unpaired watch invisible to phones attempting to pair. Reset s_last_ble_discoverable_state to false in bt_pairability_init() so the next evaluation unconditionally re-drives discoverable advertising when needed. Fixes FIRM-1283 Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Joshua Jun <joshuajun@proton.me>
Fixes FIRM-1275 Signed-off-by: Joshua Jun <joshuajun@proton.me>
Signed-off-by: Joshua Jun <joshuajun@proton.me>
Add repository check to S3 upload steps in: - build-firmware.yml - build-prf.yml - release.yml The S3 upload now only runs when in coredevices/PebbleOS, not in forks. This prevents "access-key-id required" errors in fork workflows without using continue-on-error. Fixes workflow failures in forks due to missing AWS credentials. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This is currently not used. Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
- When excellent samples are reported, turn off faster (5) - When good samples are reported, turn off faster (10) Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
Remove it from drivers as well. Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This is not needed on main firmware, and, it is actually buggy (WTF, app timer here!). Also, stop is never called, so a 10ms periodic timer can be left on. This is just a workaround for this whole brain damaged implementation. Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
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 <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
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 <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
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 <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
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 <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
Document the cross-platform fixture naming scheme, Docker testing workflow, and troubleshooting for CI vs local test discrepancies. Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
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 <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
- gatt_client_subscriptions: check if gatt_subscriptions is NULL before dereferencing when prepending to the list - ppogatt: distinguish between retriable and permanent GATT errors during meta characteristic read; only retry on timeout/resource errors, immediately fail on permission/handle errors Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
- Add conditional compilation for Bluetopia headers (SS1BTPS, L2CAPAPI) - Move bt_driver_gatt and bt_driver_gatt_client_discovery implementations to .c files to break circular header dependencies - Add stub implementations for bt_driver CCCD handling - Update gap_le_advert stubs with advertising data functions - Add DiscoveryJobQueue cleanup stub implementation Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
When Bluetopia headers (GAPAPI, GATTAPI) are unavailable (non-BTSTACK builds), provide dummy implementations so tests can compile. This enables running BLE-related tests without the full Bluetooth stack dependencies. Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
- Enable previously broken BLE tests (gatt_client_subscriptions, gatt_client_discovery, gap_le_advert, ppogatt, kernel_le_client) - Add compiler normalisation flags for consistent test results - Fix include path (../include → ../src/include) - Disable DUMA on macOS ARM - Create platform-specific failure directories to prevent contamination - Skip Xbit processing when platform-specific PNG files exist Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
Rename BTDeviceAddressToBDADDR that takes BTDeviceAddress to prv_get_addr_octets to avoid conflict with the stub version that takes const uint8_t* when HCIAPI is not available. Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
Update test files to pass the new watchdog_timer parameter. Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
Link bt_driver_gatt and gap_le_advert stubs to resolve undefined reference errors in BLE tests. Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
The sh library has a bug on macOS with Python 3.11 that causes an OverflowError in os.closerange when calling pip.freeze. Using subprocess.check_output avoids this issue. Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
- Update gap_le_connection_add() calls with 4th argument - Fix include path for stubs_bluetopia_interface.h - Add static keyword to prevent multiple definition errors - Remove reference to non-existent stubs_gap_le_advert.c Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
- Add static inline to bt_driver_advert_* functions in stubs_gap_le_advert.h to prevent multiple definition linker errors - Fix gatt_client_discovery_cleanup_by_connection signature in fake_gatt_client_discovery.c to match the real function signature Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
This fixes undefined reference errors for bt_driver_advert_* functions. Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
Remove 'static inline' from stub functions in stubs_gap_le_advert.h and stubs_gatt_client_discovery.h so they generate linkable symbols. When real source files like gap_le_advert.c are compiled, they call these driver functions. With static inline, the compiler can't inline across translation units, so the linker can't find the symbols. By removing static inline, these become regular functions that can be linked against from compiled source files. Fixes test failures in: - test_gap_le_advert - test_gatt_client_discovery - test_gatt_client_accessors Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
The stub was calling undefined GAP API functions (GAP_LE_Set_Advertising_Data and GAP_LE_Set_Scan_Response_Data) which caused linker errors. Simplify the stub to be a no-op, which is sufficient for test purposes. Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
Add stub implementations for bt_driver_gatt_* functions that only had declarations. This fixes linker errors when real source files call these driver functions. Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
The test file declares this function as extern but it was not defined. Add a stub implementation that checks NumberOfCharacteristics > 0. Co-authored-by: Claude <claude@anthropic.com> Signed-off-by: Joseph Mearman <joseph@mearman.co.uk>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove BLE-related tests from BROKEN_TESTS now that fakes/stubs exist:
Also enable other tests with new fixtures:
Co-authored-by: Claude claude@anthropic.com