home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / cvs-1.8.7-src.tgz / tar.out / fsf / cvs / src / sanity.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1996-09-28  |  135KB  |  4,442 lines

  1. #! /bin/sh
  2. :
  3. #    sanity.sh -- a growing testsuite for cvs.
  4. #
  5. # Copyright (C) 1992, 1993 Cygnus Support
  6. #
  7. # Original Author: K. Richard Pixley
  8.  
  9. # usage: sanity.sh [-r] @var{cvs-to-test} @var{tests-to-run}
  10. # -r means to test remote instead of local cvs.
  11. # @var{tests-to-run} are the names of the tests to run; if omitted run all
  12. # tests.
  13.  
  14. # See TODO list at end of file.
  15.  
  16. # required to make this script work properly.
  17. unset CVSREAD
  18.  
  19. TESTDIR=/tmp/cvs-sanity
  20. # This will show up in cvs history output where it prints the working
  21. # directory.  It should *not* appear in any cvs output referring to the
  22. # repository; cvs should use the name of the repository as specified.
  23. TMPPWD=`cd /tmp; /bin/pwd`
  24.  
  25. # "debugger"
  26. #set -x
  27.  
  28. echo 'This test should produce no other output than this line, and a final "OK".'
  29.  
  30. if test x"$1" = x"-r"; then
  31.     shift
  32.     remote=yes
  33. else
  34.     remote=no
  35. fi
  36.  
  37. # The --keep option will eventually cause all the tests to leave around the
  38. # contents of the /tmp directory; right now only some implement it.  Not
  39. # useful if you are running more than one test.
  40. # FIXME: need some real option parsing so this doesn't depend on the order
  41. # in which they are specified.
  42. if test x"$1" = x"--keep"; then
  43.   shift
  44.   keep=yes
  45. else
  46.   keep=no
  47. fi
  48.  
  49. # Use full path for CVS executable, so that CVS_SERVER gets set properly
  50. # for remote.
  51. case $1 in
  52. /*)
  53.     testcvs=$1
  54.     ;;
  55. *)
  56.     testcvs=`pwd`/$1
  57.     ;;
  58. esac
  59.  
  60. shift
  61.  
  62. # Regexp to match what CVS will call itself in output that it prints.
  63. # FIXME: we don't properly quote this--if the name contains . we'll
  64. # just spuriously match a few things; if the name contains other regexp
  65. # special characters we are probably in big trouble.
  66. PROG=`basename ${testcvs}`
  67.  
  68. # FIXME: try things (what things? checkins?) without -m.
  69. #
  70. # Some of these tests are written to expect -Q.  But testing with
  71. # -Q is kind of bogus, it is not the way users actually use CVS (usually).
  72. # So new tests probably should invoke ${testcvs} directly, rather than ${CVS}.
  73. # and then they've obviously got to do something with the output....
  74. #
  75. CVS="${testcvs} -Q"
  76.  
  77. LOGFILE=`pwd`/check.log
  78.  
  79. # Save the previous log in case the person running the tests decides
  80. # they want to look at it.  The extension ".plog" is chosen for consistency
  81. # with dejagnu.
  82. if test -f check.log; then
  83.     mv check.log check.plog
  84. fi
  85.  
  86. GEXPRLOCS="`echo $PATH | sed 's/:/ /g'` /usr/local/bin /usr/contrib/bin /usr/gnu/bin /local/bin /local/gnu/bin /gun/bin"
  87.  
  88. EXPR=expr
  89.  
  90. # Cause NextStep 3.3 users to lose in a more graceful fashion.
  91. if $EXPR 'abc
  92. def' : 'abc
  93. def' >/dev/null; then
  94.   : good, it works
  95. else
  96.   for path in $GEXPRLOCS ; do
  97.     if test -x $path/gexpr ; then
  98.       if test "X`$path/gexpr --version`" != "X--version" ; then
  99.         EXPR=$path/gexpr
  100.         break
  101.       fi
  102.     fi
  103.     if test -x $path/expr ; then
  104.       if test "X`$path/expr --version`" != "X--version" ; then
  105.         EXPR=$path/expr
  106.         break
  107.       fi
  108.     fi
  109.   done
  110.   if test -z "$EXPR" ; then
  111.     echo 'Running these tests requires an "expr" program that can handle'
  112.     echo 'multi-line patterns.  Make sure that such an expr (GNU, or many but'
  113.     echo 'not all vendor-supplied versions) is in your path.'
  114.     exit 1
  115.   fi
  116. fi
  117.  
  118. # Warn SunOS, SysVr3.2, etc., users that they may be partially losing
  119. # if we can't find a GNU expr to ease their troubles...
  120. if $EXPR 'a
  121. b' : 'a
  122. c' >/dev/null; then
  123.   for path in $GEXPRLOCS ; do
  124.     if test -x $path/gexpr ; then
  125.       if test "X`$path/gexpr --version`" != "X--version" ; then
  126.         EXPR=$path/gexpr
  127.         break
  128.       fi
  129.     fi
  130.     if test -x $path/expr ; then
  131.       if test "X`$path/expr --version`" != "X--version" ; then
  132.         EXPR=$path/expr
  133.         break
  134.       fi
  135.     fi
  136.   done
  137.   if test -z "$EXPR" ; then
  138.     echo 'Warning: you are using a version of expr which does not correctly'
  139.     echo 'match multi-line patterns.  Some tests may spuriously pass.'
  140.     echo 'You may wish to make sure GNU expr is in your path.'
  141.     EXPR=expr
  142.   fi
  143. else
  144.   : good, it works
  145. fi
  146.  
  147. # That we should have to do this is total bogosity, but GNU expr
  148. # version 1.9.4 uses the emacs definition of "$" instead of the unix
  149. # (e.g. SunOS 4.1.3 expr) one.  Rumor has it this will be fixed in the
  150. # next release of GNU expr after 1.12 (but we still have to cater to the old
  151. # ones for some time because they are in many linux distributions).
  152. ENDANCHOR="$"
  153. if $EXPR 'abc
  154. def' : 'abc$' >/dev/null; then
  155.   ENDANCHOR='\'\'
  156. fi
  157.  
  158. # Work around another GNU expr (version 1.10) bug/incompatibility.
  159. # "." doesn't appear to match a newline (it does with SunOS 4.1.3 expr).
  160. # Note that the workaround is not a complete equivalent of .* because
  161. # the first parenthesized expression in the regexp must match something
  162. # in order for expr to return a successful exit status.
  163. # Rumor has it this will be fixed in the
  164. # next release of GNU expr after 1.12 (but we still have to cater to the old
  165. # ones for some time because they are in many linux distributions).
  166. DOTSTAR='.*'
  167. if $EXPR 'abc
  168. def' : "a${DOTSTAR}f" >/dev/null; then
  169.   : good, it works
  170. else
  171.   DOTSTAR='\(.\|
  172. \)*'
  173. fi
  174.  
  175. # Work around yet another GNU expr (version 1.10) bug/incompatibility.
  176. # "+" is a special character, yet for unix expr (e.g. SunOS 4.1.3)
  177. # it is not.  I doubt that POSIX allows us to use \+ and assume it means
  178. # (non-special) +, so here is another workaround
  179. # Rumor has it this will be fixed in the
  180. # next release of GNU expr after 1.12 (but we still have to cater to the old
  181. # ones for some time because they are in many linux distributions).
  182. PLUS='+'
  183. if $EXPR 'a +b' : "a ${PLUS}b" >/dev/null; then
  184.   : good, it works
  185. else
  186.   PLUS='\+'
  187. fi
  188.  
  189. # Likewise, for ?
  190. QUESTION='?'
  191. if $EXPR 'a?b' : "a${QUESTION}b" >/dev/null; then
  192.   : good, it works
  193. else
  194.   QUESTION='\?'
  195. fi
  196.  
  197. pass ()
  198. {
  199.   echo "PASS: $1" >>${LOGFILE}
  200. }
  201.  
  202. fail ()
  203. {
  204.   echo "FAIL: $1" | tee -a ${LOGFILE}
  205.   # This way the tester can go and see what remnants were left
  206.   exit 1
  207. }
  208.  
  209. # See dotest and dotest_fail for explanation (this is the parts
  210. # of the implementation common to the two).
  211. dotest_internal ()
  212. {
  213.   # expr can't distinguish between "zero characters matched" and "no match",
  214.   # so special-case it.
  215.   if test -z "$3"; then
  216.     if test -s ${TESTDIR}/dotest.tmp; then
  217.       echo "** expected: " >>${LOGFILE}
  218.       echo "$3" >>${LOGFILE}
  219.       echo "** got: " >>${LOGFILE}
  220.       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  221.       fail "$1"
  222.     else
  223.       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  224.       pass "$1"
  225.     fi
  226.   else
  227.     if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : \
  228.     "$3"${ENDANCHOR} >/dev/null; then
  229.       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  230.       pass "$1"
  231.     else
  232.       if test x"$4" != x; then
  233.     if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : \
  234.         "$4"${ENDANCHOR} >/dev/null; then
  235.       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  236.       pass "$1"
  237.     else
  238.       echo "** expected: " >>${LOGFILE}
  239.       echo "$3" >>${LOGFILE}
  240.       echo "** or: " >>${LOGFILE}
  241.       echo "$4" >>${LOGFILE}
  242.       echo "** got: " >>${LOGFILE}
  243.       cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  244.       fail "$1"
  245.     fi
  246.       else
  247.     echo "** expected: " >>${LOGFILE}
  248.     echo "$3" >>${LOGFILE}
  249.     echo "** got: " >>${LOGFILE}
  250.     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  251.     fail "$1"
  252.       fi
  253.     fi
  254.   fi
  255. }
  256.  
  257. # Usage:
  258. #  dotest TESTNAME COMMAND OUTPUT [OUTPUT2]
  259. # TESTNAME is the name used in the log to identify the test.
  260. # COMMAND is the command to run; for the test to pass, it exits with 
  261. # exitstatus zero.
  262. # OUTPUT is a regexp which is compared against the output (stdout and
  263. # stderr combined) from the test.  It is anchored to the start and end
  264. # of the output, so should start or end with ".*" if that is what is desired.
  265. # Trailing newlines are stripped from the command's actual output before
  266. # matching against OUTPUT.
  267. # If OUTPUT2 is specified and the output matches it, then it is also
  268. # a pass (partial workaround for the fact that some versions of expr
  269. # lack \|).
  270. dotest ()
  271. {
  272.   if $2 >${TESTDIR}/dotest.tmp 2>&1; then
  273.     : so far so good
  274.   else
  275.     status=$?
  276.     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  277.     echo "exit status was $status" >>${LOGFILE}
  278.     fail "$1"
  279.   fi
  280.   dotest_internal "$@"
  281. }
  282.  
  283. # Like dotest except only 2 args and result must exactly match stdin
  284. dotest_lit ()
  285. {
  286.   if $2 >${TESTDIR}/dotest.tmp 2>&1; then
  287.     : so far so good
  288.   else
  289.     status=$?
  290.     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  291.     echo "exit status was $status" >>${LOGFILE}
  292.     fail "$1"
  293.   fi
  294.   cat >${TESTDIR}/dotest.res
  295.   if cmp ${TESTDIR}/dotest.res ${TESTDIR}/dotest.tmp >/dev/null 2>&1; then
  296.     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  297.     pass "$1"
  298.   else
  299.     echo "** expected: " >>${LOGFILE}
  300.     cat ${TESTDIR}/dotest.res >>${LOGFILE}
  301.     echo "** got: " >>${LOGFILE}
  302.     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  303.     fail "$1"
  304.   fi
  305. }
  306.  
  307. # Like dotest except exitstatus should be nonzero.
  308. dotest_fail ()
  309. {
  310.   if $2 >${TESTDIR}/dotest.tmp 2>&1; then
  311.     status=$?
  312.     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  313.     echo "exit status was $status" >>${LOGFILE}
  314.     fail "$1"
  315.   else
  316.     : so far so good
  317.   fi
  318.   dotest_internal "$@"
  319. }
  320.  
  321. # Like dotest except second argument is the required exitstatus.
  322. dotest_status ()
  323. {
  324.   $3 >${TESTDIR}/dotest.tmp 2>&1
  325.   status=$?
  326.   if test "$status" = "$2"; then
  327.     : so far so good
  328.   else
  329.     cat ${TESTDIR}/dotest.tmp >>${LOGFILE}
  330.     echo "exit status was $status; expected $2" >>${LOGFILE}
  331.     fail "$1"
  332.   fi
  333.   dotest_internal "$1" "$3" "$4" "$5"
  334. }
  335.  
  336. # clean any old remnants
  337. rm -rf ${TESTDIR}
  338. mkdir ${TESTDIR}
  339. cd ${TESTDIR}
  340.  
  341. # Avoid picking up any stray .cvsrc, etc., from the user running the tests
  342. mkdir home
  343. HOME=${TESTDIR}/home; export HOME
  344.  
  345. # Remaining arguments are the names of tests to run.
  346. #
  347. # The testsuite is broken up into (hopefully manageably-sized)
  348. # independently runnable tests, so that one can quickly get a result
  349. # from a cvs or testsuite change, and to facilitate understanding the
  350. # tests.
  351.  
  352. if test x"$*" = x; then
  353.     tests="basica basicb basic1 deep basic2 death death2 branches import join new newb conflicts conflicts2 modules mflag errmsg1 devcom ignore binfiles binwrap info patch log"
  354. else
  355.     tests="$*"
  356. fi
  357.  
  358. # this should die
  359. if ${CVS} -d `pwd`/cvsroot co cvs-sanity 2>> ${LOGFILE} ; then
  360.     echo "FAIL: test 1" | tee -a ${LOGFILE}
  361.     exit 1
  362. else
  363.     echo "PASS: test 1" >>${LOGFILE}
  364. fi
  365.  
  366. # this should still die
  367. mkdir cvsroot
  368. if ${CVS} -d `pwd`/cvsroot co cvs-sanity 2>> ${LOGFILE} ; then
  369.     echo "FAIL: test 2" | tee -a ${LOGFILE}
  370.     exit 1
  371. else
  372.     echo "PASS: test 2" >>${LOGFILE}
  373. fi
  374.  
  375. # this should still die
  376. mkdir cvsroot/CVSROOT
  377. if ${CVS} -d `pwd`/cvsroot co cvs-sanity 2>> ${LOGFILE} ; then
  378.     echo "FAIL: test 3" | tee -a ${LOGFILE}
  379.     exit 1
  380. else
  381.     echo "PASS: test 3" >>${LOGFILE}
  382. fi
  383.  
  384. # This one should work, although it should spit a warning.
  385. mkdir tmp ; cd tmp
  386. ${CVS} -d `pwd`/../cvsroot co CVSROOT 2>> ${LOGFILE}
  387. cd .. ; rm -rf tmp
  388.  
  389. # set up a minimal modules file...
  390. # (now that mkmodules is gone, this doesn't test -i the way it
  391. # used to.  In fact, it looks like a noop to me).
  392. echo "CVSROOT        CVSROOT" > cvsroot/CVSROOT/modules
  393. # The following line stolen from cvsinit.sh.  FIXME: create our
  394. # repository via cvsinit.sh; that way we test it too.
  395. (cd cvsroot/CVSROOT; ci -q -u -t/dev/null \
  396.   -m'initial checkin of modules' modules)
  397.  
  398. # This one should succeed.  No warnings.
  399. mkdir tmp ; cd tmp
  400. if ${CVS} -d `pwd`/../cvsroot co CVSROOT ; then
  401.     echo "PASS: test 4" >>${LOGFILE}
  402. else
  403.     echo "FAIL: test 4" | tee -a ${LOGFILE}
  404.     exit 1
  405. fi
  406.  
  407. if echo "yes" | ${CVS} -d `pwd`/../cvsroot release -d CVSROOT ; then
  408.     echo "PASS: test 4.5" >>${LOGFILE}
  409. else
  410.     echo "FAIL: test 4.5" | tee -a ${LOGFILE}
  411.     exit 1
  412. fi
  413. # this had better be empty
  414. cd ..; rmdir tmp
  415. dotest_fail 4.75 "test -d tmp" ''
  416.  
  417. # a simple function to compare directory contents
  418. #
  419. # BTW, I don't care any more -- if you don't have a /bin/sh that handles
  420. # shell functions, well get one.
  421. #
  422. # Returns: ISDIFF := true|false
  423. #
  424. directory_cmp ()
  425. {
  426.     OLDPWD=`pwd`
  427.     DIR_1=$1
  428.     DIR_2=$2
  429.     ISDIFF=false
  430.  
  431.     cd $DIR_1
  432.     find . -print | fgrep -v /CVS | sort > /tmp/dc$$d1
  433.  
  434.     # go back where we were to avoid symlink hell...
  435.     cd $OLDPWD
  436.     cd $DIR_2
  437.     find . -print | fgrep -v /CVS | sort > /tmp/dc$$d2
  438.  
  439.     if diff /tmp/dc$$d1 /tmp/dc$$d2 >/dev/null 2>&1
  440.     then
  441.         :
  442.     else
  443.         ISDIFF=true
  444.         return
  445.     fi
  446.     cd $OLDPWD
  447.     while read a
  448.     do
  449.         if test -f $DIR_1/"$a" ; then
  450.             cmp -s $DIR_1/"$a" $DIR_2/"$a"
  451.             if test $? -ne 0 ; then
  452.                 ISDIFF=true
  453.             fi
  454.         fi
  455.     done < /tmp/dc$$d1
  456. ### FIXME:
  457. ###    rm -f /tmp/dc$$*
  458. }
  459.  
  460. # so much for the setup.  Let's try something harder.
  461.  
  462. # Try setting CVSROOT so we don't have to worry about it anymore.  (now that
  463. # we've tested -d cvsroot.)
  464. CVSROOT_DIRNAME=${TESTDIR}/cvsroot
  465. CVSROOT=${CVSROOT_DIRNAME} ; export CVSROOT
  466. if test "x$remote" = xyes; then
  467.     # Use rsh so we can test it without having to muck with inetd or anything 
  468.     # like that.  Also needed to get CVS_SERVER to work.
  469.     CVSROOT=:server:`hostname`:${CVSROOT_DIRNAME} ; export CVSROOT
  470.     CVS_SERVER=${testcvs}; export CVS_SERVER
  471. fi
  472.  
  473. # start keeping history
  474. touch ${CVSROOT_DIRNAME}/CVSROOT/history
  475.  
  476. ### The big loop
  477. for what in $tests; do
  478.     case $what in
  479.     basica)
  480.       # Similar in spirit to some of the basic1, and basic2
  481.       # tests, but hopefully a lot faster.  Also tests operating on
  482.       # files two directories down *without* operating on the parent dirs.
  483.  
  484.       # Using mkdir in the repository is used throughout these
  485.       # tests to create a top-level directory.  I think instead it
  486.       # should be:
  487.       #   cvs co -l .
  488.       #   mkdir first-dir
  489.       #   cvs add first-dir
  490.       # but currently that works only for local CVS, not remote.
  491.       mkdir ${CVSROOT_DIRNAME}/first-dir
  492.       dotest basica-1 "${testcvs} -q co first-dir" ''
  493.       cd first-dir
  494.  
  495.       # Test a few operations, to ensure they gracefully do
  496.       # nothing in an empty directory.
  497.       dotest basica-1a0 "${testcvs} -q update" ''
  498.       dotest basica-1a1 "${testcvs} -q diff -c" ''
  499.       dotest basica-1a2 "${testcvs} -q status" ''
  500.  
  501.       mkdir sdir
  502.       # Remote CVS gives the "cannot open CVS/Entries" error, which is
  503.       # clearly a bug, but not a simple one to fix.
  504.       dotest basica-1a10 "${testcvs} -n add sdir" \
  505. 'Directory /tmp/cvs-sanity/cvsroot/first-dir/sdir added to the repository' \
  506. "${PROG} add: cannot open CVS/Entries for reading: No such file or directory
  507. Directory /tmp/cvs-sanity/cvsroot/first-dir/sdir added to the repository"
  508.       dotest_fail basica-1a11 \
  509.         "test -d ${CVSROOT_DIRNAME}/first-dir/sdir" ''
  510.       dotest basica-2 "${testcvs} add sdir" \
  511. 'Directory /tmp/cvs-sanity/cvsroot/first-dir/sdir added to the repository'
  512.       cd sdir
  513.       mkdir ssdir
  514.       dotest basica-3 "${testcvs} add ssdir" \
  515. 'Directory /tmp/cvs-sanity/cvsroot/first-dir/sdir/ssdir added to the repository'
  516.       cd ssdir
  517.       echo ssfile >ssfile
  518.  
  519.       # Trying to commit it without a "cvs add" should be an error.
  520.       # The "use `cvs add' to create an entry" message is the one
  521.       # that I consider to be more correct, but local cvs prints the
  522.       # "nothing known" message and noone has gotten around to fixing it.
  523.       dotest_fail basica-notadded "${testcvs} -q ci ssfile" \
  524. "${PROG} [a-z]*: use "'`cvs add'\'' to create an entry for ssfile
  525. '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!' \
  526. "${PROG}"' [a-z]*: nothing known about `ssfile'\''
  527. '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
  528.  
  529.       dotest basica-4 "${testcvs} add ssfile" \
  530. "${PROG}"' [a-z]*: scheduling file `ssfile'\'' for addition
  531. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  532.       dotest_fail basica-4a "${testcvs} tag tag0 ssfile" \
  533. "${PROG} [a-z]*: nothing known about ssfile
  534. ${PROG} "'\[[a-z]* aborted\]: correct the above errors first!'
  535.       cd ../..
  536.       dotest basica-5 "${testcvs} -q ci -m add-it" \
  537. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/sdir/ssdir/ssfile,v
  538. done
  539. Checking in sdir/ssdir/ssfile;
  540. /tmp/cvs-sanity/cvsroot/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
  541. initial revision: 1.1
  542. done'
  543.       dotest_fail basica-5a \
  544.         "${testcvs} -q tag BASE sdir/ssdir/ssfile" \
  545. "${PROG} [a-z]*: Attempt to add reserved tag name BASE
  546. ${PROG} \[[a-z]* aborted\]: failed to set tag BASE to revision 1.1 in /tmp/cvs-sanity/cvsroot/first-dir/sdir/ssdir/ssfile,v"
  547.       dotest basica-5b "${testcvs} -q tag NOT_RESERVED" \
  548. 'T sdir/ssdir/ssfile'
  549.  
  550.       dotest basica-6 "${testcvs} -q update" ''
  551.       echo "ssfile line 2" >>sdir/ssdir/ssfile
  552.       dotest_status basica-6.2 1 "${testcvs} -q diff -c" \
  553. 'Index: sdir/ssdir/ssfile
  554. ===================================================================
  555. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/sdir/ssdir/ssfile,v
  556. retrieving revision 1\.1
  557. diff -c -r1\.1 ssfile
  558. \*\*\* ssfile    [0-9/]* [0-9:]*    1\.1
  559. --- ssfile    [0-9/]* [0-9:]*
  560. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  561. \*\*\* 1 \*\*\*\*
  562. --- 1,2 ----
  563.   ssfile
  564. '"${PLUS} ssfile line 2"
  565.       dotest_status basica-6.3 1 "${testcvs} -q diff -c -rBASE" \
  566. 'Index: sdir/ssdir/ssfile
  567. ===================================================================
  568. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/sdir/ssdir/ssfile,v
  569. retrieving revision 1\.1
  570. diff -c -r1\.1 ssfile
  571. \*\*\* ssfile    [0-9/]* [0-9:]*    1\.1
  572. --- ssfile    [0-9/]* [0-9:]*
  573. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  574. \*\*\* 1 \*\*\*\*
  575. --- 1,2 ----
  576.   ssfile
  577. '"${PLUS} ssfile line 2"
  578.       dotest basica-7 "${testcvs} -q ci -m modify-it" \
  579. 'Checking in sdir/ssdir/ssfile;
  580. /tmp/cvs-sanity/cvsroot/first-dir/sdir/ssdir/ssfile,v  <--  ssfile
  581. new revision: 1.2; previous revision: 1.1
  582. done'
  583.       dotest_fail basica-nonexist "${testcvs} -q ci nonexist" \
  584. "${PROG}"' [a-z]*: nothing known about `nonexist'\''
  585. '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
  586.       dotest basica-8 "${testcvs} -q update" ''
  587.  
  588.       # The .* here will normally be "No such file or directory",
  589.       # but if memory serves some systems (AIX?) have a different message.
  590. :      dotest_fail basica-9 \
  591.         "${testcvs} -q -d /tmp/cvs-sanity/nonexist update" \
  592. "${PROG}: cannot access cvs root /tmp/cvs-sanity/nonexist: .*"
  593.       dotest_fail basica-9 \
  594.         "${testcvs} -q -d /tmp/cvs-sanity/nonexist update" \
  595. "${PROG} \[[a-z]* aborted\]: /tmp/cvs-sanity/nonexist/CVSROOT: .*"
  596.  
  597.       dotest basica-10 "${testcvs} annotate" \
  598. 'Annotations for sdir/ssdir/ssfile
  599. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  600. 1.1          .[a-z0-9@][a-z0-9@ ]* [0-9a-zA-Z-]*.: ssfile
  601. 1.2          .[a-z0-9@][a-z0-9@ ]* [0-9a-zA-Z-]*.: ssfile line 2'
  602.       cd ..
  603.  
  604.       rm -rf ${CVSROOT_DIRNAME}/first-dir
  605.       rm -r first-dir
  606.       ;;
  607.  
  608.     basicb)
  609.       # More basic tests, including non-branch tags and co -d.
  610.       mkdir ${CVSROOT_DIRNAME}/first-dir
  611.       dotest basicb-1 "${testcvs} -q co first-dir" ''
  612.       cd first-dir
  613.       mkdir sdir1 sdir2
  614.       dotest basicb-2 "${testcvs} add sdir1 sdir2" \
  615. 'Directory /tmp/cvs-sanity/cvsroot/first-dir/sdir1 added to the repository
  616. Directory /tmp/cvs-sanity/cvsroot/first-dir/sdir2 added to the repository'
  617.       cd sdir1
  618.       echo sfile1 starts >sfile1
  619.       dotest basicb-2a10 "${testcvs} -n add sfile1" \
  620. "${PROG} [a-z]*: scheduling file .sfile1. for addition
  621. ${PROG} [a-z]*: use .cvs commit. to add this file permanently"
  622.       dotest basicb-2a11 "${testcvs} status sfile1" \
  623. "${PROG} [a-z]*: use .cvs add' to create an entry for sfile1
  624. ===================================================================
  625. File: sfile1               Status: Unknown
  626.  
  627.    Working revision:    No entry for sfile1
  628.    Repository revision:    No revision control file"
  629.       dotest basicb-3 "${testcvs} add sfile1" \
  630. "${PROG} [a-z]*: scheduling file .sfile1. for addition
  631. ${PROG} [a-z]*: use .cvs commit. to add this file permanently"
  632.       dotest basicb-3a1 "${testcvs} status sfile1" \
  633. "===================================================================
  634. File: sfile1               Status: Locally Added
  635.  
  636.    Working revision:    New file!
  637.    Repository revision:    No revision control file
  638.    Sticky Tag:        (none)
  639.    Sticky Date:        (none)
  640.    Sticky Options:    (none)"
  641.  
  642.       cd ../sdir2
  643.       echo sfile2 starts >sfile2
  644.       dotest basicb-4 "${testcvs} add sfile2" \
  645. "${PROG} [a-z]*: scheduling file .sfile2. for addition
  646. ${PROG} [a-z]*: use .cvs commit. to add this file permanently"
  647.       cd ..
  648.       dotest basicb-5 "${testcvs} -q ci -m add" \
  649. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/sdir1/sfile1,v
  650. done
  651. Checking in sdir1/sfile1;
  652. /tmp/cvs-sanity/cvsroot/first-dir/sdir1/sfile1,v  <--  sfile1
  653. initial revision: 1\.1
  654. done
  655. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/sdir2/sfile2,v
  656. done
  657. Checking in sdir2/sfile2;
  658. /tmp/cvs-sanity/cvsroot/first-dir/sdir2/sfile2,v  <--  sfile2
  659. initial revision: 1\.1
  660. done'
  661.       echo sfile1 develops >sdir1/sfile1
  662.       dotest basicb-6 "${testcvs} -q ci -m modify" \
  663. 'Checking in sdir1/sfile1;
  664. /tmp/cvs-sanity/cvsroot/first-dir/sdir1/sfile1,v  <--  sfile1
  665. new revision: 1\.2; previous revision: 1\.1
  666. done'
  667.       dotest basicb-7 "${testcvs} -q tag release-1" 'T sdir1/sfile1
  668. T sdir2/sfile2'
  669.       echo not in time for release-1 >sdir2/sfile2
  670.       dotest basicb-8 "${testcvs} -q ci -m modify-2" \
  671. 'Checking in sdir2/sfile2;
  672. /tmp/cvs-sanity/cvsroot/first-dir/sdir2/sfile2,v  <--  sfile2
  673. new revision: 1\.2; previous revision: 1\.1
  674. done'
  675.       cd ..
  676.  
  677.       # Test that we recurse into the correct directory when checking
  678.       # for existing files, even if co -d is in use.
  679.       touch first-dir/extra
  680.       dotest basicb-cod-1 "${testcvs} -q co -d first-dir1 first-dir" \
  681. 'U first-dir1/sdir1/sfile1
  682. U first-dir1/sdir2/sfile2'
  683.       rm -rf first-dir1
  684.  
  685.       rm -rf first-dir
  686.       dotest basicb-9 \
  687. "${testcvs} -q co -d newdir -r release-1 first-dir/sdir1 first-dir/sdir2" \
  688. 'U newdir/sdir1/sfile1
  689. U newdir/sdir2/sfile2'
  690.       dotest basicb-10 "cat newdir/sdir1/sfile1 newdir/sdir2/sfile2" \
  691. "sfile1 develops
  692. sfile2 starts"
  693.  
  694.       rm -rf newdir
  695.  
  696.       rm -rf ${CVSROOT_DIRNAME}/first-dir
  697.       ;;
  698.  
  699.     basic1) # first dive - add a files, first singly, then in a group.
  700.         mkdir ${CVSROOT_DIRNAME}/first-dir
  701.         # check out an empty directory
  702.         if ${CVS} co first-dir  ; then
  703.           echo "PASS: test 13a" >>${LOGFILE}
  704.         else
  705.           echo "FAIL: test 13a" | tee -a ${LOGFILE}; exit 1
  706.         fi
  707.  
  708.         cd first-dir
  709.         files=first-file
  710.         for i in a b ; do
  711.             for j in ${files} ; do
  712.                 echo $j > $j
  713.             done
  714.  
  715.             for do in add rm ; do
  716.                 for j in ${do} "commit -m test" ; do
  717.                     # ${do}
  718.                     if ${CVS} $j ${files}  >> ${LOGFILE} 2>&1; then
  719.                       echo "PASS: test 14-${do}-$j" >>${LOGFILE}
  720.                     else
  721.                       echo "FAIL: test 14-${do}-$j" | tee -a ${LOGFILE}; exit 1
  722.                     fi
  723.  
  724.                     # update it.
  725.                     if test "${do}" = "rm" -a "$j" != "commit -m test" || ${CVS} update ${files} ; then
  726.                       echo "PASS: test 15-${do}-$j" >>${LOGFILE}
  727.                     else
  728.                       echo "FAIL: test 15-${do}-$j" | tee -a ${LOGFILE}; exit 1
  729.                     fi
  730.  
  731.                     # update all.
  732.                     if ${CVS} update  ; then
  733.                       echo "PASS: test 16-${do}-$j" >>${LOGFILE}
  734.                     else
  735.                       echo "FAIL: test 16-${do}-$j" | tee -a ${LOGFILE}; exit 1
  736.                     fi
  737.  
  738.                     # status all.
  739.                     if ${CVS} status  >> ${LOGFILE}; then
  740.                       echo "PASS: test 17-${do}-$j" >>${LOGFILE}
  741.                     else
  742.                       echo "FAIL: test 17-${do}-$j" | tee -a ${LOGFILE}; exit 1
  743.                     fi
  744.  
  745.         # FIXME: this one doesn't work yet for added files.
  746.                     # log all.
  747.                     if ${CVS} log  >> ${LOGFILE}; then
  748.                       echo "PASS: test 18-${do}-$j" >>${LOGFILE}
  749.                     else
  750.                       echo "FAIL: test 18-${do}-$j" | tee -a ${LOGFILE}
  751.                     fi
  752.  
  753.                     cd ..
  754.                     # update all.
  755.                     if ${CVS} update  ; then
  756.                       echo "PASS: test 21-${do}-$j" >>${LOGFILE}
  757.                     else
  758.                       echo "FAIL: test 21-${do}-$j" | tee -a ${LOGFILE}; exit 1
  759.                     fi
  760.  
  761.                     # log all.
  762.         # FIXME: doesn't work right for added files.
  763.                     if ${CVS} log first-dir  >> ${LOGFILE}; then
  764.                       echo "PASS: test 22-${do}-$j" >>${LOGFILE}
  765.                     else
  766.                       echo "FAIL: test 22-${do}-$j" | tee -a ${LOGFILE}
  767.                     fi
  768.  
  769.                     # status all.
  770.                     if ${CVS} status first-dir  >> ${LOGFILE}; then
  771.                       echo "PASS: test 23-${do}-$j" >>${LOGFILE}
  772.                     else
  773.                       echo "FAIL: test 23-${do}-$j" | tee -a ${LOGFILE}; exit 1
  774.                     fi
  775.  
  776.                     # update all.
  777.                     if ${CVS} update first-dir  ; then
  778.                       echo "PASS: test 24-${do}-$j" >>${LOGFILE}
  779.                     else
  780.                       echo "FAIL: test 24-${do}-$j" | tee -a ${LOGFILE} ; exit 1
  781.                     fi
  782.  
  783.                     # update all.
  784.                     if ${CVS} co first-dir  ; then
  785.                       echo "PASS: test 27-${do}-$j" >>${LOGFILE}
  786.                     else
  787.                       echo "FAIL: test 27-${do}-$j" | tee -a ${LOGFILE} ; exit 1
  788.                     fi
  789.  
  790.                     cd first-dir
  791.                 done # j
  792.                 rm -f ${files}
  793.             done # do
  794.  
  795.             files="file2 file3 file4 file5"
  796.         done
  797.         if ${CVS} tag first-dive  ; then
  798.           echo "PASS: test 28" >>${LOGFILE}
  799.         else
  800.           echo "FAIL: test 28" | tee -a ${LOGFILE} ; exit 1
  801.         fi
  802.         cd ..
  803.         rm -rf ${CVSROOT_DIRNAME}/first-dir
  804.         rm -rf first-dir
  805.         ;;
  806.  
  807.     deep)
  808.       # Test the ability to operate on directories nested rather deeply.
  809.       mkdir ${CVSROOT_DIRNAME}/first-dir
  810.       dotest deep-1 "${testcvs} -q co first-dir" ''
  811.       cd first-dir
  812.       for i in dir1 dir2 dir3 dir4 dir5 dir6 dir7 dir8; do
  813.         mkdir $i
  814.         dotest deep-2-$i "${testcvs} add $i" \
  815. 'Directory /tmp/cvs-sanity/cvsroot/first-dir/dir1[/dir0-9]* added to the repository'
  816.         cd $i
  817.         echo file1 >file1
  818.         dotest deep-3-$i "${testcvs} add file1" \
  819. "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
  820. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  821.       done
  822.       cd ../../../../../../../../..
  823.       dotest_lit deep-4 "${testcvs} -q ci -m add-them first-dir" <<'HERE'
  824. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/file1,v
  825. done
  826. Checking in first-dir/dir1/file1;
  827. /tmp/cvs-sanity/cvsroot/first-dir/dir1/file1,v  <--  file1
  828. initial revision: 1.1
  829. done
  830. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/file1,v
  831. done
  832. Checking in first-dir/dir1/dir2/file1;
  833. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/file1,v  <--  file1
  834. initial revision: 1.1
  835. done
  836. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/file1,v
  837. done
  838. Checking in first-dir/dir1/dir2/dir3/file1;
  839. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/file1,v  <--  file1
  840. initial revision: 1.1
  841. done
  842. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/file1,v
  843. done
  844. Checking in first-dir/dir1/dir2/dir3/dir4/file1;
  845. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/file1,v  <--  file1
  846. initial revision: 1.1
  847. done
  848. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v
  849. done
  850. Checking in first-dir/dir1/dir2/dir3/dir4/dir5/file1;
  851. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/file1,v  <--  file1
  852. initial revision: 1.1
  853. done
  854. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v
  855. done
  856. Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1;
  857. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/file1,v  <--  file1
  858. initial revision: 1.1
  859. done
  860. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v
  861. done
  862. Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1;
  863. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/file1,v  <--  file1
  864. initial revision: 1.1
  865. done
  866. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v
  867. done
  868. Checking in first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1;
  869. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v  <--  file1
  870. initial revision: 1.1
  871. done
  872. HERE
  873.  
  874.       cd first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8
  875.       rm file1
  876.       dotest deep-4a0 "${testcvs} rm file1" \
  877. "${PROG} [a-z]*: scheduling .file1. for removal
  878. ${PROG} [a-z]*: use .cvs commit. to remove this file permanently"
  879.       dotest deep-4a1 "${testcvs} -q ci -m rm-it" 'Removing file1;
  880. /tmp/cvs-sanity/cvsroot/first-dir/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/file1,v  <--  file1
  881. new revision: delete; previous revision: 1\.1
  882. done'
  883.       cd ../../..
  884.       dotest deep-4a2 "${testcvs} -q update -P dir6/dir7" ''
  885.       # Should be using "test -e" if that is portable enough.
  886.       dotest_fail deep-4a3 "test -d dir6/dir7/dir8" ''
  887.       cd ../../../../../..
  888.  
  889.       if echo "yes" | ${testcvs} release -d first-dir >>${LOGFILE}; then
  890.         pass deep-5
  891.       else
  892.         fail deep-5
  893.       fi
  894.       rm -rf ${CVSROOT_DIRNAME}/first-dir
  895.       ;;
  896.  
  897.     basic2)
  898.         # Test rtag, import, history, various miscellaneous operations
  899.  
  900.         # NOTE: this section has reached the size and
  901.         # complexity where it is getting to be a good idea to
  902.         # add new tests to a new section rather than
  903.         # continuing to piggyback them onto the tests here.
  904.  
  905.         # First empty the history file
  906.         rm ${CVSROOT_DIRNAME}/CVSROOT/history
  907.         touch ${CVSROOT_DIRNAME}/CVSROOT/history
  908.  
  909.         mkdir ${CVSROOT_DIRNAME}/first-dir
  910.         dotest basic2-1 "${testcvs} -q co first-dir" ''
  911.         for i in first-dir dir1 dir2 ; do
  912.             if test ! -d $i ; then
  913.                 mkdir $i
  914.                 if ${CVS} add $i  >> ${LOGFILE}; then
  915.                   echo "PASS: test 29-$i" >>${LOGFILE}
  916.                 else
  917.                   echo "FAIL: test 29-$i" | tee -a ${LOGFILE} ; exit 1
  918.                 fi
  919.             fi
  920.  
  921.             cd $i
  922.  
  923.             for j in file6 file7; do
  924.                 echo $j > $j
  925.             done
  926.  
  927.             if ${CVS} add file6 file7  2>> ${LOGFILE}; then
  928.                 echo "PASS: test 30-$i-$j" >>${LOGFILE}
  929.             else
  930.                 echo "FAIL: test 30-$i-$j" | tee -a ${LOGFILE} ; exit 1
  931.             fi
  932.         done
  933.         cd ../../..
  934.         if ${CVS} update first-dir  ; then
  935.             echo "PASS: test 31" >>${LOGFILE}
  936.         else
  937.             echo "FAIL: test 31" | tee -a ${LOGFILE} ; exit 1
  938.         fi
  939.  
  940.         # fixme: doesn't work right for added files.
  941.         if ${CVS} log first-dir  >> ${LOGFILE}; then
  942.             echo "PASS: test 32" >>${LOGFILE}
  943.         else
  944.             echo "FAIL: test 32" | tee -a ${LOGFILE} # ; exit 1
  945.         fi
  946.  
  947.         if ${CVS} status first-dir  >> ${LOGFILE}; then
  948.             echo "PASS: test 33" >>${LOGFILE}
  949.         else
  950.             echo "FAIL: test 33" | tee -a ${LOGFILE} ; exit 1
  951.         fi
  952.  
  953. #        if ${CVS} diff -u first-dir   >> ${LOGFILE} || test $? = 1 ; then
  954. #            echo "PASS: test 34" >>${LOGFILE}
  955. #        else
  956. #            echo "FAIL: test 34" | tee -a ${LOGFILE} # ; exit 1
  957. #        fi
  958.  
  959.         if ${CVS} ci -m "second dive" first-dir  >> ${LOGFILE} 2>&1; then
  960.             echo "PASS: test 35" >>${LOGFILE}
  961.         else
  962.             echo "FAIL: test 35" | tee -a ${LOGFILE} ; exit 1
  963.         fi
  964.  
  965.         if ${CVS} tag second-dive first-dir  ; then
  966.             echo "PASS: test 36" >>${LOGFILE}
  967.         else
  968.             echo "FAIL: test 36" | tee -a ${LOGFILE} ; exit 1
  969.         fi
  970.  
  971.         # third dive - in bunch o' directories, add bunch o' files,
  972.         # delete some, change some.
  973.  
  974.         for i in first-dir dir1 dir2 ; do
  975.             cd $i
  976.  
  977.             # modify a file
  978.             echo file6 >>file6
  979.  
  980.             # delete a file
  981.             rm file7
  982.  
  983.             if ${CVS} rm file7  2>> ${LOGFILE}; then
  984.                 echo "PASS: test 37-$i" >>${LOGFILE}
  985.             else
  986.                 echo "FAIL: test 37-$i" | tee -a ${LOGFILE} ; exit 1
  987.             fi
  988.  
  989.             # and add a new file
  990.             echo file14 >file14
  991.  
  992.             if ${CVS} add file14  2>> ${LOGFILE}; then
  993.                 echo "PASS: test 38-$i" >>${LOGFILE}
  994.             else
  995.                 echo "FAIL: test 38-$i" | tee -a ${LOGFILE} ; exit 1
  996.             fi
  997.         done
  998.         cd ../../..
  999.         if ${CVS} update first-dir  ; then
  1000.             echo "PASS: test 39" >>${LOGFILE}
  1001.         else
  1002.             echo "FAIL: test 39" | tee -a ${LOGFILE} ; exit 1
  1003.         fi
  1004.  
  1005.         # fixme: doesn't work right for added files
  1006.         if ${CVS} log first-dir  >> ${LOGFILE}; then
  1007.             echo "PASS: test 40" >>${LOGFILE}
  1008.         else
  1009.             echo "FAIL: test 40" | tee -a ${LOGFILE} # ; exit 1
  1010.         fi
  1011.  
  1012.         if ${CVS} status first-dir  >> ${LOGFILE}; then
  1013.             echo "PASS: test 41" >>${LOGFILE}
  1014.         else
  1015.             echo "FAIL: test 41" | tee -a ${LOGFILE} ; exit 1
  1016.         fi
  1017.  
  1018. #        if ${CVS} diff -u first-dir  >> ${LOGFILE} || test $? = 1 ; then
  1019. #            echo "PASS: test 42" >>${LOGFILE}
  1020. #        else
  1021. #            echo "FAIL: test 42" | tee -a ${LOGFILE} # ; exit 1
  1022. #        fi
  1023.  
  1024.         if ${CVS} ci -m "third dive" first-dir  >>${LOGFILE} 2>&1; then
  1025.             echo "PASS: test 43" >>${LOGFILE}
  1026.         else
  1027.             echo "FAIL: test 43" | tee -a ${LOGFILE} ; exit 1
  1028.         fi
  1029.         dotest 43.5 "${testcvs} -q update first-dir" ''
  1030.  
  1031.         if ${CVS} tag third-dive first-dir  ; then
  1032.             echo "PASS: test 44" >>${LOGFILE}
  1033.         else
  1034.             echo "FAIL: test 44" | tee -a ${LOGFILE} ; exit 1
  1035.         fi
  1036.  
  1037.         if echo "yes" | ${CVS} release -d first-dir  ; then
  1038.             echo "PASS: test 45" >>${LOGFILE}
  1039.         else
  1040.             echo "FAIL: test 45" | tee -a ${LOGFILE} ; exit 1
  1041.         fi
  1042.  
  1043.         # end of third dive
  1044.         if test -d first-dir ; then
  1045.             echo "FAIL: test 45.5" | tee -a ${LOGFILE} ; exit 1
  1046.         else
  1047.             echo "PASS: test 45.5" >>${LOGFILE}
  1048.         fi
  1049.  
  1050.         # now try some rtags
  1051.  
  1052.         # rtag HEADS
  1053.         if ${CVS} rtag rtagged-by-head first-dir  ; then
  1054.             echo "PASS: test 46" >>${LOGFILE}
  1055.         else
  1056.             echo "FAIL: test 46" | tee -a ${LOGFILE} ; exit 1
  1057.         fi
  1058.  
  1059.         # tag by tag
  1060.         if ${CVS} rtag -r rtagged-by-head rtagged-by-tag first-dir  ; then
  1061.             echo "PASS: test 47" >>${LOGFILE}
  1062.         else
  1063.             echo "FAIL: test 47" | tee -a ${LOGFILE} ; exit 1
  1064.         fi
  1065.  
  1066.         # tag by revision
  1067.         if ${CVS} rtag -r1.1 rtagged-by-revision first-dir  ; then
  1068.             echo "PASS: test 48" >>${LOGFILE}
  1069.         else
  1070.             echo "FAIL: test 48" | tee -a ${LOGFILE} ; exit 1
  1071.         fi
  1072.  
  1073.         # rdiff by revision
  1074.         if ${CVS} rdiff -r1.1 -rrtagged-by-head first-dir  >> ${LOGFILE} || test $? = 1 ; then
  1075.             echo "PASS: test 49" >>${LOGFILE}
  1076.         else
  1077.             echo "FAIL: test 49" | tee -a ${LOGFILE} ; exit 1
  1078.         fi
  1079.  
  1080.         # now export by rtagged-by-head and rtagged-by-tag and compare.
  1081.         rm -rf first-dir
  1082.         if ${CVS} export -r rtagged-by-head first-dir  ; then
  1083.             echo "PASS: test 50" >>${LOGFILE}
  1084.         else
  1085.             echo "FAIL: test 50" | tee -a ${LOGFILE} ; exit 1
  1086.         fi
  1087.  
  1088.         mv first-dir 1dir
  1089.         if ${CVS} export -r rtagged-by-tag first-dir  ; then
  1090.             echo "PASS: test 51" >>${LOGFILE}
  1091.         else
  1092.             echo "FAIL: test 51" | tee -a ${LOGFILE} ; exit 1
  1093.         fi
  1094.  
  1095.         directory_cmp 1dir first-dir
  1096.  
  1097.         if $ISDIFF ; then
  1098.             echo "FAIL: test 52" | tee -a ${LOGFILE} ; exit 1
  1099.         else
  1100.             echo "PASS: test 52" >>${LOGFILE}
  1101.         fi
  1102.         rm -rf 1dir first-dir
  1103.  
  1104.         # checkout by revision vs export by rtagged-by-revision and compare.
  1105.         if ${CVS} export -rrtagged-by-revision -d export-dir first-dir  ; then
  1106.             echo "PASS: test 53" >>${LOGFILE}
  1107.         else
  1108.             echo "FAIL: test 53" | tee -a ${LOGFILE} ; exit 1
  1109.         fi
  1110.  
  1111.         if ${CVS} co -r1.1 first-dir  ; then
  1112.             echo "PASS: test 54" >>${LOGFILE}
  1113.         else
  1114.             echo "FAIL: test 54" | tee -a ${LOGFILE} ; exit 1
  1115.         fi
  1116.  
  1117.         # directory copies are done in an oblique way in order to avoid a bug in sun's tmp filesystem.
  1118.         mkdir first-dir.cpy ; (cd first-dir ; tar cf - * | (cd ../first-dir.cpy ; tar xf -))
  1119.  
  1120.         directory_cmp first-dir export-dir
  1121.  
  1122.         if $ISDIFF ; then 
  1123.             echo "FAIL: test 55" | tee -a ${LOGFILE} ; exit 1
  1124.         else
  1125.             echo "PASS: test 55" >>${LOGFILE}
  1126.         fi
  1127.  
  1128.         # interrupt, while we've got a clean 1.1 here, let's import it into another tree.
  1129.         cd export-dir
  1130.         dotest 56 "${testcvs} import -m first-import second-dir first-immigration immigration1 immigration1_0" \
  1131. 'N second-dir/file14
  1132. N second-dir/file6
  1133. N second-dir/file7
  1134. '"${PROG}"' [a-z]*: Importing /tmp/cvs-sanity/cvsroot/second-dir/dir1
  1135. N second-dir/dir1/file14
  1136. N second-dir/dir1/file6
  1137. N second-dir/dir1/file7
  1138. '"${PROG}"' [a-z]*: Importing /tmp/cvs-sanity/cvsroot/second-dir/dir1/dir2
  1139. N second-dir/dir1/dir2/file14
  1140. N second-dir/dir1/dir2/file6
  1141. N second-dir/dir1/dir2/file7
  1142.  
  1143. No conflicts created by this import'
  1144.  
  1145.         cd ..
  1146.  
  1147.         if ${CVS} export -r HEAD second-dir  ; then
  1148.             echo "PASS: test 57" >>${LOGFILE}
  1149.         else
  1150.             echo "FAIL: test 57" | tee -a ${LOGFILE} ; exit 1
  1151.         fi
  1152.  
  1153.         directory_cmp first-dir second-dir
  1154.  
  1155.         if $ISDIFF ; then
  1156.             echo "FAIL: test 58" | tee -a ${LOGFILE} ; exit 1
  1157.         else
  1158.             echo "PASS: test 58" >>${LOGFILE}
  1159.         fi
  1160.  
  1161.         rm -rf second-dir
  1162.         rm -rf export-dir first-dir
  1163.         mkdir first-dir
  1164.         (cd first-dir.cpy ; tar cf - * | (cd ../first-dir ; tar xf -))
  1165.  
  1166.         # update the top, cancelling sticky tags, retag, update other copy, compare.
  1167.         cd first-dir
  1168.         if ${CVS} update -A -l *file*  2>> ${LOGFILE}; then
  1169.             echo "PASS: test 59" >>${LOGFILE}
  1170.         else
  1171.             echo "FAIL: test 59" | tee -a ${LOGFILE} ; exit 1
  1172.         fi
  1173.  
  1174.         # If we don't delete the tag first, cvs won't retag it.
  1175.         # This would appear to be a feature.
  1176.         if ${CVS} tag -l -d rtagged-by-revision  ; then
  1177.             echo "PASS: test 60a" >>${LOGFILE}
  1178.         else
  1179.             echo "FAIL: test 60a" | tee -a ${LOGFILE} ; exit 1
  1180.         fi
  1181.         if ${CVS} tag -l rtagged-by-revision  ; then
  1182.             echo "PASS: test 60b" >>${LOGFILE}
  1183.         else
  1184.             echo "FAIL: test 60b" | tee -a ${LOGFILE} ; exit 1
  1185.         fi
  1186.  
  1187.         cd ..
  1188.         mv first-dir 1dir
  1189.         mv first-dir.cpy first-dir
  1190.         cd first-dir
  1191.  
  1192.         dotest 61 "${testcvs} -q diff -u" ''
  1193.  
  1194.         if ${CVS} update  ; then
  1195.             echo "PASS: test 62" >>${LOGFILE}
  1196.         else
  1197.             echo "FAIL: test 62" | tee -a ${LOGFILE} ; exit 1
  1198.         fi
  1199.  
  1200.         cd ..
  1201.  
  1202.         #### FIXME: is this expected to work???  Need to investigate
  1203.         #### and fix or remove the test.
  1204. #        directory_cmp 1dir first-dir
  1205. #
  1206. #        if $ISDIFF ; then
  1207. #            echo "FAIL: test 63" | tee -a ${LOGFILE} # ; exit 1
  1208. #        else
  1209. #            echo "PASS: test 63" >>${LOGFILE}
  1210. #        fi
  1211.         rm -rf 1dir first-dir
  1212.  
  1213.         # Test the cvs history command.
  1214.  
  1215.         # The reason that there are two patterns rather than using
  1216.         # \(/tmp/cvs-sanity\|<remote>\) is that we are trying to
  1217.         # make this portable.  Perhaps at some point we should
  1218.         # ditch that notion and require GNU expr (or dejagnu or....)
  1219.         # since it seems to be so painful.
  1220.  
  1221.         # why are there two lines at the end of the local output
  1222.         # which don't exist in the remote output?  would seem to be
  1223.         # a CVS bug.
  1224.         dotest basic2-64 "${testcvs} his -e -a" \
  1225. 'O [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* first-dir           =first-dir= '"${TMPPWD}"'/cvs-sanity/\*
  1226. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file6     first-dir           == '"${TMPPWD}"'/cvs-sanity
  1227. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file7     first-dir           == '"${TMPPWD}"'/cvs-sanity
  1228. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file6     first-dir/dir1      == '"${TMPPWD}"'/cvs-sanity
  1229. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file7     first-dir/dir1      == '"${TMPPWD}"'/cvs-sanity
  1230. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file6     first-dir/dir1/dir2 == '"${TMPPWD}"'/cvs-sanity
  1231. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file7     first-dir/dir1/dir2 == '"${TMPPWD}"'/cvs-sanity
  1232. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file14    first-dir           == '"${TMPPWD}"'/cvs-sanity
  1233. M [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.2 file6     first-dir           == '"${TMPPWD}"'/cvs-sanity
  1234. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file14    first-dir/dir1      == '"${TMPPWD}"'/cvs-sanity
  1235. M [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.2 file6     first-dir/dir1      == '"${TMPPWD}"'/cvs-sanity
  1236. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file14    first-dir/dir1/dir2 == '"${TMPPWD}"'/cvs-sanity
  1237. M [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.2 file6     first-dir/dir1/dir2 == '"${TMPPWD}"'/cvs-sanity
  1238. F [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]*                     =first-dir= '"${TMPPWD}"'/cvs-sanity/\*
  1239. T [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-head:A\]
  1240. T [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-tag:rtagged-by-head\]
  1241. T [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-revision:1.1\]
  1242. O [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* \[1.1\] first-dir           =first-dir= '"${TMPPWD}"'/cvs-sanity/\*
  1243. U [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.2 file6     first-dir           == '"${TMPPWD}"'/cvs-sanity/first-dir
  1244. U [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.2 file7     first-dir           == '"${TMPPWD}"'/cvs-sanity/first-dir' \
  1245. 'O [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* first-dir           =first-dir= <remote>/\*
  1246. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file6     first-dir           == <remote>
  1247. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file7     first-dir           == <remote>
  1248. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file6     first-dir/dir1      == <remote>
  1249. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file7     first-dir/dir1      == <remote>
  1250. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file6     first-dir/dir1/dir2 == <remote>
  1251. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file7     first-dir/dir1/dir2 == <remote>
  1252. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file14    first-dir           == <remote>
  1253. M [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.2 file6     first-dir           == <remote>
  1254. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file14    first-dir/dir1      == <remote>
  1255. M [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.2 file6     first-dir/dir1      == <remote>
  1256. A [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.1 file14    first-dir/dir1/dir2 == <remote>
  1257. M [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* 1.2 file6     first-dir/dir1/dir2 == <remote>
  1258. F [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]*                     =first-dir= <remote>/\*
  1259. T [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-head:A\]
  1260. T [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-tag:rtagged-by-head\]
  1261. T [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* first-dir \[rtagged-by-revision:1.1\]
  1262. O [0-9/]* [0-9:]* '"${PLUS}"'0000 [a-z0-9@][a-z0-9@]* \[1.1\] first-dir           =first-dir= <remote>/\*'
  1263.  
  1264.         rm -rf ${CVSROOT_DIRNAME}/first-dir
  1265.         rm -rf ${CVSROOT_DIRNAME}/second-dir
  1266.         ;;
  1267.  
  1268.     death)
  1269.         # next dive.  test death support.
  1270.  
  1271.         # NOTE: this section has reached the size and
  1272.         # complexity where it is getting to be a good idea to
  1273.         # add new death support tests to a new section rather
  1274.         # than continuing to piggyback them onto the tests here.
  1275.  
  1276.         mkdir  ${CVSROOT_DIRNAME}/first-dir
  1277.         if ${CVS} co first-dir  ; then
  1278.             echo "PASS: test 65" >>${LOGFILE}
  1279.         else
  1280.             echo "FAIL: test 65" | tee -a ${LOGFILE} ; exit 1
  1281.         fi
  1282.  
  1283.         cd first-dir
  1284.  
  1285.         # Create a directory with only dead files, to make sure CVS
  1286.         # doesn't get confused by it.
  1287.         mkdir subdir
  1288.         dotest 65a0 "${testcvs} add subdir" \
  1289. 'Directory /tmp/cvs-sanity/cvsroot/first-dir/subdir added to the repository'
  1290.         cd subdir
  1291.         echo file in subdir >sfile
  1292.         dotest 65a1 "${testcvs} add sfile" \
  1293. "${PROG}"' [a-z]*: scheduling file `sfile'\'' for addition
  1294. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  1295.         dotest 65a2 "${testcvs} -q ci -m add-it" \
  1296. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/subdir/sfile,v
  1297. done
  1298. Checking in sfile;
  1299. /tmp/cvs-sanity/cvsroot/first-dir/subdir/sfile,v  <--  sfile
  1300. initial revision: 1.1
  1301. done'
  1302.         rm sfile
  1303.         dotest 65a3 "${testcvs} rm sfile" \
  1304. "${PROG}"' [a-z]*: scheduling `sfile'\'' for removal
  1305. '"${PROG}"' [a-z]*: use '\'"${PROG}"' commit'\'' to remove this file permanently'
  1306.         dotest 65a4 "${testcvs} -q ci -m remove-it" \
  1307. 'Removing sfile;
  1308. /tmp/cvs-sanity/cvsroot/first-dir/subdir/sfile,v  <--  sfile
  1309. new revision: delete; previous revision: 1.1
  1310. done'
  1311.         cd ..
  1312.         dotest 65a5 "${testcvs} -q update -P" ''
  1313.         dotest_fail 65a6 "test -d subdir" ''
  1314.  
  1315.         # add a file.
  1316.         touch file1
  1317.         if ${CVS} add file1  2>> ${LOGFILE}; then
  1318.             echo "PASS: test 66" >>${LOGFILE}
  1319.         else
  1320.             echo "FAIL: test 66" | tee -a ${LOGFILE} ; exit 1
  1321.         fi
  1322.  
  1323.         # commit
  1324.         if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
  1325.             echo "PASS: test 67" >>${LOGFILE}
  1326.         else
  1327.             echo "FAIL: test 67" | tee -a ${LOGFILE} ; exit 1
  1328.         fi
  1329.  
  1330.         # remove
  1331.         rm file1
  1332.         if ${CVS} rm file1  2>> ${LOGFILE}; then
  1333.             echo "PASS: test 68" >>${LOGFILE}
  1334.         else
  1335.             echo "FAIL: test 68" | tee -a ${LOGFILE} ; exit 1
  1336.         fi
  1337.  
  1338.         # commit
  1339.         if ${CVS} ci -m test  >>${LOGFILE} ; then
  1340.             echo "PASS: test 69" >>${LOGFILE}
  1341.         else
  1342.             echo "FAIL: test 69" | tee -a ${LOGFILE} ; exit 1
  1343.         fi
  1344.  
  1345.         dotest_fail 69a0 "test -f file1" ''
  1346.         # get the old contents of file1 back
  1347.         if ${testcvs} update -p -r 1.1 file1 >file1 2>>${LOGFILE}; then
  1348.           pass 69a1
  1349.         else
  1350.           fail 69a1
  1351.         fi
  1352.         dotest 69a2 "cat file1" ''
  1353.  
  1354.         # create second file
  1355.         touch file2
  1356.         if ${CVS} add file1 file2  2>> ${LOGFILE}; then
  1357.             echo "PASS: test 70" >>${LOGFILE}
  1358.         else
  1359.             echo "FAIL: test 70" | tee -a ${LOGFILE} ; exit 1
  1360.         fi
  1361.  
  1362.         # commit
  1363.         if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
  1364.             echo "PASS: test 71" >>${LOGFILE}
  1365.         else
  1366.             echo "FAIL: test 71" | tee -a ${LOGFILE} ; exit 1
  1367.         fi
  1368.  
  1369.         # log
  1370.         if ${CVS} log file1  >> ${LOGFILE}; then
  1371.             echo "PASS: test 72" >>${LOGFILE}
  1372.         else
  1373.             echo "FAIL: test 72" | tee -a ${LOGFILE} ; exit 1
  1374.         fi
  1375.  
  1376.         # file4 will be dead at the time of branching and stay dead.
  1377.         echo file4 > file4
  1378.         dotest death-file4-add "${testcvs} add file4" \
  1379. "${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
  1380. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  1381.         dotest death-file4-ciadd "${testcvs} -q ci -m add file4" \
  1382. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file4,v
  1383. done
  1384. Checking in file4;
  1385. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  1386. initial revision: 1.1
  1387. done'
  1388.         rm file4
  1389.         dotest death-file4-rm "${testcvs} remove file4" \
  1390. "${PROG}"' [a-z]*: scheduling `file4'\'' for removal
  1391. '"${PROG}"' [a-z]*: use '\'"${PROG}"' commit'\'' to remove this file permanently'
  1392.         dotest death-file4-cirm "${testcvs} -q ci -m remove file4" \
  1393. 'Removing file4;
  1394. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  1395. new revision: delete; previous revision: 1.1
  1396. done'
  1397.  
  1398.         # Tag the branchpoint.
  1399.         dotest death-72a "${testcvs} -q tag bp_branch1" 'T file1
  1400. T file2'
  1401.  
  1402.         # branch1
  1403.         if ${CVS} tag -b branch1  ; then
  1404.             echo "PASS: test 73" >>${LOGFILE}
  1405.         else
  1406.             echo "FAIL: test 73" | tee -a ${LOGFILE} ; exit 1
  1407.         fi
  1408.  
  1409.         # and move to the branch.
  1410.         if ${CVS} update -r branch1  ; then
  1411.             echo "PASS: test 74" >>${LOGFILE}
  1412.         else
  1413.             echo "FAIL: test 74" | tee -a ${LOGFILE} ; exit 1
  1414.         fi
  1415.  
  1416.         dotest_fail death-file4-3 "test -f file4" ''
  1417.  
  1418.         # add a file in the branch
  1419.         echo line1 from branch1 >> file3
  1420.         if ${CVS} add file3  2>> ${LOGFILE}; then
  1421.             echo "PASS: test 75" >>${LOGFILE}
  1422.         else
  1423.             echo "FAIL: test 75" | tee -a ${LOGFILE} ; exit 1
  1424.         fi
  1425.  
  1426.         # commit
  1427.         if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
  1428.             echo "PASS: test 76" >>${LOGFILE}
  1429.         else
  1430.             echo "FAIL: test 76" | tee -a ${LOGFILE} ; exit 1
  1431.         fi
  1432.  
  1433.         # Remote CVS outputs nothing for 76a0 and 76a1; until
  1434.         # this bug is fixed just skip those tests for remote.
  1435.         if test "x$remote" = xno; then
  1436.           dotest death-76a0 \
  1437. "${testcvs} -q rdiff -r bp_branch1 -r branch1 first-dir" \
  1438. "Index: first-dir/file3
  1439. diff -c /dev/null first-dir/file3:1\.1\.2\.1
  1440. \*\*\* /dev/null    .*
  1441. --- first-dir/file3    .*
  1442. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  1443. \*\*\* 0 \*\*\*\*
  1444. --- 1 ----
  1445. ${PLUS} line1 from branch1"
  1446.           dotest death-76a1 \
  1447. "${testcvs} -q rdiff -r branch1 -r bp_branch1 first-dir" \
  1448. 'Index: first-dir/file3
  1449. diff -c first-dir/file3:1\.1\.2\.1 first-dir/file3:removed
  1450. \*\*\* first-dir/file3:1\.1\.2\.1    .*
  1451. --- first-dir/file3    .*
  1452. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  1453. \*\*\* 1 \*\*\*\*
  1454. - line1 from branch1
  1455. --- 0 ----'
  1456.         fi
  1457.  
  1458.         # remove
  1459.         rm file3
  1460.         if ${CVS} rm file3  2>> ${LOGFILE}; then
  1461.             echo "PASS: test 77" >>${LOGFILE}
  1462.         else
  1463.             echo "FAIL: test 77" | tee -a ${LOGFILE} ; exit 1
  1464.         fi
  1465.  
  1466.         # commit
  1467.         if ${CVS} ci -m test  >>${LOGFILE} ; then
  1468.             echo "PASS: test 78" >>${LOGFILE}
  1469.         else
  1470.             echo "FAIL: test 78" | tee -a ${LOGFILE} ; exit 1
  1471.         fi
  1472.  
  1473.         # add again
  1474.         echo line1 from branch1 >> file3
  1475.         if ${CVS} add file3  2>> ${LOGFILE}; then
  1476.             echo "PASS: test 79" >>${LOGFILE}
  1477.         else
  1478.             echo "FAIL: test 79" | tee -a ${LOGFILE} ; exit 1
  1479.         fi
  1480.  
  1481.         # commit
  1482.         if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
  1483.             echo "PASS: test 80" >>${LOGFILE}
  1484.         else
  1485.             echo "FAIL: test 80" | tee -a ${LOGFILE} ; exit 1
  1486.         fi
  1487.  
  1488.         # change the first file
  1489.         echo line2 from branch1 >> file1
  1490.  
  1491.         # commit
  1492.         if ${CVS} ci -m test  >> ${LOGFILE} 2>&1; then
  1493.             echo "PASS: test 81" >>${LOGFILE}
  1494.         else
  1495.             echo "FAIL: test 81" | tee -a ${LOGFILE} ; exit 1
  1496.         fi
  1497.  
  1498.         # remove the second
  1499.         rm file2
  1500.         if ${CVS} rm file2  2>> ${LOGFILE}; then
  1501.             echo "PASS: test 82" >>${LOGFILE}
  1502.         else
  1503.             echo "FAIL: test 82" | tee -a ${LOGFILE} ; exit 1
  1504.         fi
  1505.  
  1506.         # commit
  1507.         if ${CVS} ci -m test  >>${LOGFILE}; then
  1508.             echo "PASS: test 83" >>${LOGFILE}
  1509.         else
  1510.             echo "FAIL: test 83" | tee -a ${LOGFILE} ; exit 1
  1511.         fi
  1512.  
  1513.         # back to the trunk.
  1514.         if ${CVS} update -A  2>> ${LOGFILE}; then
  1515.             echo "PASS: test 84" >>${LOGFILE}
  1516.         else
  1517.             echo "FAIL: test 84" | tee -a ${LOGFILE} ; exit 1
  1518.         fi
  1519.  
  1520.         dotest_fail death-file4-4 "test -f file4" ''
  1521.  
  1522.         if test -f file3 ; then
  1523.             echo "FAIL: test 85" | tee -a ${LOGFILE} ; exit 1
  1524.         else
  1525.             echo "PASS: test 85" >>${LOGFILE}
  1526.         fi
  1527.  
  1528.         # join
  1529.         dotest 86 "${testcvs} -q update -j branch1" \
  1530. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
  1531. retrieving revision 1.3
  1532. retrieving revision 1.3.2.1
  1533. Merging differences between 1.3 and 1.3.2.1 into file1
  1534. '"${PROG}"' [a-z]*: scheduling file2 for removal
  1535. U file3'
  1536.  
  1537.         dotest_fail death-file4-5 "test -f file4" ''
  1538.  
  1539.         if test -f file3 ; then
  1540.             echo "PASS: test 87" >>${LOGFILE}
  1541.         else
  1542.             echo "FAIL: test 87" | tee -a ${LOGFILE} ; exit 1
  1543.         fi
  1544.  
  1545.         # Make sure that we joined the correct change to file1
  1546.         if echo line2 from branch1 | cmp - file1 >/dev/null; then
  1547.             echo 'PASS: test 87a' >>${LOGFILE}
  1548.         else
  1549.             echo 'FAIL: test 87a' | tee -a ${LOGFILE}
  1550.             exit 1
  1551.         fi
  1552.  
  1553.         # update
  1554.         if ${CVS} update  ; then
  1555.             echo "PASS: test 88" >>${LOGFILE}
  1556.         else
  1557.             echo "FAIL: test 88" | tee -a ${LOGFILE} ; exit 1
  1558.         fi
  1559.  
  1560.         # commit
  1561.         dotest 89 "${testcvs} -q ci -m test" \
  1562. 'Checking in file1;
  1563. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  1564. new revision: 1\.4; previous revision: 1\.3
  1565. done
  1566. Removing file2;
  1567. /tmp/cvs-sanity/cvsroot/first-dir/file2,v  <--  file2
  1568. new revision: delete; previous revision: 1\.1
  1569. done
  1570. Checking in file3;
  1571. /tmp/cvs-sanity/cvsroot/first-dir/file3,v  <--  file3
  1572. new revision: 1\.2; previous revision: 1\.1
  1573. done'
  1574.         cd ..
  1575.         mkdir 2
  1576.         cd 2
  1577.         dotest 89a "${testcvs} -q co first-dir" 'U first-dir/file1
  1578. U first-dir/file3'
  1579.         cd ..
  1580.         rm -rf 2
  1581.         cd first-dir
  1582.  
  1583.         # remove first file.
  1584.         rm file1
  1585.         if ${CVS} rm file1  2>> ${LOGFILE}; then
  1586.             echo "PASS: test 90" >>${LOGFILE}
  1587.         else
  1588.             echo "FAIL: test 90" | tee -a ${LOGFILE} ; exit 1
  1589.         fi
  1590.  
  1591.         # commit
  1592.         if ${CVS} ci -m test  >>${LOGFILE}; then
  1593.             echo "PASS: test 91" >>${LOGFILE}
  1594.         else
  1595.             echo "FAIL: test 91" | tee -a ${LOGFILE} ; exit 1
  1596.         fi
  1597.  
  1598.         if test -f file1 ; then
  1599.             echo "FAIL: test 92" | tee -a ${LOGFILE} ; exit 1
  1600.         else
  1601.             echo "PASS: test 92" >>${LOGFILE}
  1602.         fi
  1603.  
  1604.         # typo; try to get to the branch and fail
  1605.         dotest_fail 92.1a "${testcvs} update -r brnach1" \
  1606.           "${PROG}"' \[[a-z]* aborted\]: no such tag brnach1'
  1607.         # Make sure we are still on the trunk
  1608.         if test -f file1 ; then
  1609.             echo "FAIL: 92.1b" | tee -a ${LOGFILE} ; exit 1
  1610.         else
  1611.             echo "PASS: 92.1b" >>${LOGFILE}
  1612.         fi
  1613.         if test -f file3 ; then
  1614.             echo "PASS: 92.1c" >>${LOGFILE}
  1615.         else
  1616.             echo "FAIL: 92.1c" | tee -a ${LOGFILE} ; exit 1
  1617.         fi
  1618.  
  1619.         # back to branch1
  1620.         if ${CVS} update -r branch1  2>> ${LOGFILE}; then
  1621.             echo "PASS: test 93" >>${LOGFILE}
  1622.         else
  1623.             echo "FAIL: test 93" | tee -a ${LOGFILE} ; exit 1
  1624.         fi
  1625.  
  1626.         dotest_fail death-file4-6 "test -f file4" ''
  1627.  
  1628.         if test -f file1 ; then
  1629.             echo "PASS: test 94" >>${LOGFILE}
  1630.         else
  1631.             echo "FAIL: test 94" | tee -a ${LOGFILE} ; exit 1
  1632.         fi
  1633.  
  1634.         # and join
  1635.         dotest 95 "${testcvs} -q update -j HEAD" \
  1636. "${PROG}"' [a-z]*: file file1 has been modified, but has been removed in revision HEAD
  1637. '"${PROG}"' [a-z]*: file file3 exists, but has been added in revision HEAD'
  1638.  
  1639.         dotest_fail death-file4-7 "test -f file4" ''
  1640.  
  1641.         # file2 should not have been recreated.  It was
  1642.         # deleted on the branch, and has not been modified on
  1643.         # the trunk.  That means that there have been no
  1644.         # changes between the greatest common ancestor (the
  1645.         # trunk version) and HEAD.
  1646.         dotest_fail death-file2-1 "test -f file2" ''
  1647.  
  1648.         cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
  1649.         ;;
  1650.  
  1651.     death2)
  1652.       # More tests of death support.
  1653.       mkdir ${CVSROOT_DIRNAME}/first-dir
  1654.       dotest death2-1 "${testcvs} -q co first-dir" ''
  1655.  
  1656.       cd first-dir
  1657.  
  1658.       # Add a file on the trunk.
  1659.       echo "first revision" > file1
  1660.       dotest death2-2 "${testcvs} add file1" \
  1661. "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
  1662. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  1663.  
  1664.       dotest death2-3 "${testcvs} -q commit -m add" \
  1665. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
  1666. done
  1667. Checking in file1;
  1668. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  1669. initial revision: 1.1
  1670. done'
  1671.  
  1672.       # Make a branch and a non-branch tag.
  1673.       dotest death2-4 "${testcvs} -q tag -b branch" 'T file1'
  1674.       dotest death2-5 "${testcvs} -q tag tag" 'T file1'
  1675.  
  1676.       # Switch over to the branch.
  1677.       dotest death2-6 "${testcvs} -q update -r branch" ''
  1678.  
  1679.       # Delete the file on the branch.
  1680.       rm file1
  1681.       dotest death2-7 "${testcvs} rm file1" \
  1682. "${PROG} [a-z]*: scheduling .file1. for removal
  1683. ${PROG} [a-z]*: use .cvs commit. to remove this file permanently"
  1684.       dotest death2-8 "${testcvs} -q ci -m removed" \
  1685. 'Removing file1;
  1686. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  1687. new revision: delete; previous revision: 1\.1\.2
  1688. done'
  1689.  
  1690.       # Test diff of a dead file.
  1691.       dotest_fail death2-diff-1 \
  1692. "${testcvs} -q diff -r1.1 -rbranch -c file1" \
  1693. "${PROG} [a-z]*: file1 was removed, no comparison available"
  1694.  
  1695.       dotest_fail death2-diff-2 \
  1696. "${testcvs} -q diff -r1.1 -rbranch -N -c file1" \
  1697. "Index: file1
  1698. ===================================================================
  1699. RCS file: file1
  1700. diff -N file1
  1701. \*\*\* [a-zA-Z0-9/.]*[     ][    ]*[a-zA-Z0-9: ]*
  1702. --- /dev/null[     ][     ]*[a-zA-Z0-9: ]*
  1703. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  1704. \*\*\* 1 \*\*\*\*
  1705. - first revision
  1706. --- 0 ----"
  1707.  
  1708.       dotest_fail death2-diff-3 "${testcvs} -q diff -rtag -c ." \
  1709. "${PROG} [a-z]*: file1 no longer exists, no comparison available"
  1710.  
  1711.       dotest_fail death2-diff-4 "${testcvs} -q diff -rtag -N -c ." \
  1712. "Index: file1
  1713. ===================================================================
  1714. RCS file: file1
  1715. diff -N file1
  1716. \*\*\* [a-zA-Z0-9/.]*[     ][    ]*[a-zA-Z0-9: ]*
  1717. --- /dev/null[     ][     ]*[a-zA-Z0-9: ]*
  1718. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  1719. \*\*\* 1 \*\*\*\*
  1720. - first revision
  1721. --- 0 ----"
  1722.  
  1723.       # Test rdiff of a dead file.
  1724.       dotest death2-rdiff-1 \
  1725. "${testcvs} -q rtag -rbranch rdiff-tag first-dir" ''
  1726.  
  1727.       dotest death2-rdiff-2 "${testcvs} -q rdiff -rtag -rbranch first-dir" \
  1728. "Index: first-dir/file1
  1729. diff -c first-dir/file1:1\.1 first-dir/file1:removed
  1730. \*\*\* first-dir/file1:1\.1[     ][    ]*[a-zA-Z0-9: ]*
  1731. --- first-dir/file1[     ][     ]*[a-zA-Z0-9: ]*
  1732. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  1733. \*\*\* 1 \*\*\*\*
  1734. - first revision
  1735. --- 0 ----"
  1736.  
  1737.       # Readd the file to the branch.
  1738.       echo "second revision" > file1
  1739.       dotest death2-9 "${testcvs} add file1" \
  1740. "${PROG}"' [a-z]*: file `file1'\'' will be added on branch `branch'\'' from version 1\.1\.2\.1
  1741. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  1742.       dotest death2-10 "${testcvs} -q commit -m add" \
  1743. 'Checking in file1;
  1744. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  1745. new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1
  1746. done'
  1747.  
  1748.       # Back to the trunk.
  1749.       dotest death2-11 "${testcvs} -q update -A" 'U file1' 'P file1'
  1750.  
  1751.       # Add another file on the trunk.
  1752.       echo "first revision" > file2
  1753.       dotest death2-12 "${testcvs} add file2" \
  1754. "${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
  1755. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  1756.       dotest death2-13 "${testcvs} -q commit -m add" \
  1757. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file2,v
  1758. done
  1759. Checking in file2;
  1760. /tmp/cvs-sanity/cvsroot/first-dir/file2,v  <--  file2
  1761. initial revision: 1.1
  1762. done'
  1763.  
  1764.       # Back to the branch.
  1765.       # The ``no longer in the repository'' message doesn't really
  1766.       # look right to me, but that's what CVS currently prints for
  1767.       # this case.
  1768.       dotest death2-14 "${testcvs} -q update -r branch" \
  1769. "U file1
  1770. ${PROG} [a-z]*: file2 is no longer in the repository" \
  1771. "P file1
  1772. ${PROG} [a-z]*: file2 is no longer in the repository"
  1773.  
  1774.       # Add a file on the branch with the same name.
  1775.       echo "branch revision" > file2
  1776.       dotest death2-15 "${testcvs} add file2" \
  1777. "${PROG}"' [a-z]*: scheduling file `file2'\'' for addition on branch `branch'\''
  1778. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  1779.       dotest death2-16 "${testcvs} -q commit -m add" \
  1780. 'Checking in file2;
  1781. /tmp/cvs-sanity/cvsroot/first-dir/file2,v  <--  file2
  1782. new revision: 1\.1\.2\.1; previous revision: 1\.1
  1783. done'
  1784.  
  1785.       # Add a new file on the branch.
  1786.       echo "first revision" > file3
  1787.       dotest death2-17 "${testcvs} add file3" \
  1788. "${PROG}"' [a-z]*: scheduling file `file3'\'' for addition on branch `branch'\''
  1789. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  1790.       dotest death2-18 "${testcvs} -q commit -m add" \
  1791. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/Attic/file3,v
  1792. done
  1793. Checking in file3;
  1794. /tmp/cvs-sanity/cvsroot/first-dir/Attic/file3,v  <--  file3
  1795. new revision: 1\.1\.2\.1; previous revision: 1\.1
  1796. done'
  1797.  
  1798.       # Test diff of a nonexistent tag
  1799.       dotest_fail death2-diff-5 "${testcvs} -q diff -rtag -c file3" \
  1800. "${PROG} [a-z]*: tag tag is not in file file3"
  1801.  
  1802.       dotest_fail death2-diff-6 "${testcvs} -q diff -rtag -N -c file3" \
  1803. "Index: file3
  1804. ===================================================================
  1805. RCS file: file3
  1806. diff -N file3
  1807. \*\*\* /dev/null[     ][     ]*[a-zA-Z0-9: ]*
  1808. --- [a-zA-Z0-9/.]*[     ][     ]*[a-zA-Z0-9: ]*
  1809. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  1810. \*\*\* 0 \*\*\*\*
  1811. --- 1 ----
  1812. ${PLUS} first revision"
  1813.  
  1814.       dotest_fail death2-diff-7 "${testcvs} -q diff -rtag -c ." \
  1815. "Index: file1
  1816. ===================================================================
  1817. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
  1818. retrieving revision 1\.1
  1819. retrieving revision 1\.1\.2\.2
  1820. diff -c -r1\.1 -r1\.1\.2\.2
  1821. \*\*\* file1[     ][     ]*[a-zA-Z0-9:./     ]*
  1822. --- file1[     ][     ]*[a-zA-Z0-9:./     ]*
  1823. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  1824. \*\*\* 1 \*\*\*\*
  1825. ! first revision
  1826. --- 1 ----
  1827. ! second revision
  1828. ${PROG} [a-z]*: tag tag is not in file file2
  1829. ${PROG} [a-z]*: tag tag is not in file file3"
  1830.  
  1831.       dotest_fail death2-diff-8 "${testcvs} -q diff -rtag -c -N ." \
  1832. "Index: file1
  1833. ===================================================================
  1834. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
  1835. retrieving revision 1\.1
  1836. retrieving revision 1\.1\.2\.2
  1837. diff -c -r1\.1 -r1\.1\.2\.2
  1838. \*\*\* file1[     ][     ]*[a-zA-Z0-9:./     ]*
  1839. --- file1[     ][     ]*[a-zA-Z0-9:./     ]*
  1840. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  1841. \*\*\* 1 \*\*\*\*
  1842. ! first revision
  1843. --- 1 ----
  1844. ! second revision
  1845. Index: file2
  1846. ===================================================================
  1847. RCS file: file2
  1848. diff -N file2
  1849. \*\*\* /dev/null[     ][     ]*[a-zA-Z0-9: ]*
  1850. --- [a-zA-Z0-9/.]*[     ][     ]*[a-zA-Z0-9: ]*
  1851. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  1852. \*\*\* 0 \*\*\*\*
  1853. --- 1 ----
  1854. ${PLUS} branch revision
  1855. Index: file3
  1856. ===================================================================
  1857. RCS file: file3
  1858. diff -N file3
  1859. \*\*\* /dev/null[     ][     ]*[a-zA-Z0-9: ]*
  1860. --- [a-zA-Z0-9/.]*[     ][     ]*[a-zA-Z0-9: ]*
  1861. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  1862. \*\*\* 0 \*\*\*\*
  1863. --- 1 ----
  1864. ${PLUS} first revision"
  1865.  
  1866.       # Switch to the nonbranch tag.
  1867.       dotest death2-19 "${testcvs} -q update -r tag" \
  1868. "U file1
  1869. ${PROG} [a-z]*: file2 is no longer in the repository
  1870. ${PROG} [a-z]*: file3 is no longer in the repository" \
  1871. "P file1
  1872. ${PROG} [a-z]*: file2 is no longer in the repository
  1873. ${PROG} [a-z]*: file3 is no longer in the repository"
  1874.  
  1875.       dotest_fail death2-20 "test -f file2"
  1876.  
  1877.       # Make sure we can't add a file on this nonbranch tag.
  1878.       # FIXME: Right now CVS will let you add a file on a
  1879.       # nonbranch tag, so this test is commented out.
  1880.       # echo "bad revision" > file2
  1881.       # dotest death2-21 "${testcvs} add file2" "some error message"
  1882.  
  1883.       # Make sure diff only reports appropriate files.
  1884.       dotest_fail death2-diff-9 "${testcvs} -q diff -r rdiff-tag" \
  1885. "${PROG} [a-z]*: file1 is a new entry, no comparison available"
  1886.  
  1887.       dotest_fail death2-diff-10 "${testcvs} -q diff -r rdiff-tag -c -N" \
  1888. "Index: file1
  1889. ===================================================================
  1890. RCS file: file1
  1891. diff -N file1
  1892. \*\*\* /dev/null[     ][     ]*[a-zA-Z0-9: ]*
  1893. --- [a-zA-Z0-9/.]*[     ][     ]*[a-zA-Z0-9: ]*
  1894. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  1895. \*\*\* 0 \*\*\*\*
  1896. --- 1 ----
  1897. ${PLUS} first revision"
  1898.  
  1899.       cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
  1900.       ;;
  1901.  
  1902.     branches)
  1903.       # More branch tests, including branches off of branches
  1904.       mkdir ${CVSROOT_DIRNAME}/first-dir
  1905.       dotest branches-1 "${testcvs} -q co first-dir" ''
  1906.       cd first-dir
  1907.       echo 1:ancest >file1
  1908.       echo 2:ancest >file2
  1909.       echo 3:ancest >file3
  1910.       echo 4:trunk-1 >file4
  1911.       dotest branches-2 "${testcvs} add file1 file2 file3 file4" \
  1912. "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
  1913. '"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
  1914. '"${PROG}"' [a-z]*: scheduling file `file3'\'' for addition
  1915. '"${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
  1916. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently'
  1917.       dotest_lit branches-3 "${testcvs} -q ci -m add-it" <<'HERE'
  1918. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
  1919. done
  1920. Checking in file1;
  1921. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  1922. initial revision: 1.1
  1923. done
  1924. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file2,v
  1925. done
  1926. Checking in file2;
  1927. /tmp/cvs-sanity/cvsroot/first-dir/file2,v  <--  file2
  1928. initial revision: 1.1
  1929. done
  1930. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file3,v
  1931. done
  1932. Checking in file3;
  1933. /tmp/cvs-sanity/cvsroot/first-dir/file3,v  <--  file3
  1934. initial revision: 1.1
  1935. done
  1936. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file4,v
  1937. done
  1938. Checking in file4;
  1939. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  1940. initial revision: 1.1
  1941. done
  1942. HERE
  1943.       echo 4:trunk-2 >file4
  1944.       dotest branches-3.2 "${testcvs} -q ci -m trunk-before-branch" \
  1945. 'Checking in file4;
  1946. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  1947. new revision: 1.2; previous revision: 1.1
  1948. done'
  1949.       dotest branches-4 "${testcvs} tag -b br1" "${PROG}"' [a-z]*: Tagging \.
  1950. T file1
  1951. T file2
  1952. T file3
  1953. T file4'
  1954.       dotest branches-5 "${testcvs} update -r br1" \
  1955. "${PROG}"' [a-z]*: Updating \.'
  1956.       echo 1:br1 >file1
  1957.       echo 2:br1 >file2
  1958.       echo 4:br1 >file4
  1959.       dotest branches-6 "${testcvs} -q ci -m modify" \
  1960. 'Checking in file1;
  1961. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  1962. new revision: 1.1.2.1; previous revision: 1.1
  1963. done
  1964. Checking in file2;
  1965. /tmp/cvs-sanity/cvsroot/first-dir/file2,v  <--  file2
  1966. new revision: 1.1.2.1; previous revision: 1.1
  1967. done
  1968. Checking in file4;
  1969. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  1970. new revision: 1.2.2.1; previous revision: 1.2
  1971. done'
  1972.       dotest branches-7 "${testcvs} -q tag -b brbr" 'T file1
  1973. T file2
  1974. T file3
  1975. T file4'
  1976.       dotest branches-8 "${testcvs} -q update -r brbr" ''
  1977.       echo 1:brbr >file1
  1978.       echo 4:brbr >file4
  1979.       dotest branches-9 "${testcvs} -q ci -m modify" \
  1980. 'Checking in file1;
  1981. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  1982. new revision: 1.1.2.1.2.1; previous revision: 1.1.2.1
  1983. done
  1984. Checking in file4;
  1985. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  1986. new revision: 1.2.2.1.2.1; previous revision: 1.2.2.1
  1987. done'
  1988.       dotest branches-10 "cat file1 file2 file3 file4" '1:brbr
  1989. 2:br1
  1990. 3:ancest
  1991. 4:brbr'
  1992.       dotest branches-11 "${testcvs} -q update -r br1" \
  1993. '[UP] file1
  1994. [UP] file4'
  1995.       dotest branches-12 "cat file1 file2 file3 file4" '1:br1
  1996. 2:br1
  1997. 3:ancest
  1998. 4:br1'
  1999.       echo 4:br1-2 >file4
  2000.       dotest branches-12.2 "${testcvs} -q ci -m change-on-br1" \
  2001. 'Checking in file4;
  2002. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  2003. new revision: 1.2.2.2; previous revision: 1.2.2.1
  2004. done'
  2005.       dotest branches-13 "${testcvs} -q update -A" '[UP] file1
  2006. [UP] file2
  2007. [UP] file4'
  2008.       dotest branches-14 "cat file1 file2 file3 file4" '1:ancest
  2009. 2:ancest
  2010. 3:ancest
  2011. 4:trunk-2'
  2012.       echo 4:trunk-3 >file4
  2013.       dotest branches-14.2 \
  2014.         "${testcvs} -q ci -m trunk-change-after-branch" \
  2015. 'Checking in file4;
  2016. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  2017. new revision: 1.3; previous revision: 1.2
  2018. done'
  2019.       dotest branches-14.3 "${testcvs} log file4" \
  2020. '
  2021. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file4,v
  2022. Working file: file4
  2023. head: 1\.3
  2024. branch:
  2025. locks: strict
  2026. access list:
  2027. symbolic names:
  2028.     brbr: 1\.2\.2\.1\.0\.2
  2029.     br1: 1\.2\.0\.2
  2030. keyword substitution: kv
  2031. total revisions: 6;    selected revisions: 6
  2032. description:
  2033. ----------------------------
  2034. revision 1\.3
  2035. date: [0-9/: ]*;  author: [a-z0-9@][a-z0-9@]*;  state: Exp;  lines: '"${PLUS}"'1 -1
  2036. trunk-change-after-branch
  2037. ----------------------------
  2038. revision 1\.2
  2039. date: [0-9/: ]*;  author: [a-z0-9@][a-z0-9@]*;  state: Exp;  lines: '"${PLUS}"'1 -1
  2040. branches:  1\.2\.2;
  2041. trunk-before-branch
  2042. ----------------------------
  2043. revision 1\.1
  2044. date: [0-9/: ]*;  author: [a-z0-9@][a-z0-9@]*;  state: Exp;
  2045. add-it
  2046. ----------------------------
  2047. revision 1\.2\.2\.2
  2048. date: [0-9/: ]*;  author: [a-z0-9@][a-z0-9@]*;  state: Exp;  lines: '"${PLUS}"'1 -1
  2049. change-on-br1
  2050. ----------------------------
  2051. revision 1\.2\.2\.1
  2052. date: [0-9/: ]*;  author: [a-z0-9@][a-z0-9@]*;  state: Exp;  lines: '"${PLUS}"'1 -1
  2053. branches:  1\.2\.2\.1\.2;
  2054. modify
  2055. ----------------------------
  2056. revision 1\.2\.2\.1\.2\.1
  2057. date: [0-9/: ]*;  author: [a-z0-9@][a-z0-9@]*;  state: Exp;  lines: '"${PLUS}"'1 -1
  2058. modify
  2059. ============================================================================='
  2060.       dotest_status branches-14.4 1 \
  2061.         "${testcvs} diff -c -r 1.1 -r 1.3 file4" \
  2062. 'Index: file4
  2063. ===================================================================
  2064. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file4,v
  2065. retrieving revision 1\.1
  2066. retrieving revision 1\.3
  2067. diff -c -r1\.1 -r1\.3
  2068. \*\*\* file4    [0-9/]* [0-9:]*    1\.1
  2069. --- file4    [0-9/]* [0-9:]*    1\.3
  2070. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  2071. \*\*\* 1 \*\*\*\*
  2072. ! 4:trunk-1
  2073. --- 1 ----
  2074. ! 4:trunk-3'
  2075.       dotest_status branches-14.5 1 \
  2076.         "${testcvs} diff -c -r 1.1 -r 1.2.2.1 file4" \
  2077. 'Index: file4
  2078. ===================================================================
  2079. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file4,v
  2080. retrieving revision 1\.1
  2081. retrieving revision 1\.2\.2\.1
  2082. diff -c -r1\.1 -r1\.2\.2\.1
  2083. \*\*\* file4    [0-9/]* [0-9:]*    1\.1
  2084. --- file4    [0-9/]* [0-9:]*    1\.2\.2\.1
  2085. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
  2086. \*\*\* 1 \*\*\*\*
  2087. ! 4:trunk-1
  2088. --- 1 ----
  2089. ! 4:br1'
  2090.       dotest branches-15 \
  2091.         "${testcvs} update -j 1.1.2.1 -j 1.1.2.1.2.1 file1" \
  2092.         'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
  2093. retrieving revision 1.1.2.1
  2094. retrieving revision 1.1.2.1.2.1
  2095. Merging differences between 1.1.2.1 and 1.1.2.1.2.1 into file1
  2096. rcsmerge: warning: conflicts during merge'
  2097.       dotest branches-16 "cat file1" '<<<<<<< file1
  2098. 1:ancest
  2099. =======
  2100. 1:brbr
  2101. >>>>>>> 1.1.2.1.2.1'
  2102.       cd ..
  2103.  
  2104.       if test "$keep" = yes; then
  2105.         echo Keeping /tmp/cvs-sanity and exiting due to --keep
  2106.         exit 0
  2107.       fi
  2108.  
  2109.       rm -rf ${CVSROOT_DIRNAME}/first-dir
  2110.       rm -r first-dir
  2111.       ;;
  2112.  
  2113.     import) # test death after import
  2114.         # import
  2115.         mkdir import-dir ; cd import-dir
  2116.  
  2117.         for i in 1 2 3 4 ; do
  2118.             echo imported file"$i" > imported-file"$i"
  2119.         done
  2120.  
  2121.         # This directory should be on the default ignore list,
  2122.         # so it shouldn't get imported.
  2123.         mkdir RCS
  2124.         echo ignore.me >RCS/ignore.me
  2125.  
  2126.         echo 'import should not expand $''Id$' >>imported-file2
  2127.         cp imported-file2 ../imported-file2-orig.tmp
  2128.  
  2129.         if ${CVS} import -m first-import first-dir vendor-branch junk-1_0  ; then
  2130.             echo "PASS: test 96" >>${LOGFILE}
  2131.         else
  2132.             echo "FAIL: test 96" | tee -a ${LOGFILE} ; exit 1
  2133.         fi
  2134.  
  2135.         if cmp ../imported-file2-orig.tmp imported-file2; then
  2136.           pass 96.5
  2137.         else
  2138.           fail 96.5
  2139.         fi
  2140.         cd ..
  2141.  
  2142.         # co
  2143.         if ${CVS} co first-dir  ; then
  2144.             echo "PASS: test 97" >>${LOGFILE}
  2145.         else
  2146.             echo "FAIL: test 97" | tee -a ${LOGFILE} ; exit 1
  2147.         fi
  2148.  
  2149.         cd first-dir
  2150.         for i in 1 2 3 4 ; do
  2151.             if test -f imported-file"$i" ; then
  2152.                 echo "PASS: test 98-$i" >>${LOGFILE}
  2153.             else
  2154.                 echo "FAIL: test 98-$i" | tee -a ${LOGFILE} ; exit 1
  2155.             fi
  2156.         done
  2157.         if test -d RCS; then
  2158.           echo "FAIL: test 98.5" | tee -a ${LOGFILE} ; exit 1
  2159.         else
  2160.           echo "PASS: test 98.5" >>${LOGFILE}
  2161.         fi
  2162.  
  2163.         # remove
  2164.         rm imported-file1
  2165.         if ${CVS} rm imported-file1  2>> ${LOGFILE}; then
  2166.             echo "PASS: test 99" >>${LOGFILE}
  2167.         else
  2168.             echo "FAIL: test 99" | tee -a ${LOGFILE} ; exit 1
  2169.         fi
  2170.  
  2171.         # change
  2172.         echo local-change >> imported-file2
  2173.  
  2174.         # commit
  2175.         if ${CVS} ci -m local-changes  >> ${LOGFILE} 2>&1; then
  2176.             echo "PASS: test 100" >>${LOGFILE}
  2177.         else
  2178.             echo "FAIL: test 100" | tee -a ${LOGFILE} ; exit 1
  2179.         fi
  2180.  
  2181.         # log
  2182.         if ${CVS} log imported-file1 | grep '1.1.1.2 (dead)'  ; then
  2183.             echo "FAIL: test 101" | tee -a ${LOGFILE} ; exit 1
  2184.         else
  2185.             echo "PASS: test 101" >>${LOGFILE}
  2186.         fi
  2187.  
  2188.         # update into the vendor branch.
  2189.         if ${CVS} update -rvendor-branch  ; then
  2190.             echo "PASS: test 102" >>${LOGFILE}
  2191.         else
  2192.             echo "FAIL: test 102" | tee -a ${LOGFILE} ; exit 1
  2193.         fi
  2194.  
  2195.         # remove file4 on the vendor branch
  2196.         rm imported-file4
  2197.  
  2198.         if ${CVS} rm imported-file4  2>> ${LOGFILE}; then
  2199.             echo "PASS: test 103" >>${LOGFILE}
  2200.         else
  2201.             echo "FAIL: test 103" | tee -a ${LOGFILE} ; exit 1
  2202.         fi
  2203.  
  2204.         # commit
  2205.         if ${CVS} ci -m vendor-removed imported-file4 >>${LOGFILE}; then
  2206.             echo "PASS: test 104" >>${LOGFILE}
  2207.         else
  2208.             echo "FAIL: test 104" | tee -a ${LOGFILE} ; exit 1
  2209.         fi
  2210.  
  2211.         # update to main line
  2212.         if ${CVS} update -A  2>> ${LOGFILE}; then
  2213.             echo "PASS: test 105" >>${LOGFILE}
  2214.         else
  2215.             echo "FAIL: test 105" | tee -a ${LOGFILE} ; exit 1
  2216.         fi
  2217.  
  2218.         # second import - file4 deliberately unchanged
  2219.         cd ../import-dir
  2220.         for i in 1 2 3 ; do
  2221.             echo rev 2 of file $i >> imported-file"$i"
  2222.         done
  2223.         cp imported-file2 ../imported-file2-orig.tmp
  2224.  
  2225.         if ${CVS} import -m second-import first-dir vendor-branch junk-2_0  ; then
  2226.             echo "PASS: test 106" >>${LOGFILE}
  2227.         else
  2228.             echo "FAIL: test 106" | tee -a ${LOGFILE} ; exit 1
  2229.         fi
  2230.         if cmp ../imported-file2-orig.tmp imported-file2; then
  2231.           pass 106.5
  2232.         else
  2233.           fail 106.5
  2234.         fi
  2235.         cd ..
  2236.  
  2237.         # co
  2238.         if ${CVS} co first-dir  ; then
  2239.             echo "PASS: test 107" >>${LOGFILE}
  2240.         else
  2241.             echo "FAIL: test 107" | tee -a ${LOGFILE} ; exit 1
  2242.         fi
  2243.  
  2244.         cd first-dir
  2245.  
  2246.         if test -f imported-file1 ; then
  2247.             echo "FAIL: test 108" | tee -a ${LOGFILE} ; exit 1
  2248.         else
  2249.             echo "PASS: test 108" >>${LOGFILE}
  2250.         fi
  2251.  
  2252.         for i in 2 3 ; do
  2253.             if test -f imported-file"$i" ; then
  2254.                 echo "PASS: test 109-$i" >>${LOGFILE}
  2255.             else
  2256.                 echo "FAIL: test 109-$i" | tee -a ${LOGFILE} ; exit 1
  2257.             fi
  2258.         done
  2259.  
  2260.         # check vendor branch for file4
  2261.         if ${CVS} update -rvendor-branch  ; then
  2262.             echo "PASS: test 110" >>${LOGFILE}
  2263.         else
  2264.             echo "FAIL: test 110" | tee -a ${LOGFILE} ; exit 1
  2265.         fi
  2266.  
  2267.         if test -f imported-file4 ; then
  2268.             echo "PASS: test 111" >>${LOGFILE}
  2269.         else
  2270.             echo "FAIL: test 111" | tee -a ${LOGFILE} ; exit 1
  2271.         fi
  2272.  
  2273.         # update to main line
  2274.         if ${CVS} update -A  2>> ${LOGFILE}; then
  2275.             echo "PASS: test 112" >>${LOGFILE}
  2276.         else
  2277.             echo "FAIL: test 112" | tee -a ${LOGFILE} ; exit 1
  2278.         fi
  2279.  
  2280.         cd ..
  2281.  
  2282.         dotest import-113 \
  2283. "${testcvs} -q co -jjunk-1_0 -jjunk-2_0 first-dir" \
  2284. "${PROG}"' [a-z]*: file first-dir/imported-file1 is present in revision junk-2_0
  2285. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/imported-file2,v
  2286. retrieving revision 1.1.1.1
  2287. retrieving revision 1.1.1.2
  2288. Merging differences between 1.1.1.1 and 1.1.1.2 into imported-file2
  2289. rcsmerge: warning: conflicts during merge'
  2290.  
  2291.         cd first-dir
  2292.  
  2293.         if test -f imported-file1 ; then
  2294.             echo "FAIL: test 114" | tee -a ${LOGFILE} ; exit 1
  2295.         else
  2296.             echo "PASS: test 114" >>${LOGFILE}
  2297.         fi
  2298.  
  2299.         for i in 2 3 ; do
  2300.             if test -f imported-file"$i" ; then
  2301.                 echo "PASS: test 115-$i" >>${LOGFILE}
  2302.             else
  2303.                 echo "FAIL: test 115-$i" | tee -a ${LOGFILE} ; exit 1
  2304.             fi
  2305.         done
  2306.  
  2307.         dotest import-116 'cat imported-file2' \
  2308. 'imported file2
  2309. <<<<<<< imported-file2
  2310. import should not expand \$''Id: imported-file2,v 1\.2 [0-9/]* [0-9:]* [a-z0-9@][a-z0-9@]* Exp \$
  2311. local-change
  2312. =======
  2313. import should not expand \$''Id: imported-file2,v 1\.1\.1\.2 [0-9/]* [0-9:]* [a-z0-9@][a-z0-9@]* Exp \$
  2314. rev 2 of file 2
  2315. >>>>>>> 1\.1\.1\.2'
  2316.  
  2317.         cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
  2318.         rm -rf import-dir
  2319.         ;;
  2320.  
  2321.     join)
  2322.       # Test doing joins which involve adding and removing files.
  2323.  
  2324.       # We check merging changes from T1 to T2 into the main line.
  2325.       # Here are the interesting cases I can think of:
  2326.       #   1) File added between T1 and T2, not on main line.
  2327.       #      File should be marked for addition.
  2328.       #   2) File added between T1 and T2, also added on main line.
  2329.       #      Conflict.
  2330.       #   3) File removed between T1 and T2, unchanged on main line.
  2331.       #      File should be marked for removal.
  2332.       #   4) File removed between T1 and T2, modified on main line.
  2333.       #      If mod checked in, file should be marked for removal.
  2334.       #     If mod still in working directory, conflict.
  2335.       #   5) File removed between T1 and T2, was never on main line.
  2336.       #      Nothing should happen.
  2337.       #   6) File removed between T1 and T2, also removed on main line.
  2338.       #      Nothing should happen.
  2339.       #   7) File added on main line, not added between T1 and T2.
  2340.       #      Nothing should happen.
  2341.       #   8) File removed on main line, not modified between T1 and T2.
  2342.       #      Nothing should happen.
  2343.  
  2344.       # We also check merging changes from a branch into the main
  2345.       # line.  Here are the interesting cases:
  2346.       #   1) File added on branch, not on main line.
  2347.       #      File should be marked for addition.
  2348.       #   2) File added on branch, also added on main line.
  2349.       #      Conflict.
  2350.       #   3) File removed on branch, unchanged on main line.
  2351.       #      File should be marked for removal.
  2352.       #   4) File removed on branch, modified on main line.
  2353.       #      Conflict.
  2354.       #   5) File removed on branch, was never on main line.
  2355.       #      Nothing should happen.
  2356.       #   6) File removed on branch, also removed on main line.
  2357.       #      Nothing should happen.
  2358.       #   7) File added on main line, not added on branch.
  2359.       #      Nothing should happen.
  2360.       #   8) File removed on main line, not modified on branch.
  2361.       #      Nothing should happen.
  2362.  
  2363.       # In the tests below, fileN represents case N in the above
  2364.       # lists.
  2365.  
  2366.       mkdir ${CVSROOT_DIRNAME}/first-dir
  2367.       mkdir 1
  2368.       cd 1
  2369.       dotest join-1 "${testcvs} -q co first-dir" ''
  2370.  
  2371.       cd first-dir
  2372.  
  2373.       # Add two files.
  2374.       echo 'first revision of file3' > file3
  2375.       echo 'first revision of file4' > file4
  2376.       echo 'first revision of file6' > file6
  2377.       echo 'first revision of file8' > file8
  2378.       dotest join-2 "${testcvs} add file3 file4 file6 file8" \
  2379. "${PROG}"' [a-z]*: scheduling file `file3'\'' for addition
  2380. '"${PROG}"' [a-z]*: scheduling file `file4'\'' for addition
  2381. '"${PROG}"' [a-z]*: scheduling file `file6'\'' for addition
  2382. '"${PROG}"' [a-z]*: scheduling file `file8'\'' for addition
  2383. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently'
  2384.  
  2385.       dotest join-3 "${testcvs} -q commit -m add" \
  2386. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file3,v
  2387. done
  2388. Checking in file3;
  2389. /tmp/cvs-sanity/cvsroot/first-dir/file3,v  <--  file3
  2390. initial revision: 1\.1
  2391. done
  2392. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file4,v
  2393. done
  2394. Checking in file4;
  2395. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  2396. initial revision: 1\.1
  2397. done
  2398. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file6,v
  2399. done
  2400. Checking in file6;
  2401. /tmp/cvs-sanity/cvsroot/first-dir/file6,v  <--  file6
  2402. initial revision: 1\.1
  2403. done
  2404. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file8,v
  2405. done
  2406. Checking in file8;
  2407. /tmp/cvs-sanity/cvsroot/first-dir/file8,v  <--  file8
  2408. initial revision: 1\.1
  2409. done'
  2410.  
  2411.       # Make a branch.
  2412.       dotest join-4 "${testcvs} -q tag -b branch ." \
  2413. 'T file3
  2414. T file4
  2415. T file6
  2416. T file8'
  2417.  
  2418.       # Add file2 and file7, modify file4, and remove file6 and file8.
  2419.       echo 'first revision of file2' > file2
  2420.       echo 'second revision of file4' > file4
  2421.       echo 'first revision of file7' > file7
  2422.       rm file6 file8
  2423.       dotest join-5 "${testcvs} add file2 file7" \
  2424. "${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
  2425. '"${PROG}"' [a-z]*: scheduling file `file7'\'' for addition
  2426. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently'
  2427.       dotest join-6 "${testcvs} rm file6 file8" \
  2428. "${PROG}"' [a-z]*: scheduling `file6'\'' for removal
  2429. '"${PROG}"' [a-z]*: scheduling `file8'\'' for removal
  2430. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to remove these files permanently'
  2431.       dotest join-7 "${testcvs} -q ci -mx ." \
  2432. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file2,v
  2433. done
  2434. Checking in file2;
  2435. /tmp/cvs-sanity/cvsroot/first-dir/file2,v  <--  file2
  2436. initial revision: 1\.1
  2437. done
  2438. Checking in file4;
  2439. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  2440. new revision: 1\.2; previous revision: 1\.1
  2441. done
  2442. Removing file6;
  2443. /tmp/cvs-sanity/cvsroot/first-dir/file6,v  <--  file6
  2444. new revision: delete; previous revision: 1\.1
  2445. done
  2446. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file7,v
  2447. done
  2448. Checking in file7;
  2449. /tmp/cvs-sanity/cvsroot/first-dir/file7,v  <--  file7
  2450. initial revision: 1\.1
  2451. done
  2452. Removing file8;
  2453. /tmp/cvs-sanity/cvsroot/first-dir/file8,v  <--  file8
  2454. new revision: delete; previous revision: 1\.1
  2455. done'
  2456.  
  2457.       # Check out the branch.
  2458.       cd ../..
  2459.       mkdir 2
  2460.       cd 2
  2461.       dotest join-8 "${testcvs} -q co -r branch first-dir" \
  2462. 'U first-dir/file3
  2463. U first-dir/file4
  2464. U first-dir/file6
  2465. U first-dir/file8'
  2466.  
  2467.       cd first-dir
  2468.  
  2469.       # Modify the files on the branch, so that T1 is not an
  2470.       # ancestor of the main line, and add file5
  2471.       echo 'first branch revision of file3' > file3
  2472.       echo 'first branch revision of file4' > file4
  2473.       echo 'first branch revision of file6' > file6
  2474.       echo 'first branch revision of file5' > file5
  2475.       dotest join-9 "${testcvs} add file5" \
  2476. "${PROG}"' [a-z]*: scheduling file `file5'\'' for addition on branch `branch'\''
  2477. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  2478.       dotest join-10 "${testcvs} -q ci -mx ." \
  2479. 'Checking in file3;
  2480. /tmp/cvs-sanity/cvsroot/first-dir/file3,v  <--  file3
  2481. new revision: 1\.1\.2\.1; previous revision: 1\.1
  2482. done
  2483. Checking in file4;
  2484. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  2485. new revision: 1\.1\.2\.1; previous revision: 1\.1
  2486. done
  2487. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/Attic/file5,v
  2488. done
  2489. Checking in file5;
  2490. /tmp/cvs-sanity/cvsroot/first-dir/Attic/file5,v  <--  file5
  2491. new revision: 1\.1\.2\.1; previous revision: 1\.1
  2492. done
  2493. Checking in file6;
  2494. /tmp/cvs-sanity/cvsroot/first-dir/Attic/file6,v  <--  file6
  2495. new revision: 1\.1\.2\.1; previous revision: 1\.1
  2496. done'
  2497.  
  2498.       # Tag the current revisions on the branch.
  2499.       dotest join-11 "${testcvs} -q tag T1 ." \
  2500. 'T file3
  2501. T file4
  2502. T file5
  2503. T file6
  2504. T file8'
  2505.  
  2506.       # Add file1 and file2, and remove the other files.
  2507.       echo 'first branch revision of file1' > file1
  2508.       echo 'first branch revision of file2' > file2
  2509.       rm file3 file4 file5 file6
  2510.       dotest join-12 "${testcvs} add file1 file2" \
  2511. "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition on branch `branch'\''
  2512. '"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition on branch `branch'\''
  2513. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently'
  2514.       dotest join-13 "${testcvs} rm file3 file4 file5 file6" \
  2515. "${PROG}"' [a-z]*: scheduling `file3'\'' for removal
  2516. '"${PROG}"' [a-z]*: scheduling `file4'\'' for removal
  2517. '"${PROG}"' [a-z]*: scheduling `file5'\'' for removal
  2518. '"${PROG}"' [a-z]*: scheduling `file6'\'' for removal
  2519. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to remove these files permanently'
  2520.       dotest join-14 "${testcvs} -q ci -mx ." \
  2521. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v
  2522. done
  2523. Checking in file1;
  2524. /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v  <--  file1
  2525. new revision: 1\.1\.2\.1; previous revision: 1\.1
  2526. done
  2527. Checking in file2;
  2528. /tmp/cvs-sanity/cvsroot/first-dir/file2,v  <--  file2
  2529. new revision: 1\.1\.2\.1; previous revision: 1\.1
  2530. done
  2531. Removing file3;
  2532. /tmp/cvs-sanity/cvsroot/first-dir/file3,v  <--  file3
  2533. new revision: delete; previous revision: 1\.1\.2\.1
  2534. done
  2535. Removing file4;
  2536. /tmp/cvs-sanity/cvsroot/first-dir/file4,v  <--  file4
  2537. new revision: delete; previous revision: 1\.1\.2\.1
  2538. done
  2539. Removing file5;
  2540. /tmp/cvs-sanity/cvsroot/first-dir/Attic/file5,v  <--  file5
  2541. new revision: delete; previous revision: 1\.1\.2\.1
  2542. done
  2543. Removing file6;
  2544. /tmp/cvs-sanity/cvsroot/first-dir/Attic/file6,v  <--  file6
  2545. new revision: delete; previous revision: 1\.1\.2\.1
  2546. done'
  2547.  
  2548.       # Tag the current revisions on the branch.
  2549.       dotest join-15 "${testcvs} -q tag T2 ." \
  2550. 'T file1
  2551. T file2
  2552. T file8'
  2553.  
  2554.       # Do a checkout with a merge.
  2555.       cd ../..
  2556.       mkdir 3
  2557.       cd 3
  2558.       dotest join-16 "${testcvs} -q co -jT1 -jT2 first-dir" \
  2559. 'U first-dir/file1
  2560. U first-dir/file2
  2561. '"${PROG}"' [a-z]*: file first-dir/file2 exists, but has been added in revision T2
  2562. U first-dir/file3
  2563. '"${PROG}"' [a-z]*: scheduling first-dir/file3 for removal
  2564. U first-dir/file4
  2565. '"${PROG}"' [a-z]*: scheduling first-dir/file4 for removal
  2566. U first-dir/file7'
  2567.  
  2568.       # Verify that the right changes have been scheduled.
  2569.       cd first-dir
  2570.       dotest join-17 "${testcvs} -q update" \
  2571. 'A file1
  2572. R file3
  2573. R file4'
  2574.  
  2575.       # Modify file4 locally, and do an update with a merge.
  2576.       cd ../../1/first-dir
  2577.       echo 'third revision of file4' > file4
  2578.       dotest join-18 "${testcvs} -q update -jT1 -jT2 ." \
  2579. 'U file1
  2580. '"${PROG}"' [a-z]*: file file2 exists, but has been added in revision T2
  2581. '"${PROG}"' [a-z]*: scheduling file3 for removal
  2582. M file4
  2583. '"${PROG}"' [a-z]*: file file4 is locally modified, but has been removed in revision T2'
  2584.  
  2585.       # Verify that the right changes have been scheduled.
  2586.       dotest join-19 "${testcvs} -q update" \
  2587. 'A file1
  2588. R file3
  2589. M file4'
  2590.  
  2591.       # Do a checkout with a merge from a single revision.
  2592.  
  2593.       # FIXME: CVS currently gets this wrong.  file2 has been
  2594.       # added on both the branch and the main line, and so should
  2595.       # be regarded as a conflict.  However, given the way that
  2596.       # CVS sets up the RCS file, there is no way to distinguish
  2597.       # this case from the case of file2 having existed before the
  2598.       # branch was made.  This could be fixed by reserving
  2599.       # a revision somewhere, perhaps 1.1, as an always dead
  2600.       # revision which can be used as the source for files added
  2601.       # on branches.
  2602.       cd ../../3
  2603.       rm -rf first-dir
  2604.       dotest join-20 "${testcvs} -q co -jbranch first-dir" \
  2605. 'U first-dir/file1
  2606. U first-dir/file2
  2607. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file2,v
  2608. retrieving revision 1\.1
  2609. retrieving revision 1\.1\.2\.1
  2610. Merging differences between 1\.1 and 1\.1\.2\.1 into file2
  2611. U first-dir/file3
  2612. '"${PROG}"' [a-z]*: scheduling first-dir/file3 for removal
  2613. U first-dir/file4
  2614. '"${PROG}"' [a-z]*: file first-dir/file4 has been modified, but has been removed in revision branch
  2615. U first-dir/file7'
  2616.  
  2617.       # Verify that the right changes have been scheduled.
  2618.       # The M file2 line is a bug; see above join-20.
  2619.       cd first-dir
  2620.       dotest join-21 "${testcvs} -q update" \
  2621. 'A file1
  2622. M file2
  2623. R file3'
  2624.  
  2625.       # Checkout the main line again.
  2626.       cd ../../1
  2627.       rm -rf first-dir
  2628.       dotest join-22 "${testcvs} -q co first-dir" \
  2629. 'U first-dir/file2
  2630. U first-dir/file3
  2631. U first-dir/file4
  2632. U first-dir/file7'
  2633.  
  2634.       # Modify file4 locally, and do an update with a merge from a
  2635.       # single revision.
  2636.       # The file2 handling is a bug; see above join-20.
  2637.       cd first-dir
  2638.       echo 'third revision of file4' > file4
  2639.       dotest join-23 "${testcvs} -q update -jbranch ." \
  2640. 'U file1
  2641. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file2,v
  2642. retrieving revision 1\.1
  2643. retrieving revision 1\.1\.2\.1
  2644. Merging differences between 1\.1 and 1\.1\.2\.1 into file2
  2645. '"${PROG}"' [a-z]*: scheduling file3 for removal
  2646. M file4
  2647. '"${PROG}"' [a-z]*: file file4 is locally modified, but has been removed in revision branch'
  2648.  
  2649.       # Verify that the right changes have been scheduled.
  2650.       # The M file2 line is a bug; see above join-20
  2651.       dotest join-24 "${testcvs} -q update" \
  2652. 'A file1
  2653. M file2
  2654. R file3
  2655. M file4'
  2656.  
  2657.       cd ../..
  2658.       rm -rf 1 2 3 ${CVSROOT_DIRNAME}/first-dir
  2659.       ;;
  2660.  
  2661.     new) # look for stray "no longer pertinent" messages.
  2662.         mkdir ${CVSROOT_DIRNAME}/first-dir
  2663.  
  2664.         if ${CVS} co first-dir  ; then
  2665.             echo "PASS: test 117" >>${LOGFILE}
  2666.         else
  2667.             echo "FAIL: test 117" | tee -a ${LOGFILE} ; exit 1
  2668.         fi
  2669.  
  2670.         cd first-dir
  2671.         touch a
  2672.  
  2673.         if ${CVS} add a  2>>${LOGFILE}; then
  2674.             echo "PASS: test 118" >>${LOGFILE}
  2675.         else
  2676.             echo "FAIL: test 118" | tee -a ${LOGFILE} ; exit 1
  2677.         fi
  2678.  
  2679.         if ${CVS} ci -m added  >>${LOGFILE} 2>&1; then
  2680.             echo "PASS: test 119" >>${LOGFILE}
  2681.         else
  2682.             echo "FAIL: test 119" | tee -a ${LOGFILE} ; exit 1
  2683.         fi
  2684.  
  2685.         rm a
  2686.  
  2687.         if ${CVS} rm a  2>>${LOGFILE}; then
  2688.             echo "PASS: test 120" >>${LOGFILE}
  2689.         else
  2690.             echo "FAIL: test 120" | tee -a ${LOGFILE} ; exit 1
  2691.         fi
  2692.  
  2693.         if ${CVS} ci -m removed >>${LOGFILE} ; then
  2694.             echo "PASS: test 121" >>${LOGFILE}
  2695.         else
  2696.             echo "FAIL: test 121" | tee -a ${LOGFILE} ; exit 1
  2697.         fi
  2698.  
  2699.         if ${CVS} update -A  2>&1 | grep longer ; then
  2700.             echo "FAIL: test 122" | tee -a ${LOGFILE} ; exit 1
  2701.         else
  2702.             echo "PASS: test 122" >>${LOGFILE}
  2703.         fi
  2704.  
  2705.         if ${CVS} update -rHEAD 2>&1 | grep longer ; then
  2706.             echo "FAIL: test 123" | tee -a ${LOGFILE} ; exit 1
  2707.         else
  2708.             echo "PASS: test 123" >>${LOGFILE}
  2709.         fi
  2710.  
  2711.         cd .. ; rm -rf first-dir ; rm -rf ${CVSROOT_DIRNAME}/first-dir
  2712.         ;;
  2713.  
  2714.     newb)
  2715.       # Test removing a file on a branch and then checking it out.
  2716.  
  2717.       # We call this "newb" only because it, like the "new" tests,
  2718.       # has something to do with "no longer pertinent" messages.
  2719.       # Not necessarily the most brilliant nomenclature.
  2720.  
  2721.       # Create file 'a'.
  2722.       mkdir ${CVSROOT_DIRNAME}/first-dir
  2723.       dotest newb-123a "${testcvs} -q co first-dir" ''
  2724.       cd first-dir
  2725.       touch a
  2726.       dotest newb-123b "${testcvs} add a" \
  2727. "${PROG} [a-z]*: scheduling file .a. for addition
  2728. ${PROG} [a-z]*: use .cvs commit. to add this file permanently"
  2729.       dotest newb-123c "${testcvs} -q ci -m added" \
  2730. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/a,v
  2731. done
  2732. Checking in a;
  2733. /tmp/cvs-sanity/cvsroot/first-dir/a,v  <--  a
  2734. initial revision: 1\.1
  2735. done'
  2736.  
  2737.       # Make a branch.
  2738.       dotest newb-123d "${testcvs} -q tag -b branch" "T a"
  2739.  
  2740.       # Check out the branch.
  2741.       cd ..
  2742.       rm -rf first-dir
  2743.       mkdir 1
  2744.       cd 1
  2745.       dotest newb-123e "${testcvs} -q co -r branch first-dir" \
  2746. "U first-dir/a"
  2747.  
  2748.       # Remove 'a' on another copy of the branch.
  2749.       cd ..
  2750.       mkdir 2
  2751.       cd 2
  2752.       dotest newb-123f "${testcvs} -q co -r branch first-dir" \
  2753. "U first-dir/a"
  2754.       cd first-dir
  2755.       rm a
  2756.       dotest newb-123g "${testcvs} rm a" \
  2757. "${PROG} [a-z]*: scheduling .a. for removal
  2758. ${PROG} [a-z]*: use .cvs commit. to remove this file permanently"
  2759.       dotest newb-123h "${testcvs} -q ci -m removed" \
  2760. 'Removing a;
  2761. /tmp/cvs-sanity/cvsroot/first-dir/a,v  <--  a
  2762. new revision: delete; previous revision: 1\.1\.2
  2763. done'
  2764.  
  2765.       # Check out the file on the branch.  This should report
  2766.       # that the file is not pertinent, but it should not
  2767.       # say anything else.
  2768.       cd ..
  2769.       rm -rf first-dir
  2770.       dotest newb-123i "${testcvs} -q co -r branch first-dir/a" \
  2771. "${PROG} [a-z]*: warning: first-dir/a is not (any longer) pertinent"
  2772.  
  2773.       # Update the other copy, and make sure that a is removed.
  2774.       cd ../1/first-dir
  2775.       dotest newb-123j "${testcvs} -q update" \
  2776. "${PROG} [a-z]*: warning: a is not (any longer) pertinent"
  2777.  
  2778.       if test -f a; then
  2779.         fail newb-123k
  2780.       else
  2781.         pass newb-123k
  2782.       fi
  2783.  
  2784.       cd ../..
  2785.       rm -rf 1 2 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
  2786.       ;;
  2787.  
  2788.     conflicts)
  2789.         mkdir ${CVSROOT_DIRNAME}/first-dir
  2790.  
  2791.         mkdir 1
  2792.         cd 1
  2793.  
  2794.         dotest conflicts-124 "${testcvs} -q co first-dir" ''
  2795.  
  2796.         cd first-dir
  2797.         touch a
  2798.  
  2799.         dotest conflicts-125 "${testcvs} add a" \
  2800. "${PROG} [a-z]*: scheduling file .a. for addition
  2801. ${PROG} [a-z]*: use .cvs commit. to add this file permanently"
  2802.         dotest conflicts-126 "${testcvs} -q ci -m added" \
  2803. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/a,v
  2804. done
  2805. Checking in a;
  2806. /tmp/cvs-sanity/cvsroot/first-dir/a,v  <--  a
  2807. initial revision: 1\.1
  2808. done'
  2809.  
  2810.         cd ../..
  2811.         mkdir 2
  2812.         cd 2
  2813.  
  2814.         # TODO-maybe: we could also check this (also in an empty
  2815.         # directory) after the file has nonempty contents.
  2816.         #
  2817.         # The need for TMPPWD here is a (minor) CVS bug; the
  2818.         # output should use the name of the repository as specified.
  2819.         dotest conflicts-126.5 "${testcvs} co -p first-dir" \
  2820. "${PROG} [a-z]*"': Updating first-dir
  2821. ===================================================================
  2822. Checking out first-dir/a
  2823. RCS:  '"${TMPPWD}"'/cvs-sanity/cvsroot/first-dir/a,v
  2824. VERS: 1\.1
  2825. \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*'
  2826.         if ${CVS} co first-dir ; then
  2827.             echo 'PASS: test 127' >>${LOGFILE}
  2828.         else
  2829.             echo 'FAIL: test 127' | tee -a ${LOGFILE}
  2830.         fi
  2831.         cd first-dir
  2832.         if test -f a; then
  2833.             echo 'PASS: test 127a' >>${LOGFILE}
  2834.         else
  2835.             echo 'FAIL: test 127a' | tee -a ${LOGFILE}
  2836.         fi
  2837.  
  2838.         cd ../../1/first-dir
  2839.         echo add a line >>a
  2840.         mkdir dir1
  2841.         dotest conflicts-127b "${testcvs} add dir1" \
  2842. 'Directory /tmp/cvs-sanity/cvsroot/first-dir/dir1 added to the repository'
  2843.         dotest conflicts-128 "${testcvs} -q ci -m changed" \
  2844. 'Checking in a;
  2845. /tmp/cvs-sanity/cvsroot/first-dir/a,v  <--  a
  2846. new revision: 1.2; previous revision: 1.1
  2847. done'
  2848.         cd ../../2/first-dir
  2849.         echo add a conflicting line >>a
  2850.         dotest_fail conflicts-129 "${testcvs} -q ci -m changed" \
  2851. "${PROG}"' [a-z]*: Up-to-date check failed for `a'\''
  2852. '"${PROG}"' \[[a-z]* aborted\]: correct above errors first!'
  2853.         mkdir dir1
  2854.         mkdir sdir
  2855.         dotest conflicts-130 "${testcvs} -q update" \
  2856. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/a,v
  2857. retrieving revision 1.1
  2858. retrieving revision 1.2
  2859. Merging differences between 1.1 and 1.2 into a
  2860. rcsmerge: warning: conflicts during merge
  2861. '"${PROG}"' [a-z]*: conflicts found in a
  2862. C a
  2863. '"${QUESTION}"' dir1
  2864. '"${QUESTION}"' sdir' \
  2865. ''"${QUESTION}"' dir1
  2866. '"${QUESTION}"' sdir
  2867. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/a,v
  2868. retrieving revision 1.1
  2869. retrieving revision 1.2
  2870. Merging differences between 1.1 and 1.2 into a
  2871. rcsmerge: warning: conflicts during merge
  2872. '"${PROG}"' [a-z]*: conflicts found in a
  2873. C a'
  2874.         rmdir dir1 sdir
  2875.  
  2876.         # Try to check in the file with the conflict markers in it.
  2877.         if ${CVS} ci -m try 2>>${LOGFILE}; then
  2878.             echo 'FAIL: test 131' | tee -a ${LOGFILE}
  2879.         else
  2880.             # Should tell us to resolve conflict first
  2881.             echo 'PASS: test 131' >>${LOGFILE}
  2882.         fi
  2883.  
  2884.         echo lame attempt at resolving it >>a
  2885.         # Try to check in the file with the conflict markers in it.
  2886.         if ${CVS} ci -m try >>${LOGFILE} 2>&1; then
  2887.             echo 'FAIL: test 132' | tee -a ${LOGFILE}
  2888.         else
  2889.             # Should tell us to resolve conflict first
  2890.             echo 'PASS: test 132' >>${LOGFILE}
  2891.         fi
  2892.  
  2893.         echo resolve conflict >a
  2894.         if ${CVS} ci -m resolved >>${LOGFILE} 2>&1; then
  2895.             echo 'PASS: test 133' >>${LOGFILE}
  2896.         else
  2897.             echo 'FAIL: test 133' | tee -a ${LOGFILE}
  2898.         fi
  2899.  
  2900.         # Now test that we can add a file in one working directory
  2901.         # and have an update in another get it.
  2902.         cd ../../1/first-dir
  2903.         echo abc >abc
  2904.         if ${testcvs} add abc >>${LOGFILE} 2>&1; then
  2905.             echo 'PASS: test 134' >>${LOGFILE}
  2906.         else
  2907.             echo 'FAIL: test 134' | tee -a ${LOGFILE}
  2908.         fi
  2909.         if ${testcvs} ci -m 'add abc' abc >>${LOGFILE} 2>&1; then
  2910.             echo 'PASS: test 135' >>${LOGFILE}
  2911.         else
  2912.             echo 'FAIL: test 135' | tee -a ${LOGFILE}
  2913.         fi
  2914.         cd ../../2
  2915.         mkdir first-dir/dir1 first-dir/sdir
  2916.         dotest conflicts-136 "${testcvs} -q update" \
  2917. '[UP] first-dir/abc
  2918. '"${QUESTION}"' first-dir/dir1
  2919. '"${QUESTION}"' first-dir/sdir' \
  2920. ''"${QUESTION}"' first-dir/dir1
  2921. '"${QUESTION}"' first-dir/sdir
  2922. [UP] first-dir/abc'
  2923.         dotest conflicts-137 'test -f first-dir/abc' ''
  2924.         rmdir first-dir/dir1 first-dir/sdir
  2925.  
  2926.         # Now test something similar, but in which the parent directory
  2927.         # (not the directory in question) has the Entries.Static flag
  2928.         # set.
  2929.         cd ../1/first-dir
  2930.         mkdir subdir
  2931.         if ${testcvs} add subdir >>${LOGFILE}; then
  2932.             echo 'PASS: test 138' >>${LOGFILE}
  2933.         else
  2934.             echo 'FAIL: test 138' | tee -a ${LOGFILE}
  2935.         fi
  2936.         cd ../..
  2937.         mkdir 3
  2938.         cd 3
  2939.         if ${testcvs} -q co first-dir/abc first-dir/subdir \
  2940.             >>${LOGFILE}; then
  2941.           echo 'PASS: test 139' >>${LOGFILE}
  2942.         else
  2943.           echo 'FAIL: test 139' | tee -a ${LOGFILE}
  2944.         fi
  2945.         cd ../1/first-dir/subdir
  2946.         echo sss >sss
  2947.         if ${testcvs} add sss >>${LOGFILE} 2>&1; then
  2948.           echo 'PASS: test 140' >>${LOGFILE}
  2949.         else
  2950.           echo 'FAIL: test 140' | tee -a ${LOGFILE}
  2951.         fi
  2952.         if ${testcvs} ci -m adding sss >>${LOGFILE} 2>&1; then
  2953.           echo 'PASS: test 140' >>${LOGFILE}
  2954.         else
  2955.           echo 'FAIL: test 140' | tee -a ${LOGFILE}
  2956.         fi
  2957.         cd ../../../3/first-dir
  2958.         if ${testcvs} -q update >>${LOGFILE}; then
  2959.           echo 'PASS: test 141' >>${LOGFILE}
  2960.         else
  2961.           echo 'FAIL: test 141' | tee -a ${LOGFILE}
  2962.         fi
  2963.         if test -f subdir/sss; then
  2964.           echo 'PASS: test 142' >>${LOGFILE}
  2965.         else
  2966.           echo 'FAIL: test 142' | tee -a ${LOGFILE}
  2967.         fi
  2968.         cd ../..
  2969.         rm -rf 1 2 3 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
  2970.         ;;
  2971.  
  2972.     conflicts2)
  2973.       # More conflicts tests; separate from conflicts to keep each
  2974.       # test a manageable size.
  2975.       mkdir ${CVSROOT_DIRNAME}/first-dir
  2976.  
  2977.       mkdir 1
  2978.       cd 1
  2979.  
  2980.       dotest conflicts2-142a1 "${testcvs} -q co first-dir" ''
  2981.  
  2982.       cd first-dir
  2983.       touch a abc
  2984.  
  2985.       dotest conflicts2-142a2 "${testcvs} add a abc" \
  2986. "${PROG} [a-z]*: scheduling file .a. for addition
  2987. ${PROG} [a-z]*: scheduling file .abc. for addition
  2988. ${PROG} [a-z]*: use .cvs commit. to add these files permanently"
  2989.       dotest conflicts2-142a3 "${testcvs} -q ci -m added" \
  2990. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/a,v
  2991. done
  2992. Checking in a;
  2993. /tmp/cvs-sanity/cvsroot/first-dir/a,v  <--  a
  2994. initial revision: 1\.1
  2995. done
  2996. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/abc,v
  2997. done
  2998. Checking in abc;
  2999. /tmp/cvs-sanity/cvsroot/first-dir/abc,v  <--  abc
  3000. initial revision: 1\.1
  3001. done'
  3002.  
  3003.       cd ../..
  3004.       mkdir 2
  3005.       cd 2
  3006.  
  3007.       dotest conflicts2-142a4 "${testcvs} -q co first-dir" 'U first-dir/a
  3008. U first-dir/abc'
  3009.       cd ..
  3010.  
  3011.       # Now test that if one person modifies and commits a
  3012.       # file and a second person removes it, it is a
  3013.       # conflict
  3014.       cd 1/first-dir
  3015.       echo modify a >>a
  3016.       dotest conflicts2-142b2 "${testcvs} -q ci -m modify-a" \
  3017. 'Checking in a;
  3018. /tmp/cvs-sanity/cvsroot/first-dir/a,v  <--  a
  3019. new revision: 1\.2; previous revision: 1\.1
  3020. done'
  3021.       cd ../../2/first-dir
  3022.       rm a
  3023.       dotest conflicts2-142b3 "${testcvs} rm a" \
  3024. "${PROG} [a-z]*: scheduling .a. for removal
  3025. ${PROG} [a-z]*: use .cvs commit. to remove this file permanently"
  3026.       dotest_fail conflicts2-142b4 "${testcvs} -q update" \
  3027. "${PROG} [a-z]*: conflict: removed a was modified by second party
  3028. C a"
  3029.       # Resolve the conflict by deciding not to remove the file
  3030.       # after all.
  3031.       dotest conflicts2-142b5 "${testcvs} add a" "U a
  3032. ${PROG} [a-z]*: a, version 1\.1, resurrected"
  3033.       dotest conflicts2-142b6 "${testcvs} -q update" ''
  3034.       cd ../..
  3035.  
  3036.       # Now test that if one person removes a file and
  3037.       # commits it, and a second person removes it, is it
  3038.       # not a conflict.
  3039.       cd 1/first-dir
  3040.       rm abc
  3041.       dotest conflicts2-142c0 "${testcvs} rm abc" \
  3042. "${PROG} [a-z]*: scheduling .abc. for removal
  3043. ${PROG} [a-z]*: use .cvs commit. to remove this file permanently"
  3044.       dotest conflicts2-142c1 "${testcvs} -q ci -m remove-abc" \
  3045. 'Removing abc;
  3046. /tmp/cvs-sanity/cvsroot/first-dir/abc,v  <--  abc
  3047. new revision: delete; previous revision: 1\.1
  3048. done'
  3049.       cd ../../2/first-dir
  3050.       rm abc
  3051.       dotest conflicts2-142c2 "${testcvs} rm abc" \
  3052. "${PROG} [a-z]*: scheduling .abc. for removal
  3053. ${PROG} [a-z]*: use .cvs commit. to remove this file permanently"
  3054.       dotest conflicts2-142c3 "${testcvs} update" \
  3055. "${PROG} [a-z]*: Updating \."
  3056.       cd ../..
  3057.  
  3058.       # conflicts2-142d*: test that if one party adds a file, and another
  3059.       # party has a file of the same name, cvs notices
  3060.       cd 1/first-dir
  3061.       touch aa.c
  3062.       dotest conflicts2-142d0 "${testcvs} add aa.c" \
  3063. "${PROG} [a-z]*: scheduling file .aa\.c. for addition
  3064. ${PROG} [a-z]*: use .cvs commit. to add this file permanently"
  3065.       dotest conflicts2-142d1 "${testcvs} -q ci -m added" \
  3066. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/aa.c,v
  3067. done
  3068. Checking in aa.c;
  3069. /tmp/cvs-sanity/cvsroot/first-dir/aa.c,v  <--  aa.c
  3070. initial revision: 1\.1
  3071. done'
  3072.       cd ../../2/first-dir
  3073.       echo "don't you dare obliterate this text" >aa.c
  3074.       # Doing this test separately for remote and local is a fair
  3075.       # bit of a kludge, but the exit status differs.  I'm not sure
  3076.       # which exit status is the more appropriate one.
  3077.       if test "$remote" = yes; then
  3078.         dotest conflicts2-142d2 "${testcvs} -q update" \
  3079. "${QUESTION} aa\.c
  3080. U aa\.c
  3081. ${PROG} update: move away \./aa\.c; it is in the way"
  3082.       else
  3083.         dotest_fail conflicts2-142d2 "${testcvs} -q update" \
  3084. "${PROG} [a-z]*: move away aa\.c; it is in the way
  3085. C aa\.c"
  3086.       fi
  3087.       cd ../..
  3088.  
  3089.       rm -rf 1 2 ; rm -rf ${CVSROOT_DIRNAME}/first-dir
  3090.       ;;
  3091.  
  3092.     modules)
  3093.       rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
  3094.       mkdir ${CVSROOT_DIRNAME}/first-dir
  3095.  
  3096.       mkdir 1
  3097.       cd 1
  3098.  
  3099.       if ${testcvs} -q co first-dir; then
  3100.         echo 'PASS: test 143' >>${LOGFILE}
  3101.       else
  3102.         echo 'FAIL: test 143' | tee -a ${LOGFILE}
  3103.         exit 1
  3104.       fi
  3105.  
  3106.       cd first-dir
  3107.       mkdir subdir
  3108.       ${testcvs} add subdir >>${LOGFILE}
  3109.       cd subdir
  3110.  
  3111.       mkdir ssdir
  3112.       ${testcvs} add ssdir >>${LOGFILE}
  3113.  
  3114.       touch a b
  3115.  
  3116.       if ${testcvs} add a b 2>>${LOGFILE} ; then
  3117.         echo 'PASS: test 144' >>${LOGFILE}
  3118.       else
  3119.         echo 'FAIL: test 144' | tee -a ${LOGFILE}
  3120.         exit 1
  3121.       fi
  3122.  
  3123.       if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
  3124.         echo 'PASS: test 145' >>${LOGFILE}
  3125.       else
  3126.         echo 'FAIL: test 145' | tee -a ${LOGFILE}
  3127.         exit 1
  3128.       fi
  3129.  
  3130.       cd ..
  3131.       if ${testcvs} -q co CVSROOT >>${LOGFILE}; then
  3132.         echo 'PASS: test 146' >>${LOGFILE}
  3133.       else
  3134.         echo 'FAIL: test 146' | tee -a ${LOGFILE}
  3135.         exit 1
  3136.       fi
  3137.  
  3138.       # Here we test that CVS can deal with CVSROOT (whose repository
  3139.       # is at top level) in the same directory as subdir (whose repository
  3140.       # is a subdirectory of first-dir).  TODO: Might want to check that
  3141.       # files can actually get updated in this state.
  3142.       if ${testcvs} -q update; then
  3143.         echo 'PASS: test 147' >>${LOGFILE}
  3144.       else
  3145.         echo 'FAIL: test 147' | tee -a ${LOGFILE}
  3146.         exit 1
  3147.       fi
  3148.  
  3149.       echo realmodule first-dir/subdir a >>CVSROOT/modules
  3150.       echo dirmodule first-dir/subdir >>CVSROOT/modules
  3151.       echo namedmodule -d nameddir first-dir/subdir >>CVSROOT/modules
  3152.       echo aliasmodule -a first-dir/subdir/a >>CVSROOT/modules
  3153.       echo aliasnested -a first-dir/subdir/ssdir >>CVSROOT/modules
  3154.       echo topfiles -a first-dir/file1 first-dir/file2 >>CVSROOT/modules
  3155.       echo world -a . >>CVSROOT/modules
  3156.  
  3157.       # Options must come before arguments.  It is possible this should
  3158.       # be relaxed at some point (though the result would be bizarre for
  3159.       # -a); for now test the current behavior.
  3160.       echo bogusalias first-dir/subdir/a -a >>CVSROOT/modules
  3161.       if ${testcvs} ci -m 'add modules' CVSROOT/modules \
  3162.           >>${LOGFILE} 2>&1; then
  3163.         echo 'PASS: test 148' >>${LOGFILE}
  3164.       else
  3165.         echo 'FAIL: test 148' | tee -a ${LOGFILE}
  3166.         exit 1
  3167.       fi
  3168.       cd ..
  3169.       dotest 148a0 "${testcvs} co -c" 'CVSROOT      CVSROOT
  3170. aliasmodule  -a first-dir/subdir/a
  3171. aliasnested  -a first-dir/subdir/ssdir
  3172. bogusalias   first-dir/subdir/a -a
  3173. dirmodule    first-dir/subdir
  3174. namedmodule  -d nameddir first-dir/subdir
  3175. realmodule   first-dir/subdir a
  3176. topfiles     -a first-dir/file1 first-dir/file2
  3177. world        -a .'
  3178.       # I don't know why aliasmodule isn't printed (I would have thought
  3179.       # that it gets printed without the -a; although I'm not sure that
  3180.       # printing expansions without options is useful).
  3181.       dotest 148a1 "${testcvs} co -s" 'CVSROOT      NONE        CVSROOT
  3182. bogusalias   NONE        first-dir/subdir/a -a
  3183. dirmodule    NONE        first-dir/subdir
  3184. namedmodule  NONE        first-dir/subdir
  3185. realmodule   NONE        first-dir/subdir a'
  3186.  
  3187.       # Test that real modules check out to realmodule/a, not subdir/a.
  3188.       if ${testcvs} co realmodule >>${LOGFILE}; then
  3189.         echo 'PASS: test 149a1' >>${LOGFILE}
  3190.       else
  3191.         echo 'FAIL: test 149a1' | tee -a ${LOGFILE}
  3192.         exit 1
  3193.       fi
  3194.       if test -d realmodule && test -f realmodule/a; then
  3195.         echo 'PASS: test 149a2' >>${LOGFILE}
  3196.       else
  3197.         echo 'FAIL: test 149a2' | tee -a ${LOGFILE}
  3198.         exit 1
  3199.       fi
  3200.       if test -f realmodule/b; then
  3201.         echo 'FAIL: test 149a3' | tee -a ${LOGFILE}
  3202.         exit 1
  3203.       else
  3204.         echo 'PASS: test 149a3' >>${LOGFILE}
  3205.       fi
  3206.       if ${testcvs} -q co realmodule; then
  3207.         echo 'PASS: test 149a4' >>${LOGFILE}
  3208.       else
  3209.         echo 'FAIL: test 149a4' | tee -a ${LOGFILE}
  3210.         exit 1
  3211.       fi
  3212.       if echo "yes" | ${testcvs} release -d realmodule >>${LOGFILE} ; then
  3213.         echo 'PASS: test 149a5' >>${LOGFILE}
  3214.       else
  3215.         echo 'FAIL: test 149a5' | tee -a ${LOGFILE}
  3216.         exit 1
  3217.       fi
  3218.  
  3219.       # Now test the ability to check out a single file from a directory
  3220.       if ${testcvs} co dirmodule/a >>${LOGFILE}; then
  3221.         echo 'PASS: test 150c' >>${LOGFILE}
  3222.       else
  3223.         echo 'FAIL: test 150c' | tee -a ${LOGFILE}
  3224.         exit 1
  3225.       fi
  3226.       if test -d dirmodule && test -f dirmodule/a; then
  3227.         echo 'PASS: test 150d' >>${LOGFILE}
  3228.       else
  3229.         echo 'FAIL: test 150d' | tee -a ${LOGFILE}
  3230.         exit 1
  3231.       fi
  3232.       if test -f dirmodule/b; then
  3233.         echo 'FAIL: test 150e' | tee -a ${LOGFILE}
  3234.         exit 1
  3235.       else
  3236.         echo 'PASS: test 150e' >>${LOGFILE}
  3237.       fi
  3238.       if echo "yes" | ${testcvs} release -d dirmodule >>${LOGFILE} ; then
  3239.         echo 'PASS: test 150f' >>${LOGFILE}
  3240.       else
  3241.         echo 'FAIL: test 150f' | tee -a ${LOGFILE}
  3242.         exit 1
  3243.       fi
  3244.       # Now test the ability to correctly reject a non-existent filename.
  3245.       # For maximum studliness we would check that an error message is
  3246.       # being output.
  3247.       if ${testcvs} co dirmodule/nonexist >>${LOGFILE} 2>&1; then
  3248.         # We accept a zero exit status because it is what CVS does
  3249.         # (Dec 95).  Probably the exit status should be nonzero,
  3250.         # however.
  3251.         echo 'PASS: test 150g1' >>${LOGFILE}
  3252.       else
  3253.         echo 'PASS: test 150g1' >>${LOGFILE}
  3254.       fi
  3255.       # We tolerate the creation of the dirmodule directory, since that
  3256.       # is what CVS does, not because we view that as preferable to not
  3257.       # creating it.
  3258.       if test -f dirmodule/a || test -f dirmodule/b; then
  3259.         echo 'FAIL: test 150g2' | tee -a ${LOGFILE}
  3260.         exit 1
  3261.       else
  3262.         echo 'PASS: test 150g2' >>${LOGFILE}
  3263.       fi
  3264.       rm -rf dirmodule
  3265.  
  3266.       # Now test that a module using -d checks out to the specified
  3267.       # directory.
  3268.       dotest 150h1 "${testcvs} -q co namedmodule" 'U nameddir/a
  3269. U nameddir/b'
  3270.       if test -f nameddir/a && test -f nameddir/b; then
  3271.         pass 150h2
  3272.       else
  3273.         fail 150h2
  3274.       fi
  3275.       echo add line >>nameddir/a
  3276.       dotest 150h3 "${testcvs} -q co namedmodule" 'M nameddir/a'
  3277.       rm nameddir/a
  3278.       dotest 150h4 "${testcvs} -q co namedmodule" 'U nameddir/a'
  3279.       if echo "yes" | ${testcvs} release -d nameddir >>${LOGFILE} ; then
  3280.         pass 150h99
  3281.       else
  3282.         fail 150h99
  3283.       fi
  3284.  
  3285.       # Now test that alias modules check out to subdir/a, not
  3286.       # aliasmodule/a.
  3287.       if ${testcvs} co aliasmodule >>${LOGFILE}; then
  3288.         echo 'PASS: test 151' >>${LOGFILE}
  3289.       else
  3290.         echo 'FAIL: test 151' | tee -a ${LOGFILE}
  3291.         exit 1
  3292.       fi
  3293.       if test -d aliasmodule; then
  3294.         echo 'FAIL: test 152' | tee -a ${LOGFILE}
  3295.         exit 1
  3296.       else
  3297.         echo 'PASS: test 152' >>${LOGFILE}
  3298.       fi
  3299.       echo abc >>first-dir/subdir/a
  3300.       if (${testcvs} -q co aliasmodule | tee test153.tmp) \
  3301.           >>${LOGFILE}; then
  3302.         echo 'PASS: test 153' >>${LOGFILE}
  3303.       else
  3304.         echo 'FAIL: test 153' | tee -a ${LOGFILE}
  3305.         exit 1
  3306.       fi
  3307.       echo 'M first-dir/subdir/a' >ans153.tmp
  3308.       if cmp test153.tmp ans153.tmp; then
  3309.         echo 'PASS: test 154' >>${LOGFILE}
  3310.       else
  3311.         echo 'FAIL: test 154' | tee -a ${LOGFILE}
  3312.         exit 1
  3313.       fi
  3314.  
  3315.       cd ..
  3316.       rm -rf 1
  3317.  
  3318.       mkdir 2
  3319.       cd 2
  3320.       dotest modules-155a0 "${testcvs} co aliasnested" \
  3321. "${PROG} [a-z]*: Updating first-dir/subdir/ssdir"
  3322.       dotest modules-155a1 "test -d first-dir" ''
  3323.       dotest modules-155a2 "test -d first-dir/subdir" ''
  3324.       dotest modules-155a3 "test -d first-dir/subdir/ssdir" ''
  3325.       # Test that nothing extraneous got created.
  3326.       dotest modules-155a4 "ls" "first-dir"
  3327.       cd ..
  3328.       rm -rf 2
  3329.  
  3330.       # Test checking out everything.
  3331.       mkdir 1
  3332.       cd 1
  3333.       dotest modules-155b "${testcvs} -q co world" \
  3334. "U CVSROOT/modules
  3335. U first-dir/subdir/a
  3336. U first-dir/subdir/b"
  3337.       cd ..
  3338.       rm -rf 1
  3339.  
  3340.       # Test checking out a module which lists at least two
  3341.       # specific files twice.  At one time, this failed over
  3342.       # remote CVS.
  3343.       mkdir 1
  3344.       cd 1
  3345.       dotest modules-155c1 "${testcvs} -q co first-dir" \
  3346. "U first-dir/subdir/a
  3347. U first-dir/subdir/b"
  3348.  
  3349.       cd first-dir
  3350.       echo 'first revision' > file1
  3351.       echo 'first revision' > file2
  3352.       dotest modules-155c2 "${testcvs} add file1 file2" \
  3353. "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
  3354. '"${PROG}"' [a-z]*: scheduling file `file2'\'' for addition
  3355. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add these files permanently'
  3356.       dotest modules-155c3 "${testcvs} -q ci -m add-it" \
  3357. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
  3358. done
  3359. Checking in file1;
  3360. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  3361. initial revision: 1.1
  3362. done
  3363. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file2,v
  3364. done
  3365. Checking in file2;
  3366. /tmp/cvs-sanity/cvsroot/first-dir/file2,v  <--  file2
  3367. initial revision: 1.1
  3368. done'
  3369.  
  3370.       cd ..
  3371.       rm -rf first-dir
  3372.       dotest modules-155c4 "${testcvs} -q co topfiles" \
  3373. "U first-dir/file1
  3374. U first-dir/file2"
  3375.       dotest modules-155c5 "${testcvs} -q co topfiles" ""
  3376.       cd ..
  3377.       rm -rf 1
  3378.  
  3379.       rm -rf ${CVSROOT_DIRNAME}/first-dir
  3380.       ;;
  3381.     mflag)
  3382.       for message in '' ' ' '    
  3383.            ' '              test' ; do
  3384.         # Set up
  3385.         mkdir a-dir; cd a-dir
  3386.         # Test handling of -m during import
  3387.         echo testa >>test
  3388.         if ${testcvs} import -m "$message" a-dir A A1 >>${LOGFILE} 2>&1;then
  3389.           echo 'PASS: test 156' >>${LOGFILE}
  3390.         else
  3391.           echo 'FAIL: test 156' | tee -a ${LOGFILE}
  3392.           exit 1
  3393.         fi
  3394.         # Must import twice since the first time uses inline code that
  3395.         # avoids RCS call.
  3396.         echo testb >>test
  3397.         if ${testcvs} import -m "$message" a-dir A A2 >>${LOGFILE} 2>&1;then
  3398.           echo 'PASS: test 157' >>${LOGFILE}
  3399.         else
  3400.           echo 'FAIL: test 157' | tee -a ${LOGFILE}
  3401.           exit 1
  3402.         fi
  3403.         # Test handling of -m during ci
  3404.         cd ..; rm -rf a-dir;
  3405.         if ${testcvs} co a-dir >>${LOGFILE} 2>&1; then
  3406.           echo 'PASS: test 158' >>${LOGFILE}
  3407.         else
  3408.           echo 'FAIL: test 158' | tee -a ${LOGFILE}
  3409.           exit 1
  3410.         fi
  3411.         cd a-dir
  3412.         echo testc >>test
  3413.         if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
  3414.           echo 'PASS: test 159' >>${LOGFILE}
  3415.         else
  3416.           echo 'FAIL: test 159' | tee -a ${LOGFILE}
  3417.           exit 1
  3418.         fi
  3419.         # Test handling of -m during rm/ci
  3420.         rm test;
  3421.         if ${testcvs} rm test >>${LOGFILE} 2>&1; then
  3422.           echo 'PASS: test 160' >>${LOGFILE}
  3423.         else
  3424.           echo 'FAIL: test 160' | tee -a ${LOGFILE}
  3425.           exit 1
  3426.         fi
  3427.         if ${testcvs} ci -m "$message" >>${LOGFILE} 2>&1; then
  3428.           echo 'PASS: test 161' >>${LOGFILE}
  3429.         else
  3430.           echo 'FAIL: test 161' | tee -a ${LOGFILE}
  3431.           exit 1
  3432.         fi
  3433.         # Clean up
  3434.         cd ..; rm -rf a-dir ${CVSROOT_DIRNAME}/a-dir
  3435.       done
  3436.       ;;
  3437.     errmsg1)
  3438.       mkdir ${CVSROOT_DIRNAME}/1dir
  3439.       mkdir 1
  3440.       cd 1
  3441.       if ${testcvs} -q co 1dir; then
  3442.         echo 'PASS: test 162' >>${LOGFILE}
  3443.       else
  3444.         echo 'FAIL: test 162' | tee -a ${LOGFILE}
  3445.         exit 1
  3446.       fi
  3447.       cd 1dir
  3448.       touch foo
  3449.       if ${testcvs} add foo 2>>${LOGFILE}; then
  3450.         echo 'PASS: test 163' >>${LOGFILE}
  3451.       else
  3452.         echo 'FAIL: test 163' | tee -a ${LOGFILE}
  3453.         exit 1
  3454.       fi
  3455.       if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
  3456.         echo 'PASS: test 164' >>${LOGFILE}
  3457.       else
  3458.         echo 'FAIL: test 164' | tee -a ${LOGFILE}
  3459.         exit 1
  3460.       fi
  3461.       cd ../..
  3462.       mkdir 2
  3463.       cd 2
  3464.       if ${testcvs} -q co 1dir >>${LOGFILE}; then
  3465.         echo 'PASS: test 165' >>${LOGFILE}
  3466.       else
  3467.         echo 'FAIL: test 165' | tee -a ${LOGFILE}
  3468.         exit 1
  3469.       fi
  3470.       chmod a-w 1dir
  3471.       cd ../1/1dir
  3472.       rm foo; 
  3473.       if ${testcvs} rm foo >>${LOGFILE} 2>&1; then
  3474.         echo 'PASS: test 166' >>${LOGFILE}
  3475.       else
  3476.         echo 'FAIL: test 166' | tee -a ${LOGFILE}
  3477.         exit 1
  3478.       fi
  3479.       if ${testcvs} ci -m removed >>${LOGFILE} 2>&1; then
  3480.         echo 'PASS: test 167' >>${LOGFILE}
  3481.       else
  3482.         echo 'FAIL: test 167' | tee -a ${LOGFILE}
  3483.         exit 1
  3484.       fi
  3485.  
  3486.       cd ../../2/1dir
  3487.       # FIXME: should be using dotest and PROG.
  3488.       ${testcvs} -q update 2>../tst167.err
  3489.       CVSBASE=`basename $testcvs`    # Get basename of CVS executable.
  3490.       cat <<EOF >../tst167.ans
  3491. $CVSBASE server: warning: foo is not (any longer) pertinent
  3492. $CVSBASE update: unable to remove ./foo: Permission denied
  3493. EOF
  3494.       if cmp ../tst167.ans ../tst167.err >/dev/null ||
  3495.       ( echo "$CVSBASE [update aborted]: cannot rename file foo to CVS/,,foo: Permission denied" | cmp - ../tst167.err >/dev/null )
  3496.       then
  3497.         echo 'PASS: test 168' >>${LOGFILE}
  3498.       else
  3499.         echo 'FAIL: test 168' | tee -a ${LOGFILE}
  3500.         exit 1
  3501.       fi
  3502.  
  3503.       cd ..
  3504.       chmod u+w 1dir
  3505.       cd ..
  3506.       rm -rf 1 2 ${CVSROOT_DIRNAME}/1dir
  3507.       ;;
  3508.  
  3509.     devcom)
  3510.       mkdir ${CVSROOT_DIRNAME}/first-dir
  3511.       mkdir 1
  3512.       cd 1
  3513.       if ${testcvs} -q co first-dir >>${LOGFILE} ; then
  3514.         echo 'PASS: test 169' >>${LOGFILE}
  3515.       else
  3516.         echo 'FAIL: test 169' | tee -a ${LOGFILE}
  3517.         exit 1
  3518.       fi
  3519.  
  3520.       cd first-dir
  3521.       echo abb >abb
  3522.       if ${testcvs} add abb 2>>${LOGFILE}; then
  3523.         echo 'PASS: test 170' >>${LOGFILE}
  3524.       else
  3525.         echo 'FAIL: test 170' | tee -a ${LOGFILE}
  3526.         exit 1
  3527.       fi
  3528.       if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
  3529.         echo 'PASS: test 171' >>${LOGFILE}
  3530.       else
  3531.         echo 'FAIL: test 171' | tee -a ${LOGFILE}
  3532.         exit 1
  3533.       fi
  3534.       dotest_fail 171a0 "${testcvs} watch" "Usage${DOTSTAR}"
  3535.       if ${testcvs} watch on; then
  3536.         echo 'PASS: test 172' >>${LOGFILE}
  3537.       else
  3538.         echo 'FAIL: test 172' | tee -a ${LOGFILE}
  3539.       fi
  3540.       echo abc >abc
  3541.       if ${testcvs} add abc 2>>${LOGFILE}; then
  3542.         echo 'PASS: test 173' >>${LOGFILE}
  3543.       else
  3544.         echo 'FAIL: test 173' | tee -a ${LOGFILE}
  3545.       fi
  3546.       if ${testcvs} ci -m added >>${LOGFILE} 2>&1; then
  3547.         echo 'PASS: test 174' >>${LOGFILE}
  3548.       else
  3549.         echo 'FAIL: test 174' | tee -a ${LOGFILE}
  3550.       fi
  3551.  
  3552.       cd ../..
  3553.       mkdir 2
  3554.       cd 2
  3555.  
  3556.       if ${testcvs} -q co first-dir >>${LOGFILE}; then
  3557.         echo 'PASS: test 175' >>${LOGFILE}
  3558.       else
  3559.         echo 'FAIL: test 175' | tee -a ${LOGFILE}
  3560.       fi
  3561.       cd first-dir
  3562.       if test -w abb; then
  3563.         echo 'FAIL: test 176' | tee -a ${LOGFILE}
  3564.       else
  3565.         echo 'PASS: test 176' >>${LOGFILE}
  3566.       fi
  3567.       if test -w abc; then
  3568.         echo 'FAIL: test 177' | tee -a ${LOGFILE}
  3569.       else
  3570.         echo 'PASS: test 177' >>${LOGFILE}
  3571.       fi
  3572.  
  3573.       if ${testcvs} editors >../ans178.tmp; then
  3574.         echo 'PASS: test 178' >>${LOGFILE}
  3575.       else
  3576.         echo 'FAIL: test 178' | tee -a ${LOGFILE}
  3577.       fi
  3578.       cat ../ans178.tmp >>${LOGFILE}
  3579.       if test -s ../ans178.tmp; then
  3580.         echo 'FAIL: test 178a' | tee -a ${LOGFILE}
  3581.       else
  3582.         echo 'PASS: test 178a' >>${LOGFILE}
  3583.       fi
  3584.  
  3585.       if ${testcvs} edit abb; then
  3586.         echo 'PASS: test 179' >>${LOGFILE}
  3587.       else
  3588.         echo 'FAIL: test 179' | tee -a ${LOGFILE}
  3589.         exit 1
  3590.       fi
  3591.  
  3592.       if ${testcvs} editors >../ans180.tmp; then
  3593.         echo 'PASS: test 180' >>${LOGFILE}
  3594.       else
  3595.         echo 'FAIL: test 180' | tee -a ${LOGFILE}
  3596.         exit 1
  3597.       fi
  3598.       cat ../ans180.tmp >>${LOGFILE}
  3599.       if test -s ../ans180.tmp; then
  3600.         echo 'PASS: test 181' >>${LOGFILE}
  3601.       else
  3602.         echo 'FAIL: test 181' | tee -a ${LOGFILE}
  3603.       fi
  3604.  
  3605.       echo aaaa >>abb
  3606.       if ${testcvs} ci -m modify abb >>${LOGFILE} 2>&1; then
  3607.         echo 'PASS: test 182' >>${LOGFILE}
  3608.       else
  3609.         echo 'FAIL: test 182' | tee -a ${LOGFILE}
  3610.       fi
  3611.       # Unedit of a file not being edited should be a noop.
  3612.       dotest 182.5 "${testcvs} unedit abb" ''
  3613.  
  3614.       if ${testcvs} editors >../ans183.tmp; then
  3615.         echo 'PASS: test 183' >>${LOGFILE}
  3616.       else
  3617.         echo 'FAIL: test 183' | tee -a ${LOGFILE}
  3618.       fi
  3619.       cat ../ans183.tmp >>${LOGFILE}
  3620.       if test -s ../ans183.tmp; then
  3621.         echo 'FAIL: test 184' | tee -a ${LOGFILE}
  3622.       else
  3623.         echo 'PASS: test 184' >>${LOGFILE}
  3624.       fi
  3625.  
  3626.       if test -w abb; then
  3627.         echo 'FAIL: test 185' | tee -a ${LOGFILE}
  3628.       else
  3629.         echo 'PASS: test 185' >>${LOGFILE}
  3630.       fi
  3631.  
  3632.       if ${testcvs} edit abc; then
  3633.         echo 'PASS: test 186a1' >>${LOGFILE}
  3634.       else
  3635.         echo 'FAIL: test 186a1' | tee -a ${LOGFILE}
  3636.       fi
  3637.       # Unedit of an unmodified file.
  3638.       if ${testcvs} unedit abc; then
  3639.         echo 'PASS: test 186a2' >>${LOGFILE}
  3640.       else
  3641.         echo 'FAIL: test 186a2' | tee -a ${LOGFILE}
  3642.       fi
  3643.       if ${testcvs} edit abc; then
  3644.         echo 'PASS: test 186a3' >>${LOGFILE}
  3645.       else
  3646.         echo 'FAIL: test 186a3' | tee -a ${LOGFILE}
  3647.       fi
  3648.       echo changedabc >abc
  3649.       # Try to unedit a modified file; cvs should ask for confirmation
  3650.       if (echo no | ${testcvs} unedit abc) >>${LOGFILE}; then
  3651.         echo 'PASS: test 186a4' >>${LOGFILE}
  3652.       else
  3653.         echo 'FAIL: test 186a4' | tee -a ${LOGFILE}
  3654.       fi
  3655.       if echo changedabc | cmp - abc; then
  3656.         echo 'PASS: test 186a5' >>${LOGFILE}
  3657.       else
  3658.         echo 'FAIL: test 186a5' | tee -a ${LOGFILE}
  3659.       fi
  3660.       # OK, now confirm the unedit
  3661.       if (echo yes | ${testcvs} unedit abc) >>${LOGFILE}; then
  3662.         echo 'PASS: test 186a6' >>${LOGFILE}
  3663.       else
  3664.         echo 'FAIL: test 186a6' | tee -a ${LOGFILE}
  3665.       fi
  3666.       if echo abc | cmp - abc; then
  3667.         echo 'PASS: test 186a7' >>${LOGFILE}
  3668.       else
  3669.         echo 'FAIL: test 186a7' | tee -a ${LOGFILE}
  3670.       fi
  3671.  
  3672.       dotest devcom-a0 "${testcvs} watchers" ''
  3673.       dotest devcom-a1 "${testcvs} watch add" ''
  3674.       dotest devcom-a2 "${testcvs} watchers" \
  3675. 'abb    [a-z0-9]*    edit    unedit    commit
  3676. abc    [a-z0-9]*    edit    unedit    commit'
  3677.       dotest devcom-a3 "${testcvs} watch remove -a unedit abb" ''
  3678.       dotest devcom-a4 "${testcvs} watchers abb" \
  3679. 'abb    [a-z0-9]*    edit    commit'
  3680.  
  3681.       # Check tagging and checking out while we have a CVS
  3682.       # directory in the repository.
  3683.       dotest devcom-t0 "${testcvs} -q tag tag" \
  3684. 'T abb
  3685. T abc'
  3686.       cd ../..
  3687.       mkdir 3
  3688.       cd 3
  3689.       dotest devcom-t1 "${testcvs} -q co -rtag first-dir/abb" \
  3690. 'U first-dir/abb'
  3691.  
  3692.       # Now remove all the file attributes
  3693.       cd ../2/first-dir
  3694.       dotest devcom-b0 "${testcvs} watch off" ''
  3695.       dotest devcom-b1 "${testcvs} watch remove" ''
  3696.       # Test that CVS 1.6 and earlier can handle the repository.
  3697.       dotest_fail devcom-b2 "test -d ${CVSROOT_DIRNAME}/first-dir/CVS"
  3698.  
  3699.       cd ../..
  3700.       rm -rf 1 2 3 ${CVSROOT_DIRNAME}/first-dir
  3701.       ;;
  3702.  
  3703.     ignore)
  3704.       dotest 187a1 "${testcvs} -q co CVSROOT" 'U CVSROOT/modules'
  3705.       cd CVSROOT
  3706.       echo rootig.c >cvsignore
  3707.       dotest 187a2 "${testcvs} add cvsignore" "${PROG}"' [a-z]*: scheduling file `cvsignore'"'"' for addition
  3708. '"${PROG}"' [a-z]*: use '"'"'cvs commit'"'"' to add this file permanently'
  3709.  
  3710.       # As of Jan 96, local CVS prints "Examining ." and remote doesn't.
  3711.       # Accept either.
  3712.       dotest 187a3 " ${testcvs} ci -m added" \
  3713. "${DOTSTAR}"'CS file: /tmp/cvs-sanity/cvsroot/CVSROOT/cvsignore,v
  3714. done
  3715. Checking in cvsignore;
  3716. /tmp/cvs-sanity/cvsroot/CVSROOT/cvsignore,v  <--  cvsignore
  3717. initial revision: 1.1
  3718. done
  3719. '"${PROG}"' [a-z]*: Rebuilding administrative file database'
  3720.  
  3721.       cd ..
  3722.       if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
  3723.         echo 'PASS: test 187a4' >>${LOGFILE}
  3724.       else
  3725.         echo 'FAIL: test 187a4' | tee -a ${LOGFILE}
  3726.         exit 1
  3727.       fi
  3728.  
  3729.       # CVS looks at the home dir from getpwuid, not HOME (is that correct
  3730.       # behavior?), so this is hard to test and we won't try.
  3731.       # echo foobar.c >${HOME}/.cvsignore
  3732.       CVSIGNORE=envig.c; export CVSIGNORE
  3733.       mkdir dir-to-import
  3734.       cd dir-to-import
  3735.       touch foobar.c bar.c rootig.c defig.o envig.c optig.c
  3736.       # We really should allow the files to be listed in any order.
  3737.       # But we (kludgily) just list the orders which have been observed.
  3738.       dotest 188a "${testcvs} import -m m -I optig.c first-dir tag1 tag2" \
  3739.         'N first-dir/foobar.c
  3740. N first-dir/bar.c
  3741. I first-dir/rootig.c
  3742. I first-dir/defig.o
  3743. I first-dir/envig.c
  3744. I first-dir/optig.c
  3745.  
  3746. No conflicts created by this import' 'I first-dir/defig.o
  3747. I first-dir/envig.c
  3748. I first-dir/optig.c
  3749. N first-dir/foobar.c
  3750. N first-dir/bar.c
  3751. I first-dir/rootig.c
  3752.  
  3753. No conflicts created by this import'
  3754.       dotest 188b "${testcvs} import -m m -I ! second-dir tag3 tag4" \
  3755.         'N second-dir/foobar.c
  3756. N second-dir/bar.c
  3757. N second-dir/rootig.c
  3758. N second-dir/defig.o
  3759. N second-dir/envig.c
  3760. N second-dir/optig.c
  3761.  
  3762. No conflicts created by this import'
  3763.       cd ..
  3764.       rm -rf dir-to-import
  3765.  
  3766.       dotest 189a "${testcvs} -q co second-dir" \
  3767. 'U second-dir/bar.c
  3768. U second-dir/defig.o
  3769. U second-dir/envig.c
  3770. U second-dir/foobar.c
  3771. U second-dir/optig.c
  3772. U second-dir/rootig.c'
  3773.       dotest 189b "${testcvs} -q co first-dir" 'U first-dir/bar.c
  3774. U first-dir/foobar.c'
  3775.       cd first-dir
  3776.       touch rootig.c defig.o envig.c optig.c notig.c
  3777.       dotest 189c "${testcvs} -q update -I optig.c" "${QUESTION} notig.c"
  3778.       # The fact that CVS requires us to specify -I CVS here strikes me
  3779.       # as a bug.
  3780.       dotest 189d "${testcvs} -q update -I ! -I CVS" "${QUESTION} rootig.c
  3781. ${QUESTION} defig.o
  3782. ${QUESTION} envig.c
  3783. ${QUESTION} optig.c
  3784. ${QUESTION} notig.c"
  3785.  
  3786.       # Now test that commands other than update also print "? notig.c"
  3787.       # where appropriate.  Only test this for remote, because local
  3788.       # CVS only prints it on update.
  3789.       rm optig.c
  3790.       if test "x$remote" = xyes; then
  3791.         dotest 189e "${testcvs} -q diff" "${QUESTION} notig.c"
  3792.  
  3793.         # Force the server to be contacted.  Ugh.  Having CVS
  3794.         # contact the server for the sole purpose of checking
  3795.         # the CVSROOT/cvsignore file does not seem like such a
  3796.         # good idea, so I imagine this will continue to be
  3797.         # necessary.  Oh well, at least we test CVS's ablity to
  3798.         # handle a file with a modified timestamp but unmodified
  3799.         # contents.
  3800.         touch bar.c
  3801.  
  3802.         dotest 189f "${testcvs} -q ci -m commit-it" "${QUESTION} notig.c"
  3803.       fi
  3804.  
  3805.       # now test .cvsignore files
  3806.       cd ..
  3807.       echo notig.c >first-dir/.cvsignore
  3808.       echo foobar.c >second-dir/.cvsignore
  3809.       touch first-dir/notig.c second-dir/notig.c second-dir/foobar.c
  3810.       dotest 190 "${testcvs} -qn update" \
  3811. "${QUESTION} first-dir/.cvsignore
  3812. ${QUESTION} second-dir/.cvsignore
  3813. ${QUESTION} second-dir/notig.c" \
  3814. "${QUESTION} first-dir/.cvsignore
  3815. ${QUESTION} second-dir/notig.c
  3816. ${QUESTION} second-dir/.cvsignore"
  3817.       dotest 191 "${testcvs} -qn update -I!" \
  3818. "${QUESTION} first-dir/CVS
  3819. ${QUESTION} first-dir/rootig.c
  3820. ${QUESTION} first-dir/defig.o
  3821. ${QUESTION} first-dir/envig.c
  3822. ${QUESTION} first-dir/.cvsignore
  3823. ${QUESTION} second-dir/CVS
  3824. ${QUESTION} second-dir/.cvsignore
  3825. ${QUESTION} second-dir/notig.c" \
  3826. "${QUESTION} first-dir/CVS
  3827. ${QUESTION} first-dir/rootig.c
  3828. ${QUESTION} first-dir/defig.o
  3829. ${QUESTION} first-dir/envig.c
  3830. ${QUESTION} first-dir/.cvsignore
  3831. ${QUESTION} second-dir/CVS
  3832. ${QUESTION} second-dir/notig.c
  3833. ${QUESTION} second-dir/.cvsignore"
  3834.  
  3835.       rm -rf first-dir second-dir
  3836.       rm -rf ${CVSROOT_DIRNAME}/first-dir ${CVSROOT_DIRNAME}/second-dir
  3837.       ;;
  3838.  
  3839.     binfiles)
  3840.       # Test cvs's ability to handle binary files.
  3841.       mkdir ${CVSROOT_DIRNAME}/first-dir
  3842.       mkdir 1; cd 1
  3843.       dotest binfiles-1 "${testcvs} -q co first-dir" ''
  3844.       awk 'BEGIN { printf "%c%c%c%c%c%c", 2, 10, 137, 0, 13, 10 }' \
  3845.         </dev/null >binfile.dat
  3846.       cat binfile.dat binfile.dat >binfile2.dat
  3847.       cd first-dir
  3848.       cp ../binfile.dat binfile
  3849.       dotest binfiles-2 "${testcvs} add -kb binfile" \
  3850. "${PROG}"' [a-z]*: scheduling file `binfile'\'' for addition
  3851. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  3852.       dotest binfiles-3 "${testcvs} -q ci -m add-it" \
  3853. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/binfile,v
  3854. done
  3855. Checking in binfile;
  3856. /tmp/cvs-sanity/cvsroot/first-dir/binfile,v  <--  binfile
  3857. initial revision: 1.1
  3858. done'
  3859.       cd ../..
  3860.       mkdir 2; cd 2
  3861.       dotest binfiles-4 "${testcvs} -q co first-dir" 'U first-dir/binfile'
  3862.       cd first-dir
  3863.       dotest binfiles-5 "cmp ../../1/binfile.dat binfile" ''
  3864.       # Testing that sticky options is -kb is the closest thing we have
  3865.       # to testing that binary files work right on non-unix machines
  3866.       # (until there is automated testing for such machines, of course).
  3867.       dotest binfiles-5.5 "${testcvs} status binfile" \
  3868. '===================================================================
  3869. File: binfile              Status: Up-to-date
  3870.  
  3871.    Working revision:    1\.1.*
  3872.    Repository revision:    1\.1    /tmp/cvs-sanity/cvsroot/first-dir/binfile,v
  3873.    Sticky Tag:        (none)
  3874.    Sticky Date:        (none)
  3875.    Sticky Options:    -kb'
  3876.  
  3877.       # Test whether the default options from the RCS file are
  3878.       # also used when operating on files instead of whole
  3879.       # directories
  3880.           cd ../..
  3881.       mkdir 3; cd 3
  3882.       dotest binfiles-5.5b0 "${testcvs} -q co first-dir/binfile" \
  3883. 'U first-dir/binfile'
  3884.       cd first-dir
  3885.       dotest binfiles-5.5b1 "${testcvs} status binfile" \
  3886. '===================================================================
  3887. File: binfile              Status: Up-to-date
  3888.  
  3889.    Working revision:    1\.1.*
  3890.    Repository revision:    1\.1    /tmp/cvs-sanity/cvsroot/first-dir/binfile,v
  3891.    Sticky Tag:        (none)
  3892.    Sticky Date:        (none)
  3893.    Sticky Options:    -kb'
  3894.       cd ../..
  3895.       rm -rf 3
  3896.       cd 2/first-dir
  3897.  
  3898.       cp ../../1/binfile2.dat binfile
  3899.       dotest binfiles-6 "${testcvs} -q ci -m modify-it" \
  3900. 'Checking in binfile;
  3901. /tmp/cvs-sanity/cvsroot/first-dir/binfile,v  <--  binfile
  3902. new revision: 1.2; previous revision: 1.1
  3903. done'
  3904.       cd ../../1/first-dir
  3905.       dotest binfiles-7 "${testcvs} -q update" '[UP] binfile'
  3906.       dotest binfiles-8 "cmp ../binfile2.dat binfile" ''
  3907.  
  3908.       # Now test handling of conflicts with binary files.
  3909.       cp ../binfile.dat binfile
  3910.       dotest binfiles-con0 "${testcvs} -q ci -m modify-it" \
  3911. 'Checking in binfile;
  3912. /tmp/cvs-sanity/cvsroot/first-dir/binfile,v  <--  binfile
  3913. new revision: 1.3; previous revision: 1.2
  3914. done'
  3915.       cd ../../2/first-dir
  3916.       echo 'edits in dir 2' >binfile
  3917.       dotest binfiles-con1 "${testcvs} -q update" \
  3918. 'U binfile
  3919. cvs [a-z]*: binary file needs merge
  3920. cvs [a-z]*: revision 1\.3 from repository is now in binfile
  3921. cvs [a-z]*: file from working directory is now in \.#binfile\.1\.2
  3922. C binfile'
  3923.       dotest binfiles-con2 "cmp binfile ../../1/binfile.dat" ''
  3924.       dotest binfiles-con3 "cat .#binfile.1.2" 'edits in dir 2'
  3925.  
  3926.       cp ../../1/binfile2.dat binfile
  3927.       dotest binfiles-con4 "${testcvs} -q ci -m resolve-it" \
  3928. 'Checking in binfile;
  3929. /tmp/cvs-sanity/cvsroot/first-dir/binfile,v  <--  binfile
  3930. new revision: 1.4; previous revision: 1.3
  3931. done'
  3932.       cd ../../1/first-dir
  3933.       dotest binfiles-con5 "${testcvs} -q update" '[UP] binfile'
  3934.  
  3935.       # The bugs which these test for are apparently not fixed for remote.
  3936.       if test "$remote" = no; then
  3937.         dotest binfiles-9 "${testcvs} -q update -A" ''
  3938.         dotest binfiles-10 "${testcvs} -q update -kk" '[UP] binfile'
  3939.         dotest binfiles-11 "${testcvs} -q update" ''
  3940.         dotest binfiles-12 "${testcvs} -q update -A" '[UP] binfile'
  3941.         dotest binfiles-13 "${testcvs} -q update -A" ''
  3942.       fi
  3943.       cd ../..
  3944.       rm -rf 1
  3945.  
  3946.       mkdir 3
  3947.       cd 3
  3948.       dotest binfiles-13a0 "${testcvs} -q co -r HEAD first-dir" \
  3949. 'U first-dir/binfile'
  3950.       cd first-dir
  3951.       dotest binfiles-13a1 "${testcvs} status binfile" \
  3952. '===================================================================
  3953. File: binfile              Status: Up-to-date
  3954.  
  3955.    Working revision:    1\.4.*
  3956.    Repository revision:    1\.4    /tmp/cvs-sanity/cvsroot/first-dir/binfile,v
  3957.    Sticky Tag:        HEAD (revision: 1\.4)
  3958.    Sticky Date:        (none)
  3959.    Sticky Options:    -kb'
  3960.       cd ../..
  3961.       rm -rf 3
  3962.  
  3963.       cd 2/first-dir
  3964.       echo 'this file is $''RCSfile$' >binfile
  3965.       dotest binfiles-14a "${testcvs} -q ci -m modify-it" \
  3966. 'Checking in binfile;
  3967. /tmp/cvs-sanity/cvsroot/first-dir/binfile,v  <--  binfile
  3968. new revision: 1\.5; previous revision: 1\.4
  3969. done'
  3970.       dotest binfiles-14b "cat binfile" 'this file is $''RCSfile$'
  3971.       # See binfiles-5.5 for discussion of -kb.
  3972.       dotest binfiles-14c "${testcvs} status binfile" \
  3973. '===================================================================
  3974. File: binfile              Status: Up-to-date
  3975.  
  3976.    Working revision:    1\.5.*
  3977.    Repository revision:    1\.5    /tmp/cvs-sanity/cvsroot/first-dir/binfile,v
  3978.    Sticky Tag:        (none)
  3979.    Sticky Date:        (none)
  3980.    Sticky Options:    -kb'
  3981.       dotest binfiles-14d "${testcvs} admin -kv binfile" \
  3982. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/binfile,v
  3983. done'
  3984.       # cvs admin doesn't change the checked-out file or its sticky
  3985.       # kopts.  There probably should be a way which does (but
  3986.       # what if the file is modified?  And do we try to version
  3987.       # control the kopt setting?)
  3988.       dotest binfiles-14e "cat binfile" 'this file is $''RCSfile$'
  3989.       dotest binfiles-14f "${testcvs} status binfile" \
  3990. '===================================================================
  3991. File: binfile              Status: Up-to-date
  3992.  
  3993.    Working revision:    1\.5.*
  3994.    Repository revision:    1\.5    /tmp/cvs-sanity/cvsroot/first-dir/binfile,v
  3995.    Sticky Tag:        (none)
  3996.    Sticky Date:        (none)
  3997.    Sticky Options:    -kb'
  3998.       dotest binfiles-14g "${testcvs} -q update -A" '[UP] binfile'
  3999.       dotest binfiles-14h "cat binfile" 'this file is binfile,v'
  4000.       dotest binfiles-14i "${testcvs} status binfile" \
  4001. '===================================================================
  4002. File: binfile              Status: Up-to-date
  4003.  
  4004.    Working revision:    1\.5.*
  4005.    Repository revision:    1\.5    /tmp/cvs-sanity/cvsroot/first-dir/binfile,v
  4006.    Sticky Tag:        (none)
  4007.    Sticky Date:        (none)
  4008.    Sticky Options:    -kv'
  4009.  
  4010.       cd ../..
  4011.       rm -rf ${CVSROOT_DIRNAME}/first-dir
  4012.       rm -r 2
  4013.       ;;
  4014.  
  4015.     binwrap)
  4016.       # Test the ability to specify binary-ness based on file name.
  4017.       # We could also be testing the ability to use the other
  4018.       # ways to specify a wrapper (CVSROOT/cvswrappers, etc.).
  4019.  
  4020.       mkdir dir-to-import
  4021.       cd dir-to-import
  4022.       touch foo.c foo.exe
  4023.       if ${testcvs} import -m message -I ! -W "*.exe -k 'b'" \
  4024.           first-dir tag1 tag2 >>${LOGFILE}; then
  4025.         pass binwrap-1
  4026.       else
  4027.         fail binwrap-1
  4028.       fi
  4029.       cd ..
  4030.       rm -rf dir-to-import
  4031.       dotest binwrap-2 "${testcvs} -q co first-dir" 'U first-dir/foo.c
  4032. U first-dir/foo.exe'
  4033.       dotest binwrap-3 "${testcvs} -q status first-dir" \
  4034. '===================================================================
  4035. File: foo\.c                Status: Up-to-date
  4036.  
  4037.    Working revision:    1\.1\.1\.1.*
  4038.    Repository revision:    1\.1\.1\.1    /tmp/cvs-sanity/cvsroot/first-dir/foo\.c,v
  4039.    Sticky Tag:        (none)
  4040.    Sticky Date:        (none)
  4041.    Sticky Options:    (none)
  4042.  
  4043. ===================================================================
  4044. File: foo\.exe              Status: Up-to-date
  4045.  
  4046.    Working revision:    1\.1\.1\.1.*
  4047.    Repository revision:    1\.1\.1\.1    /tmp/cvs-sanity/cvsroot/first-dir/foo\.exe,v
  4048.    Sticky Tag:        (none)
  4049.    Sticky Date:        (none)
  4050.    Sticky Options:    -kb'
  4051.       rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
  4052.       ;;
  4053.  
  4054.     info)
  4055.       # Test CVS's ability to handle *info files.
  4056.       dotest info-1 "${testcvs} -q co CVSROOT" "[UP] CVSROOT${DOTSTAR}"
  4057.       cd CVSROOT
  4058.       echo "ALL sh -c \"echo x\${=MYENV}\${=OTHER}y\${=ZEE}=\$USER=\$CVSROOT= >>$TESTDIR/testlog; cat >/dev/null\"" > loginfo
  4059.       dotest info-2 "${testcvs} add loginfo" \
  4060. "${PROG}"' [a-z]*: scheduling file `loginfo'"'"' for addition
  4061. '"${PROG}"' [a-z]*: use '"'"'cvs commit'"'"' to add this file permanently'
  4062.       dotest info-3 "${testcvs} -q ci -m new-loginfo" \
  4063. 'RCS file: /tmp/cvs-sanity/cvsroot/CVSROOT/loginfo,v
  4064. done
  4065. Checking in loginfo;
  4066. /tmp/cvs-sanity/cvsroot/CVSROOT/loginfo,v  <--  loginfo
  4067. initial revision: 1.1
  4068. done
  4069. '"${PROG}"' [a-z]*: Rebuilding administrative file database'
  4070.       cd ..
  4071.       if echo "yes" | ${testcvs} release -d CVSROOT >>${LOGFILE} ; then
  4072.         pass info-4
  4073.       else
  4074.         fail info-4
  4075.       fi
  4076.  
  4077.       mkdir ${CVSROOT_DIRNAME}/first-dir
  4078.       dotest info-5 "${testcvs} -q co first-dir" ''
  4079.       cd first-dir
  4080.       touch file1
  4081.       dotest info-6 "${testcvs} add file1" \
  4082. "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
  4083. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  4084.       echo "cvs -s OTHER=not-this -s MYENV=env-" >>$HOME/.cvsrc
  4085.       dotest info-6a "${testcvs} -q -s OTHER=value ci -m add-it" \
  4086. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
  4087. done
  4088. Checking in file1;
  4089. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  4090. initial revision: 1.1
  4091. done
  4092. '"${PROG}"' [a-z]*: loginfo:1: no such user variable ${=ZEE}'
  4093.       echo line1 >>file1
  4094.       dotest info-7 "${testcvs} -q -s OTHER=value -s ZEE=z ci -m mod-it" \
  4095. 'Checking in file1;
  4096. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  4097. new revision: 1.2; previous revision: 1.1
  4098. done'
  4099.       cd ..
  4100.       if echo "yes" | ${testcvs} release -d first-dir >>${LOGFILE} ; then
  4101.         pass info-8
  4102.       else
  4103.         fail info-8
  4104.       fi
  4105.       dotest info-9 "cat $TESTDIR/testlog" 'xenv-valueyz=[a-z0-9@][a-z0-9@]*=/tmp/cvs-sanity/cvsroot='
  4106.  
  4107.       # I think this might be doable with cvs remove, or at least
  4108.       # checking in a version with only comments, but I'm too lazy
  4109.       # at the moment.  Blow it away.
  4110.       rm -f ${CVSROOT_DIRNAME}/CVSROOT/loginfo*
  4111.  
  4112.       rm -rf ${CVSROOT_DIRNAME}/first-dir
  4113.       ;;
  4114.  
  4115.     patch)
  4116.       # Test remote CVS handling of unpatchable files.  This isn't
  4117.       # much of a test for local CVS.
  4118.       mkdir ${CVSROOT_DIRNAME}/first-dir
  4119.       mkdir 1
  4120.       cd 1
  4121.       dotest patch-1 "${testcvs} -q co first-dir" ''
  4122.  
  4123.       cd first-dir
  4124.  
  4125.       # Add a file with an RCS keyword.
  4126.       echo '$''Name$' > file1
  4127.       echo '1' >> file1
  4128.       dotest patch-2 "${testcvs} add file1" \
  4129. "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
  4130. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  4131.  
  4132.       dotest patch-3 "${testcvs} -q commit -m add" \
  4133. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
  4134. done
  4135. Checking in file1;
  4136. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  4137. initial revision: 1.1
  4138. done'
  4139.  
  4140.       # Tag the file.
  4141.       dotest patch-4 "${testcvs} -q tag tag file1" 'T file1'
  4142.  
  4143.       # Check out a tagged copy of the file.
  4144.       cd ../..
  4145.       mkdir 2
  4146.       cd 2
  4147.       dotest patch-5 "${testcvs} -q co -r tag first-dir" \
  4148. 'U first-dir/file1'
  4149.  
  4150.       # Remove the tag.  This will leave the tag string in the
  4151.       # expansion of the Name keyword.
  4152.       dotest patch-6 "${testcvs} -q update -A" ''
  4153.  
  4154.       # Modify and check in the first copy.
  4155.       cd ../1/first-dir
  4156.       echo '2' >> file1
  4157.       dotest patch-7 "${testcvs} -q ci -mx file1" \
  4158. 'Checking in file1;
  4159. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  4160. new revision: 1.2; previous revision: 1.1
  4161. done'
  4162.  
  4163.       # Now update the second copy.  When using remote CVS, the
  4164.       # patch will fail, forcing the file to be refetched.
  4165.       cd ../../2/first-dir
  4166.       dotest patch-8 "${testcvs} -q update" \
  4167. 'U file1' \
  4168. 'P file1
  4169. '"${PROG}"' [a-z]*: checksum failure after patch to ./file1; will refetch
  4170. '"${PROG}"' [a-z]*: refetching unpatchable files
  4171. U file1'
  4172.  
  4173.       cd ../..
  4174.       rm -rf 1 2 ${CVSROOT_DIRNAME}/first-dir
  4175.       ;;
  4176.  
  4177.     log)
  4178.       # Test selecting revisions with cvs log.
  4179.  
  4180.       # Check in a file with a few revisions and branches.
  4181.       mkdir ${CVSROOT_DIRNAME}/first-dir
  4182.       dotest log-1 "${testcvs} -q co first-dir" ''
  4183.       cd first-dir
  4184.       echo 'first revision' > file1
  4185.       dotest log-2 "${testcvs} add file1" \
  4186. "${PROG}"' [a-z]*: scheduling file `file1'\'' for addition
  4187. '"${PROG}"' [a-z]*: use '\''cvs commit'\'' to add this file permanently'
  4188.  
  4189.       dotest log-3 "${testcvs} -q commit -m 1" \
  4190. 'RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
  4191. done
  4192. Checking in file1;
  4193. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  4194. initial revision: 1.1
  4195. done'
  4196.  
  4197.       echo 'second revision' > file1
  4198.       dotest log-4 "${testcvs} -q ci -m2 file1" \
  4199. 'Checking in file1;
  4200. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  4201. new revision: 1.2; previous revision: 1.1
  4202. done'
  4203.  
  4204.       dotest log-5 "${testcvs} -q tag -b branch file1" 'T file1'
  4205.  
  4206.       echo 'third revision' > file1
  4207.       dotest log-6 "${testcvs} -q ci -m3 file1" \
  4208. 'Checking in file1;
  4209. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  4210. new revision: 1.3; previous revision: 1.2
  4211. done'
  4212.  
  4213.       dotest log-7 "${testcvs} -q update -r branch" '[UP] file1'
  4214.  
  4215.       echo 'first branch revision' > file1
  4216.       dotest log-8 "${testcvs} -q ci -m1b file1" \
  4217. 'Checking in file1;
  4218. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  4219. new revision: 1.2.2.1; previous revision: 1.2
  4220. done'
  4221.  
  4222.       dotest log-9 "${testcvs} -q tag tag file1" 'T file1'
  4223.  
  4224.       echo 'second branch revision' > file1
  4225.       dotest log-10 "${testcvs} -q ci -m2b file1" \
  4226. 'Checking in file1;
  4227. /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  4228. new revision: 1.2.2.2; previous revision: 1.2.2.1
  4229. done'
  4230.  
  4231.       # Set up a bunch of shell variables to make the later tests
  4232.       # easier to describe.=
  4233.       log_header='
  4234. RCS file: /tmp/cvs-sanity/cvsroot/first-dir/file1,v
  4235. Working file: file1
  4236. head: 1.3
  4237. branch:
  4238. locks: strict
  4239. access list:'
  4240.       log_tags='symbolic names:
  4241.     tag: 1.2.2.1
  4242.     branch: 1.2.0.2'
  4243.       log_header2='keyword substitution: kv'
  4244.       log_dash='----------------------------
  4245. revision'
  4246.       log_date='date: [0-9/]* [0-9:]*;  author: [a-zA-Z0-9@]*;  state: Exp;'
  4247.       log_lines="  lines: ${PLUS}1 -1"
  4248.       log_rev1="${log_dash} 1.1
  4249. ${log_date}
  4250. 1"
  4251.       log_rev2="${log_dash} 1.2
  4252. ${log_date}${log_lines}
  4253. branches:  1.2.2;
  4254. 2"
  4255.       log_rev3="${log_dash} 1.3
  4256. ${log_date}${log_lines}
  4257. 3"
  4258.       log_rev1b="${log_dash} 1.2.2.1
  4259. ${log_date}${log_lines}
  4260. 1b"
  4261.       log_rev2b="${log_dash} 1.2.2.2
  4262. ${log_date}${log_lines}
  4263. 2b"
  4264.       log_trailer='============================================================================='
  4265.  
  4266.       # Now, finally, test the log output.
  4267.  
  4268.       dotest log-11 "${testcvs} log file1" \
  4269. "${log_header}
  4270. ${log_tags}
  4271. ${log_header2}
  4272. total revisions: 5;    selected revisions: 5
  4273. description:
  4274. ${log_rev3}
  4275. ${log_rev2}
  4276. ${log_rev1}
  4277. ${log_rev2b}
  4278. ${log_rev1b}
  4279. ${log_trailer}"
  4280.  
  4281.       dotest log-12 "${testcvs} log -N file1" \
  4282. "${log_header}
  4283. ${log_header2}
  4284. total revisions: 5;    selected revisions: 5
  4285. description:
  4286. ${log_rev3}
  4287. ${log_rev2}
  4288. ${log_rev1}
  4289. ${log_rev2b}
  4290. ${log_rev1b}
  4291. ${log_trailer}"
  4292.  
  4293.       dotest log-13 "${testcvs} log -b file1" \
  4294. "${log_header}
  4295. ${log_tags}
  4296. ${log_header2}
  4297. total revisions: 5;    selected revisions: 3
  4298. description:
  4299. ${log_rev3}
  4300. ${log_rev2}
  4301. ${log_rev1}
  4302. ${log_trailer}"
  4303.  
  4304.       dotest log-14 "${testcvs} log -r file1" \
  4305. "${log_header}
  4306. ${log_tags}
  4307. ${log_header2}
  4308. total revisions: 5;    selected revisions: 1
  4309. description:
  4310. ${log_rev3}
  4311. ${log_trailer}"
  4312.  
  4313.       dotest log-15 "${testcvs} log -r1.2 file1" \
  4314. "${log_header}
  4315. ${log_tags}
  4316. ${log_header2}
  4317. total revisions: 5;    selected revisions: 1
  4318. description:
  4319. ${log_rev2}
  4320. ${log_trailer}"
  4321.  
  4322.       dotest log-16 "${testcvs} log -r1.2.2 file1" \
  4323. "${log_header}
  4324. ${log_tags}
  4325. ${log_header2}
  4326. total revisions: 5;    selected revisions: 2
  4327. description:
  4328. ${log_rev2b}
  4329. ${log_rev1b}
  4330. ${log_trailer}"
  4331.  
  4332.       # This test would fail with the old invocation of rlog, but it
  4333.       # works with the builtin log support.
  4334.       dotest log-17 "${testcvs} log -rbranch file1" \
  4335. "${log_header}
  4336. ${log_tags}
  4337. ${log_header2}
  4338. total revisions: 5;    selected revisions: 2
  4339. description:
  4340. ${log_rev2b}
  4341. ${log_rev1b}
  4342. ${log_trailer}"
  4343.  
  4344.       dotest log-18 "${testcvs} log -r1.2.2. file1" \
  4345. "${log_header}
  4346. ${log_tags}
  4347. ${log_header2}
  4348. total revisions: 5;    selected revisions: 1
  4349. description:
  4350. ${log_rev2b}
  4351. ${log_trailer}"
  4352.  
  4353.       # This test would fail with the old invocation of rlog, but it
  4354.       # works with the builtin log support.
  4355.       dotest log-19 "${testcvs} log -rbranch. file1" \
  4356. "${log_header}
  4357. ${log_tags}
  4358. ${log_header2}
  4359. total revisions: 5;    selected revisions: 1
  4360. description:
  4361. ${log_rev2b}
  4362. ${log_trailer}"
  4363.  
  4364.       dotest log-20 "${testcvs} log -r1.2: file1" \
  4365. "${log_header}
  4366. ${log_tags}
  4367. ${log_header2}
  4368. total revisions: 5;    selected revisions: 2
  4369. description:
  4370. ${log_rev3}
  4371. ${log_rev2}
  4372. ${log_trailer}"
  4373.  
  4374.       dotest log-21 "${testcvs} log -r:1.2 file1" \
  4375. "${log_header}
  4376. ${log_tags}
  4377. ${log_header2}
  4378. total revisions: 5;    selected revisions: 2
  4379. description:
  4380. ${log_rev2}
  4381. ${log_rev1}
  4382. ${log_trailer}"
  4383.  
  4384.       dotest log-22 "${testcvs} log -r1.1:1.2 file1" \
  4385. "${log_header}
  4386. ${log_tags}
  4387. ${log_header2}
  4388. total revisions: 5;    selected revisions: 2
  4389. description:
  4390. ${log_rev2}
  4391. ${log_rev1}
  4392. ${log_trailer}"
  4393.  
  4394.       cd ..
  4395.       rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir
  4396.       ;;
  4397.  
  4398.     *)
  4399.        echo $what is not the name of a test -- ignored
  4400.        ;;
  4401.     esac
  4402. done
  4403.  
  4404. echo "OK, all tests completed."
  4405.  
  4406. # TODO:
  4407. # * use "test" not "[" and see if all test's support `-z'
  4408. # * Test `cvs admin'.
  4409. # * Test `cvs update -d foo' (where foo does not exist).
  4410. # * Test `cvs update foo bar' (where foo and bar are both from the same
  4411. #   repository).  Suppose one is a branch--make sure that both directories
  4412. #   get updated with the respective correct thing.
  4413. # * `cvs update ../foo'.  Also ../../foo ./../foo foo/../../bar /foo/bar
  4414. #   foo/.././../bar foo/../bar etc.
  4415. # * Test all flags in modules file.
  4416. #   Test that ciprog gets run both on checkin in that directory, or a
  4417. #     higher-level checkin which recurses into it.
  4418. # * Test that $ followed by "Header" followed by $ gets expanded on checkin.
  4419. # * Test operations on a directory that contains other directories but has 
  4420. #   no files of its own.
  4421. # * -t global option
  4422. # * cvs rm followed by cvs add or vice versa (with no checkin in between).
  4423. # * cvs rm twice (should be a nice error message).
  4424. # * -P option to checkout--(a) refrains from checking out new empty dirs,
  4425. #   (b) prunes empty dirs already there.
  4426. # * Test that cvs -d `hostname`:/tmp/cvs-sanity/non/existent co foo
  4427. #   gives an appropriate error (e.g. 
  4428. #     Cannot access /tmp/cvs-sanity/non-existent/CVSROOT
  4429. #     No such file or directory).
  4430. # * Test ability to send notifications in response to watches.  (currently
  4431. #   hard to test because CVS doesn't send notifications if username is the
  4432. #   same).
  4433. # * Test that remote edit and/or unedit works when disconnected from
  4434. #   server (e.g. set CVS_SERVER to "foobar").
  4435. # End of TODO list.
  4436.  
  4437. # Remove the test directory, but first change out of it.
  4438. cd /tmp
  4439. rm -rf ${TESTDIR}
  4440.  
  4441. # end of sanity.sh
  4442.