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

Fix one typical misusage of CMock. #1112

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

Moral-Hao
Copy link
Contributor

Description

CMock has three policies when dealing with pointer:

  1. compare_ptr : compare the pointer itself;
  2. compare_data : compare the data which is pointed by pointer;
  3. smart : compare the pointer itself, or compare the data;

By default, CMock use compare_data policy.

Most test cases in FreeRTOS need to compare the pointer itself, and we haven't use CMock properly.
For example, one test case of vTaskResume is wrong, and because CMock compares the data pointed by pointer currently, so the error didn't exposed.

There are so many misusage need to fix, it will take a lot of work. I'm here to fix one typical misusage first.

Test Steps

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

CMock has three policies when dealing with pointer:
1. compare_ptr : compare the pointer itself;
2. compare_data : compare the data which is pointed by pointer;
3. smart : compare the pointer itself, or compare the data;
By default, CMock use compare_data policy.

Most test cases in FreeRTOS need to compare the pointer itself,
and we haven't use CMock properly.
For example, one test case of vTaskResume is wrong, because current
CMock compares the data pointed by pointer, so the error didn't exposed.

There are so many misusage need to fix, it will take a lot of work.
I'm here to fix one typical misusage first.
@Moral-Hao Moral-Hao requested a review from a team as a code owner November 8, 2023 02:53
Copy link
Member

@cookpate cookpate left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. LGTM

@cookpate cookpate merged commit ae39f8e into FreeRTOS:main Nov 13, 2023
24 checks passed
@Moral-Hao Moral-Hao deleted the fix_misusage_of_CMock_about_pointer branch November 21, 2023 14:03
every-breaking-wave pushed a commit to every-breaking-wave/FreeRTOS that referenced this pull request Nov 15, 2024
* Remove hardware dependence in portmacros.h

The IAR MSP430X port `#include "msp430.h"` which pulls all the hardware
register definitions into anything which `#include "FreeRTOS.h"`.  This
removes that hardware dependency "leak" by removing the header file
and re-defining the `portDISABLE_INTERRUPTS()` and
`portENABLE_INTERRUPTS()` macros in terms of `__asm`.

* Code review suggestions

Signed-off-by: Gaurav Aggarwal <[email protected]>

---------

Signed-off-by: Gaurav Aggarwal <[email protected]>
Co-authored-by: Gaurav-Aggarwal-AWS <[email protected]>
Co-authored-by: Gaurav Aggarwal <[email protected]>
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.

3 participants