From fa33b4ee23aba4e713a60ab7b9e2e542e3924eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Thu, 15 Nov 2018 10:06:45 +0100 Subject: [PATCH] Remove the traces of ATF from documentation --- README | 5 ++-- README.md | 4 +-- doc/dev/dev.md | 73 +++++--------------------------------------------- unit/README | 8 +++--- 4 files changed, 15 insertions(+), 75 deletions(-) diff --git a/README b/README index 31b58aa1a8..8ea021026a 100644 --- a/README +++ b/README @@ -289,8 +289,9 @@ and will be skipped if these are not available. Some tests require Python and the 'dnspython' module and will be skipped if these are not available. See bin/tests/system/README for further details. -Unit tests are implemented using Automated Testing Framework (ATF). To run -them, use configure --with-atf, then run make test or make unit. +Unit tests are implemented using cmocka unit testing framework. +To run them, use configure --with-cmocka, then run make test or +make unit. Documentation diff --git a/README.md b/README.md index 272e5a7e0b..ea95a9d6c6 100644 --- a/README.md +++ b/README.md @@ -307,8 +307,8 @@ and will be skipped if these are not available. Some tests require Python and the 'dnspython' module and will be skipped if these are not available. See bin/tests/system/README for further details. -Unit tests are implemented using Automated Testing Framework (ATF). -To run them, use `configure --with-atf`, then run `make test` or +Unit tests are implemented using cmocka unit testing framework. +To run them, use `configure --with-cmocka`, then run `make test` or `make unit`. ### Documentation diff --git a/doc/dev/dev.md b/doc/dev/dev.md index e7e4b897af..b9c37aa7a3 100644 --- a/doc/dev/dev.md +++ b/doc/dev/dev.md @@ -197,27 +197,10 @@ points to `rndc`, `SIGNZONE` to `dnssec-signzone`, etc. #### Building unit tests -BIND uses the Automated Testing Framework (ATF), originally from the NetBSD -project, as its unit testing framework. (Note: ATF has been supplanted by -a newer version called Kyua, but BIND is still using the older system.) +BIND uses the cmocka, unit testing framework. -To build BIND with unit tests, run `configure` with the `--with-atf` -option. This causes the ATF source code in the `unit/atf-src` -subdirectory to be built. - -To save time on repeated builds, you can build and install ATF -in another directory, and configure BIND to use the pre-built -version. (Be sure to disable shared libraries in the ATF build, -and to build the ATF tools; libraries alone are not sufficient). - - $ cd atf-src - $ configure --prefix= --enable-tools --disable-shared - $ make - $ make install - -After this has been done, specify the ATF prefix when building BIND: - - $ configure --with-atf= +To build BIND with unit tests, run `configure` with the `--with-cmocka` +option. This requires cmocka >= 1.0.0 to be installed in the system. #### Running unit tests @@ -249,53 +232,11 @@ redirected: #### Writing unit tests -Information on writing ATF tests can be found at the -[NetBSD site](http://wiki.netbsd.org/tutorials/atf/). +Information on writing cmocka tests can be found at the +[cmocka website](https://cmocka.org). -New unit tests should be added whenever significant new API -functionality is added to libdns or libisc. - -Each unit test file contains at least one unit test case, and -a list of test cases to execute when the test is run. These -will look like the following: - - ATF_TC(test_case); - ATF_TC_HEAD(test_case, tc) { - atf_tc_set_md_var(tc, "descr", - "Describe the test case here."); - } - ATF_TC_BODY(serialize_align, tc) { - UNUSED(tc); - - result = isc_test_begin(NULL, true); - ATF_REQUIRE_EQ(result, ISC_R_SUCCESS); - - ATF_CHECK_EQ(value1, value2); - ATF_CHECK(value1 + value2 < 100); - - isc_test_end(); - } - - /* - * Main - */ - ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, test_case); - - return (atf_no_error()); - } - -If the conditions specified in `ATF_CHECK` and `ATF_CHECK_EQ` -directives are found to be false, then the test case will fail, but it -will continue running to see if there are any more failures. - -If the conditions specified in `ATF_REQUIRE` and `ATF_REQUIRE_EQ` are -found to be false, the test case cannot continue running and will stop - -`isc_test_begin()` and `isc_test_end()` set up necessary preconditions -for checking libisc functions, such as starting a task manger and -creating a memory context. Similar functions `dns_test_begin()` and -`dns_test_end()` are available for testing libdns functions. +New unit tests should be added whenever new API functionality is added to the +libraries. ### BIND system architecture diff --git a/unit/README b/unit/README index 0f0c209df0..5775ef87ef 100644 --- a/unit/README +++ b/unit/README @@ -1,9 +1,7 @@ -Unit tests for BIND 9 are based on NetBSD Automated Test Framework, cmocka and -test execution engine Kyua. +Unit tests for BIND 9 are based on cmocka and test execution engine Kyua. -If your distribution of choice doesn't include packages for atf, kyua and -cmocka, the sources can be found here: +If your distribution of choice doesn't include packages for kyua or cmocka, the +sources can be found here: - * ATF 0.20 - https://github.com/jmmv/atf/releases * Kyua 0.13 - https://github.com/jmmv/kyua/releases * CMocka 1.0 - https://cmocka.org/files/