Skip to content

Conversation

@roma-jam
Copy link
Contributor

@roma-jam roma-jam commented Nov 14, 2025

Description

This is the first part of the plan: Refactor the runtime_config test application

  • Fixed concurrent access to the nb_of_success var from several tasks
  • Changed the logic of getting notification from the worker thread to sem_done instead of direct notification
  • Added the test case for uninstall the tinyusb driver via several tasks
  • Added README.md to runtime_config test application

Related

Testing

  • CI
  • Added test case: "Multitask: Uninstall" [runtime_config][default]

Checklist

Before submitting a Pull Request, please ensure the following:

  • 🚨 This PR does not introduce breaking changes.
  • All CI checks (GH Actions) pass.
  • Documentation is updated as needed.
  • Tests are updated or added as necessary.
  • Code is well-commented, especially in complex areas.
  • Git history is clean — commits are squashed to the minimum necessary.

Note

Refactors TinyUSB runtime_config multitask tests to use semaphore-based synchronization with thread-safe counters, adds a new uninstall test, and introduces a README.

  • Tests (runtime_config/main/test_multitask_access.c):
    • Switch worker completion signaling to counting sem_done; tasks start via notifications and wait with xSemaphoreTake.
    • Make success counter thread-safe (volatile + spinlock) and track task handles for coordinated start.
    • Extract USB PHY helpers: test_init_phy() and test_deinit_phy().
    • Add new test: "Multitask: Uninstall" tagged [runtime_config][default].
    • Update existing multitask install test to [default], improve assertions and task creation (pdPASS).
  • Docs:
    • Add README.md describing the runtime_config test app, focus areas, and tag taxonomy.

Written by Cursor Bugbot for commit 5ac149b. This will update automatically on new commits. Configure here.

@roma-jam roma-jam self-assigned this Nov 14, 2025
@roma-jam roma-jam requested a review from Copilot November 14, 2025 13:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the TinyUSB runtime_config test application to improve test reliability and enable local execution. The changes address concurrent access issues in multitask testing and modernize the pytest configuration for better developer experience.

Key changes:

  • Fixed race condition in multitask access test by adding spinlock protection for shared counter
  • Converted pytest markers to parametrize format for easier local test execution
  • Added comprehensive README documentation for the test application

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pytest_runtime_config.py Migrated from individual @pytest.mark decorators to @pytest.mark.parametrize for target specification
test_multitask_access.c Added spinlock to protect concurrent access to nb_of_success counter and improved task synchronization
README.md Added new documentation explaining test purpose, structure, tags, and usage

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@roma-jam roma-jam force-pushed the refactor/tinyusb_task_deletion_part1 branch from 9a60cda to 86f222d Compare November 14, 2025 15:26
@roma-jam roma-jam added this to the esp_tinyusb v2.0.2 milestone Nov 14, 2025
@roma-jam roma-jam added the Component: usb_device Issue affects usb_device component label Nov 14, 2025
@roma-jam roma-jam force-pushed the refactor/tinyusb_task_deletion_part1 branch from 86f222d to c0e3d66 Compare November 17, 2025 11:09
@roma-jam roma-jam requested a review from Copilot November 17, 2025 11:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@roma-jam roma-jam force-pushed the refactor/tinyusb_task_deletion_part1 branch from c0e3d66 to aed6a02 Compare November 17, 2025 11:21
@roma-jam roma-jam changed the title feature(esp_tinyusb): TinyUSB task deletion notification driven (part 1/3) [WIP] feature(esp_tinyusb): TinyUSB task deletion notification driven (part 1/3) Nov 17, 2025
@roma-jam roma-jam marked this pull request as ready for review November 17, 2025 11:31
@roma-jam roma-jam changed the title feature(esp_tinyusb): TinyUSB task deletion notification driven (part 1/3) refactor(esp_tinyusb): TinyUSB task deletion notification driven (part 1/3) Nov 17, 2025
@roma-jam
Copy link
Contributor Author

Hi
@tore-espressif
@peter-marcisovsky
@igi540

This PR is ready, PTAL.

@roma-jam roma-jam force-pushed the refactor/tinyusb_task_deletion_part1 branch from aed6a02 to 6ec9db1 Compare November 18, 2025 15:29
Copy link
Collaborator

@igi540 igi540 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall. I left one minor nitpick in an inline comment.

@roma-jam roma-jam force-pushed the refactor/tinyusb_task_deletion_part1 branch from 6ec9db1 to 0c6cf9e Compare November 20, 2025 12:26
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 20

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

…ss test

- Fixed concurrent access to the nb_of_success var from several tasks
- Changed the logic of getting notification from the worker thread to sem_done
- Added the test case for uninstall the tinyusb driver via several tasks
- Added README.md
@roma-jam roma-jam force-pushed the refactor/tinyusb_task_deletion_part1 branch from 0c6cf9e to 5ac149b Compare November 20, 2025 13:32
@roma-jam roma-jam merged commit 7df1773 into master Nov 20, 2025
65 checks passed
@roma-jam roma-jam deleted the refactor/tinyusb_task_deletion_part1 branch November 20, 2025 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: usb_device Issue affects usb_device component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants