summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIker Pedrosa <ipedrosa@redhat.com>2023-09-15 09:24:41 +0200
committerIker Pedrosa <ikerpedrosam@gmail.com>2023-09-29 09:24:01 +0200
commit4f49e3fd3e869246a4f78efe07c104c0b681e41b (patch)
tree42e1eed0df15cfe4dc4d08b24c35c86e8df7ee68
parent0fc697a4b1bee92e568f0c0ac7e612db88736fcd (diff)
doc: add unit tests
Brief description of the unit testing framework and how to create test cases with it. Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
-rw-r--r--doc/contributions/tests.md18
1 files changed, 17 insertions, 1 deletions
diff --git a/doc/contributions/tests.md b/doc/contributions/tests.md
index db7218d9..e765fe69 100644
--- a/doc/contributions/tests.md
+++ b/doc/contributions/tests.md
@@ -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