From: Tomas Krizek Date: Tue, 21 Dec 2021 15:36:09 +0000 (+0100) Subject: tests: bring README up to date X-Git-Tag: v5.5.0~18^2~6 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=65ad94d3e2126e4c775469289c57db9279ec501b;p=thirdparty%2Fknot-resolver.git tests: bring README up to date --- diff --git a/tests/README.rst b/tests/README.rst index bd5bbbb97..81402c035 100644 --- a/tests/README.rst +++ b/tests/README.rst @@ -1,31 +1,86 @@ .. SPDX-License-Identifier: GPL-3.0-or-later +Tests +===== + +The following is a non-comprehensitve lists of various tests that can be found +in this repo. + Unit tests -========== +---------- -The unit tests depend on cmocka_. +The unit tests depend on cmocka_ and can easily be executed after compilation. +They are enabled by default. .. code-block:: bash - $ make check + $ meson test -C build_dir --suite unit + +Config tests +------------ + +Config tests utilize the kresd's lua config file to execute arbitrary tests, +typically testing various modules, their API etc. + +These tests require installed kresd. The binary ``kresd`` found in ``$PATH`` +will be tested. When testing through meson, ``$PATH`` is modified automatically +and you just need to make sure to install kresd first. -.. todo:: Writing tests. +To enable these tests, specify ``-Dconfig_tests=enabled`` option for meson. +Multiple dependencies are required (refer to meson's output when configuring +the build dir). + +.. code-block:: bash + + $ meson configure build_dir -Dconfig_tests=enabled + $ ninja install -C build_dir + $ meson test -C build_dir --suite config Integration tests -================= +----------------- + +The integration tests are using Deckard, the `DNS test harness `_. The +tests simulate specific DNS scenarios, including authoritative server and their +responses. + +These tests require installed kresd. The binary ``kresd`` found in ``$PATH`` +will be tested. When testing through meson, ``$PATH`` is modified automatically +and you just need to make sure to install kresd first. + +To enable these tests, specify ``-Dextra_tests=enabled`` option for meson. +Multiple dependencies are required (refer to meson's output when configuring +the build dir). + +Enabling ``extra_tests`` automatically enables config tests as well. + +.. code-block:: bash + + $ meson configure build_dir -Dextra_tests=enabled + $ ninja install -C build_dir + $ meson test -C build_dir --suite integration + +Pytests +------- + +The pytest suite is designed to spin up a kresd instance, acquire a connected +socket, and then performs any tests on it. These tests are used to test for +example TCP, TLS and its connection management. + +These tests require installed kresd. The binary ``kresd`` found in ``$PATH`` +will be tested. When testing through meson, ``$PATH`` is modified automatically +and you just need to make sure to install kresd first. -The integration tests are using Deckard, the `DNS test harness `_. -It requires Jinja2_ and Python, `socket_wrapper`_, libfaketime_ are embedded in the build (cmake is required for `socket_wrapper`_). +To enable these tests, specify ``-Dextra_tests=enabled`` option for meson. +Multiple dependencies are required (refer to meson's output when configuring +the build dir). -Execute the tests by: +Enabling ``extra_tests`` automatically enables config tests as well. .. code-block:: bash - $ make check-integration + $ meson configure build_dir -Dextra_tests=enabled + $ ninja install -C build_dir + $ meson test -C build_dir --suite pytests -See deckard_ documentation on how to write additional tests. -.. _cmocka: https://cmocka.org/ -.. _`socket_wrapper`: https://cwrap.org/socket_wrapper.html -.. _`libfaketime`: https://github.com/wolfcw/libfaketime .. _deckard: https://gitlab.nic.cz/knot/deckard