Skip to content

Conversation

@nrwahl2
Copy link
Contributor

@nrwahl2 nrwahl2 commented Dec 29, 2025

No description provided.

@nrwahl2 nrwahl2 force-pushed the nrwahl2-cmocka branch 3 times, most recently from db0bfed to 5ed1769 Compare December 29, 2025 23:29
We'll need to handle a few more of these in upcoming commits. Some of
them are used in multiple files, so it will be easier and cleaner to
collect them in one place rather than having them in each file where
they're needed.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
CMocka 1.1.4 started requiring stdint.h (commit 8d99418e). CMocka 2.0.0
started requiring stdbool.h (commit f9e5b1fa) and also started including
the required headers by default (commit cbdd14a7, but we cannot rely on
this).

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
I added this in commit 215ad4f, and it's unclear why I used it instead
of assert_int_equal(). Maybe I thought assert_int_equal() would use the
int data type and thus overflow for some values, and that
assert_in_range() somehow would not.

In fact, assert_int_equal() is a macro that casts its arguments to the
largest integer type before comparing them.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
We know it's a macro, so just use #ifndef in unittest_internal.h.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
This caused CI failures in newer builders.

The check_expected_*() definitions could go in mock.c instead of
unittest_internal.h. It's unlikely that they'll ever be used in any
other .c file. However, it seems reasonable to collect everything in one
place.

Amusingly, CMocka provides macros to check the current CMocka version,
but they're not available until CMocka 2.0.0.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
@nrwahl2
Copy link
Contributor Author

nrwahl2 commented Dec 30, 2025

@clumens I'm gonna merge this since it fixes build failures. Feel free to take a look when you're back, and we can revisit this if needed.

@nrwahl2 nrwahl2 merged commit deb3ac7 into ClusterLabs:main Dec 30, 2025
1 check passed
@nrwahl2 nrwahl2 deleted the nrwahl2-cmocka branch December 30, 2025 01:28
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.

1 participant