On Wednesday, 20 December 2023 15:49:44 CET Thomas Brinker wrote:
Dear CMocka-Team,
Hi Thomas,
we use the cmocka framework in unit-testing of our opensource tools and found some things that would be very useful as extensions for it:
* Mocking can be turned on on runtime * Differentiation of wrap and weak mocking * Handling of static and shared linking * Macros to convenient create mocks * Macros to create setup-, teardown- and test function-prototypes in a consistent & convenient way for a given function. * some additional convenient macros (see. https://github.com/Elektrobit/cmocka_extensions/blob/main/src/cmocka_extensi ons/include/cmocka_extensions/cmocka_extensions.h)
thank you very much for reaching out! like
`will_set_parameter` for output parameter or `will_set_errno`. * ...
I'd like to invite you to have look at
https://github.com/Elektrobit/cmocka_extensions especially https://github.com/Elektrobit/cmocka_extensions/blob/main/documentation/docu mentation.md
Do you expect this to be useful? Is this something that should become part of cmocka or stay as a separate extension?
I always want to improve cmocka and the best is if people using cmocka contribute code back! First, please take a look at the master branch. It has some big changes to always use uintmax_t (C99) and other integer types. I'm happy to discuss integrating the stuff you created. If you want we can have a phone call beforehand. The way to go is to create *small* merge requests on gitlab: https://gitlab.com/cmocka/cmocka We can then integrate things step by step and improve them on the way if needed. Note that cmocka is unit-testing library. So each feature being added needs to be covered by unit tests. I just had a quick look. We could add nearly everything from cmocka_extensions.h. However it needs to be cleaned up, protected and probably documented. Just something catched my eye: assert_non_null_msg(void *ptr, const char *msg) calls free on a NULL pointer. Why?
Additionally to these extensions we have created some mocks for jsonc, libc, libmnl, openssl. Which can be found here:
I will take a look.
Same questions as above apply.
Best regards Andreas
Kind regards Thomas Brinker
-- ppa. Dipl.-Ing. Thomas Brinker
emlix GmbH Headquarters: Berliner Str. 12, 37073 Göttingen, Germany Phone +49 (0)551 30664-0, e-mail info@emlix.com District Court of Göttingen, Registry Number HR B 3160 Managing Directors: Heike Jordan, Dr. Uwe Kracke VAT ID No. DE 205 198 055 Office Berlin: Panoramastr. 1, 10178 Berlin, Germany Office Bonn: Bachstr. 6, 53115 Bonn, Germany http://www.emlix.com
emlix - your embedded Linux partner
_______________________________________________ cmocka-devel mailing list -- cmocka-devel@cmocka.org To unsubscribe send an email to cmocka-devel-leave@cmocka.org
-- Andreas Schneider asn@cryptomilk.org GPG-ID: 8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D