xref: /openbsd-src/gnu/usr.bin/cvs/TESTS (revision e77048c1007676349fedef3cd7d0b6b93f74c675)
150bf276cStholoTo run the tests:
250bf276cStholo
350bf276cStholo	$ make check
450bf276cStholo
550bf276cStholoNote that if your /bin/sh doesn't support shell functions, you'll
650bf276cStholohave to try something like this, where "/bin/sh5" is replaced by the
750bf276cStholopathname of a shell which handles normal shell functions:
850bf276cStholo
950bf276cStholo	$ make SHELL=/bin/sh5 check
1050bf276cStholo
11*e77048c1StholoAlso note that you must be logged in as a regular user, not root.
12*e77048c1Stholo
1350bf276cStholoWARNING:  This test can take quite a while to run, esp. if your
1450bf276cStholodisks are slow or over-loaded.
1550bf276cStholo
162770ece5StholoThe tests work in /tmp/cvs-sanity (which the tests create) by default.
172770ece5StholoIf for some reason you want them to work in a different directory, you
182770ece5Stholocan set the TESTDIR environment variable to the desired location
19b6f6614eStholobefore running them.
202770ece5Stholo
21*e77048c1StholoThe tests use a number of tools (awk, expr, id, tr, etc.) that are not
22*e77048c1Stholorequired for running CVS itself.  In most cases, the standard vendor-
23*e77048c1Stholosupplied versions of these tools work just fine, but there are some
24*e77048c1Stholoexceptions -- expr in particular is heavily used and many vendor
25*e77048c1Stholoversions are deficient in one way or another.  Note that some vendors
26*e77048c1Stholoprovide multiple versions of tools (typically an ancient, traditional
27*e77048c1Stholoversion and a new, standards-conforming version), so you may already
28*e77048c1Stholohave a usable version even if the default version isn't.  If you don't
29*e77048c1Stholohave a suitable tool, you can probably get one from the GNU Project (see
30*e77048c1Stholohttp://www.gnu.org).  expr and id are both part of the GNU shellutils
31*e77048c1Stholopackage, tr is part of the GNU textutils package, and awk is part of the
32*e77048c1StholoGNU gawk package.  The test script tries to verify that the tools exist
33*e77048c1Stholoand are usable; if not, it tries to find the GNU versions and use them
34*e77048c1Stholoinstead.  If it can't find the GNU versions either, it will print an
35*e77048c1Stholoerror message and, depending on the severity of the deficiency, it may
36*e77048c1Stholoexit.
3750bf276cStholo
3850bf276cStholoIf there is some unexpected output, that is a failure which can be
3950bf276cStholosomewhat hard to track down.  Finding out which test is producing the
4050bf276cStholooutput is not always easy.  The newer tests (that is, ones using
4150bf276cStholodotest*) will not have this problem, but there are many old tests
4250bf276cStholowhich have not been converted.
4350bf276cStholo
4450bf276cStholoIf running the tests produces the output "FAIL:" followed by the name
4550bf276cStholoof the test that failed, then the details on the failure are in the
4650bf276cStholofile check.log.  If it says "exit status is " followed by a number,
4750bf276cStholothen the exit status of the command under test was not what the test
4850bf276cStholoexpected.  If it says "** expected:" followed by a regular expression
4950bf276cStholofollowed by "** got:" followed by some text, then the regular
5050bf276cStholoexpression is the output which the test expected, and the text is the
5150bf276cStholooutput which the command under test actually produced.  In some cases
5250bf276cStholoyou'll have to look closely to see how they differ.
5350bf276cStholo
5450bf276cStholoIf output from "make remotecheck" is out of order compared to what is
5550bf276cStholoexpected (for example,
5650bf276cStholo
5750bf276cStholo   a
5850bf276cStholo   b
5950bf276cStholo   cvs foo: this is a demo
6050bf276cStholo
6150bf276cStholois expected and
6250bf276cStholo
6350bf276cStholo   a
6450bf276cStholo   cvs foo: this is a demo
6550bf276cStholo   b
6650bf276cStholo
6750bf276cStholois output), this is probably a well-known bug in the CVS server
6850bf276cStholo(search for "out-of-order" in src/server.c for a comment explaining
6950bf276cStholothe cause).  It is a real pain in running the testsuite, but if you
7050bf276cStholoare lucky and/or your machine is fast and/or lightly loaded, you won't
7150bf276cStholorun into it.  Running the tests again might succeed if the first run
7250bf276cStholofailed in this manner.
7350bf276cStholo
7450bf276cStholoFor more information on what goes in check.log, and how the tests are
7550bf276cStholorun in general, you'll have to read sanity.sh.  Depending on just what
7650bf276cStholoyou are looking for, and how familiar you are with the Bourne shell
7750bf276cStholoand regular expressions, it will range from relatively straightforward
7850bf276cStholoto obscure.
7950bf276cStholo
8050bf276cStholoIf you choose to submit a bug report based on tests failing, be
8150bf276cStholoaware that, as with all bug reports, you may or may not get a
8250bf276cStholoresponse, and your odds might be better if you include enough
8350bf276cStholoinformation to reproduce the bug, an analysis of what is going
8450bf276cStholowrong (if you have the time to provide one), etc.  The check.log
8550bf276cStholofile is the first place to look.
8650bf276cStholo
8750bf276cStholoABOUT STDOUT AND STDERR
8850bf276cStholo***********************
8950bf276cStholo
9050bf276cStholoThe sanity.sh test framework combines stdout and stderr and for tests
9150bf276cStholoto pass requires that output appear in the given order.  Some people
9250bf276cStholosuggest that ordering between stdout and stderr should not be
9350bf276cStholorequired, or to put it another way, that the out-of-order bug referred
9450bf276cStholoto above, and similar behaviors, should be considered features, or at
9550bf276cSthololeast tolerable.  The reasoning behind the current behavior is that
9650bf276cStholohaving the output appear in a certain order is the correct behavior
9750bf276cStholofor users using CVS interactively--that users get confused if the
9850bf276cStholoorder is unpredictable.
9950bf276cStholo
10050bf276cStholoABOUT TEST FRAMEWORKS
10150bf276cStholo*********************
10250bf276cStholo
10350bf276cStholoPeople periodically suggest using dejagnu or some other test
10450bf276cStholoframework.  A quick look at sanity.sh should make it clear that there
10550bf276cStholoare indeed reasons to be dissatisfied with the status quo.  Ideally a
10650bf276cStholoreplacement framework would achieve the following:
10750bf276cStholo
10850bf276cStholo1.  Widely portable, including to a wide variety of unices, NT, Win95,
10950bf276cStholoOS/2, VMS, probably DOS and Win3, etc.
11050bf276cStholo
11150bf276cStholo2.  Nicely match extended regular expressions of unlimited length.
11250bf276cStholo
11350bf276cStholo3.  Be freely redistributable, and if possible already the kind of
11450bf276cStholothing people might have already installed.  The harder it is to get
11550bf276cStholoand install the framework, the less people will run the tests.
11650bf276cStholo
11750bf276cStholoThe various contenders are:
11850bf276cStholo
11950bf276cStholo* Bourne shell and GNU expr (the status quo).  Falls short on #1
12050bf276cStholo(we've only tried unix and NT, although MKS might help with other DOS
12150bf276cStholomutants).  #3 is pretty good (the main dependency is GNU expr which is
12250bf276cStholofairly widely available).
12350bf276cStholo
12450bf276cStholo* Bourne shell with a new regexp matcher we would distribute with
12550bf276cStholoCVS.  This means maintaining a regexp matcher and the makefiles which
12650bf276cSthologo with it.  Not clearly a win over Bourne shell and GNU expr.
12750bf276cStholo
12850bf276cStholo* Bourne shell, and use sed to remove variable portions of output, and
12950bf276cStholothus produce a form that can be compared with cmp or diff (this
13050bf276cStholosidesteps the need for a full regular expression matcher as mentioned
13150bf276cStholoin #2 above).  The C News tests are said to work this way.  This would
13250bf276cStholoappear to rely on variable portions of output having a certain syntax
13350bf276cStholoand might spuriously recognize them out of context (this issue needs
13450bf276cStholomore investigation; it isn't clear how big a problem it is in
13550bf276cStholopractice).  Same portability issues as the other choices based on the
13650bf276cStholoBourne shell.
13750bf276cStholo
13850bf276cStholo* Dejagnu.  This is overkill; most of dejagnu is either unnecessary
13950bf276cStholo(e.g. libraries for communicating with target boards) or undesirable
14050bf276cStholo(e.g. the code which stats every file in sight to find the tests).  On
14150bf276cStholothe plus side, dejagnu is probably closer than any of the other
14250bf276cStholochoices to having everything which is needed already there.
14350bf276cStholo
14450bf276cStholo* Write our own small framework directly in tcl and distribute with
14550bf276cStholoCVS.  The tests would look much like dejagnu tests, but we'd avoid the
14650bf276cStholounnecessary baggage.  The only dependency would be on tcl (that is,
14750bf276cStholowish).
14850bf276cStholo
14950bf276cStholo* perl or python or <any other serious contenders here?>
1502286d8edStholo
1512286d8edStholoIt is worth thinking about how to:
1522286d8edStholo
1532286d8edStholoa.  include spaces in arguments which we pass to the program under
1542286d8edStholotest (sanity.sh dotest cannot do this; see test rcs-9 for a
1552286d8edStholoworkaround).
1562286d8edStholo
1572286d8edStholob.  pass stdin to the program under test (sanity.sh, again, handles
1582286d8edStholothis by bypassing dotest).
159892c0aadStholo
160892c0aadStholoc.  have a send-expect type dialog with the program under test
161892c0aadStholo    (e.g. see server-7 or pserver-4 which want to talk the CVS
162892c0aadStholo    protocol, or the many tests which need to answer the prompt of "cvs
163892c0aadStholo    release", e.g. deep-5).
164