Skip to content

Conversation

@vChavezB
Copy link
Contributor

@vChavezB vChavezB commented Jun 16, 2024

Similar to gTest, CppuTest is a CPP framework for unit tests. This commit adds support to detect Cpputest console output when verbose mode is enabled (-v).

I am open for any feedback. My main use case was some unit tests that were written with Cpputest that I needed to port to Zephyr and integrate with twister.

@MaureenHelm
Copy link
Member

@vChavezB please take a look at the failed checks

@vChavezB
Copy link
Contributor Author

vChavezB commented Aug 8, 2024

Thanks for the feedback, I must have missed it.

@zephyrbot zephyrbot added the area: Testsuite Testsuite label Aug 8, 2024
@vChavezB vChavezB force-pushed the twister_cpputest branch 2 times, most recently from d526801 to 0ddcc40 Compare August 8, 2024 21:42
@hakehuang
Copy link
Contributor

would be possible to a test application for this?

Comment on lines 468 to 492
Copy link
Member

Choose a reason for hiding this comment

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

Why the need for "-v"? I don't see it in the code. Also, it shouldn't be the case. Level of output verbosity mustn't affect a test result.

Copy link
Contributor Author

@vChavezB vChavezB Aug 9, 2024

Choose a reason for hiding this comment

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

The verbose argument must be applied to your CPPUtest application. Correct me if I am wrong but if you do not add the verbose option, you do not get information about which test cases have passed. Instead you will only get a dot for each test that has passed (e.g. ....) and at the end something such as OK (2 tests, 2 ran, 94 checks, 0 ignored, 0 filtered out, 2 ms).

Without verbose

..
OK (2 tests, 2 ran, 94 checks, 0 ignored, 0 filtered out, 2 ms)

With verbose

TEST(MyGroup, test1)
TEST(MyGroup, test2)
 OK (2 tests, 2 ran, 94 checks, 0 ignored, 0 filtered out, 2 ms)

@vChavezB
Copy link
Contributor Author

vChavezB commented Aug 9, 2024

would be possible to a test application for this?

I made a sample here

https://github.com/vChavezB/zephyr_cpputest_sample

git clone https://github.com/vChavezB/zephyr_cpputest_sample
wes init -l zephyr_cpputest_sample
west update -o=--depth=1 -n
./zephyr/scripts/twister -vvv -T zephyr_cpputest_sample

@hakehuang
Copy link
Contributor

would be possible to a test application for this?

I made a sample here

https://github.com/vChavezB/zephyr_cpputest_sample

git clone https://github.com/vChavezB/zephyr_cpputest_sample
wes init -l zephyr_cpputest_sample
west update -o=--depth=1 -n
./zephyr/scripts/twister -vvv -T zephyr_cpputest_sample

I would support you to move this test into tests/cpputest

@vChavezB vChavezB force-pushed the twister_cpputest branch 3 times, most recently from d4ecb01 to 647d718 Compare March 4, 2025 12:25
@vChavezB
Copy link
Contributor Author

vChavezB commented Mar 4, 2025

Rebased and fixed according to #81176 (comment)

yperess
yperess previously approved these changes Mar 21, 2025
include(FetchContent)
FetchContent_Declare(
CppUTest
GIT_REPOSITORY https://github.com/cpputest/cpputest.git
Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible to move cpputest project into zephyr umbrella? further, ztest has many configs which would be good to aligned with cpputest as well.

Copy link
Contributor Author

@vChavezB vChavezB Mar 21, 2025

Choose a reason for hiding this comment

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

By moving, do you mean declaring a west manifest under tests/cpputest/base/west.yml with cpputest or something such as creating a repository under the github url zephyproject-rtos/cpputest ?

about the configs you mean creating an interoperability layer to make the KConfigs from ZTest compatible when using cpputest such as

Copy link
Contributor

Choose a reason for hiding this comment

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

By moving, do you mean declaring a west manifest under tests/cpputest/base/west.yml with cpputest or something such as creating a repository under the github url zephyproject-rtos/cpputest ?

yes

Copy link
Contributor

Choose a reason for hiding this comment

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

about the configs you mean creating an interoperability layer to make the KConfigs from ZTest compatible when using cpputest such as

check this file,
https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/testsuite/ztest/Kconfig

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By moving, do you mean declaring a west manifest under tests/cpputest/base/west.yml with cpputest or something such as creating a repository under the github url zephyproject-rtos/cpputest ?

yes

Do you mean yes...declaring a west manifest or yes creating a repository? If you mean declaring a west manifest, do you mean adding cpputest to the root of the zephyr project repo, such as is the case for bsim, see

- name: babblesim_base

check this file,
https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/testsuite/ztest/Kconfig

Are you proposing to add a repository under /subsys/testsuite/cpputest and replicate the Kconfigs from ztest for cpputest?

sorry for the specific questions but its not that clear for me as I havent used ztest.

Copy link
Contributor

Choose a reason for hiding this comment

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

no actually. I will raise this problem in testing working group this week. Maybe we can enhance in following PR, but would this possible that you create a similar Kconfig for cpputest first.

Copy link
Contributor

Choose a reason for hiding this comment

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

per TWG meeting, we agreed that Kconfig is no need to aligned with ztest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the info. So what would be required to continue with the PR.
Kind regards

Copy link
Contributor

Choose a reason for hiding this comment

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

@vChavezB can you contact @nashif on whether cpputest can move into zephyr project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it enough to tag him here? @nashif , as per @hakehuang , there is a question regarding adding cpputest to the zephyr project.

From my perspective unless, someone will mantain cpputest for the zephyr project it is a good idea to add it. If not I would suggest just adding a west manifest to tests/cpputest/base/west.yml if using the CMake FetchContent_Declare is not preferred by the maintainers.

@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@vChavezB
Copy link
Contributor Author

vChavezB commented Jun 15, 2025

rebased as there was a conflict in the docs with the addition of harness "power". Will leave this PR for any further discussion on what to do with cpputest as mentioned here #74372 (comment)

@vChavezB vChavezB force-pushed the twister_cpputest branch 5 times, most recently from 16fe82e to 5b75d67 Compare June 15, 2025 14:35
Similar to gTest, CppuTest is a CPP framework for unit tests.
This commit adds support based on the console output of
a cpputest test suite application.

Signed-off-by: Victor Chavez <[email protected]>
@sonarqubecloud
Copy link

@github-actions github-actions bot removed the Stale label Jun 16, 2025
@danieldegrasse danieldegrasse removed this from the v4.2.0 milestone Jul 21, 2025
@github-actions
Copy link

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

@github-actions github-actions bot added the Stale label Sep 20, 2025
@github-actions github-actions bot closed this Oct 5, 2025
@epc-ake
Copy link
Contributor

epc-ake commented Oct 30, 2025

Are there still plans to merge this?
I would appreciate cpputest support in zephyr since a lot of our existing code bases test using cpputest.

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.