nfs-utils: add testing infrastructure to nfs-utils
Subsystems (3)
cover nfs-utils: add testing infrastructure to nfs-utils
This patchset is intended as a starting point for an automated test suite for nfs-utils. The idea here is to start simply and add a suite of tests that we can run via "make check" -- the standard automake method for running tests.
Clearly there are limits to what we can test with out a multi-host test harness, but my hope is that this should keep us from breaking basic functionality by allowing us to test it in a very simple fashion. At some point in the future we should also consider how to best handle multi-machine testing, but I see that as complimenting this code rather than replacing it.
For this set, the focus is on testing statd, which is particularly susceptible to subtle breakage. Problems with it are often not noticed until lock recovery breaks, and that may greatly lag the actual breakage.
To faciitate statd testing, I've added a "statdtest" program that can serve as a synthetic statd client and an NLM simulator. It's very loosely based on the old statd simulator code. That program is dependent on some of Chuck's recent statd patches -- notably the ones that break out common NSM code into libnsm.a.
For this initial drop, I'm just adding a single test that tests mon and unmon functionality with statd. Adding more tests shouldn't be too hard, however.
At this point, I'm mostly interested in general feedback on the concept. Does this seem like a reasonable starting point for automated nfs-utils
Jeff Layton (2):
nfs-utils: introduce new statd testing simulator
nfs-utils: add initial tests for statd that run via "make check"
Makefile.am | 2 +- configure.ac | 4 +- tests/Makefile.am | 7 + tests/statdtest/Makefile.am | 45 ++++ tests/statdtest/README | 12 + tests/statdtest/nlm_sm_inter.x | 43 ++++ tests/statdtest/statdtest.c | 462 ++++++++++++++++++++++++++++++++++ tests/t0001-statd-basic-mon-unmon.sh | 56 ++++ tests/test-lib.sh | 41 +++ 9 files changed, 670 insertions(+), 2 deletions(-) create mode 100644 tests/Makefile.am create mode 100644 tests/statdtest/Makefile.am create mode 100644 tests/statdtest/README create mode 100644 tests/statdtest/nlm_sm_inter.x create mode 100644 tests/statdtest/statdtest.c create mode 100755 tests/t0001-statd-basic-mon-unmon.sh create mode 100755 tests/test-lib.sh
PATCH 1/2 nfs-utils: introduce new statd testing simulator
rpc.statd is often prone to subtle, difficult to detect breakage. When it has problems, they're often invisible and only manifest themselves as failed lock recovery.
This program is intended to function as part of a test harness for statd. It's a multicall binary that serves as a synthetic NSM client program, and a daemon that can simulate lockd for purposes of testing the NSM to NLM downcall.
A new top level "tests/" directory is also added to nfs-utils to start as a repository for automated tests of nfs-utils components.
--- Makefile.am | 2 +- configure.ac | 4 +- tests/Makefile.am | 5 + tests/statdtest/Makefile.am | 45 ++++ tests/statdtest/README | 12 + tests/statdtest/nlm_sm_inter.x | 43 ++++ tests/statdtest/statdtest.c | 462 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 571 insertions(+), 2 deletions(-) create mode 100644 tests/Makefile.am create mode 100644 tests/statdtest/Makefile.am create mode 100644 tests/statdtest/README create mode 100644 tests/statdtest/nlm_sm_inter.x create mode 100644 tests/statdtest/statdtest.c
Makefile.am +1 -1
@@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = foreign -SUBDIRS = tools support utils linux-nfs +SUBDIRS = tools support utils linux-nfs tests MAINTAINERCLEANFILES = Makefile.in
configure.ac +3 -1
@@ -418,6 +418,8 @@ AC_CONFIG_FILES([ utils/nfsd/Makefile utils/nfsstat/Makefile utils/showmount/Makefile - utils/statd/Makefile]) + utils/statd/Makefile + tests/Makefile + tests/statdtest/Makefile]) AC_OUTPUT
tests/Makefile.am new file +5 -0
@@ -0,0 +1,5 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = statdtest + +MAINTAINERCLEANFILES = Makefile.in
tests/statdtest/Makefile.am new file +45 -0
45 lines not on this page · raw message
tests/statdtest/README new file +12 -0
@@ -0,0 +1,12 @@ +The statdtest program is a multicall binary intended for testing statd. +It has the ability to act as a synthetic NSM client for sending +artificial NSM calls to any host you choose. + +It also has an NLM simulator that implements the call that statd uses to +communicate with lockd. The daemon simulator will start itself up, +register as an NLM service and listen for upcalls from statd. When it +gets one, it will log a message. + +Note that lockd will need to be down when using the daemon simulator, it +also does not implement the entire NLM protocol and is only really +useful for testing statd.
tests/statdtest/nlm_sm_inter.x new file +43 -0
43 lines not on this page · raw message
tests/statdtest/statdtest.c new file +462 -0
462 lines not on this page · raw message
Signature · 1 line
1.6.2.5
PATCH 2/2 nfs-utils: add initial tests for statd that run via "make check"
In reply to Jeff LaytonLeverage the support that automake already has for running tests via make check. Add a simple test that just checks that the statd mon and unmon calls actually work.
Adding more tests should be a simple matter of adding new scripts exit 0 on success and non-zero on fail, and adding those to the Makefile.am.
--- tests/Makefile.am | 2 + tests/t0001-statd-basic-mon-unmon.sh | 56 ++++++++++++++++++++++++++++++++++ tests/test-lib.sh | 41 +++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 0 deletions(-) create mode 100755 tests/t0001-statd-basic-mon-unmon.sh create mode 100755 tests/test-lib.sh
tests/Makefile.am +2 -0
@@ -3,3 +3,5 @@ SUBDIRS = statdtest MAINTAINERCLEANFILES = Makefile.in + +TESTS = t0001-statd-basic-mon-unmon.sh
tests/t0001-statd-basic-mon-unmon.sh new file +56 -0
56 lines not on this page · raw message
tests/test-lib.sh new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
1.6.2.5