Skip to content

Replace TEST_ASSERT_INT_WITHIN usage in netsocket tests #11289

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

Merged
merged 1 commit into from
Aug 23, 2019

Conversation

michalpasztamobica
Copy link
Contributor

Description

IPCore's netsocket tests are expected to run all tests even if some of them fail. The TEST_ASSERT_INT_WITHIN macro sets a global variable Unity.CurrentTestFailed which prevents further checks and gives incorrect results and failure count. Other assertion macros in Unity do not do that.

We've considered updating the Unity test code, but other modules also use this macro and it's hard to judge whether they rely on the macro's behavior or not.

The latest version of Unity does not allow the test suite to run after the first assertion triggers.

Fixes #10941.

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Docs update
[x] Test update
[ ] Breaking change

Reviewers

@SeppoTakalo
@VVESTM
@jeromecoutant
@VeijoPesonen

IPCore's netsocket tests are expected to run all tests even if some of them fail. The TEST_ASSERT_INT_WITHIN macro sets a global variable Unity.CurrentTestFailed which prevents further checks and gives incorrect failure count. Other assertion macros in Unity do not do that.
@ciarmcom ciarmcom requested review from SeppoTakalo, VeijoPesonen and a team August 22, 2019 13:00
@ciarmcom
Copy link
Member

@michalpasztamobica, thank you for your changes.
@VeijoPesonen @SeppoTakalo @ARMmbed/mbed-os-ipcore @ARMmbed/mbed-os-test @ARMmbed/mbed-os-maintainers please review.

@VVESTM
Copy link
Contributor

VVESTM commented Aug 23, 2019

Tested OK on my side.
It may need a comment in unity.h to warn user in case he wants to use TEST_ASSERT_INT_WITHIN.

@0xc0170
Copy link
Contributor

0xc0170 commented Aug 23, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented Aug 23, 2019

Test run: SUCCESS

Summary: 4 of 4 test jobs passed
Build number : 1
Build artifacts

@0xc0170 0xc0170 merged commit f1a8eec into ARMmbed:master Aug 23, 2019
@michalpasztamobica michalpasztamobica deleted the unity_replace_macro branch August 26, 2019 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test result is not always reliable (TEST_ASSERT_DOUBLE_WITHIN after a failed test)
6 participants