<!-- $NetBSD: chap-regress.xml,v 1.1 2007/06/09 11:33:39 dsieger Exp $ -->

<chapter id="chap-regress">
  <title>Regression testing</title>

  <para>Regression testing is an important part of software development.
  Unfortunately, NetBSD does not have a consistent regression testing
  framework.  Each subsystem defines its own set of tests in whichever
  form it wishes to stress test itself.</para>

  <para>This chapter provides some guidelines on how to test different
  parts of the system, but please do keep in mind that the whole
  regression testing framework ought to be replaced with something
  better.</para>

  <para>XXX: This chapter is extremely incomplete.  It currently
  contains supporting documentation for <xref
  linkend="chap-file-system" /> but nothing else.</para>

  <!-- ================================================================ -->

  <sect1 id="chap-regress-filesystems">
    <title>Testing file systems</title>

    <para>Testing file systems this is specially important because they
    work within kernel space; any unexpected failure is often fatal and
    renders the whole system unusable.  Also, because there are
    literally hundreds of minor details to test, none of them should
    suffer regressions.</para>

    <para>The tests for a given file system are stored inside a
    directory named after it, placed under
    <filename>src/regress/sys/fs/</filename>.  For example, the tmpfs
    test suite lives in <filename>src/regress/sys/fs/tmpfs/</filename>.
    Generally, this directory is accompanied by a
    <filename>Makefile</filename> whose <literal>regress</literal>
    targets executes all the tests automatically.</para>

    <para>The author of this text suggests you to add individual and
    independent tests for each feature you want to check, and within
    these, add as many subtests as you need to ensure that the whole
    feature works.  For example, if you wanted to verify the mkdir vnode
    operation, you'd write a <filename>t_mkdir</filename> script that
    checks its functionality through the &man.mkdir.1; command.  This
    script could check that directories can be created, that they cannot
    be overwritten, that their link count is updated correctly,
    etc.</para>

    <para>tmpfs comes with a good set of generic tests that can be
    reused for other file systems.</para>

  </sect1>

</chapter>
