From: Andrew Price Date: Fri, 11 Sep 2020 15:42:43 +0100 Subject: [Cluster-devel] [PATCH 3/3] Describe the unit tests in README.tests In-Reply-To: <20200911144243.667554-1-anprice@redhat.com> References: <20200911144243.667554-1-anprice@redhat.com> Message-ID: <20200911144243.667554-4-anprice@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Signed-off-by: Andrew Price --- doc/README.tests | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/doc/README.tests b/doc/README.tests index 1b90a0c4..292d2ae7 100644 --- a/doc/README.tests +++ b/doc/README.tests @@ -23,8 +23,8 @@ tests can be re-run using make check TOPTS='--recheck' although it's better to re-run the entire suite after fixing tests as a fix for one test could break another. -Writing tests -------------- +Smoke/regression tests +---------------------- A number of GFS2-specific convenience macros have been defined in testsuite.at to make defining new tests quick and easy. Also, some variables have been defined in atlocal.in so that full paths to programs do not have to be included @@ -55,6 +55,33 @@ be found in the autoconf manual at: http://www.gnu.org/software/autoconf/manual/index.html +Unit tests +---------- +A unit test framework for each of the main utils and libgfs2 is included in its +source directory. These tests are based on the libcheck C unit test library and +are built and run by 'make check'. Generally, there should be one check "Suite" +defined for each source file of the util, named with a check_ prefix, +containing one or more test cases defined for each externally-visible function. +For example: + + check_libgfs2 (main file: check_libgfs2.c) + |--------Suite: rgrp.c (in check_rgrp.c) + | |---------- Test case: test_rbm_find_good + | |-----------Test case: test_rbm_find_bad + |--------Suite: meta.c (in check_meta.c) + | |-----------Test case: test_lgfs2_meta + etc. etc. + +The build rules for the unit tests are separated into a checks.am file in each +source directory. Documentation for writing libcheck unit tests can be found +at: + + https://libcheck.github.io/check/doc/check_html/index.html + +Autoconf's automatically generated test driver script only prints one line for +each unit test executable run instead of one line per test case. To view +details of unit test failures, see the generated .log and .trs files. + Generating coverage reports --------------------------- Test coverage instrumentation can be enabled using the --enable-gcov option at -- 2.26.2