Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user-defined TEST_PROTECT & TEST_ABORT macros #695

Conversation

fkjagodzinski
Copy link
Contributor

@fkjagodzinski fkjagodzinski commented Aug 29, 2023

This update covers use cases where:

  • Unity is used to provide the assertion macros only, and an external test harness/runner is used for test orchestration/reporting, e.g. Mbed OS.
  • Calling longjmp on a given platform is possible, but has a platform-specific (or implementation-specific) set of prerequisites, e.g. privileged access level. Which has been mentioned in Prevent unity from bailing on failed tests #616 (comment).

Enable project-specific customisation of TEST_PROTECT and TEST_ABORT macros:

  • Use the user-defined UNITY_TEST_ABORT if available; fall back to default behaviour otherwise.
  • Use the user-defined UNITY_TEST_PROTECT if available; fall back to default behaviour otherwise.
  • These may be defined independently.

@fkjagodzinski
Copy link
Contributor Author

Marking this as a draft because the patch is missing docs update. 🙂

Also, please let me know if this path is acceptable, then I'll update the relevant markdown files.

@mvandervoord
Copy link
Member

Hi. Thanks for the patch! I appreciate that you've matched the pattern of usage we have for other override-able options in the project. If you update the configuration docs with this, I'd say you have a great feature here. :)

However rare, this update covers real-world use cases where:
- Unity is used to provide the assertion macros only, and an external
  test harness/runner is used for test orchestration/reporting.
- Calling longjmp on a given platform is possible, but has a
  platform-specific (or implementation-specific) set of prerequisites,
e.g. privileged access level.

Enable project-specific customisation of TEST_PROTECT and TEST_ABORT
macros.
- Use the user-defined UNITY_TEST_ABORT if available; fall back to
  default behaviour otherwise.
- Use the user-defined UNITY_TEST_PROTECT if available; fall back to
  default behaviour otherwise.
- These may be defined independently.
@fkjagodzinski fkjagodzinski force-pushed the dev/add-user-defined-protect-and-abort branch from 8acfb0a to 710bb58 Compare September 4, 2023 11:36
@fkjagodzinski
Copy link
Contributor Author

I've updated the docs. I think the macro descriptions are OK, but my view is rather biased, so I'd appreciate any reviews. 😉

@fkjagodzinski fkjagodzinski marked this pull request as ready for review September 4, 2023 11:42
@fkjagodzinski
Copy link
Contributor Author

Hi there. It's been a while so I took another look at the docs, and I'd say both the macro descriptions and the code snippets still make sense. @mvandervoord, could you review the PR when you get a chance?

@mvandervoord mvandervoord merged commit d3804d0 into ThrowTheSwitch:master Sep 19, 2023
1 check passed
@fkjagodzinski fkjagodzinski deleted the dev/add-user-defined-protect-and-abort branch September 19, 2023 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants