#4922 Run "make check" and cmocka unit tests during build
Closed: Fixed None Opened 9 years ago by mkosek.

FreeIPA already contains at least one [cmocka] tests (daemons/ipa-slapi-plugins/ipa-cldap/ipa_cldap_tests.c). Sumit plans to add more, even utilizing https://cwrap.org/ cwrap.

We should update our BuildRequires at least on Fedora platform to pull the optional check, cwrap and cmocka libraries and execute make the check during the build, at least in FreeIPA CI builds.

Right now, we just give:

checking for CHECK... no
configure: WARNING: Without the 'CHECK' library, you will be unable to run all tests in the 'make check' suite

The cmocka 1.0 can even produce JUnit XML reports that can be imported in Jenkins CI results.


Before there was cmocka we used check http://check.sourceforge.net/ for unit-test. Those old test might be replaced by cmocka based ones eventually. The error above indicates that the check-devel package is missing.

We may want to replace them right away as part of this exercise, I see they are used in just 2 places:

$ git grep check.h | grep include
daemons/ipa-kdb/tests/ipa_kdb_tests.c:#include <check.h>
daemons/ipa-slapi-plugins/ipa-extdom-extop/ipa_extdom_tests.c:#include <check.h>

Are there any more automated ways how to replace check tests with cmocka ones?

Please keep in mind that cmocka-1.0 changed the API so the existing tests would emit a deprecation warning (but continue working). I sent a patch to the sssd-devel list, opinions by IPA developers are welcome as well:
https://lists.fedorahosted.org/pipermail/sssd-devel/2015-February/022714.html

There is no automated tool. But I already converted the extdom tests in my tree. So I'll take the ticket and convert the kdb tests as well.

master:

  • d0d79ad extdom: migrate check-based test to cmocka

Not required for 4.2, can be postponed.

master:[[BR]]
5017726 ipa-kdb: add unit_tests for string_to_sid() and dom_sid_string()[[BR]]
3f7481a ipa-kdb: make string_to_sid() and dom_sid_string() more robust[[BR]]
7a1b4dc ipa-kdb: add unit-test for filter_logon_info()[[BR]]
9d026ba ipa-kdb: convert test to cmocka[[BR]]

Metadata Update from @mkosek:
- Issue assigned to sbose
- Issue set to the milestone: FreeIPA 4.2

7 years ago

Login to comment on this ticket.

Metadata