info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reserved lock and other patches


From: Derek R. Price
Subject: Re: reserved lock and other patches
Date: Thu, 22 Mar 2001 14:47:32 -0500

Noel L Yap wrote:

> Yes, maybe that would give me enough of a hint to get the gist of sanity.sh.

[ . . . ]


> address@hidden on 2001.03.21 20:47:59
>
> > add any checks for the new features.  I can send you a sanity.sh diff if you
>
> > want.

As far as hints are concerned, the basics are pretty simple:

There is one main loop which repeatedly calls a case statement where the
individual cases are of the form:

    testname)
            ...
            ;;

If you add a complete new test be sure to add it into the default list of tests
(grep for 'tests=' near the begining of the script) as well as the case
statement.  During debugging, be aware that the sanity.sh usage allows for a '-f
testname' option to continue through the default list "from" a particular test
as well as interpreting everything in argv past the required options as test
names to run individual tests.

Within each major test section, individual tests usually look like:

    dotest testname-subtestname "shell command" "optionally multiline regexp"

Tests should always start in $testdir and create a subdirectory to operate in
and remove their cruft and end back in $testdir.  The dotest functions output
failure messages and exit if the shell command exits with the wrong exit code or
it's stdin/stderr output doesn't match the regexp.  There are a few dotest
variations, most notably dotest_fail for expected non-zero exit codes.

Other than that it's mostly vanilla Bourne shell.  There are a few constructs
used for versatility and portability.  You can grep for the ones I miss, but
here are a few important ones.  I'm leaving off long explanations after the
first few since it probably gives you the idea and the data is in sanity.sh.


   * $testdir  = the directory this test is taking place in
     (CVSROOT=$testdir/cvsroot or CVSROOT=:fork:$testdir/cvsroot)
   * $testcvs  = full path to the cvs executable we are testing
   * $PLUS     = expr dependant uninterpreted '+' since this can vary
   * $DOTSTAR  = expr dependant _interpreted_ .* since some exprs don't match
     EOL
   * $username = regexp to match a username
   * $hostname = regexp to match a hostname
   * $PROG     = regexp to match progname in CVS error messages
   * $remote   = 'yes' or 'no', depending on whether the script is running with
     a remote CVSROOT

And, of course, some characters like '.' in regexps need to be '\' escaped when
you mean them literally.  Some characters than may be interpret by the shell,
e.g. backquotes and '$', are usually either escaped or replaced with '.'.
dotest adds the final '$' anchor to the regexp itself and all the expr
implementations I know of implicitly supply the start anchor ('^').

If you only make a few mistakes, the work is, of course, still usable, though we
may send the patch back to you for repair.  :)

Hmm.  Maybe I should check this in as documentation.  Well, maybe later.

Derek

--
Derek Price                      CVS Solutions Architect ( http://CVSHome.org )
mailto:address@hidden         CollabNet ( http://collab.net )
--
A polar bear is a rectangular bear after a coordinate transform.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]