]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
tests/README: merge with docs
authorTomas Krizek <tomas.krizek@nic.cz>
Mon, 10 Jan 2022 14:38:15 +0000 (15:38 +0100)
committerTomas Krizek <tomas.krizek@nic.cz>
Thu, 13 Jan 2022 11:51:36 +0000 (12:51 +0100)
doc/build.rst
tests/README.rst

index 75dfa882d97d4135d001b549d415e08cb9b1a8b2..dfd9c70535047d535308202d1eec698545caa475 100644 (file)
@@ -166,36 +166,7 @@ For complete control over the build flags, use ``--buildtype=plain`` and set
 ``CFLAGS``, ``LDFLAGS`` when creating the build directory with ``meson``
 command.
 
-Tests
------
-
-The following command runs all enabled tests. By default, only unit tests are
-enabled (when ``cmocka`` is installed).
-
-.. code-block:: bash
-
-   $ ninja -C build_dir
-   $ meson test -C build_dir
-
-More comprehensive tests require you to install ``kresd`` into the configured
-prefix before running the test suite. They also have to be explicitly enabled
-by using either ``-Dconfig_tests=enabled`` for postinstall config tests, or
-``-Dextra_tests=enabled`` for all tests, including deckard tests.
-
-.. code-block:: bash
-
-   $ meson configure build_dir -Dconfig_tests=enabled
-   $ ninja install -C build_dir
-   $ meson test -C build_dir
-
-It's also possible to run only specific test suite or a test.
-
-.. code-block:: bash
-
-   $ meson test -C build_dir --help
-   $ meson test -C build_dir --list
-   $ meson test -C build_dir --no-suite postinstall
-   $ meson test -C build_dir integration.serve_stale
+.. include:: ../tests/README.rst
 
 .. _build-html-doc:
 
index 81402c03559407a98e3a9c2a9d8f139e8a9b9f71..69393dcc01725f02ea3de9d446990b9f9ea6230c 100644 (file)
@@ -1,31 +1,40 @@
 .. 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.
+in this repo. These can be enabled by the build system.
 
 Unit tests
-----------
+~~~~~~~~~~
 
 The unit tests depend on cmocka_ and can easily be executed after compilation.
-They are enabled by default.
+They are enabled by default (if ``cmocka`` is found).
 
 .. code-block:: bash
 
+        $ ninja -C build_dir
         $ meson test -C build_dir --suite unit
 
+Postinstall tests
+~~~~~~~~~~~~~~~~~
+
+There following tests require a working installation of 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.
+
+.. code-block:: bash
+
+        $ ninja install -C build_dir
+
 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.
-
 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).
@@ -36,22 +45,23 @@ the build dir).
         $ ninja install -C build_dir
         $ meson test -C build_dir --suite config
 
-Integration tests
------------------
-
-The integration tests are using Deckard, the `DNS test harness <deckard>`_. The
-tests simulate specific DNS scenarios, including authoritative server and their
-responses.
+Extra tests
+~~~~~~~~~~~
 
-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 extra tests require a large set of additional dependencies and executing
+them outside of upstream development is probably redundant.
 
 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).
+the build dir). Enabling ``extra_tests`` automatically enables config tests as
+well.
+
+**Integration tests**
 
-Enabling ``extra_tests`` automatically enables config tests as well.
+The integration tests are using Deckard, the `DNS test harness
+<https://gitlab.nic.cz/knot/deckard>`_. The tests simulate specific DNS
+scenarios, including authoritative server and their responses. These tests rely
+on linux namespaces, refer to Deckard documentation for more info.
 
 .. code-block:: bash
 
@@ -59,28 +69,26 @@ Enabling ``extra_tests`` automatically enables config tests as well.
         $ ninja install -C build_dir
         $ meson test -C build_dir --suite integration
 
-Pytests
--------
+**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.
-
-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 pytests
 
+Useful meson commands
+~~~~~~~~~~~~~~~~~~~~~
+
+It's possible to run only specific test suite or a test.
+
+.. code-block:: bash
 
-.. _deckard: https://gitlab.nic.cz/knot/deckard
+   $ meson test -C build_dir --help
+   $ meson test -C build_dir --list
+   $ meson test -C build_dir --no-suite postinstall
+   $ meson test -C build_dir integration.serve_stale