Skip to content

Add bare CException unit testing for different platforms and compilers - #33

Open
swaldhoer wants to merge 18 commits into
ThrowTheSwitch:masterfrom
swaldhoer:bare-testing
Open

Add bare CException unit testing for different platforms and compilers#33
swaldhoer wants to merge 18 commits into
ThrowTheSwitch:masterfrom
swaldhoer:bare-testing

Conversation

@swaldhoer

Copy link
Copy Markdown

Spoiler: Sorry the MR grew a bit in size, but it's worth in the end!


What: Build and unit test CException on different Linux (GCC, Clang) and Windows(GCC and MSVC) without having the full dependency on Ceedling or Unity, i.e., it implements a bare unit test of CException just using <assert.h>, to show that it does what it promises.

What has been done:

  • CI:
    • Fix setup for Ceedling based test
    • Add tests for described platforms and compilers
  • test/TestException.c and tests/support/CExceptionConfig.h: Add minimal boiler plate for bare testing.
  • waf and wscript: We need a simple tool to build the run the tests.

What actually needs to be done is documented in the wscript itself.

Please create some comments on the lines that would need some more documentation/explanation.


  • The changes are entirely backwards compatible!
  • Running with GCC creates a coverage report. Interestingly this showed, that not all branches of Throw are covered.
    image

@@ -1 +1 @@
---

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

You can see at https://github.com/swaldhoer/CException/actions that the tests are working as expected.

Comment thread wscript
Logs.warn("Cannot generate coverage report.")
return
gcovr_options = []
if bld.env.CC_NAME == "clang":

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

All Linux/Clang stuff works, except that there is no coverage report generated.

(WARNING) All coverage data is filtered out. Please check your paths and filters.

I do not really understand why coverage data is not created for clang (maybe something with LLVM_PROFILE_FILE environment variable).
If this is a blocker, I'll look into it, otherwise I'd have no problem leaving this as it is, as the current unit testing works and the overall Situation for Linux/Clang is already improved by this MR.

@mvandervoord

Copy link
Copy Markdown
Member

Hi @swaldhoer -- I'm not following the goal of the change.

To be honest, this is close to how this project was originally tested. Some time ago, we realized that we can verify it works on many more platforms with less effort if we just dropped all the manual test wrangling here, and used Ceedling which already can handle coverage, common (and uncommon) toolchains, etc.

Since the only effect was on the TESTING of this toolchain, usually done by devs of CException, we decided that the added dependencies (for testing only) were worthwhile. For anyone else, they only need this project.

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