Changeset 974


Ignore:
Timestamp:
Dec 11, 2009, 5:33:48 AM (12 years ago)
Author:
Peter Johansson
Message:

extend list of tips when writing tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/README

    r952 r974  
    6363  have fixed the bug.
    6464
     65  Add a copyright and license followed by one or two lines describing
     66  what the test does.
     67
     68  Tests shall returns 0 at success, 77 if it should be skipped, and
     69  something else at failure. Tests should be silent also at failure
     70  unless option `-v` is passed or env variable VERBOSE is set.
     71
     72  Add the test to XFAIL_TESTS in Makefile.am, if it tests a bug still
     73  present, i.e., the test is expected to fail.
     74
     75C++ tests
     76---------
     77
    6578  Use the test::Suite class liberally. See other tests for examples of
    6679  typical usage.
    6780
    68   Tests shall return 0 at success and -1 otherwise (see
    69   test::Suite::return_value()). If the test should be skipped for some
    70   reason it shall return 77.
     81  Set `need_test_repo` to true in Suite constructor if the test uses
     82  the test repository. That will result in the test being skipped if
     83  test repo is not available, or if it is available the wc will
     84  checked out (if needed) and updated.
    7185
    72   When a test is run without verbose flag, it should be silent also at
    73   failure. Achieve this behaviour by sending output through
    74   test::Suite::out().
     86  Send output via test::Suite::out() which redirects the output to
     87  cout or /dev/null depending on whether VERBOSE and option `-v` are set.
    7588
    7689  If a test needs a data file, place the data in directory
     
    7992  VPATH build in which builddir and srcdir are not the same. To avoid
    8093  problems with files not found in VPATH builds, use the function
    81   test::filename() which gives you the absolute path to the file.
     94  test::src_filename() which gives you the absolute path to the
     95  file. If the data file is generated during build, e.g., checked out
     96  in a wc and residing in builddir, use test:filename instead.
    8297
     98  Add the test to check_PROGRAMS in Makefile.am.
     99
     100Shell tests
     101-----------
     102
     103  Use `required=...` for setting a space delimited list of required
     104  tools (see other tests and init.sh). If `repo` is included in
     105  `required`, a toy_project wc will be checked out and updated if test
     106  repo is available, otherwise test is skipped.
     107
     108  Include init.sh, with `. ./init.sh`.
     109
     110  Use variables set in init.sh such as $srcdir, $SVNDIGEST, and $SVN.
     111
     112  Do not use `exit`, but use functions `exit_fail()`, `exit_skip()`,
     113  or `exit_success()`.
     114
     115  Make sure to set svn property `svn:executable` on test.
     116
     117  Add test to `distributed_TESTS` in Makefile.am.
    83118
    84119======================================================================
Note: See TracChangeset for help on using the changeset viewer.