]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
doc: add unit tests
authorIker Pedrosa <ipedrosa@redhat.com>
Fri, 15 Sep 2023 07:24:41 +0000 (09:24 +0200)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Fri, 29 Sep 2023 07:24:01 +0000 (09:24 +0200)
Brief description of the unit testing framework and how to create test
cases with it.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
doc/contributions/tests.md

index db7218d95d414aefd8171c4a3d8a3c2eceb11c6c..e765fe690b6913e2ac4e161e376eb579a64084de 100644 (file)
@@ -1,6 +1,22 @@
 # Tests
 
-Currently, shadow only provides system tests.
+Currently, shadow provides unit and system tests.
+
+## Unit tests
+
+Unit testing is provided by the [cmocka](https://cmocka.org/) framework. It's
+recommended to read the
+[basics](https://cmocka.org/talks/cmocka_unit_testing_and_mocking.pdf) and
+[API](https://api.cmocka.org/) before writing any test case.
+
+In addition, you can check [test_logind.c](../../tests/unit/test_logind.c) to
+get a general idea on how to implement unit tests for shadow using cmocka.
+
+You can execute unit tests by running:
+
+```
+make check
+```
 
 ## System tests