summaryrefslogtreecommitdiff
path: root/tests/HOWTO-unit-test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/HOWTO-unit-test')
-rw-r--r--tests/HOWTO-unit-test48
1 files changed, 37 insertions, 11 deletions
diff --git a/tests/HOWTO-unit-test b/tests/HOWTO-unit-test
index b84beba3..e00b7d58 100644
--- a/tests/HOWTO-unit-test
+++ b/tests/HOWTO-unit-test
@@ -13,7 +13,7 @@ and then opening doc/html/index.html
Tests Overview
--------------
-In DHCP, a unit test exercises a particular piece of code in
+In DHCP, a unit test exercises a particular piece of code in
isolation. There is a separate unit test per module or API. Each unit
test lives in a directory beneath the code it is designed to exercise.
So, we (will eventually) have:
@@ -26,31 +26,57 @@ So, we (will eventually) have:
And so on.
We are using ATF (Automated Test Framework) as a framework to run our
-unittests. See ISC DHCP Developer's Guide for much more thorough
+unit tests. See ISC DHCP Developer's Guide for much more thorough
description of unit-test and ATF framework in general.
+Installing ATF
+--------------
+ATF sources can be downloaded from https://github.com/jmmv/kyua. ATF
+must be configured, compiled and then installed to be available during
+the DHCP configure procedure. Please follow INSTALL file supplied with
+ATF sources (it's essentially the typical ./configure && make &&
+make install procedure).
+
+Beginning with ATF version 0.16, it is necessary to include the following
+options --enable-tools and --disable-shared when configuring ATF:
+
+ configure --prefix=<prefix> --enable-tools --disable-shared
+
+ISC DHCP unittests will run with ATF releases upto 0.19. Beginning with
+ATF 0.20, the tools, atf-run and atf-report required by ISC DHCP, were
+deprecated and are no longer included with ATF.
+
Running Unit Tests
------------------
In order to run the unit tests for DHCP, enable ATF support during configure:
-$ ./configure --with-atf
+$ ./configure --with-atf{=<atf-path>}
+
+ where <atf-path> is the path into which ATF was installed. This would
+ be same value used for --prefix when ATF was configured (default is
+ /usr/local).
-And then use:
+And then build ISC_DHCP with:
+
+$ make
+
+Finally build and run unit tests with:
$ make check
-This will run all of the unit tests. Make sure that ATF is actually
-installed and that you have atf-run and atf-report tool in your PATH.
+This will traverse the source tree running the unit tests in each unit test
+subdirectory. Note that if one or more tests in a unit test subdirectory fail
+the make process will stop. To run all of the tests regardless of outcome,
+use:
+
+$ make -k check
-You can run a single test by going to the appropriate test directory
+You can run a single test by going to the appropriate test directory
and invoking the test directly:
$ cd server/tests
-$ atf-run | atf-report
-
-There are also a number of options that you can use when running a
-test. See atf-run and atf-report documentation.
+$ make check
Adding a New Unit Test
----------------------