diff options
Diffstat (limited to 'contrib/cvs/src/sanity.sh')
-rwxr-xr-x | contrib/cvs/src/sanity.sh | 2647 |
1 files changed, 2280 insertions, 367 deletions
diff --git a/contrib/cvs/src/sanity.sh b/contrib/cvs/src/sanity.sh index acbb8d0..ae0580e 100755 --- a/contrib/cvs/src/sanity.sh +++ b/contrib/cvs/src/sanity.sh @@ -22,7 +22,7 @@ usage () { echo "Usage: `basename $0` --help" - echo "Usage: `basename $0` [-klr] [-f FROM-TEST] [-h HOSTNAME] CVS-TO-TEST [TESTS-TO-RUN...]" + echo "Usage: `basename $0` [-eklrv] [-f FROM-TEST] [-h HOSTNAME] CVS-TO-TEST [TESTS-TO-RUN...]" } exit_usage () @@ -35,22 +35,27 @@ exit_help () { usage echo - echo "-H|--help display this text" - echo "-l|--link-root" - echo " test CVS using a symlink to a real CVSROOT" - echo "-r|--remote test remote instead of local cvs" + echo "-H|--help Display this text." + echo "-e|--skipfail Treat tests that would otherwise be nonfatally skipped" + echo " for reasons like missing tools as failures, exiting" + echo " with an error message. Also treat warnings as" + echo " failures." + echo "-f FROM-TEST Run TESTS-TO-RUN, skipping all tests in the list before" + echo " FROM-TEST." echo "-h HOSTNAME Use :ext:HOSTNAME to run remote tests rather than" echo " :fork:. Implies --remote and assumes that \$TESTDIR" echo " resolves to the same directory on both the client and" echo " the server." - echo "-k|--keep try to keep directories created by individual tests" - echo " around, exiting after the first test which supports" - echo " --keep" - echo "-f FROM-TEST run TESTS-TO-RUN, skipping all tests in the list before" - echo " FROM-TEST" + echo "-k|--keep Try to keep directories created by individual tests" + echo " around, exiting after the first test which supports" + echo " --keep." + echo "-l|--link-root" + echo " Test CVS using a symlink to a real CVSROOT." + echo "-r|--remote Test remote instead of local cvs." + echo "-v|--verbose List test names as they are executed." echo - echo "CVS-TO-TEST the path to the CVS executable to be tested" - echo "TESTS-TO-RUN the names of the tests to run (defaults to all tests)" + echo "CVS-TO-TEST The path to the CVS executable to be tested." + echo "TESTS-TO-RUN The names of the tests to run (defaults to all tests)." exit 2 } @@ -59,6 +64,10 @@ exit_help () # required to make this script work properly. unset CVSREAD +# This will cause malloc to run slower but should also catch some common errors +# when CVS is linked with glibc 2.x. +MALLOC_CHECK_=2; export MALLOC_CHECK_ + # We want to invoke a predictable set of i18n behaviors, not whatever # the user running this script might have set. # In particular: @@ -71,6 +80,14 @@ LC_ALL=C export LC_ALL +# +# Initialize the test counts. +# +passed=0 +skipped=0 +warnings=0 + + # # read our options @@ -80,7 +97,9 @@ unset remotehost keep=false linkroot=false remote=false -while getopts f:h:Hklr-: option ; do +skipfail=false +verbose=false +while getopts ef:h:Hklrv-: option ; do # convert the long opts to short opts if test x$option = x-; then case "$OPTARG" in @@ -100,12 +119,23 @@ while getopts f:h:Hklr-: option ; do option=k; OPTARG= ;; + s|sk|ski|skip|skipf|skipfa|skipfai|skipfail) + option=e + OPTARG= + ;; + v|ve|ver|verb|verbo|verbos|verbose) + option=v + OPTARG= + ;; *) option=\? OPTARG= esac fi case "$option" in + e) + skipfail=: + ;; f) fromtest="$OPTARG" ;; @@ -133,6 +163,9 @@ while getopts f:h:Hklr-: option ; do r) remote=: ;; + v) + verbose=: + ;; \?) exit_usage ;; @@ -183,7 +216,8 @@ echo 'This test should produce no other output than this message, and a final "O echo '(Note that the test can take an hour or more to run and periodically stops' echo 'for as long as one minute. Do not assume there is a problem just because' echo 'nothing seems to happen for a long time. If you cannot live without' -echo "running status, try the command: \`tail -f check.log' from another window.)" +echo 'running status, use the -v option or try the command:' +echo "\`tail -f check.log' from another window.)" # Regexp to match what CVS will call itself in output that it prints. # FIXME: we don't properly quote this--if the name contains . we'll @@ -191,11 +225,7 @@ echo "running status, try the command: \`tail -f check.log' from another window. # special characters we are probably in big trouble. PROG=`basename ${testcvs}` -# Regexp to match an author name. I'm not really sure what characters -# should be here. a-zA-Z obviously. People complained when 0-9 were -# not allowed in usernames. Other than that I'm not sure. -username="[-a-zA-Z0-9][-a-zA-Z0-9]*" -author="[-a-zA-Z0-9][-a-zA-Z0-9]*" +# Match the hostname hostname="[-_.a-zA-Z0-9]*" # Regexp to match the name of a temporary file (from cvs_temp_name). @@ -211,11 +241,41 @@ RFCDATE_EPOCH="1 Jan 1970 00:00:00 -0000" # than diff does DATE="[a-zA-Z]* [a-zA-Z]* [ 1-3][0-9] [0-9:]* [0-9]*" +# Which directories should Which and find_tool search for executables? +SEARCHPATH=$PATH:/usr/local/bin:/usr/contrib/bin:/usr/contrib:/usr/gnu/bin:/local/bin:/local/gnu/bin:/gnu/bin:/sw/bin:/usr/pkg/bin + +# Do not assume that `type -p cmd` is portable +# Usage: Which [-a] [-x|-f|-r] prog [$SEARCHPATH:/with/directories:/to/search] +Which() { + # Optional first argument for file type, defaults to -x. + # Second argument is the file or directory to be found. + # Third argument is the PATH to search. + # By default, print only the first file that matches, + # -a will cause all matches to be printed. + notevery=: + if [ "x$1" = "x-a" ]; then notevery=false; shift; fi + case "$1" in + -*) t=$1; shift ;; + *) t=-x ;; + esac + case "$1" in + # FIXME: Someday this may need to be fixed + # to deal better with C:\some\path\to\ssh values... + /*) test $t $1 && echo $1 ;; + *) for d in `IFS=:; echo ${2-$SEARCHPATH}` + do + test $t $d/$1 && { echo $d/$1; if $notevery; then break; fi; } + done + ;; + esac +} + + # On cygwin32, we may not have /bin/sh. if test -r /bin/sh; then TESTSHELL="/bin/sh" else - TESTSHELL=`type -p sh 2>/dev/null` + TESTSHELL=`Which -f sh` if test ! -r "$TESTSHELL"; then TESTSHELL="/bin/sh" fi @@ -245,6 +305,12 @@ fi # which makes for a lot of failed `tail -f' attempts. touch check.log +# Workaround any X11Forwarding by ssh. Otherwise this text: +# Warning: No xauth data; using fake authentication data for X11 forwarding. +# has been known to end up in the test results below +# causing the test to fail. +[ -n "$DISPLAY" ] && unset DISPLAY + # The default value of /tmp/cvs-sanity for TESTDIR is dubious, # because it loses if two people/scripts try to run the tests # at the same time. Some possible solutions: @@ -326,40 +392,103 @@ fi : ${ID=id} : ${TR=tr} +# Keep track of tools that are found, but do NOT work as we hope +# in order to avoid them in future +badtools= +set_bad_tool () +{ + badtools=$badtools:$1 +} +is_bad_tool () +{ + case ":$badtools:" in *:$1:*) return 0 ;; *) return 1 ; esac +} + +version_test () +{ + vercmd=$1 + verbad=: + if RES=`$vercmd --version </dev/null 2>&1`; then + if test "X$RES" != "X--version" && test "X$RES" != "X" ; then + echo "$RES" + verbad=false + fi + fi + if $verbad; then + echo "The command \`$vercmd' does not support the --version option." + fi + # It does not really matter that --version is not supported + return 0 +} + +# Try to find a tool that satisfies all of the tests. +# Usage: list:of:colon:separated:alternatives test1 test2 test3 test4... +# Example: find_tool awk:gawk:nawk awk_tooltest1 awk_tooltest2 find_tool () { - GLOCS="`echo $PATH | sed 's/:/ /g'` /usr/local/bin /usr/contrib/bin /usr/gnu/bin /local/bin /local/gnu/bin /gnu/bin" + default_TOOL=$1 + echo find_tool: ${1+"$@"} >>$LOGFILE + cmds="`IFS=:; echo $1`"; shift; tooltests="${1+$@}" + if test -z "$tooltests"; then tooltests=version_test; fi + clist=; for cmd in $cmds; do clist="$clist `Which -a $cmd`"; done + # Make sure the default tool is just the first real command name + for default_TOOL in $clist `IFS=:; echo $default_TOOL`; do break; done TOOL="" - for path in $GLOCS ; do - if test -x $path/g$1 ; then - RES="`$path/g$1 --version </dev/null 2>/dev/null`" - if test "X$RES" != "X--version" && test "X$RES" != "X" ; then - TOOL=$path/g$1 - break + for trytool in $clist ; do + pass=: + for tooltest in $tooltests; do + result=`eval $tooltest $trytool` + rc=$? + echo "Running $tooltest $trytool" >>$LOGFILE + if test -n "$result"; then + echo "$result" >>$LOGFILE fi - fi - if test -x $path/$1 ; then - RES="`$path/$1 --version </dev/null 2>/dev/null`" - if test "X$RES" != "X--version" && test "X$RES" != "X" ; then - TOOL=$path/$1 - break + if test "$rc" = "0"; then + echo "PASS: $tooltest $trytool" >>$LOGFILE + elif test "$rc" = "77"; then + echo "MARGINAL: $tooltest $trytool; rc=$rc" >>$LOGFILE + TOOL=$trytool + pass=false + else + set_bad_tool $trytool + echo "FAIL: $tooltest $trytool; rc=$rc" >>$LOGFILE + pass=false fi + done + if $pass; then + echo $trytool + return 0 fi done - if test -z "$TOOL"; then - : + if test -n "$TOOL"; then + echo "Notice: The default version of \`$default_TOOL' is defective." >>$LOGFILE + echo "using \`$TOOL' and hoping for the best." >>$LOGFILE + echo "Notice: The default version of \`$default_TOOL' is defective." >&2 + echo "using \`$TOOL' and hoping for the best." >&2 + echo $TOOL else - echo "Notice: The default version of \`$1' is defective, using" >&2 - echo "\`$TOOL' instead." >&2 + echo $default_TOOL fi - echo "$TOOL" } +id_tool_test () +{ + id=$1 + if $id -u >/dev/null 2>&1 && $id -un >/dev/null 2>&1; then + return 0 + else + echo "Running these tests requires an \`id' program that understands the" + echo "-u and -n flags. Make sure that such an id (GNU, or many but not" + echo "all vendor-supplied versions) is in your path." + return 1 + fi +} + +ID=`find_tool id version_test id_tool_test` +echo "Using ID=$ID" >>$LOGFILE + # You can't run CVS as root; print a nice error message here instead # of somewhere later, after making a mess. -# -# FIXME - find_tool() finds the 'gid' from GNU id-utils if I pull 'id' out of -# my path. for pass in false :; do case "`$ID -u 2>/dev/null`" in "0") @@ -367,18 +496,6 @@ for pass in false :; do exit 1 ;; - "") - if $pass; then :; else - ID=`find_tool id` - fi - if $pass || test -z "$ID" ; then - echo "Running these tests requires an \`id' program that understands the" >&2 - echo "-u and -n flags. Make sure that such an id (GNU, or many but not" >&2 - echo "all vendor-supplied versions) is in your path." >&2 - exit 1 - fi - ;; - *) break ;; @@ -386,63 +503,70 @@ for pass in false :; do done # Cause NextStep 3.3 users to lose in a more graceful fashion. -if $EXPR 'abc +expr_tooltest1 () +{ +expr=$1 +if $expr 'abc def' : 'abc def' >/dev/null; then - : good, it works + # good, it works + return 0 else - EXPR=`find_tool expr` - if test -z "$EXPR" ; then - echo 'Running these tests requires an "expr" program that can handle' >&2 - echo 'multi-line patterns. Make sure that such an expr (GNU, or many but' >&2 - echo 'not all vendor-supplied versions) is in your path.' >&2 - exit 1 - fi + echo 'Running these tests requires an "expr" program that can handle' + echo 'multi-line patterns. Make sure that such an expr (GNU, or many but' + echo 'not all vendor-supplied versions) is in your path.' + return 1 fi +} # Warn SunOS, SysVr3.2, etc., users that they may be partially losing # if we can't find a GNU expr to ease their troubles... -if $EXPR 'a +expr_tooltest2 () +{ +expr=$1 +if $expr 'a b' : 'a c' >/dev/null; then - EXPR=`find_tool expr` - if test -z "$EXPR" ; then - echo 'Warning: you are using a version of expr that does not correctly' - echo 'match multi-line patterns. Some tests may spuriously pass or fail.' - echo 'You may wish to make sure GNU expr is in your path.' - EXPR=expr - fi + echo 'Warning: you are using a version of expr that does not correctly' + echo 'match multi-line patterns. Some tests may spuriously pass or fail.' + echo 'You may wish to make sure GNU expr is in your path.' + return 1 else - : good, it works + return 0 fi +} -# More SunOS lossage... +expr_create_bar () +{ echo 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' >${TESTDIR}/foo cat ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo >${TESTDIR}/bar cat ${TESTDIR}/bar ${TESTDIR}/bar ${TESTDIR}/bar ${TESTDIR}/bar >${TESTDIR}/foo cat ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo ${TESTDIR}/foo >${TESTDIR}/bar -if $EXPR "`cat ${TESTDIR}/bar`" : "`cat ${TESTDIR}/bar`" >/dev/null; then +rm -f ${TESTDIR}/foo +} + +expr_tooltest3 () +{ +expr=$1 +# More SunOS lossage... +test ! -f ${TESTDIR}/bar && expr_create_bar +if $expr "`cat ${TESTDIR}/bar`" : "`cat ${TESTDIR}/bar`" >/dev/null; then : good, it works else - EXPR=`find_tool expr` - if test -z "$EXPR" ; then - echo 'Warning: you are using a version of expr that does not correctly' - echo 'match large patterns. Some tests may spuriously pass or fail.' - echo 'You may wish to make sure GNU expr is in your path.' - EXPR=expr - fi + echo 'Warning: you are using a version of expr that does not correctly' + echo 'match large patterns. Some tests may spuriously pass or fail.' + echo 'You may wish to make sure GNU expr is in your path.' + return 1 fi -if $EXPR "`cat ${TESTDIR}/bar`x" : "`cat ${TESTDIR}/bar`y" >/dev/null; then - EXPR=`find_tool expr` - if test -z "$EXPR" ; then - echo 'Warning: you are using a version of expr that does not correctly' - echo 'match large patterns. Some tests may spuriously pass or fail.' - echo 'You may wish to make sure GNU expr is in your path.' - EXPR=expr - fi -else - : good, it works +if $expr "`cat ${TESTDIR}/bar`x" : "`cat ${TESTDIR}/bar`y" >/dev/null; then + echo 'Warning: you are using a version of expr that does not correctly' + echo 'match large patterns. Some tests may spuriously pass or fail.' + echo 'You may wish to make sure GNU expr is in your path.' + return 1 fi +# good, it works +return 0 +} # That we should have to do this is total bogosity, but GNU expr # version 1.9.4-1.12 uses the emacs definition of "$" instead of the unix @@ -450,10 +574,18 @@ fi # next release of GNU expr after 1.12 (but we still have to cater to the old # ones for some time because they are in many linux distributions). ENDANCHOR="$" -if $EXPR 'abc +expr_set_ENDANCHOR () +{ +expr=$1 +ENDANCHOR="$" +if $expr 'abc def' : 'abc$' >/dev/null; then ENDANCHOR='\'\' + echo "Notice: An ENDANCHOR of dollar does not work." + echo "Using a workaround for GNU expr versions 1.9.4 thru 1.12" fi +return 0 +} # Work around another GNU expr (version 1.10-1.12) bug/incompatibility. # "." doesn't appear to match a newline (it does with SunOS 4.1.3 expr). @@ -464,28 +596,53 @@ fi # next release of GNU expr after 1.12 (but we still have to cater to the old # ones for some time because they are in many linux distributions). DOTSTAR='.*' -if $EXPR 'abc +expr_set_DOTSTAR () +{ +expr=$1 +DOTSTAR='.*' +if $expr 'abc def' : "a${DOTSTAR}f" >/dev/null; then : good, it works else DOTSTAR='\(.\| \)*' + echo "Notice: DOTSTAR changed from sane \`.*' value to \`$DOTSTAR\`" + echo "to workaround GNU expr version 1.10 thru 1.12 bug where \`.'" + echo "does not match a newline." fi +return 0 +} # Now that we have DOTSTAR, make sure it works with big matches -if $EXPR "`cat ${TESTDIR}/bar`" : "${DOTSTAR}xyzABC${DOTSTAR}$" >/dev/null; then - : good, it works +expr_tooltest_DOTSTAR () +{ +expr=$1 +test ! -f ${TESTDIR}/bar && expr_create_bar +if $expr "`cat ${TESTDIR}/bar`" : "${DOTSTAR}xyzABC${DOTSTAR}$" >/dev/null; then + # good, it works + return 0 else - EXPR=`find_tool expr` - if test -z "$EXPR" ; then - echo 'Warning: you are using a version of expr that does not correctly' - echo 'match large patterns. Some tests may spuriously pass or fail.' - echo 'You may wish to make sure GNU expr is in your path.' - EXPR=expr - fi + echo 'Warning: you are using a version of expr that does not correctly' + echo 'match large patterns. Some tests may spuriously pass or fail.' + echo 'You may wish to make sure GNU expr is in your path.' + return 77 fi +} + +EXPR=`find_tool ${EXPR}:gexpr \ + version_test expr_tooltest1 expr_tooltest2 expr_tooltest3 \ +expr_set_ENDANCHOR expr_set_DOTSTAR expr_tooltest_DOTSTAR` + +# Set the ENDANCHOR and DOTSTAR for the chosen expr version. +expr_set_ENDANCHOR ${EXPR} >/dev/null +expr_tooltest_DOTSTAR ${EXPR} >/dev/null -rm -f ${TESTDIR}/foo ${TESTDIR}/bar +echo "Using EXPR=$EXPR" >>$LOGFILE +echo "Using ENDANCHOR=$ENDANCHOR" >>$LOGFILE +echo "Using DOTSTAR=$DOTSTAR" >>$LOGFILE + +# Cleanup +rm -f ${TESTDIR}/bar # Work around yet another GNU expr (version 1.10) bug/incompatibility. # "+" is a special character, yet for unix expr (e.g. SunOS 4.1.3) @@ -519,22 +676,151 @@ else exit 1 fi +# Only 8 characters of $username appear in some output. +if test `echo $username |wc -c` -gt 8; then + username8=`echo $username |sed 's/^\(........\).*/\1/'` +else + username8=$username +fi + +# Rarely, we need to match any username, not just the name of the user +# running this test. +# +# I'm not really sure what characters should be here. a-zA-Z obviously. +# People complained when 0-9 were not allowed in usernames. Other than that +# I'm not sure. +anyusername="[-a-zA-Z0-9][-a-zA-Z0-9]*" + # now make sure that tr works on NULs -if $EXPR `echo "123" | ${TR} '2' '\0'` : "123" >/dev/null 2>&1; then - TR=`find_tool tr` - if test -z "$TR" ; then - echo 'Warning: you are using a version of tr which does not correctly' - echo 'handle NUL bytes. Some tests may spuriously pass or fail.' - echo 'You may wish to make sure GNU tr is in your path.' - TR=tr - fi +tr_tooltest1 () +{ +tr=$1 +if $EXPR `echo "123" | $tr '2' '\0'` : "123" >/dev/null 2>&1; then + echo 'Warning: you are using a version of tr which does not correctly' + echo 'handle NUL bytes. Some tests may spuriously pass or fail.' + echo 'You may wish to make sure GNU tr is in your path.' + return 77 +fi +# good, it works +return 0 +} + +TR=`find_tool ${TR}:gtr version_test tr_tooltest1` +echo "Using TR=$TR" >>$LOGFILE + +# Awk testing + +awk_tooltest1 () +{ +awk=$1 +$awk 'BEGIN {printf("one\ntwo\nthree\nfour\nfive\nsix")}' </dev/null >abc +if $EXPR "`cat abc`" : \ +'one +two +three +four +five +six'; then + rm abc + return 0 else - : good, it works + rm abc + echo "Notice: awk BEGIN clause or printf is not be working properly." + return 1 +fi +} + +# Format item %c check +awk_tooltest2 () +{ +awk=$1 +$awk 'BEGIN { printf "%c%c%c", 2, 3, 4 }' </dev/null \ + | ${TR} '\002\003\004' '123' >abc +if $EXPR "`cat abc`" : "123" ; then + : good, found it +else + echo "Notice: awk format %c string may not be working properly." + rm abc + return 77 fi +rm abc +return 0 +} + +AWK=`find_tool gawk:nawk:awk version_test awk_tooltest1 awk_tooltest2` +echo "Using AWK=$AWK" >>$LOGFILE + +# Test that $1 works as a remote shell. If so, set $host, $CVS_RSH, & +# $save_CVS_RSH to match and return 0. Otherwise, set $skipreason and return +# 77. +depends_on_rsh () +{ + host=${remotehost-"`hostname`"} + result=`$1 $host 'echo test'` + rc=$? + if test $? != 0 || test "x$result" != "xtest"; then + skipreason="\`$1 $host' failed rc=$rc result=$result" + return 77 + fi + + save_CVS_RSH=$CVS_RSH + CVS_RSH=$1; export CVS_RSH + return 0 +} + +# Find a usable SSH. When a usable ssh is found, set $host, $CVS_RSH, and +# $save_CVS_RSH and return 0. Otherwise, set $skipreason and return 77. +depends_on_ssh () +{ + case "$CVS_RSH" in + *ssh*|*putty*) + tryssh=`Which $CVS_RSH` + if [ ! -n "$tryssh" ]; then + skipreason="Unable to find CVS_RSH=$CVS_RSH executable" + return 77 + elif [ ! -x "$tryssh" ]; then + skipreason="Unable to execute $tryssh program" + return 77 + fi + ;; + *) + # Look in the user's PATH for "ssh" + tryssh=`Which ssh` + if test ! -r "$tryssh"; then + skipreason="Unable to find ssh program" + return 77 + fi + ;; + esac + + depends_on_rsh "$tryssh" + return $? +} pass () { echo "PASS: $1" >>${LOGFILE} + passed=`expr $passed + 1` +} + +skip () +{ + if $skipfail; then + fail "$1${2+ ($2)}" + else + echo "SKIP: $1${2+ ($2)}" >>$LOGFILE + fi + skipped=`expr $skipped + 1` +} + +warn () +{ + if $skipfail; then + fail "$1${2+ ($2)}" + else + echo "WARNING: $1${2+ ($2)}" >>$LOGFILE + fi + warnings=`expr $warnings + 1` } fail () @@ -545,6 +831,28 @@ fail () exit 1 } +verify_tmp_empty () +{ + # Test our temp directory for cvs-serv* directories and cvsXXXXXX temp + # files. We would like to not leave any behind. + if $remote && ls $TMPDIR/cvs-serv* >/dev/null 2>&1; then + # A true value means ls found files/directories with these names. + # Give the server some time to finish, then retry. + sleep 1 + if ls $TMPDIR/cvs-serv* >/dev/null 2>&1; then + warn "$1" "Found cvs-serv* directories in $TMPDIR." + # The above will exit if $skipfail + rm -rf $TMPDIR/cvs-serv* + fi + fi + if ls $TMPDIR/cvs?????? >/dev/null 2>&1; then + # A true value means ls found files/directories with these names. + warn "$1" "Found cvsXXXXXX temp files in $TMPDIR." + # The above will exit if $skipfail + rm -f ls $TMPDIR/cvs?????? + fi +} + # See dotest and dotest_fail for explanation (this is the parts # of the implementation common to the two). dotest_internal () @@ -562,14 +870,17 @@ dotest_internal () # surely use a somewhat non-specific pattern). cat ${TESTDIR}/dotest.tmp >>${LOGFILE} pass "$1" + verify_tmp_empty "$1" # expr can't distinguish between "zero characters matched" and "no match", # so special-case it. elif test -z "$3" && test ! -s ${TESTDIR}/dotest.tmp; then pass "$1" + verify_tmp_empty "$1" elif test x"$4" != x; then if $EXPR "`cat ${TESTDIR}/dotest.tmp`" : "$4${ENDANCHOR}" >/dev/null; then cat ${TESTDIR}/dotest.tmp >>${LOGFILE} pass "$1" + verify_tmp_empty "$1" else echo "** expected: " >>${LOGFILE} echo "$3" >>${LOGFILE} @@ -644,17 +955,20 @@ dotest_internal_debug () fail "$1" else pass "$1" + verify_tmp_empty "$1" fi else echo "$3" > ${TESTDIR}/dotest.exp if dotest_line_by_line "$1" "$2"; then pass "$1" + verify_tmp_empty "$1" else if test x"$4" != x; then mv ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.ex1 echo "$4" > ${TESTDIR}/dotest.exp if dotest_line_by_line "$1" "$2"; then pass "$1" + verify_tmp_empty "$1" else mv ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.ex2 echo "** expected: " >>${LOGFILE} @@ -716,6 +1030,7 @@ dotest_lit () cat >${TESTDIR}/dotest.exp if cmp ${TESTDIR}/dotest.exp ${TESTDIR}/dotest.tmp >/dev/null 2>&1; then pass "$1" + verify_tmp_empty "$1" else echo "** expected: " >>${LOGFILE} cat ${TESTDIR}/dotest.exp >>${LOGFILE} @@ -754,6 +1069,19 @@ dotest_sort () dotest_internal "$@" } +# A function for fetching the timestamp of a revison of a file +getrlogdate () { + ${testcvs} -n rlog -N ${1+"$@"} | + while read token value; do + case "$token" in + date:) + echo $value | sed "s,;.*,," + break; + ;; + esac + done +} + # Avoid picking up any stray .cvsrc, etc., from the user running the tests mkdir home HOME=${TESTDIR}/home; export HOME @@ -773,30 +1101,31 @@ RCSINIT=; export RCSINIT if test x"$*" = x; then # Basic/miscellaneous functionality tests="version basica basicb basicc basic1 deep basic2" - tests="${tests} parseroot files spacefiles commit-readonly" + tests="${tests} parseroot parseroot2 files spacefiles commit-readonly" tests="${tests} commit-add-missing" tests="${tests} status" # Branching, tagging, removing, adding, multiple directories tests="${tests} rdiff rdiff-short" - tests="${tests} rdiff2 diff diffnl death death2" + tests="${tests} rdiff2 diff diffnl death death2 death-rtag" tests="${tests} rm-update-message rmadd rmadd2 rmadd3 resurrection" - tests="${tests} dirs dirs2 branches branches2 tagc tagf" + tests="${tests} dirs dirs2 branches branches2 tagc tagf tag-space" tests="${tests} rcslib multibranch import importb importc import-CVS" + tests="$tests import-quirks" tests="${tests} update-p import-after-initial branch-after-import" - tests="${tests} join join2 join3 join4 join5 join6" + tests="${tests} join join2 join3 join4 join5 join6 join7" tests="${tests} join-readonly-conflict join-admin join-admin-2" tests="${tests} join-rm" - tests="${tests} new newb conflicts conflicts2 conflicts3" + tests="${tests} new newb conflicts conflicts2 conflicts3 conflicts4" tests="${tests} clean" # Checking out various places (modules, checkout -d, &c) tests="${tests} modules modules2 modules3 modules4 modules5 modules6" - tests="${tests} mkmodules co-d" + tests="${tests} modules7 mkmodules co-d" tests="${tests} cvsadm emptydir abspath abspath2 toplevel toplevel2" tests="${tests} rstar-toplevel trailingslashes checkout_repository" # Log messages, error messages. tests="${tests} mflag editor errmsg1 errmsg2 adderrmsg opterrmsg" # Watches, binary files, history browsing, &c. - tests="${tests} devcom devcom2 devcom3 watch4 watch5" + tests="${tests} devcom devcom2 devcom3 watch4 watch5 watch6" tests="${tests} unedit-without-baserev" tests="${tests} ignore ignore-on-branch binfiles binfiles2 binfiles3" tests="${tests} mcopy binwrap binwrap2" @@ -804,7 +1133,9 @@ if test x"$*" = x; then tests="${tests} serverpatch log log2 logopt ann ann-id" # Repository Storage (RCS file format, CVS lock files, creating # a repository without "cvs init", &c). - tests="${tests} crerepos rcs rcs2 rcs3 lockfiles backuprecover" + tests="${tests} crerepos rcs rcs2 rcs3 rcs4 rcs5 rcs6" + tests="$tests lockfiles backuprecover" + tests="${tests} sshstdio" # More history browsing, &c. tests="${tests} history" tests="${tests} big modes modes2 modes3 stamps" @@ -1757,6 +2088,11 @@ for what in $tests; do continue fi fi + + if $verbose; then + echo "$what:" + fi + case $what in version) @@ -1766,8 +2102,11 @@ for what in $tests; do ' Concurrent Versions System (CVS) [0-9.]*.* -Copyright (c) [-0-9]* Brian Berliner, david d .zoo. zuhn, - Jeff Polk, and other authors +Copyright (C) [0-9]* Free Software Foundation, Inc. + +Senior active maintainers include Larry Jones, Derek R. Price, +and Mark D. Baushke. Please see the AUTHORS and README files from the CVS +distribution kit for a complete list of contributors and copyrights. CVS may be copied only under the terms of the GNU General Public License, a copy of which can be found with the CVS distribution kit. @@ -1895,7 +2234,7 @@ ${PLUS} ssfile line 2" =================================================================== RCS file: ${CVSROOT_DIRNAME}/first-dir/sdir/ssdir/ssfile,v retrieving revision 1\.1 -diff -c -C3isacrowd -r1\.1 ssfile +diff -c -C 3isacrowd -r1\.1 ssfile ${PROG} diff: invalid context length argument" dotest basica-7 "${testcvs} -q ci -m modify-it" \ "Checking in sdir/ssdir/ssfile; @@ -1992,8 +2331,8 @@ done" ' Annotations for sdir/ssdir/ssfile \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -1\.1 .'"${username}"' *[0-9a-zA-Z-]*.: ssfile -1\.2 .'"${username}"' *[0-9a-zA-Z-]*.: ssfile line 2' +1\.1 .'"$username8"' *[0-9a-zA-Z-]*.: ssfile +1\.2 .'"$username8"' *[0-9a-zA-Z-]*.: ssfile line 2' # Test resurrecting with strange revision numbers cd sdir/ssdir @@ -2381,7 +2720,8 @@ ${PROG} update: Updating second-dir" # On Linux 2.2 systems, the cwd may be gone, so we recreate it # to allow basicc-11 to actually happen if test ! -d ../first-dir; then - cd .. + # Apparently `cd ..' doesn't work with Linux 2.2 & Bash 2.05b. + cd $TESTDIR/1 mkdir ./first-dir cd ./first-dir fi @@ -2389,8 +2729,7 @@ ${PROG} update: Updating second-dir" "" "${PROG} release: deletion of directory \./\. failed: .*" dotest basicc-11a "test -d ../second-dir" "" - cd .. - cd .. + cd ../.. mkdir 2; cd 2 dotest basicc-12 "${testcvs} -Q co ." "" @@ -3433,7 +3772,17 @@ Are you sure you want to release (and delete) directory .first-dir.: " "${PROG} rtag: Tagging first-dir ${PROG} rtag: Tagging first-dir/dir1 ${PROG} rtag: Tagging first-dir/dir1/dir2" - + # The next test used to cause an assert failure + # something like: + # cvs: ./recurse.c:667: do_recursion: Assertion `repository != ((void *)0)' failed. + dotest basic2-21b "${testcvs} co -p -r rtagged-by-head first-dir/file6" \ +"=================================================================== +Checking out first-dir/file6 +RCS: $CVSROOT_DIRNAME/first-dir/file6,v +VERS: 1\.2 +\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* +file6 +file6" # tag by tag dotest basic2-22 "${testcvs} rtag -r rtagged-by-head rtagged-by-tag first-dir" \ "${PROG} rtag: Tagging first-dir @@ -3772,6 +4121,8 @@ $PROG logout: Entry not found\." rm -r 1 ;; + + files) # Test of how we specify files on the command line # (recurse.c and that sort of thing). Vaguely similar to @@ -3847,26 +4198,25 @@ ${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v <-- \.file new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1 done" if $remote; then + # FIXCVS: # This is a bug, looks like that toplevel_repos cruft in # client.c is coming back to haunt us. # May want to think about the whole issue, toplevel_repos # has always been crufty and trying to patch it up again # might be a mistake. - dotest_fail files-12 \ + dotest files-12 \ "${testcvs} commit -f -m test ./sdir/ssdir/.file ./.file" \ -"${PROG} commit: Up-to-date check failed for .\.file' -${PROG} \[commit aborted\]: correct above errors first!" +"Checking in \./sdir/ssdir/\.file; +${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v <-- \.file +new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2 +done" # Sync up the version numbers so that the rest of the # tests don't need to expect different numbers based # local or remote. dotest files-12-workaround \ -"${testcvs} commit -f -m test sdir/ssdir/.file .file" \ -"Checking in sdir/ssdir/\.file; -${CVSROOT_DIRNAME}/first-dir/dir/sdir/ssdir/Attic/\.file,v <-- \.file -new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2 -done -Checking in \.file; +"${testcvs} commit -f -m test .file" \ +"Checking in \.file; ${CVSROOT_DIRNAME}/first-dir/dir/Attic/\.file,v <-- \.file new revision: 1\.1\.2\.3; previous revision: 1\.1\.2\.2 done" @@ -4053,7 +4403,7 @@ C tfile" # Now note our status dotest status-1 "${testcvs} status tfile" \ "=================================================================== -File: tfile Status: File had conflicts on merge +File: tfile Status: Unresolved Conflict Working revision: 1\.2.* Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/tfile,v @@ -4086,6 +4436,21 @@ File: tfile Status: Locally Modified Sticky Date: (none) Sticky Options: (none)" + # Check that there are no problems just using CVS/Root too. + save_CVSROOT=$CVSROOT + unset CVSROOT + dotest status-3a "${testcvs} status tfile" \ +"=================================================================== +File: tfile Status: Locally Modified + + Working revision: 1\.2.* + Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/tfile,v + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: (none)" + CVSROOT=$save_CVSROOT + export CVSROOT + # FIXCVS: # Update is supposed to re-Register() the file when it # finds resolved conflicts: @@ -4477,7 +4842,7 @@ done" =================================================================== RCS file: ${CVSROOT_DIRNAME}/first-dir/abc,v retrieving revision 1\.2 -diff --ifdef=HAVE_WINSOCK_H -r1\.2 abc +diff --ifdef HAVE_WINSOCK_H -r1\.2 abc #ifndef HAVE_WINSOCK_H extern int gethostname (); #else /\* HAVE_WINSOCK_H \*/ @@ -5248,7 +5613,7 @@ ${PROG} update: file4 is no longer in the repository" dotest death2-16 "${testcvs} -q commit -m add" \ "Checking in file2; ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2 -new revision: 1\.1\.2\.1; previous revision: 1\.1 +new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1 done" # Add a new file on the branch. @@ -5398,6 +5763,103 @@ C file4" cd .. ; rm -rf first-dir ${CVSROOT_DIRNAME}/first-dir ;; + + + death-rtag) + # This documents a bug in CVS that prevents rtag from tagging files + # in the Attic. + mkdir $CVSROOT_DIRNAME/death-rtag + dotest death-rtag-init-1 "$testcvs -Q co death-rtag" + cd death-rtag + echo "This is the file foo" > foo + echo "This is the file bar" > bar + dotest death-rtag-init-2 "$testcvs -Q add foo bar" + dotest death-rtag-init-3 "$testcvs -Q ci -m 'Add foo and bar.'" \ +"RCS file: $CVSROOT_DIRNAME/death-rtag/bar,v +done +Checking in bar; +$CVSROOT_DIRNAME/death-rtag/bar,v <-- bar +initial revision: 1\.[0-9]* +done +RCS file: $CVSROOT_DIRNAME/death-rtag/foo,v +done +Checking in foo; +$CVSROOT_DIRNAME/death-rtag/foo,v <-- foo +initial revision: 1\.[0-9]* +done" + dotest death-rtag-init-5 "$testcvs -Q tag -b mybranch" + + dotest death-rtag-1 "$testcvs -q rtag -rmybranch willtag death-rtag" + dotest death-rtag-2 "$testcvs -Q rm -f foo" + dotest death-rtag-3 "$testcvs -Q ci -m 'Remove foo.'" \ +"Removing foo; +$CVSROOT_DIRNAME/death-rtag/foo,v <-- foo +new revision: delete; previous revision: 1\.[0-9]* +done" + # commit something on the branch so that the moving tag is visible. + dotest death-rtag-3.2 "$testcvs -Q up -rmybranch" + echo some branch content >>foo + echo some branch content >>bar + dotest death-rtag-3.3 "$testcvs -Q ci -m 'Change foo.'" \ +"Checking in bar; +$CVSROOT_DIRNAME/death-rtag/bar,v <-- bar +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done +Checking in foo; +$CVSROOT_DIRNAME/death-rtag/Attic/foo,v <-- foo +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done" + dotest death-rtag-3.4 \ +"$testcvs -q rtag -rmybranch wontmove death-rtag" + dotest death-rtag-3.5 "$testcvs -q rtag -F wontmove death-rtag" + + cd .. + # Removing -f below avoids this bug. + dotest death-rtag-4 "$testcvs -q rtag -frmybranch wonttag death-rtag" + + # When the bug existed, `wonttag' would not have been present in + # foo,v. + # + # A second bug prevented `wontmove' from moving from the branch to + # the dead revision on the trunk (death-rtag-3.4 & death-rtag-3.5). + dotest death-rtag-5 "$testcvs -q rlog death-rtag" \ +" +RCS file: $CVSROOT_DIRNAME/death-rtag/bar,v +head: 1.[0-9]* +branch: +locks: strict +access list: +symbolic names: + wonttag: 1\.1\.2\.1 + wontmove: 1\.1 + willtag: 1\.1 + mybranch: 1\.1.0\.2 +keyword substitution: kv +$DOTSTAR +RCS file: $CVSROOT_DIRNAME/death-rtag/Attic/foo,v +head: 1.[0-9]* +branch: +locks: strict +access list: +symbolic names: + wonttag: 1\.1\.2\.1 + wontmove: 1\.2 + willtag: 1\.1 + mybranch: 1\.1.0\.2 +keyword substitution: kv +$DOTSTAR" + + if $keep; then + echo Keeping $TESTDIR and exiting due to --keep + exit 0 + fi + + rm -r death-rtag + rm -rf $CVSROOT_DIRNAME/death-rtag + ;; + + + rm-update-message) # FIXME # local CVS prints a warning message when update notices a missing @@ -5860,8 +6322,8 @@ done" dotest resurrection-init5 "$testcvs -Q rm -f file1" - # The first test is that `cvs add' will resurrect a file before it - # has been committed. + # The first test is that `cvs add' will resurrect a file before its + # removal has been committed. dotest_sort resurrection-1 "$testcvs add file1" \ "U file1 $PROG add: file1, version 1\.1, resurrected" @@ -5909,6 +6371,24 @@ $PROG add: use 'cvs commit' to add this file permanently" $CVSROOT_DIRNAME/first-dir/file1,v <-- file1 new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1 done" + + # The next few tests verify that an attempted resurrection of a file + # with no previous revision on the trunk fails. + touch file2 + dotest resurrection-9 "$testcvs -Q add file2" + dotest resurrection-10 "$testcvs -Q ci -mnew-file2" \ +"RCS file: $CVSROOT_DIRNAME/first-dir/Attic/file2,v +done +Checking in file2; +$CVSROOT_DIRNAME/first-dir/Attic/file2,v <-- file2 +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done" + dotest resurrection-11 "$testcvs -Q up -A" + + # This command once caused an assertion failure. + dotest resurrection-12 "$testcvs add file2" \ +"$PROG add: File \`file2' has no previous revision to resurrect\." + if $keep; then echo Keeping $TESTDIR and exiting due to --keep exit 0 @@ -7009,6 +7489,160 @@ ${PROG} rtag: first-dir/file1: Not moving non-branch tag .regulartag. from 1\.1 rm -rf ${CVSROOT_DIRNAME}/first-dir ;; + tag-space) + # Test tags with spaces in the names. + # + # Prior to releases 1.11.18 & 1.12.10, some commands used with + # tags with spaces in the names could hang CVS. + + # Setup; check in first-dir/file1 + mkdir 1; cd 1 + dotest tag-space-init-1 "$testcvs -q co -l ." + mkdir first-dir + dotest tag-space-init-2 "$testcvs add first-dir" \ +"Directory $CVSROOT_DIRNAME/first-dir added to the repository" + cd first-dir + touch file1 + dotest tag-space-init-3 "$testcvs add file1" \ +"$PROG add: scheduling file \`file1' for addition +$PROG add: use '$PROG commit' to add this file permanently" + dotest tag-space-init-4 "$testcvs -Q ci -m add" \ +"RCS file: $CVSROOT_DIRNAME/first-dir/file1,v +done +Checking in file1; +$CVSROOT_DIRNAME/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done" + + # Reportedly, the following two tags make it past WinCVS. + dotest_fail tag-space-1 "$testcvs tag ' spacetag '" \ +"$PROG \[tag aborted\]: tag \` spacetag ' must start with a letter" + dotest_fail tag-space-2 "$testcvs tag 'spacetag '" \ +"$PROG \[tag aborted\]: tag \`spacetag ' has non-visible graphic characters" + + if $remote; then + # Verify that this isn't a client check. + dotest tag-space-3 "$testcvs server" \ +"E $PROG \[tag aborted\]: tag \` spacetag ' must start with a letter +error " <<EOF +Root $CVSROOT_DIRNAME +UseUnchanged +Argument -- +Argument spacetag +Directory . +$CVSROOT_DIRNAME/first-dir +Entry /file1/1.1/// +Unchanged file1 +tag +EOF + + dotest tag-space-4 "$testcvs server" \ +"E $PROG \[tag aborted\]: tag \`spacetag ' has non-visible graphic characters +error " <<EOF +Root $CVSROOT_DIRNAME +UseUnchanged +Argument -- +Argument spacetag +Directory . +$CVSROOT_DIRNAME/first-dir +Entry /file1/1.1/// +Unchanged file1 +tag +EOF + fi # $remote + + # Any number of normal tags and branches were handled correctly. + dotest tag-space-5 "$testcvs -Q tag t1" + dotest tag-space-5b "$testcvs -Q tag t2" + dotest tag-space-5c "$testcvs -Q tag -b b1" + + cd ../.. + mkdir 2; cd 2 + + # But once a vendor branch exists, it's all over. + mkdir project; cd project + touch file1 + dotest tag-space-init-4 \ +"$testcvs -Q import -mimport second-dir VENDOR RELEASE" + + cd .. + + dotest_fail tag-space-6 "$testcvs -Q co -r ' spacetag ' first-dir" \ +"$PROG \[checkout aborted\]: tag \` spacetag ' must start with a letter" + + # But when any files were imported, this test hung prior to CVS + # versions 1.11.18 & 1.12.10. + dotest_fail tag-space-7 "$testcvs -Q co -r ' spacetag ' second-dir" \ +"$PROG \[checkout aborted\]: tag \` spacetag ' must start with a letter" + + if $remote; then + # I based the client input in the next two tests on actual input + # from WinCVS 1.2. + dotest tag-space-8 "$testcvs server" \ +"E $PROG \[checkout aborted\]: tag \` spacetag ' must start with a letter +error " <<EOF +Root $CVSROOT_DIRNAME +Argument -P +Argument -r +Argument spacetag +Argument first-dir +Directory . +$CVSROOT_DIRNAME +co +EOF + + # Verify the test is not on the client side. + dotest tag-space-9 "$testcvs server" \ +"E $PROG \[checkout aborted\]: tag \` spacetag ' must start with a letter +error " <<EOF +Root $CVSROOT_DIRNAME +Argument -P +Argument -r +Argument spacetag +Argument second-dir +Directory . +$CVSROOT_DIRNAME +co +EOF + fi # $remote + + dotest tag-space-10 "$testcvs -Q co second-dir" + cd second-dir + + # This test would also hang. + dotest_fail tag-space-11 "$testcvs -Q up -r ' spacetag '" \ +"$PROG \[update aborted\]: tag \` spacetag ' must start with a letter" + + if $remote; then + dotest tag-space-12 "$testcvs server" \ +"E $PROG \[update aborted\]: tag \` spacetag ' must start with a letter +error " <<EOF +Root $CVSROOT_DIRNAME +Argument -r +Argument spacetag +Argument -u +Argument -- +Directory . +$CVSROOT_DIRNAME +Unchanged file1 +update +EOF + fi # $remote + + # I'm skipping tests for other commands that may have had the same + # problem. Hopefully, if a new issue arises, one of the above tests + # will catch the problem. + + if $keep; then + echo Keeping $TESTDIR and exiting due to --keep + exit 0 + fi + + cd ../.. + rm -r 1 2 + rm -rf $CVSROOT_DIRNAME/first-dir $CVSROOT_DIRNAME/second-dir + ;; + rcslib) # Test librarification of RCS. # First: test whether `cvs diff' handles $Name expansion @@ -7115,12 +7749,12 @@ mumble; } EOF # Use dotest_fail because exit status from `cvs diff' must be 1. - dotest_fail rcslib-diffrgx-3 "${testcvs} diff -c -F'.*(' rgx.c" \ + dotest_fail rcslib-diffrgx-3 "${testcvs} diff -c -F'.* (' rgx.c" \ "Index: rgx\.c =================================================================== RCS file: ${CVSROOT_DIRNAME}/first-dir/rgx\.c,v retrieving revision 1\.1 -diff -c -F\.\*( -r1\.1 rgx\.c +diff -c -F \.\* ( -r1\.1 rgx\.c \*\*\* rgx\.c ${RFCDATE} 1\.1 --- rgx\.c ${RFCDATE} \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* test_regex (whiz, bang) @@ -7334,15 +7968,59 @@ done" "${PROG} rtag: could not read RCS file for file2 ${PROG} rtag: could not read RCS file for first-dir/file2 ${PROG} rtag: could not read RCS file for first-dir/file2" - cd .. - cd .. + # Restore file1 for the next test. + dotest rcslib-long-symlink-init-1 "$testcvs -Q up -A" + dotest rcslib-long-symlink-init-2 "$testcvs -Q add file1" + dotest rcslib-long-symlink-init-3 "$testcvs -Q ci -mback" \ +"Checking in file1; +$CVSROOT_DIRNAME/first-dir/file1,v <-- file1 +new revision: 1\.4; previous revision: 1\.3 +done" + + cd ../.. # $TESTDIR + + # CVS has a hard-coded default link path size of 127 characters. + # Make sure it knows how to exceed that. + longpath=$CVSROOT_DIRNAME + count=0 + while test $count -lt 10; do + count=`expr $count + 1` + longpath=$longpath/123456789012345678901234567890 + mkdir $longpath + done + cp $CVSROOT_DIRNAME/first-dir/file1,v $longpath + mkdir $CVSROOT_DIRNAME/second-dir + + # Switch as for rcslib-symlink-1 + if test -n "$remotehost"; then + dotest rcslib-long-symlink-1rh \ +"$CVS_RSH $remotehost 'ln -s $longpath/file1,v $CVSROOT_DIRNAME/second-dir/fileX,v'" + else + dotest rcslib-long-symlink-1 \ +"ln -s $longpath/file1,v $CVSROOT_DIRNAME/second-dir/fileX,v" + fi + + dotest rcslib-long-symlink-2 "$testcvs co second-dir" \ +"$PROG checkout: Updating second-dir +U second-dir/fileX" + + cd second-dir + echo change-it >>fileX + + # Writes actually cause symlinks to be resolved. + dotest rcslib-long-symlink-3 "$testcvs -q ci -mwrite-it" \ +"Checking in fileX; +$CVSROOT_DIRNAME/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/123456789012345678901234567890/file1,v <-- fileX +new revision: 1\.5; previous revision: 1\.4 +done" if $keep; then echo Keeping ${TESTDIR} and exiting due to --keep exit 0 fi + cd .. # Must remove the symlink first. Samba doesn't appear to show # broken symlink across the SMB share, and rm -rf by itself # will remove file1,v first and leave file2,v a broken link and the @@ -7353,10 +8031,12 @@ ${PROG} rtag: could not read RCS file for first-dir/file2" # rcslib-symlink-3j works fine, but the next one doesn't unless run # remotely under Cygwin and using a TESTDIR on a Samba share. if test -n "$remotehost"; then - $CVS_RSH $remotehost "rm -f ${CVSROOT_DIRNAME}/first-dir/file2,v" + $CVS_RSH $remotehost \ +"rm -f $CVSROOT_DIRNAME/first-dir/file2,v $CVSROOT_DIRNAME/second-dir/fileX,v" fi - rm -rf ${CVSROOT_DIRNAME}/first-dir - rm -r first-dir 2 + rm -rf $CVSROOT_DIRNAME/first-dir $CVSROOT_DIRNAME/second-dir \ + $CVSROOT_DIRNAME/123456789012345678901234567890 + rm -r first-dir second-dir 2 ;; multibranch) @@ -7457,6 +8137,7 @@ modify-on-br1 # head -- intended to test vendor branches and HEAD, # although it doesn't really do it yet. # import-CVS -- refuse to import directories named "CVS". + # import-quirks -- short tests of import quirks. # import mkdir import-dir ; cd import-dir @@ -7717,7 +8398,8 @@ Use the following command to help the merge:" echo 'my own stuff' >mine2.c dotest_fail importb-3 \ "${testcvs} import -m add -b 1 second-dir dummy really_dumb_y" \ -"${PROG} \[[a-z]* aborted\]: Only branches with two dots are supported: 1" +"$PROG \[import aborted\]: Only numeric branch specifications with two dots are +supported by import, not \`1'\. For example: \`1\.1\.1'\." : when we implement main-branch import, should be \ "N second-dir/mine1\.c N second-dir/mine2\.c @@ -7935,6 +8617,72 @@ $PROG import: Importing $CVSROOT_DIRNAME/import-CVS/sdir" rm -rf $CVSROOT_DIRNAME/import-CVS ;; + + + import-quirks) + # Short tests of quirky import behavior. + # + # For a list of other import tests with short descriptions, see the + # comment header of the "import" test. + mkdir import-quirks + cd import-quirks + touch file1 file2 file3 + + # CVS prior to 1.11.18 and 1.12.10 used to happily import to + # "branch 1.1", creating RCS archives with revisions like, + # "1.1..1". That double-dot is *not* a typo. + dotest_fail import-quirks-1 \ +"$testcvs import -b1.1. -mbad-bad-bad import-quirks VB RT" \ +"$PROG \[import aborted\]: Only numeric branch specifications with two dots are +supported by import, not \`1\.1\.'\. For example: \`1\.1\.1'\." + + dotest_fail import-quirks-2 \ +"$testcvs import -b1.1.1.. -mbad-bad-bad import-quirks VB RT" \ +"$PROG \[import aborted\]: Only numeric branch specifications with two dots are +supported by import, not \`1\.1\.1\.\.'\. For example: \`1\.1\.1'\." + + # Try a few odd numbers. This is hardly comprehensive. + dotest_sort import-quirks-2 \ +"$testcvs import -b10.10.101 -mthis-ones-ok import-quirks-2 VB RT" \ +" + +N import-quirks-2/file1 +N import-quirks-2/file2 +N import-quirks-2/file3 +No conflicts created by this import" + + dotest_sort import-quirks-3 \ +"$testcvs import -b2345678901.2345678901.2345678901 -mthis-ones-ok import-quirks-3 VB RT" \ +" + +N import-quirks-3/file1 +N import-quirks-3/file2 +N import-quirks-3/file3 +No conflicts created by this import" + + dotest_sort import-quirks-4 \ +"$testcvs import -b1.1.2 -mthis-ones-ok import-quirks-4 VB RT" \ +" + +N import-quirks-4/file1 +N import-quirks-4/file2 +N import-quirks-4/file3 +No conflicts created by this import" + + if $keep; then + echo Keeping $TESTDIR and exiting due to --keep + exit 0 + fi + + cd .. + rm -r import-quirks + rm -rf $CVSROOT_DIRNAME/import-quirks-2 \ + $CVSROOT_DIRNAME/import-quirks-3 \ + $CVSROOT_DIRNAME/import-quirks-4 + ;; + + + import-after-initial) # Properly handle the case in which the first version of a # file is created by a regular cvs add and commit, and there @@ -8041,7 +8789,7 @@ ${PROG} add: use .${PROG} commit. to add this file permanently" "${testcvs} commit -m cvs-add file2" \ "Checking in file2; ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2 -new revision: 1\.1\.1\.1\.2\.1; previous revision: 1\.1\.1\.1 +new revision: 1\.1\.1\.1\.2\.2; previous revision: 1\.1\.1\.1\.2\.1 done" if $keep; then @@ -8337,7 +9085,7 @@ new revision: 1\.1\.2\.1; previous revision: 1\.1 done Checking in file2; ${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2 -new revision: 1\.1\.2\.1; previous revision: 1\.1 +new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1 done Removing file3; ${CVSROOT_DIRNAME}/first-dir/file3,v <-- file3 @@ -8424,8 +9172,8 @@ M file4' U first-dir/file2 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v retrieving revision 1\.1 -retrieving revision 1\.1\.2\.1 -Merging differences between 1\.1 and 1\.1\.2\.1 into file2 +retrieving revision 1\.1\.2\.2 +Merging differences between 1\.1 and 1\.1\.2\.2 into file2 U first-dir/file3 ${PROG} checkout: scheduling first-dir/file3 for removal U first-dir/file4 @@ -8459,8 +9207,8 @@ U first-dir/file7' "U file1 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v retrieving revision 1\.1 -retrieving revision 1\.1\.2\.1 -Merging differences between 1\.1 and 1\.1\.2\.1 into file2 +retrieving revision 1\.1\.2\.2 +Merging differences between 1\.1 and 1\.1\.2\.2 into file2 ${PROG} update: scheduling file3 for removal M file4 ${PROG} update: file file4 is locally modified, but has been removed in revision branch @@ -8498,8 +9246,8 @@ T file7" "U file1 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v retrieving revision 1.1 -retrieving revision 1.1.2.1 -Merging differences between 1.1 and 1.1.2.1 into file2 +retrieving revision 1.1.2.2 +Merging differences between 1.1 and 1.1.2.2 into file2 ${PROG} update: scheduling file3 for removal ${PROG} update: file file4 has been modified, but has been removed in revision branch U file8 @@ -8532,8 +9280,8 @@ U file1 U file2 RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v retrieving revision 1\.1 -retrieving revision 1\.1\.2\.1 -Merging differences between 1\.1 and 1\.1\.2\.1 into file2 +retrieving revision 1\.1\.2\.2 +Merging differences between 1\.1 and 1\.1\.2\.2 into file2 U file3 ${PROG} update: scheduling file3 for removal U file4 @@ -9335,6 +10083,66 @@ U temp2\.txt rm -rf ${CVSROOT_DIRNAME}/join6 ;; + join7) + # This test deals with joins that happen with the -n switch + mkdir join7; cd join7 + mkdir impdir; cd impdir + echo aaa >temp.txt + echo bbb >>temp.txt + echo ccc >>temp.txt + dotest join7-1 \ +"${testcvs} -Q import -minitial join7 vendor vers-1" \ +"" + cd .. + dotest join7-2 "${testcvs} -Q co join7" "" + cd join7 + echo ddd >> temp.txt + dotest join7-3 "${testcvs} -Q ci -madded-line temp.txt" \ +"Checking in temp.txt; +$CVSROOT_DIRNAME/join7/temp.txt,v <-- temp.txt +new revision: 1\.2; previous revision: 1\.1 +done" + cd ../impdir + echo aaaa >temp.txt + echo bbbb >>temp.txt + echo ccc >>temp.txt + echo eee >>temp.txt + dotest join7-4 \ +"${testcvs} -Q import -minitial join7 vendor vers-2" \ +"" + cd ../join7 + dotest join7-5 \ +"${testcvs} -n update -jvers-1 -jvers-2 temp.txt" \ +"RCS file: $CVSROOT_DIRNAME/join7/temp.txt,v +retrieving revision 1\.1\.1\.1 +retrieving revision 1\.1\.1\.2 +Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into temp.txt +rcsmerge: warning: conflicts during merge" + touch temp.txt + dotest join7-6 "${testcvs} -n update -jvers-1 -jvers-2 temp.txt" \ +"RCS file: $CVSROOT_DIRNAME/join7/temp.txt,v +retrieving revision 1\.1\.1\.1 +retrieving revision 1\.1\.1\.2 +Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into temp.txt +rcsmerge: warning: conflicts during merge" \ +"RCS file: $CVSROOT_DIRNAME/join7/temp.txt,v +retrieving revision 1\.1\.1\.1 +retrieving revision 1\.1\.1\.2 +Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into temp.txt +rcsmerge: warning: conflicts during merge" + + if $keep; then + echo Keeping ${TESTDIR} and exiting due to --keep + exit 0 + fi + + cd ../.. + rm -r join7 + rm -rf $CVSROOT_DIRNAME/join7 + ;; + + + join-readonly-conflict) # Previously, only tests 1 & 11 were being tested. I added the # intermediate dotest's to try and diagnose a different failure @@ -9397,7 +10205,7 @@ C $file" # (and read-only) .# file for writing. echo conflict > $file - # verify that the backup file is writable + # verify that the backup file is not writable if test -w ".#$file.1.1"; then fail "join-readonly-conflict-10 : .#$file.1.1 is writable" else @@ -9985,7 +10793,7 @@ C a" dotest conflicts-status-1 "${testcvs} status a" \ "=================================================================== -File: a Status: File had conflicts on merge +File: a Status: Unresolved Conflict Working revision: 1\.2.* Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/a,v @@ -10522,6 +11330,129 @@ done" rm -rf ${CVSROOT_DIRNAME}/first-dir ;; + conflicts4) + mkdir conflicts4; cd conflicts4 + mkdir 1; cd 1 + dotest conflicts4-1 "$testcvs -q co -l ." + mkdir first-dir + dotest conflicts4-2 "${testcvs} add first-dir" \ +"Directory ${CVSROOT_DIRNAME}/first-dir added to the repository" + cd .. + mkdir 2; cd 2 + dotest conflicts4-3 "${testcvs} -q co -l first-dir" '' + cd ../1/first-dir + echo baseline >file1 + dotest conflicts4-4 "${testcvs} -q add file1" \ +"$PROG add: use .$PROG commit. to add this file permanently" + dotest conflicts4-5 "${testcvs} -q ci -m add-it" \ +"RCS file: $CVSROOT_DIRNAME/first-dir/file1,v +done +Checking in file1; +$CVSROOT_DIRNAME/first-dir/file1,v <-- file1 +initial revision: 1\.1 +done" + cd ../../2/first-dir + dotest conflicts4-6 "${testcvs} -q update" "U file1" + # Make a local change + echo wibble2 >> file1 + dotest conflicts4-7 "${testcvs} -q ci -m update2" \ +"Checking in file1; +$CVSROOT_DIRNAME/first-dir/file1,v <-- file1 +new revision: 1\.2; previous revision: 1\.1 +done" + cd ../../1/first-dir + echo wibble1 >>file1 + dotest conflicts4-8 "${testcvs} -Q update" \ +"RCS file: $CVSROOT_DIRNAME/first-dir/file1,v +retrieving revision 1\.1 +retrieving revision 1\.2 +Merging differences between 1\.1 and 1\.2 into file1 +rcsmerge: warning: conflicts during merge +cvs update: conflicts found in file1" + dotest_fail conflicts4-9 "${testcvs} -q update" \ +"C file1" + + if $remote; then + cat >$TESTDIR/conflicts4/serveme <<EOF +#!$TESTSHELL +# This is admittedly a bit cheezy, in the sense that we make lots +# of assumptions about what the client is going to send us. +# We don't mention Repository, because current clients don't require it. +# Sending these at our own pace, rather than waiting for the client to +# make the requests, is bogus, but hopefully we can get away with it. +echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update Global_option" +echo "ok" +echo "MT text C " +echo "MT fname file1" +echo "MT newline" +echo "error " +cat >$TESTDIR/conflicts4/client.out +EOF + # Cygwin. Pthffffffffft! + if test -n "$remotehost"; then + $CVS_RSH $remotehost "chmod +x $TESTDIR/conflicts4/serveme" + else + chmod +x $TESTDIR/conflicts4/serveme + fi + save_CVS_SERVER=$CVS_SERVER + CVS_SERVER=$TESTDIR/conflicts4/serveme; export CVS_SERVER + dotest_fail conflicts4-10r "$testcvs -q up" "C file1" + dotest conflicts4-11r "cat $TESTDIR/conflicts4/client.out" \ +"$DOTSTAR +Argument -- +Directory . +$CVSROOT_DIRNAME/first-dir +Entry /file1/1.2/+=// +Modified file1 +u=rw,g=rw,o=r +59 +baseline +""<<<<<<< file1 +wibble1 +""======= +wibble2 +"">>>>>>> 1.2 +update" + + cat >$TESTDIR/conflicts4/serveme <<EOF +#!$TESTSHELL +# This is admittedly a bit cheezy, in the sense that we make lots +# of assumptions about what the client is going to send us. +# We don't mention Repository, because current clients don't require it. +# Sending these at our own pace, rather than waiting for the client to +# make the requests, is bogus, but hopefully we can get away with it. +echo "Valid-requests Root Valid-responses valid-requests Directory Entry Modified Unchanged Argument Argumentx ci co update Global_option Empty-conflicts" +echo "ok" +echo "MT text C " +echo "MT fname file1" +echo "MT newline" +echo "error " +cat >$TESTDIR/conflicts4/client.out +EOF + + dotest_fail conflicts4-12r "$testcvs -q up" "C file1" + dotest conflicts4-13r "cat $TESTDIR/conflicts4/client.out" \ +"$DOTSTAR +Argument -- +Directory . +$CVSROOT_DIRNAME/first-dir +Entry /file1/1.2/+=// +Unchanged file1 +update" + + CVS_SERVER=$save_CVS_SERVER; export CVS_SERVER + fi + + if $keep; then + echo Keeping $TESTDIR and exiting due to --keep + exit 0 + fi + + cd ../../.. + rm -rf conflicts4 + rm -rf $CVSROOT_DIRNAME/first-dir + ;; + clean) # Test update -C (overwrite local mods w/ repository copies) mkdir 1; cd 1 @@ -11430,9 +12361,10 @@ done" "Directory ${CVSROOT_DIRNAME}/first-dir added to the repository" cd first-dir - mkdir subdir - dotest modules4-3 "${testcvs} add subdir" \ -"Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository" + mkdir subdir subdir_long + dotest modules4-3 "${testcvs} add subdir subdir_long" \ +"Directory ${CVSROOT_DIRNAME}/first-dir/subdir added to the repository +Directory ${CVSROOT_DIRNAME}/first-dir/subdir_long added to the repository" echo file1 > file1 dotest modules4-4 "${testcvs} add file1" \ @@ -11444,7 +12376,12 @@ done" "${PROG}"' add: scheduling file `subdir/file2'\'' for addition '"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently' - dotest modules4-6 "${testcvs} -q ci -m add-it" \ + echo file3 > subdir_long/file3 + dotest modules4-6 "${testcvs} add subdir_long/file3" \ +"${PROG}"' add: scheduling file `subdir_long/file3'\'' for addition +'"${PROG}"' add: use .'"${PROG}"' commit. to add this file permanently' + + dotest modules4-7 "${testcvs} -q ci -m add-it" \ "RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v done Checking in file1; @@ -11456,19 +12393,26 @@ done Checking in subdir/file2; ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v <-- file2 initial revision: 1\.1 +done +RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir_long/file3,v +done +Checking in subdir_long/file3; +${CVSROOT_DIRNAME}/first-dir/subdir_long/file3,v <-- file3 +initial revision: 1\.1 done" cd .. - dotest modules4-7 "${testcvs} -q update -d CVSROOT" \ + dotest modules4-8 "${testcvs} -q update -d CVSROOT" \ "U CVSROOT${DOTSTAR}" cd CVSROOT cat >modules <<EOF all -a first-dir some -a !first-dir/subdir first-dir +other -a !first-dir/subdir !first-dir/subdir_long first-dir somewhat -a first-dir !first-dir/subdir EOF - dotest modules4-8 "${testcvs} -q ci -m add-modules" \ + dotest modules4-9 "${testcvs} -q ci -m add-modules" \ "Checking in modules; ${CVSROOT_DIRNAME}/CVSROOT/modules,v <-- modules new revision: 1\.[0-9]*; previous revision: 1\.[0-9]* @@ -11479,39 +12423,56 @@ ${PROG} commit: Rebuilding administrative file database" cd .. mkdir 2; cd 2 - dotest modules4-9 "${testcvs} -q co all" \ + dotest modules4-10 "${testcvs} -q co all" \ "U first-dir/file1 -U first-dir/subdir/file2" +U first-dir/subdir/file2 +U first-dir/subdir_long/file3" rm -r first-dir - dotest modules4-10 "${testcvs} -q co some" "U first-dir/file1" - dotest_fail modules4-11 "test -d first-dir/subdir" '' + dotest modules4-11 "${testcvs} -q co some" \ +"U first-dir/file1 +U first-dir/subdir_long/file3" + dotest_fail modules4-12 "test -d first-dir/subdir" '' + dotest modules4-13 "test -d first-dir/subdir_long" '' rm -r first-dir if $remote; then # But remote seems to do it the other way. - dotest modules4-11a "${testcvs} -q co somewhat" "U first-dir/file1" - dotest_fail modules4-11b "test -d first-dir/subdir" '' + dotest modules4-14r-1 "${testcvs} -q co somewhat" \ +"U first-dir/file1 +U first-dir/subdir_long/file3" + dotest_fail modules4-14r-2 "test -d first-dir/subdir" '' + dotest modules4-14r-3 "test -d first-dir/subdir_long" '' else # This is strange behavior, in that the order of the # "!first-dir/subdir" and "first-dir" matter, and it isn't # clear that they should. I suspect it is long-standing # strange behavior but I haven't verified that. - dotest modules4-11a "${testcvs} -q co somewhat" \ + dotest modules4-14-1 "${testcvs} -q co somewhat" \ "U first-dir/file1 -U first-dir/subdir/file2" +U first-dir/subdir/file2 +U first-dir/subdir_long/file3" + dotest modules4-14-2 "test -d first-dir/subdir" '' + dotest modules4-14-3 "test -d first-dir/subdir_long" '' fi rm -r first-dir + dotest modules4-15 "${testcvs} -q co other" \ +"U first-dir/file1" + dotest_fail modules4-16 "test -d first-dir/subdir" '' + dotest_fail modules4-17 "test -d first-dir/subdir_long" '' + rm -r first-dir + cd .. rm -r 2 - dotest modules4-12 "${testcvs} rtag tag some" \ + dotest modules4-18 "${testcvs} rtag tag some" \ "${PROG} rtag: Tagging first-dir -${PROG} rtag: Ignoring first-dir/subdir" +${PROG} rtag: Ignoring first-dir/subdir +${PROG} rtag: Tagging first-dir/subdir_long" cd 1/first-dir/subdir - dotest modules4-13 "${testcvs} log file2" " + dotest modules4-19 "${testcvs} log file2" " RCS file: ${CVSROOT_DIRNAME}/first-dir/subdir/file2,v Working file: file2 head: 1\.1 @@ -11528,6 +12489,11 @@ date: [0-9/]* [0-9:]*; author: ${username}; state: Exp; add-it =============================================================================" + if $keep; then + echo Keeping $TESTDIR and exiting due to --keep + exit 0 + fi + cd ../../.. rm -r 1 @@ -11623,7 +12589,14 @@ ${PROG} commit: Rebuilding administrative file database" # Test that real modules check out to realmodule/a, not subdir/a. if $remote; then - dotest modules5-8 "${testcvs} co realmodule" \ + # FIXCVS? + # Mac OSX 10.3 (Darwin ppc-osx1 5.5) fails here when $TMPDIR + # contains a symlink (it does not fail the local modules5-8). + # Since no other platforms are exhibiting the same problem, I + # suspect an issue with OSX and fork() or the like dereferencing + # the symlink, but it is possible it is something that could be + # fixed or worked around in CVS. + dotest modules5-8r "$testcvs co realmodule" \ "U realmodule/a ${PROG} checkout: Executing ..${CVSROOT_DIRNAME}/checkout\.sh. .realmodule.. checkout script invoked in ${TMPDIR}/cvs-serv[0-9a-z]* @@ -11992,6 +12965,78 @@ ${PROG} commit: Rebuilding administrative file database" fi ;; + + + modules7) + # + # Test tag problems vs an empty CVSROOT/val-tags file + # + # See the header comment for the `modules' test for an index of + # the complete suite of modules tests. + # + mkdir modules7 + cd modules7 + dotest modules7-1 "$testcvs -Q co -d top ." + cd top + mkdir zero one + dotest modules7-2 "$testcvs -Q add zero one" + cd one + echo 'file1 contents' > file1 + dotest modules7-2 "$testcvs -Q add file1" + dotest modules7-3 "$testcvs -Q ci -mnew file1" \ +"RCS file: $CVSROOT_DIRNAME/one/file1,v +done +Checking in file1; +$CVSROOT_DIRNAME/one/file1,v <-- file1 +initial revision: 1\.1 +done" + dotest modules7-4 "$testcvs -Q tag mytag file1" + cd ../CVSROOT + echo 'all -a zero one' > modules + dotest modules7-5 "$testcvs -Q ci -mall-module" \ +"Checking in modules; +$CVSROOT_DIRNAME/CVSROOT/modules,v <-- modules +new revision: [0-9.]*; previous revision: [0-9.]* +done +$PROG commit: Rebuilding administrative file database" + cd ../.. + mkdir myexport + cd myexport + # FIXCVS: The export should NOT be aborted here + dotest_fail modules7-6 "$testcvs export -rmytag all" \ +"$PROG \[export aborted\]: no such tag mytag" + cd .. + rm -fr myexport + mkdir myexport + cd myexport + # FIXCVS: Workaround is to have mytag listed in val-tags + echo 'mytag y' > $CVSROOT_DIRNAME/CVSROOT/val-tags + dotest modules7-7 "$testcvs export -rmytag all" \ +"$PROG export: Updating zero +$PROG export: Updating one +U one/file1" + dotest modules7-8 'cat one/file1' 'file1 contents' + + if $keep; then + echo Keeping $TESTDIR and exiting due to --keep + exit 0 + fi + + # cleanup + cd ../top/CVSROOT + echo "# empty modules file" >modules + dotest modules7-cleanup-1 "$testcvs -Q ci -mempty-modules" \ +"Checking in modules; +$CVSROOT_DIRNAME/CVSROOT/modules,v <-- modules +new revision: [0-9.]*; previous revision: [0-9.]* +done +$PROG commit: Rebuilding administrative file database" + cd ../../.. + rm -fr modules7 + rm -rf $CVSROOT_DIRNAME/zero $CVSROOT_DIRNAME/one + ;; + + mkmodules) # When a file listed in checkoutlist doesn't exist, cvs-1.10.4 # would fail to remove the CVSROOT/.#[0-9]* temporary file it @@ -13651,7 +14696,11 @@ ${PROG} \[checkout aborted\]: than the 0 which Max-dotdot specified" # cvs checkout: warning: cannot make directory CVS in /: Permission denied # cvs [checkout aborted]: cannot make directory /foo: Permission denied # $ - dotest_fail abspath2-1 "${testcvs} co /foo" \ + # + # The -z9 in this test also checks for an old server bug where the + # server would block indefinitely attempting to read an EOF from the + # client in the compression buffer shutdown routine. + dotest_fail abspath2-1 "$testcvs -z9 co /foo" \ "$PROG \[checkout aborted\]: Absolute module reference invalid: \`/foo'" \ "$PROG \[server aborted\]: Absolute module reference invalid: \`/foo' $PROG \[checkout aborted\]: end of file from server (consult above messages if any)" @@ -13772,7 +14821,6 @@ U top-dir/file1" "${PROG} checkout: warning: cannot make directory CVS in \.: Permission denied ${PROG} checkout: Updating top-dir" \ "${PROG} checkout: warning: cannot make directory CVS in \.: Permission denied -${PROG} checkout: warning: cannot make directory CVS in \.: Permission denied ${PROG} checkout: in directory \.: ${PROG} checkout: cannot open CVS/Entries for reading: No such file or directory ${PROG} checkout: Updating top-dir" @@ -13893,14 +14941,14 @@ ${PROG} commit: Rebuilding administrative file database" rstar-toplevel) - # FIXCVS: - # This test confirms a bug that exists in the r* commands currently - # when run against the top-level project. + # This test used to confirm a bug that existed in the r* commands + # run against the top-level project prior to CVS 1.11.18 & 1.12.10. # - # The assertion failure is something like: + # The assertion failure was something like: # do_recursion: Assertion \`strstr (repository, \"/\./\") == ((void \*)0)' failed\..*" - dotest_fail rstar-toplevel-1 "$testcvs rlog ." \ -"${DOTSTAR}ssertion.*failed${DOTSTAR}" "${DOTSTAR}failed assertion${DOTSTAR}" + dotest rstar-toplevel-1 "$testcvs -q rlog ." \ +" +RCS file: $CVSROOT_DIRNAME/CVSROOT$DOTSTAR" if $keep; then echo Keeping ${TESTDIR} and exiting due to --keep @@ -14798,7 +15846,7 @@ U first-dir/abc' # Now do it again, after removing the val-tags file created # by devcom-t1 to force CVS to search the repository # containing CVS directories. - rm ${CVSROOT_DIRNAME}/CVSROOT/val-tags + rm -f ${CVSROOT_DIRNAME}/CVSROOT/val-tags mkdir 3 cd 3 dotest devcom-t3 "${testcvs} -q co -rtag first-dir" \ @@ -15183,6 +16231,94 @@ done" rm -rf ${CVSROOT_DIRNAME}/first-dir ;; + + + watch6) + # Check that `cvs watch on' does not reset the fileattr file. + mkdir watch6; cd watch6 + + dotest watch6-setup-1 "$testcvs -Q co -ldtop ." + cd top + mkdir watch6 + dotest watch6-setup-2 "$testcvs -Q add watch6" + + cd .. + dotest watch6-setup-3 "$testcvs -Q co watch6" + cd watch6 + + mkdir subdir + dotest watch6-setup-4 "$testcvs -Q add subdir" + cd subdir + + # START watch add/remove sequence + dotest watch6-1 "$testcvs -Q watch add" + dotest watch6-2 \ +"grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null" + + dotest watch6-3 "$testcvs watch on" + dotest watch6-4 \ +"grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null" + dotest watch6-5 \ +"grep '_watched' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null" + + dotest watch6-6 "$testcvs watch off" + dotest watch6-7 \ +"grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null" + dotest_fail watch6-8 \ +"grep '_watched' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null" + + dotest watch6-9 "$testcvs watch remove" + dotest_fail watch6-10 \ +"test -d $CVSROOT_DIRNAME/test-directory/subdir/CVS" + dotest_fail watch6-11 \ +"test -f $CVSROOT_DIRNAME/test-directory/subdir/CVS/fileattr" + # END watch add/remove sequence + + echo Hi there >afile + dotest watch6-12 "$testcvs -Q add afile" + dotest watch6-13 "$testcvs ci -m 'A file' afile" \ +"RCS file: $CVSROOT_DIRNAME/watch6/subdir/afile,v +done +Checking in afile; +$CVSROOT_DIRNAME/watch6/subdir/afile,v <-- afile +initial revision: 1\.1 +done" + + # START watch add/remove sequence + dotest watch6-14 "$testcvs -Q watch add" + dotest watch6-15 \ +"grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null" + + dotest watch6-16 "$testcvs watch on" + dotest watch6-17 \ +"grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null" + dotest watch6-18 \ +"grep '_watched' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null" + + dotest watch6-19 "$testcvs watch off" + dotest watch6-20 \ +"grep '_watchers' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null" + dotest_fail watch6-21 \ +"grep '_watched' $CVSROOT_DIRNAME/watch6/subdir/CVS/fileattr >/dev/null" + + dotest watch6-22 "$testcvs watch remove" + dotest_fail watch6-23 \ +"test -d $CVSROOT_DIRNAME/test-directory/subdir/CVS" + dotest_fail watch6-24 \ +"test -f $CVSROOT_DIRNAME/test-directory/subdir/CVS/fileattr" + # END watch add/remove sequence + + if $keep; then + echo Keeping $TESTDIR and exiting due to --keep + exit 0 + fi + cd ../../.. + rm -r watch6 + rm -rf $CVSROOT_DIRNAME/watch6 + ;; + + + unedit-without-baserev) mkdir 1; cd 1 module=x @@ -15465,7 +16601,7 @@ T file1' dotest ignore-on-branch-5 "$testcvs -q ci -mbranch file2" \ "Checking in file2; $CVSROOT_DIRNAME/ignore-on-branch/file2,v <-- file2 -new revision: 1\.1\.2\.1; previous revision: 1\.1 +new revision: 1\.1\.2\.2; previous revision: 1\.1\.2\.1 done" dotest ignore-on-branch-6 "$testcvs -q up -rbranch2" \ "${PROG} update: file2 is no longer in the repository" @@ -15523,6 +16659,24 @@ File: binfile Status: Up-to-date Sticky Date: (none) Sticky Options: -kb" + # Test that "-kk" does not override "-kb" + cd ../.. + mkdir 2a; cd 2a + dotest binfiles-5.5a0 "${testcvs} -q co -kk first-dir" 'U first-dir/binfile' + cd first-dir + # Testing that sticky options is -kb is the closest thing we have + # to testing that binary files work right on non-unix machines + # (until there is automated testing for such machines, of course). + dotest binfiles-5.5a1 "${testcvs} status binfile" \ +"=================================================================== +File: binfile Status: Up-to-date + + Working revision: 1\.1.* + Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/binfile,v + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: -kb" + # Test whether the default options from the RCS file are # also used when operating on files instead of whole # directories @@ -15542,6 +16696,22 @@ File: binfile Status: Up-to-date Sticky Options: -kb" cd ../.. rm -r 3 + # test that "-kk" does not override "-kb" + mkdir 3; cd 3 + dotest binfiles-5.5c0 "${testcvs} -q co -kk first-dir/binfile" \ +'U first-dir/binfile' + cd first-dir + dotest binfiles-5.5c1 "${testcvs} status binfile" \ +"=================================================================== +File: binfile Status: Up-to-date + + Working revision: 1\.1.* + Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/binfile,v + Sticky Tag: (none) + Sticky Date: (none) + Sticky Options: -kb" + cd ../.. + rm -r 3 cd 2/first-dir cp ../../1/binfile2.dat binfile @@ -15564,11 +16734,13 @@ done" cd ../../2/first-dir echo 'edits in dir 2' >binfile dotest binfiles-con1 "${testcvs} -q update" \ -"U binfile -${PROG} update: nonmergeable file needs merge +"$PROG update: nonmergeable file needs merge ${PROG} update: revision 1\.3 from repository is now in binfile ${PROG} update: file from working directory is now in \.#binfile\.1\.2 C binfile" + + dotest_fail binfiles-con1b "$testcvs -q up" "C binfile" + dotest binfiles-con2 "cmp binfile ../../1/binfile.dat" '' dotest binfiles-con3 "cat .#binfile.1.2" 'edits in dir 2' @@ -15582,9 +16754,11 @@ done" dotest binfiles-con5 "${testcvs} -q update" '[UP] binfile' dotest binfiles-9 "${testcvs} -q update -A" '' - dotest binfiles-10 "${testcvs} -q update -kk" '[UP] binfile' + # "-kk" no longer does anything with "-kb" + dotest binfiles-10 "${testcvs} -q update -kk" '' dotest binfiles-11 "${testcvs} -q update" '' - dotest binfiles-12 "${testcvs} -q update -A" '[UP] binfile' + # "-kk" no longer does anything with "-kb" + dotest binfiles-12 "${testcvs} -q update -A" '' dotest binfiles-13 "${testcvs} -q update -A" '' cd ../.. @@ -16590,27 +17764,13 @@ done" cd ../.. cd m1/first-dir echo "changed in m1" >aa - if $remote; then - # The tagged text code swallows up "U aa" but isn't yet up to - # trying to figure out how it interacts with the "C aa" and - # other stuff. The whole deal of having both is pretty iffy. - dotest mwrap-7 "${testcvs} -nq update" \ + dotest mwrap-7 "$testcvs -nq update" \ "${PROG} update: nonmergeable file needs merge ${PROG} update: revision 1\.2 from repository is now in aa ${PROG} update: file from working directory is now in \.#aa\.1\.1 -C aa -U aa" - else - dotest mwrap-7 "${testcvs} -nq update" \ -"U aa -${PROG} update: nonmergeable file needs merge -${PROG} update: revision 1\.2 from repository is now in aa -${PROG} update: file from working directory is now in \.#aa\.1\.1 C aa" - fi dotest mwrap-8 "${testcvs} -q update" \ -"U aa -${PROG} update: nonmergeable file needs merge +"$PROG update: nonmergeable file needs merge ${PROG} update: revision 1\.2 from repository is now in aa ${PROG} update: file from working directory is now in \.#aa\.1\.1 C aa" @@ -17594,6 +18754,28 @@ ${log_rev3} ${log_rev2} ${log_trailer}" + # Test BASE pseudotag + dotest log-23 "${testcvs} log -rBASE file1" \ +"${log_header1} +${log_tags1} +${log_keyword} +total revisions: 5; selected revisions: 1 +description: +${log_rev2b} +${log_trailer}" + + dotest log-24 "${testcvs} -q up -r1.2 file1" "[UP] file1" + dotest log-25 "${testcvs} log -rBASE file1" \ +"${log_header1} +${log_tags1} +${log_keyword} +total revisions: 5; selected revisions: 1 +description: +${log_rev2} +${log_trailer}" + + dotest log-26 "${testcvs} -q up -rbranch file1" "[UP] file1" + # Now the same tests but with rlog dotest log-r11 "${testcvs} rlog first-dir/file1" \ @@ -17817,6 +18999,26 @@ ${log_rev3} ${log_rev2} ${log_trailer}" + # Test BASE pseudotag + dotest log-r23 "${testcvs} rlog -rBASE first-dir/file1" \ +"${PROG} rlog: warning: no revision .BASE. in .${CVSROOT_DIRNAME}/first-dir/file1,v. +${rlog_header1} +${log_tags1} +${log_keyword} +total revisions: 5; selected revisions: 0 +description: +${log_trailer}" + + dotest log-r24 "${testcvs} -q up -r1.2 file1" "[UP] file1" + dotest log-r25 "${testcvs} rlog -rBASE first-dir/file1" \ +"${PROG} rlog: warning: no revision .BASE. in .${CVSROOT_DIRNAME}/first-dir/file1,v. +${rlog_header1} +${log_tags1} +${log_keyword} +total revisions: 5; selected revisions: 0 +description: +${log_trailer}" + # Test when head is dead dotest log-d0 "${testcvs} -q up -A" \ @@ -18428,47 +19630,47 @@ done" " Annotations for file1 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -1\.1 (${username} *[0-9a-zA-Z-]*): this -1\.1 (${username} *[0-9a-zA-Z-]*): is -1\.2 (${username} *[0-9a-zA-Z-]*): a -1\.3 (${username} *[0-9a-zA-Z-]*): trunk file -1\.2 (${username} *[0-9a-zA-Z-]*): -1\.2 (${username} *[0-9a-zA-Z-]*): with -1\.2 (${username} *[0-9a-zA-Z-]*): a -1\.2 (${username} *[0-9a-zA-Z-]*): blank -1\.2 (${username} *[0-9a-zA-Z-]*): line" +1\.1 ($username8 *[0-9a-zA-Z-]*): this +1\.1 ($username8 *[0-9a-zA-Z-]*): is +1\.2 ($username8 *[0-9a-zA-Z-]*): a +1\.3 ($username8 *[0-9a-zA-Z-]*): trunk file +1\.2 ($username8 *[0-9a-zA-Z-]*): +1\.2 ($username8 *[0-9a-zA-Z-]*): with +1\.2 ($username8 *[0-9a-zA-Z-]*): a +1\.2 ($username8 *[0-9a-zA-Z-]*): blank +1\.2 ($username8 *[0-9a-zA-Z-]*): line" dotest ann-11 "${testcvs} ann -r br" \ " Annotations for file1 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -1\.1 (${username} *[0-9a-zA-Z-]*): this -1\.1 (${username} *[0-9a-zA-Z-]*): is -1\.2 (${username} *[0-9a-zA-Z-]*): a -1\.1 (${username} *[0-9a-zA-Z-]*): file -1\.2 (${username} *[0-9a-zA-Z-]*): -1\.2 (${username} *[0-9a-zA-Z-]*): with -1\.2 (${username} *[0-9a-zA-Z-]*): a -1\.2 (${username} *[0-9a-zA-Z-]*): blank -1\.2 (${username} *[0-9a-zA-Z-]*): line -1\.2\.2\.1 (${username} *[0-9a-zA-Z-]*): and some -1\.2\.2\.1 (${username} *[0-9a-zA-Z-]*): branched content" +1\.1 ($username8 *[0-9a-zA-Z-]*): this +1\.1 ($username8 *[0-9a-zA-Z-]*): is +1\.2 ($username8 *[0-9a-zA-Z-]*): a +1\.1 ($username8 *[0-9a-zA-Z-]*): file +1\.2 ($username8 *[0-9a-zA-Z-]*): +1\.2 ($username8 *[0-9a-zA-Z-]*): with +1\.2 ($username8 *[0-9a-zA-Z-]*): a +1\.2 ($username8 *[0-9a-zA-Z-]*): blank +1\.2 ($username8 *[0-9a-zA-Z-]*): line +1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): and some +1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): branched content" # FIXCVS: shouldn't "-r 1.2.0.2" be the same as "-r br"? dotest ann-12 "${testcvs} ann -r 1.2.0.2 file1" "" dotest ann-13 "${testcvs} ann -r 1.2.2 file1" \ " Annotations for file1 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -1\.1 (${username} *[0-9a-zA-Z-]*): this -1\.1 (${username} *[0-9a-zA-Z-]*): is -1\.2 (${username} *[0-9a-zA-Z-]*): a -1\.1 (${username} *[0-9a-zA-Z-]*): file -1\.2 (${username} *[0-9a-zA-Z-]*): -1\.2 (${username} *[0-9a-zA-Z-]*): with -1\.2 (${username} *[0-9a-zA-Z-]*): a -1\.2 (${username} *[0-9a-zA-Z-]*): blank -1\.2 (${username} *[0-9a-zA-Z-]*): line -1\.2\.2\.1 (${username} *[0-9a-zA-Z-]*): and some -1\.2\.2\.1 (${username} *[0-9a-zA-Z-]*): branched content" +1\.1 ($username8 *[0-9a-zA-Z-]*): this +1\.1 ($username8 *[0-9a-zA-Z-]*): is +1\.2 ($username8 *[0-9a-zA-Z-]*): a +1\.1 ($username8 *[0-9a-zA-Z-]*): file +1\.2 ($username8 *[0-9a-zA-Z-]*): +1\.2 ($username8 *[0-9a-zA-Z-]*): with +1\.2 ($username8 *[0-9a-zA-Z-]*): a +1\.2 ($username8 *[0-9a-zA-Z-]*): blank +1\.2 ($username8 *[0-9a-zA-Z-]*): line +1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): and some +1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): branched content" dotest_fail ann-14 "${testcvs} ann -r bill-clintons-chastity file1" \ "${PROG} \[annotate aborted\]: no such tag bill-clintons-chastity" @@ -18480,46 +19682,46 @@ Annotations for file1 " Annotations for first-dir/file1 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -1\.1 (${username} *[0-9a-zA-Z-]*): this -1\.1 (${username} *[0-9a-zA-Z-]*): is -1\.2 (${username} *[0-9a-zA-Z-]*): a -1\.3 (${username} *[0-9a-zA-Z-]*): trunk file -1\.2 (${username} *[0-9a-zA-Z-]*): -1\.2 (${username} *[0-9a-zA-Z-]*): with -1\.2 (${username} *[0-9a-zA-Z-]*): a -1\.2 (${username} *[0-9a-zA-Z-]*): blank -1\.2 (${username} *[0-9a-zA-Z-]*): line" +1\.1 ($username8 *[0-9a-zA-Z-]*): this +1\.1 ($username8 *[0-9a-zA-Z-]*): is +1\.2 ($username8 *[0-9a-zA-Z-]*): a +1\.3 ($username8 *[0-9a-zA-Z-]*): trunk file +1\.2 ($username8 *[0-9a-zA-Z-]*): +1\.2 ($username8 *[0-9a-zA-Z-]*): with +1\.2 ($username8 *[0-9a-zA-Z-]*): a +1\.2 ($username8 *[0-9a-zA-Z-]*): blank +1\.2 ($username8 *[0-9a-zA-Z-]*): line" dotest ann-r11 "${testcvs} rann -r br first-dir" \ " Annotations for first-dir/file1 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -1\.1 (${username} *[0-9a-zA-Z-]*): this -1\.1 (${username} *[0-9a-zA-Z-]*): is -1\.2 (${username} *[0-9a-zA-Z-]*): a -1\.1 (${username} *[0-9a-zA-Z-]*): file -1\.2 (${username} *[0-9a-zA-Z-]*): -1\.2 (${username} *[0-9a-zA-Z-]*): with -1\.2 (${username} *[0-9a-zA-Z-]*): a -1\.2 (${username} *[0-9a-zA-Z-]*): blank -1\.2 (${username} *[0-9a-zA-Z-]*): line -1\.2\.2\.1 (${username} *[0-9a-zA-Z-]*): and some -1\.2\.2\.1 (${username} *[0-9a-zA-Z-]*): branched content" +1\.1 ($username8 *[0-9a-zA-Z-]*): this +1\.1 ($username8 *[0-9a-zA-Z-]*): is +1\.2 ($username8 *[0-9a-zA-Z-]*): a +1\.1 ($username8 *[0-9a-zA-Z-]*): file +1\.2 ($username8 *[0-9a-zA-Z-]*): +1\.2 ($username8 *[0-9a-zA-Z-]*): with +1\.2 ($username8 *[0-9a-zA-Z-]*): a +1\.2 ($username8 *[0-9a-zA-Z-]*): blank +1\.2 ($username8 *[0-9a-zA-Z-]*): line +1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): and some +1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): branched content" dotest ann-r12 "${testcvs} rann -r 1.2.0.2 first-dir/file1" "" dotest ann-r13 "${testcvs} rann -r 1.2.2 first-dir/file1" \ " Annotations for first-dir/file1 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -1\.1 (${username} *[0-9a-zA-Z-]*): this -1\.1 (${username} *[0-9a-zA-Z-]*): is -1\.2 (${username} *[0-9a-zA-Z-]*): a -1\.1 (${username} *[0-9a-zA-Z-]*): file -1\.2 (${username} *[0-9a-zA-Z-]*): -1\.2 (${username} *[0-9a-zA-Z-]*): with -1\.2 (${username} *[0-9a-zA-Z-]*): a -1\.2 (${username} *[0-9a-zA-Z-]*): blank -1\.2 (${username} *[0-9a-zA-Z-]*): line -1\.2\.2\.1 (${username} *[0-9a-zA-Z-]*): and some -1\.2\.2\.1 (${username} *[0-9a-zA-Z-]*): branched content" +1\.1 ($username8 *[0-9a-zA-Z-]*): this +1\.1 ($username8 *[0-9a-zA-Z-]*): is +1\.2 ($username8 *[0-9a-zA-Z-]*): a +1\.1 ($username8 *[0-9a-zA-Z-]*): file +1\.2 ($username8 *[0-9a-zA-Z-]*): +1\.2 ($username8 *[0-9a-zA-Z-]*): with +1\.2 ($username8 *[0-9a-zA-Z-]*): a +1\.2 ($username8 *[0-9a-zA-Z-]*): blank +1\.2 ($username8 *[0-9a-zA-Z-]*): line +1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): and some +1\.2\.2\.1 ($username8 *[0-9a-zA-Z-]*): branched content" dotest_fail ann-r14 "${testcvs} rann -r bill-clintons-chastity first-dir/file1" \ "${PROG} \[rannotate aborted\]: no such tag bill-clintons-chastity" @@ -18566,8 +19768,8 @@ done" " Annotations for $file \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -1.2 ($username *[0-9a-zA-Z-]*): "'\$'"Id: $file,v 1.1 [0-9/]* [0-9:]* $username Exp "'\$'" -1.2 ($username *[0-9a-zA-Z-]*): line2" +1.2 ($username8 *[0-9a-zA-Z-]*): "'\$'"Id: $file,v 1.1 [0-9/]* [0-9:]* $username Exp "'\$'" +1.2 ($username8 *[0-9a-zA-Z-]*): line2" cd ../.. rm -rf 1 @@ -18585,24 +19787,22 @@ Annotations for $file # local. if $remote; then + # Use :ext: rather than :fork:. Most of the tests use :fork:, + # so we want to make sure that we test :ext: _somewhere_. + # Make sure 'rsh' works first. + depends_on_rsh "$CVS_RSH" + if test $? -eq 77; then + skip crerepos "$skipreason" + continue + fi + # For remote, just create the repository. We don't yet do # the various other tests above for remote but that should be # changed. mkdir crerepos mkdir crerepos/CVSROOT - # Use :ext: rather than :fork:. Most of the tests use :fork:, - # so we want to make sure that we test :ext: _somewhere_. - - # Maybe a bit dubious in the sense that people need to - # have rsh working to run the tests, but at least it - # isn't inetd :-). Might want to think harder about this - - # maybe try :ext:, and if it fails, print a (single, nice) - # message and fall back to :fork:. Maybe testing :ext: - # with our own CVS_RSH rather than worrying about a system one - # would do the trick. - - # Make sure server ignores real ${HOME}/.cvsrc: + # Make sure server ignores real ${HOME}/.cvsrc: cat >$TESTDIR/cvs-setHome <<EOF #!/bin/sh HOME=$HOME @@ -18613,20 +19813,7 @@ EOF # Note that we set CVS_SERVER at the beginning. CVS_SERVER=$TESTDIR/cvs-setHome; export CVS_SERVER - - if test -n "$remotehost"; then - CREREPOS_ROOT=:ext:$remotehost${TESTDIR}/crerepos - else - CREREPOS_ROOT=:ext:`hostname`:${TESTDIR}/crerepos - fi - - # If we're going to do remote testing, make sure 'rsh' works first. - host="`hostname`" - if test "x`${CVS_RSH} $host -n 'echo hi'`" != "xhi"; then - echo "ERROR: cannot test remote CVS, because \`${CVS_RSH} $host' fails." >&2 - exit 1 - fi - + CREREPOS_ROOT=:ext:$host$TESTDIR/crerepos else # First, if the repository doesn't exist at all... @@ -18704,8 +19891,10 @@ ${PROG} \[[a-z]* aborted\]: Bad CVSROOT: .:ext:${hostname}:crerepos.\." # key or somesuch. Which error message we get depends on whether # false finishes running before we try to talk to it or not. dotest_fail crerepos-6a "CVS_RSH=false ${testcvs} -q -d ../crerepos get ." \ -"${PROG} \[checkout aborted\]: end of file from server (consult above messages if any)" \ -"${PROG} \[checkout aborted\]: received broken pipe signal" +"${PROG} \[checkout aborted\]: .*" \ +"${PROG} checkout: CVSROOT is set for a remote access method but your +${PROG} checkout: CVS executable doesn't support it\. +${PROG} \[checkout aborted\]: Bad CVSROOT: .\.\./crerepos.\." cd .. rm -r 1 @@ -19514,6 +20703,125 @@ File: file1 Status: Up-to-date rm -rf ${CVSROOT_DIRNAME}/rcs4-dir ;; + + + rcs5) + # Some tests of the $Log keyword and log message without a trailing + # EOL. This used to look ugly and, in the worst case, could cause + # a seg fault due to a buffer overflow. + # + # Note that it should not be possible to create this situation via a + # CVS server (and any client), since the server itself inserts the + # trailing EOL onto log messages that are missing one. Still, we + # shouldn't segfault due to a corrupt RCS file and I think that a log + # message without the trailing EOL doesn't actually violate the RCS + # spec, though it doesn't appear to be possible to create such a log + # message using RCS 5.7. + + mkdir $CVSROOT_DIRNAME/rcs5 + cat <<\EOF >$CVSROOT_DIRNAME/rcs5/file1,v +head 1.1; +access; +symbols; +locks; +expand kv; + +1.1 date 2007.03.20.04.03.02; author jeremiah; state Ext; branches; next; + +desc +@@ + +1.1 +log +@he always had very fine wine@ +text +@line1 +/* +EOF +echo ' * Revision history: $''Log$' >>$CVSROOT_DIRNAME/rcs5/file1,v + cat <<\EOF >>$CVSROOT_DIRNAME/rcs5/file1,v + */ +line5 +@ +EOF + + mkdir rcs5 + cd rcs5 + dotest rcs5-1 "$testcvs -Q co rcs5" + dotest rcs5-2 "cat rcs5/file1" \ +"line1 +/\\* + \\* Revision history: "'\$'"Log: file1,v "'\$'" + \\* Revision history: Revision 1\.1 2007/03/20 04:03:02 jeremiah + \\* Revision history: he always had very fine wine + \\* Revision history: + \\*/ +line5" + + cd .. + rm -r rcs5 + rm -rf $CVSROOT_DIRNAME/rcs5 + ;; + + + + rcs6) + # Test that CVS notices a specific type of corruption in the RCS + # archive. In the past, this type of corruption had turned up after + # a user ineptly attempted to delete a revision from an arcvhive + # manually. + mkdir rcs6; cd rcs6 + + # Make the project. + dotest rcs6-init-1 "$testcvs -Q co -ld top .; cd top" + mkdir rcs6 + dotest rcs6-init-2 "$testcvs -Q add rcs6" + cd rcs6 + + # Populate it. + echo some words >afile + dotest rcs6-init-3 "$testcvs -Q add afile" + dotest rcs6-init-4 "$testcvs -Q ci -mnewfile afile" \ +"RCS file: $CVSROOT_DIRNAME/rcs6/afile,v +done +Checking in afile; +$CVSROOT_DIRNAME/rcs6/afile,v <-- afile +initial revision: 1\.1 +done" + echo more words >>afile + dotest rcs6-init-5 "$testcvs -Q ci -mrev2 afile" \ +"Checking in afile; +$CVSROOT_DIRNAME/rcs6/afile,v <-- afile +new revision: 1\.2; previous revision: 1\.1 +done" + + # Corrupt the archive. + sed -e '8,12d' \ + -e 's/^head 1\.2/head 1.1/' \ + <$CVSROOT_DIRNAME/rcs6/afile,v \ + >$CVSROOT_DIRNAME/rcs6/cfile,v + + # Update used to work. + dotest_fail rcs6-1 "$testcvs -q up" \ +"$PROG \[update aborted\]: Expected head revision 1\.1, found 1\.2\." + + # Then a commit hosed the archive further without any warnings. + # Updating to an old revision (e.g. 1.1) would have reported the + # corruption. A second commit would have deleted data from the + # file. + + if $keep; then + echo Keeping $TESTDIR and exiting due to --keep + exit 0 + fi + + cd ../../.. + rm -r rcs6 + rm -rf $CVSROOT_DIRNAME/rcs6 + ;; + + + lockfiles) # Tests of CVS lock files. # TODO-maybe: Add a test where we arrange for a loginfo @@ -19583,6 +20891,86 @@ ${PROG} \[update aborted\]: cannot stat ${TESTDIR}/locks: No such file or direct dotest lockfiles-8 "${testcvs} -q update" "" dotest lockfiles-9 "${testcvs} -q co -l ." "" + ### + ### There are race conditions in the following tests, but hopefully + ### the 5 seconds the first process waits to remove the lockdir and + ### the 30 seconds CVS waits betweens checks will be significant + ### enough to render the case moot. + ### + # Considers the following cases: + # + # Lock Present + # Operation Allowed (case #) + # + # Read Write + # _______ ______ + # Read |Yes (1) No (3) + # Write |No (7) No (9) + # + # Tests do not appear in same ordering as table. The odd numbering + # scheme maintains correspondance with a larger table on 1.12.x: + # 1. Read when read locks are present... + # 3. Don't read when write locks present... + # 7. Don't write when read locks are present... + # 9. Don't write when write locks are present... + + # 3. Don't read when write locks present... + mkdir "$TESTDIR/locks/first-dir/#cvs.lock" + (sleep 5; rmdir "$TESTDIR/locks/first-dir/#cvs.lock")& + dotest lockfiles-10 "$testcvs -q co -l first-dir" \ +"$PROG checkout: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/first-dir +$PROG checkout: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/first-dir" + + # 1. Read when read locks are present... + touch "$TESTDIR/locks/first-dir/#cvs.rfl.test.lock" + dotest lockfiles-11 "$testcvs -q co -l first-dir" + rm "$TESTDIR/locks/first-dir/#cvs.rfl.test.lock" + + # 7. Don't write when read locks are present... + echo I always have trouble coming up with witty text for the test files >>first-dir/sdir/ssdir/file1 + touch "$TESTDIR/locks/first-dir/sdir/ssdir/#cvs.rfl.test.lock" + (sleep 5; rm "$TESTDIR/locks/first-dir/sdir/ssdir/#cvs.rfl.test.lock")& + dotest lockfiles-13 "$testcvs -q ci -mconflict first-dir" \ +"$PROG commit: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/first-dir/sdir/ssdir +$PROG commit: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/first-dir/sdir/ssdir +Checking in first-dir/sdir/ssdir/file1; +$CVSROOT_DIRNAME/first-dir/sdir/ssdir/file1,v <-- file1 +new revision: 1\.2; previous revision: 1\.1 +done" + + # 9. Don't write when write locks are present... + echo yet this poem would probably only give longfellow bile >>first-dir/sdir/ssdir/file1 + mkdir "$TESTDIR/locks/first-dir/sdir/ssdir/#cvs.lock" + (sleep 5; rmdir "$TESTDIR/locks/first-dir/sdir/ssdir/#cvs.lock")& + dotest lockfiles-19 "$testcvs -q ci -mnot-up-to-date first-dir" \ +"$PROG commit: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/first-dir/sdir/ssdir +$PROG commit: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/first-dir/sdir/ssdir +Checking in first-dir/sdir/ssdir/file1; +$CVSROOT_DIRNAME/first-dir/sdir/ssdir/file1,v <-- file1 +new revision: 1\.3; previous revision: 1\.2 +done" + + # 10. Don't write when history locks are present... + echo have you ever heard a poem quite so vile\? >>first-dir/sdir/ssdir/file1 + mkdir "$TESTDIR/locks/CVSROOT/#cvs.history.lock" + (sleep 5; rmdir "$TESTDIR/locks/CVSROOT/#cvs.history.lock")& + dotest lockfiles-20 "$testcvs -q ci -mnot-up-to-date first-dir" \ +"Checking in first-dir/sdir/ssdir/file1; +$CVSROOT_DIRNAME/first-dir/sdir/ssdir/file1,v <-- file1 +new revision: 1\.4; previous revision: 1\.3 +done +$PROG commit: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/CVSROOT +$PROG commit: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/CVSROOT" + + dotest lockfiles-21 "$testcvs -Q tag newtag first-dir" + + rm -f $CVSROOT_DIRNAME/CVSROOT/val-tags + mkdir "$TESTDIR/locks/CVSROOT/#cvs.val-tags.lock" + (sleep 5; rmdir "$TESTDIR/locks/CVSROOT/#cvs.val-tags.lock")& + dotest lockfiles-22 "$testcvs -q up -r newtag first-dir" \ +"$PROG update: \[[0-9:]*\] waiting for $username's lock in $CVSROOT_DIRNAME/CVSROOT +$PROG update: \[[0-9:]*\] obtained lock in $CVSROOT_DIRNAME/CVSROOT" + cd CVSROOT echo "# nobody here but us comments" >config dotest lockfiles-cleanup-1 "${testcvs} -q ci -m config-it" \ @@ -19892,6 +21280,149 @@ done" rm -rf ${CVSROOT_DIRNAME}/first-dir ;; + + + sshstdio) + # CVS_RSH=ssh can have a problem with a non-blocking stdio + # in some cases. So, this test is all about testing :ext: + # with CVS_RSH=ssh. The problem is that not all machines + # will necessarily have ssh available, so be prepared to + # skip this test. + + # Are we able to run find and use an ssh? + if $remote; then :; else + continue + fi + + depends_on_ssh + if test $? -eq 77; then + skip sshstdio "$skipreason" + continue + fi + + SSHSTDIO_ROOT=:ext:$host$CVSROOT_DIRNAME + + mkdir sshstdio; cd sshstdio + dotest sshstdio-1 "$testcvs -d $SSHSTDIO_ROOT -q co -l ." + mkdir first-dir + dotest sshstdio-2 "$testcvs add first-dir" \ + "Directory $CVSROOT_DIRNAME/first-dir added to the repository" + cd first-dir + a='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + c='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + # Generate 1024 lines of $a + cnt=0 + echo $a > aaa + while [ $cnt -lt 5 ] ; do + cnt=`expr $cnt + 1` ; + mv aaa aaa.old + cat aaa.old aaa.old aaa.old aaa.old > aaa + done + dotest sshstdio-3 "$testcvs -q add aaa" \ +"$PROG add: use .$PROG commit. to add this file permanently" + dotest sshstdio-4 "$testcvs -q ci -mcreate aaa" \ +"RCS file: $CVSROOT_DIRNAME/first-dir/aaa,v +done +Checking in aaa; +$CVSROOT_DIRNAME/first-dir/aaa,v <-- aaa +initial revision: 1\.1 +done" + # replace lines 1, 512, 513, 1024 with $c + sed 510q < aaa > aaa.old + (echo $c; cat aaa.old; echo $c; \ + echo $c; cat aaa.old; echo $c) > aaa + dotest sshstdio-5 "$testcvs -q ci -mmodify-it aaa" \ +"Checking in aaa; +$CVSROOT_DIRNAME/first-dir/aaa,v <-- aaa +new revision: 1\.2; previous revision: 1\.1 +done" + cat > wrapper.sh <<EOF +#!$TESTSHELL +exec "\$@" 2>&1 < /dev/null | cat +EOF + chmod +x wrapper.sh + ./wrapper.sh \ + $testcvs -z5 -Q diff --side-by-side -W 500 -r 1.1 -r 1.2 \ + aaa \ + |sed -e \ +'/^Write failed flushing stdout buffer\.
$/d; + /^write stdout: Broken pipe
$/d; + :retry; + /Write failed flushing stdout buffer\.
$/{ + N; + s/Write failed flushing stdout buffer\.
\n//; + b retry; +} + /write stdout: Broken pipe
$/{ + N; + s/write stdout: Broken pipe
\n//; + b retry; +}' \ + > wrapper.dif + + $testcvs -z5 -Q diff --side-by-side -W 500 -r 1.1 -r 1.2 \ + aaa > good.dif + + dotest sshstdio-6 "cmp wrapper.dif good.dif" + + if $keep; then + echo Keeping $TESTDIR and exiting due to --keep + exit 0 + fi + + cd ../.. + CVS_RSH=$save_CVS_RSH; export CVS_RSH + rm -r sshstdio + rm -rf $CVSROOT_DIRNAME/first-dir + ;; + + + + parseroot2) + # Test some :ext: roots for consistancy. + if $remote; then :; else + continue + fi + + depends_on_rsh "$CVS_RSH" + if test $? -eq 77; then + skip parseroot2 "$skipreason" + continue + fi + + # Test checking out and subsequently updating with some different + # CVSROOTs. + + # A standard case, hostname:dirname. + mkdir parseroot2; cd parseroot2 + save_CVSROOT=$CVSROOT + CVSROOT=$host:$CVSROOT_DIRNAME + dotest parseroot2-1 "$testcvs -Q co CVSROOT" + cd CVSROOT + dotest parseroot2-2 "$testcvs -Q up" + cd .. + + # A degenerate remote case, just the server name and the directory + # name, with no :'s to help parsing. It can be mistaken for a + # relative directory name. + rm -r CVSROOT + CVSROOT=$host$CVSROOT_DIRNAME + dotest parseroot2-3 "$testcvs -Q co CVSROOT" + cd CVSROOT + dotest parseroot2-4 "$testcvs -Q up" + + if $keep; then + echo Keeping $TESTDIR and exiting due to --keep + exit 0 + fi + + cd ../.. + CVSROOT=$save_CVSROOT + rm -r parseroot2 + ;; + + + history) # CVSROOT/history tests: # history: various "cvs history" invocations @@ -21226,24 +22757,24 @@ xx" " Annotations for file1 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -1\.3 (${username} *[0-9a-zA-Z-]*): initial -1\.4\.2\.1 (${username} *[0-9a-zA-Z-]*): xx "'\$'"Log: file1,v "'\$'" -1\.4\.2\.1 (${username} *[0-9a-zA-Z-]*): xx Revision 1\.4 [0-9/]* [0-9:]* ${username} -1\.4\.2\.1 (${username} *[0-9a-zA-Z-]*): xx First log line -1\.4\.2\.1 (${username} *[0-9a-zA-Z-]*): xx Second log line -1\.4\.2\.1 (${username} *[0-9a-zA-Z-]*): xx -1\.4\.2\.1 (${username} *[0-9a-zA-Z-]*): br-change" +1\.3 ($username8 *[0-9a-zA-Z-]*): initial +1\.4\.2\.1 ($username8 *[0-9a-zA-Z-]*): xx "'\$'"Log: file1,v "'\$'" +1\.4\.2\.1 ($username8 *[0-9a-zA-Z-]*): xx Revision 1\.4 [0-9/]* [0-9:]* $username +1\.4\.2\.1 ($username8 *[0-9a-zA-Z-]*): xx First log line +1\.4\.2\.1 ($username8 *[0-9a-zA-Z-]*): xx Second log line +1\.4\.2\.1 ($username8 *[0-9a-zA-Z-]*): xx +1\.4\.2\.1 ($username8 *[0-9a-zA-Z-]*): br-change" dotest keywordlog-23 "${testcvs} ann -r HEAD file1" \ " Annotations for file1 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -1\.3 (${username} *[0-9a-zA-Z-]*): initial -1\.5 (${username} *[0-9a-zA-Z-]*): xx "'\$'"Log: file1,v "'\$'" -1\.5 (${username} *[0-9a-zA-Z-]*): xx Revision 1\.4 [0-9/]* [0-9:]* ${username} -1\.5 (${username} *[0-9a-zA-Z-]*): xx First log line -1\.5 (${username} *[0-9a-zA-Z-]*): xx Second log line -1\.5 (${username} *[0-9a-zA-Z-]*): xx -1\.5 (${username} *[0-9a-zA-Z-]*): change" +1\.3 ($username8 *[0-9a-zA-Z-]*): initial +1\.5 ($username8 *[0-9a-zA-Z-]*): xx "'\$'"Log: file1,v "'\$'" +1\.5 ($username8 *[0-9a-zA-Z-]*): xx Revision 1\.4 [0-9/]* [0-9:]* $username +1\.5 ($username8 *[0-9a-zA-Z-]*): xx First log line +1\.5 ($username8 *[0-9a-zA-Z-]*): xx Second log line +1\.5 ($username8 *[0-9a-zA-Z-]*): xx +1\.5 ($username8 *[0-9a-zA-Z-]*): change" cd ../.. # @@ -21508,8 +23039,7 @@ diff -r1\.2 file1 # Here's the problem... shouldn't -kk a binary file... rm file1 dotest keyword2-13 "${testcvs} -q update -A -kk -j branch" \ -"U binfile\.dat -${PROG} update: warning: file1 was lost +"${PROG} update: warning: file1 was lost U file1 RCS file: ${CVSROOT_DIRNAME}/first-dir/file1,v retrieving revision 1\.1 @@ -21524,13 +23054,13 @@ ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1 new revision: 1\.3; previous revision: 1\.2 done" - dotest_fail keyword2-15 "cmp binfile.dat ../binfile.dat" \ -"binfile\.dat \.\./binfile\.dat differ: char 13, line 2" + # "-kk" no longer corrupts binary files + dotest keyword2-15 "cmp binfile.dat ../binfile.dat" '' # Okay, restore everything and make CVS try and merge a binary file... + # "-kk" no longer affects binary files dotest keyword2-16 "${testcvs} -q update -A" \ -"[UP] binfile.dat -[UP] file1" +"[UP] file1" dotest keyword2-17 "${testcvs} -q tag -b branch2" \ "T binfile\.dat T file1" @@ -21543,16 +23073,15 @@ T file1" ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v <-- binfile\.dat new revision: 1\.1\.4\.1; previous revision: 1\.1 done" + # "-kk" no longer affects binary files + + # XXXX: do not ask, why we get the "U binfile.dat" line twice + # looks like a bug! dotest keyword2-20 "${testcvs} -q update -A -kk -j branch2" \ "U binfile\.dat -RCS file: ${CVSROOT_DIRNAME}/first-dir/binfile\.dat,v -retrieving revision 1\.1 -retrieving revision 1\.1\.4\.1 -Merging differences between 1\.1 and 1\.1\.4\.1 into binfile\.dat +U binfile\.dat U file1" - # Yep, it's broke, 'cept for that gal in Hodunk who uses -kk - # so that some files only merge when she says so. Time to clean up... cd ../.. rm -r 1 rm -rf ${CVSROOT_DIRNAME}/first-dir @@ -21744,6 +23273,8 @@ done" # for checkout and update as well. # mkdir 1; cd 1 + save_TZ=$TZ + TZ=UTC; export TZ dotest tagdate-1 "${testcvs} -q co -l ." '' mkdir first-dir dotest tagdate-2 "${testcvs} add first-dir" \ @@ -21761,6 +23292,8 @@ Checking in file1; ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1 initial revision: 1\.1 done" + date_T1=`getrlogdate -r1.1 first-dir/file1` + dotest tagdate-5 "${testcvs} -q tag -b br1" "T file1" dotest tagdate-6 "${testcvs} -q tag -b br2" "T file1" echo trunk-2 >file1 @@ -21769,6 +23302,8 @@ done" ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1 new revision: 1\.2; previous revision: 1\.1 done" + date_T2=`getrlogdate -r1.2 first-dir/file1` + # We are testing -r -D where br1 is a (magic) branch without # any revisions. First the case where br2 doesn't have any # revisions either: @@ -21780,6 +23315,7 @@ done" ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1 new revision: 1\.1\.4\.1; previous revision: 1\.1 done" + date_T3=`getrlogdate -r1.1.4.1 first-dir/file1` # Then the case where br2 does have revisions: dotest tagdate-11 "${testcvs} -q update -p -r br1 -D now" "trunk-1" @@ -21789,52 +23325,397 @@ done" "${PROG} \[update aborted\]: argument to join may not contain a date specifier without a tag" # And check export - # Wish some shorter sleep interval would suffice, but I need to - # guarantee that the point in time specified by the argument to -D - # in tagdate-14 and tagdate-16 - # falls in the space of time between commits to br2 and I - # figure 60 seconds is probably a large enough range to - # account for most network file system delays and such... - # as it stands, it takes between 1 and 2 seconds between - # calling CVS on my machine and the -D argument being used to - # recall the file revision and this timing will certainly vary - # by several seconds between machines - dependant on CPUspeeds, - # I/O speeds, load, etc. - sleep 60 - echo br2-2 >file1 dotest tagdate-13 "${testcvs} -q ci -m modify-2-on-br2" \ "Checking in file1; ${CVSROOT_DIRNAME}/first-dir/file1,v <-- file1 new revision: 1\.1\.4\.2; previous revision: 1\.1\.4\.1 done" + date_T4=`getrlogdate -r1.1.4.2 first-dir/file1` + cd ../.. - mkdir 2; cd - dotest tagdate-14 "${testcvs} -q export -r br2 -D'1 minute ago' first-dir" \ + mkdir 2; cd 2 + dotest tagdate-14 "${testcvs} -q export -r br2 -D'$date_T3' first-dir" \ "[UP] first-dir/file1" dotest tagdate-15 "cat first-dir/file1" "br2-1" # Now for annotate cd ../1/first-dir - dotest tagdate-16 "${testcvs} annotate -rbr2 -D'1 minute ago'" \ + dotest tagdate-16 "${testcvs} annotate -rbr2 -D'$date_T3'" \ " Annotations for file1 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -1\.1\.4\.1 (${username} *[0-9a-zA-Z-]*): br2-1" +1\.1\.4\.1 ($username8 *[0-9a-zA-Z-]*): br2-1" dotest tagdate-17 "${testcvs} annotate -rbr2 -Dnow" \ " Annotations for file1 \*\*\*\*\*\*\*\*\*\*\*\*\*\*\* -1\.1\.4\.2 (${username} *[0-9a-zA-Z-]*): br2-2" +1\.1\.4\.2 ($username8 *[0-9a-zA-Z-]*): br2-2" + + # Now check to see what happens when we add files to br2 and trunk + echo br2-1 > file3 + dotest tagdate-18 "${testcvs} add file3" \ +"${PROG} add: scheduling file \`file3' for addition on branch \`br2' +${PROG} add: use .${PROG} commit. to add this file permanently" + dotest tagdate-19 "${testcvs} -q ci -m add file3" \ +"RCS file: ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v +done +Checking in file3; +${CVSROOT_DIRNAME}/first-dir/Attic/file3,v <-- file3 +new revision: 1\.1\.2\.1; previous revision: 1\.1 +done" + date_T5=`getrlogdate -r1.1 first-dir/file3` + date_T6=`getrlogdate -r1.1.2.1 first-dir/file3` + + cd ../.. + mkdir 3; cd 3 + dotest tagdate-20 "${testcvs} -Q co first-dir" '' + cd first-dir + echo trunk-1 > file2 + dotest tagdate-21 "${testcvs} add file2" \ +"${PROG} add: scheduling file .file2. for addition +${PROG} add: use .${PROG} commit. to add this file permanently" + dotest tagdate-22 "${testcvs} -q ci -m add file2" \ +"RCS file: ${CVSROOT_DIRNAME}/first-dir/file2,v +done +Checking in file2; +${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2 +initial revision: 1\.1 +done" + date_T7=`getrlogdate -r1.1 first-dir/file2` + echo "trunk-2" >file2 + dotest tagdate-23 "${testcvs} -q ci -m update file2" \ +"Checking in file2; +${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2 +new revision: 1\.2; previous revision: 1\.1 +done" + date_T8=`getrlogdate -r1.2 first-dir/file2` + + cd ../../1/first-dir + echo br2-1 > file2 + dotest tagdate-24 "${testcvs} add file2" \ +"${PROG} add: scheduling file \`file2' for addition on branch \`br2' +${PROG} add: use .${PROG} commit. to add this file permanently" + dotest tagdate-25 "${testcvs} -q ci -m add file2" \ +"Checking in file2; +${CVSROOT_DIRNAME}/first-dir/file2,v <-- file2 +new revision: 1\.2\.2\.2; previous revision: 1\.2\.2\.1 +done" + date_T9=`getrlogdate -r1.2.2.2 first-dir/file2` + cd ../.. + + # Time Rev Branch Comments + # T0 trunk first-dir created + # T1 1.1 trunk first-dir/file1 committed "trunk-1" + # br1 branch created + # br2 branch created + # T2 1.2 trunk first-dir/file1 committed "trunk-2" + # T3 1.1.4.1 br2 first-dir/file1 committed "br2-1" + # +60s + # T4 1.1.4.2 br2 first-dir/file1 committed "br2-2" + # T5 1.1 trunk first-dir/file3 dead + # T6 1.1.2.1 br2 first-dir/file3 committed "br2-1" + # T7 1.1 trunk first-dir/file2 committed "trunk-1" + # T8 1.2 trunk first-dir/file2 committed "trunk-2" + # T8 1.2.2.1 br2 first-dir/file2 dead + # T9 1.2.2.2 br2 first-dir/file2 committed "br2-1" + # + + mkdir 4; cd 4 + (echo Dates for tagdate-26-* are:;\ + echo " date_T1='$date_T1'";\ + echo " date_T2='$date_T2'";\ + echo " date_T3='$date_T3'";\ + echo " date_T4='$date_T4'";\ + echo " date_T5='$date_T5'";\ + echo " date_T6='$date_T6'";\ + echo " date_T7='$date_T7'";\ + echo " date_T8='$date_T8'";\ + echo " date_T9='$date_T9'") >>$LOGFILE + dotest tagdate-26-trunk-t1 \ +"${testcvs} co -D'$date_T1' -d first-dir-trunk-t1 first-dir" \ +"${PROG} checkout: Updating first-dir-trunk-t1 +U first-dir-trunk-t1/file1" + dotest tagdate-26-br2-t1 \ +"${testcvs} co -r br2 -D'$date_T1' -d first-dir-br2-t1 first-dir" \ +"${PROG} checkout: Updating first-dir-br2-t1 +U first-dir-br2-t1/file1" + dotest tagdate-26-trunk-t2 \ +"${testcvs} co -D'$date_T2' -d first-dir-trunk-t2 first-dir" \ +"${PROG} checkout: Updating first-dir-trunk-t2 +U first-dir-trunk-t2/file1" + dotest tagdate-26-br2-t2 \ +"${testcvs} co -r br2 -D'$date_T2' -d first-dir-br2-t2 first-dir" \ +"${PROG} checkout: Updating first-dir-br2-t2 +U first-dir-br2-t2/file1" + dotest tagdate-26-br2-t3 \ +"${testcvs} co -r br2 -D'$date_T3' -d first-dir-br2-t3 first-dir" \ +"${PROG} checkout: Updating first-dir-br2-t3 +U first-dir-br2-t3/file1" + dotest tagdate-26-br2-t4 \ +"${testcvs} co -r br2 -D'$date_T4' -d first-dir-br2-t4 first-dir" \ +"${PROG} checkout: Updating first-dir-br2-t4 +U first-dir-br2-t4/file1" + dotest tagdate-26-br2-t6 \ +"${testcvs} co -r br2 -D'$date_T6' -d first-dir-br2-t6 first-dir" \ +"${PROG} checkout: Updating first-dir-br2-t6 +U first-dir-br2-t6/file1 +U first-dir-br2-t6/file3" + dotest tagdate-26-trunk-t7 \ +"${testcvs} co -D'$date_T7' -d first-dir-trunk-t7 first-dir" \ +"${PROG} checkout: Updating first-dir-trunk-t7 +U first-dir-trunk-t7/file1 +U first-dir-trunk-t7/file2" + dotest tagdate-26-br2-t7 \ +"${testcvs} co -r br2 -D'$date_T7' -d first-dir-br2-t7 first-dir" \ +"${PROG} checkout: Updating first-dir-br2-t7 +U first-dir-br2-t7/file1 +U first-dir-br2-t7/file3" + dotest tagdate-26-trunk-t8 \ +"${testcvs} co -D'$date_T8' -d first-dir-trunk-t8 first-dir" \ +"${PROG} checkout: Updating first-dir-trunk-t8 +U first-dir-trunk-t8/file1 +U first-dir-trunk-t8/file2" + dotest tagdate-26-br2-t8 \ +"${testcvs} co -r br2 -D'$date_T8' -d first-dir-br2-t8 first-dir" \ +"${PROG} checkout: Updating first-dir-br2-t8 +U first-dir-br2-t8/file1 +U first-dir-br2-t8/file3" + dotest tagdate-26-br2-t9 \ +"${testcvs} co -r br2 -D'$date_T9' -d first-dir-br2-t9 first-dir" \ +"${PROG} checkout: Updating first-dir-br2-t9 +U first-dir-br2-t9/file1 +U first-dir-br2-t9/file2 +U first-dir-br2-t9/file3" + dotest tagdate-27-trunk-t1 \ +"${testcvs} status first-dir-trunk-t1" \ +"${PROG} status: Examining first-dir-trunk-t1 +=================================================================== +File: file1 Status: Up-to-date + + Working revision: 1\.1[^.]* + Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file1,v + Sticky Tag: (none) + Sticky Date: [0-9.]* + Sticky Options: (none)" + dotest tagdate-27-br2-t1 \ +"${testcvs} status first-dir-br2-t1" \ +"${PROG} status: Examining first-dir-br2-t1 +=================================================================== +File: file1 Status: Needs Patch + + Working revision: 1\.1[^.]* + Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v + Sticky Tag: br2 (branch: 1\.1\.4) + Sticky Date: (none) + Sticky Options: (none)" + dotest tagdate-27-trunk-t2 \ +"${testcvs} status first-dir-trunk-t2" \ +"${PROG} status: Examining first-dir-trunk-t2 +=================================================================== +File: file1 Status: Up-to-date + + Working revision: 1\.2[^.]* + Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v + Sticky Tag: (none) + Sticky Date: [0-9.]* + Sticky Options: (none)" + dotest tagdate-27-br2-t2 \ +"${testcvs} status first-dir-br2-t2" \ +"${PROG} status: Examining first-dir-br2-t2 +=================================================================== +File: file1 Status: Needs Patch + + Working revision: 1\.1[^.]* + Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v + Sticky Tag: br2 (branch: 1\.1\.4) + Sticky Date: (none) + Sticky Options: (none)" + dotest tagdate-27-br2-t3 \ +"${testcvs} status first-dir-br2-t3" \ +"${PROG} status: Examining first-dir-br2-t3 +=================================================================== +File: file1 Status: Needs Patch + + Working revision: 1\.1\.4\.1[^.]* + Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v + Sticky Tag: br2 (branch: 1\.1\.4) + Sticky Date: (none) + Sticky Options: (none)" + dotest tagdate-27-br2-t4 \ +"${testcvs} status first-dir-br2-t4" \ +"${PROG} status: Examining first-dir-br2-t4 +=================================================================== +File: file1 Status: Up-to-date + + Working revision: 1\.1\.4\.2[^.]* + Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v + Sticky Tag: br2 (branch: 1\.1\.4) + Sticky Date: (none) + Sticky Options: (none)" + dotest tagdate-27-br2-t6 \ +"${testcvs} status first-dir-br2-t6" \ +"${PROG} status: Examining first-dir-br2-t6 +=================================================================== +File: file1 Status: Up-to-date + + Working revision: 1\.1\.4\.2[^.]* + Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v + Sticky Tag: br2 (branch: 1\.1\.4) + Sticky Date: (none) + Sticky Options: (none) + +=================================================================== +File: file3 Status: Up-to-date + + Working revision: 1\.1\.2\.1[^.]* + Repository revision: 1\.1\.2\.1 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v + Sticky Tag: br2 (branch: 1\.1\.2) + Sticky Date: (none) + Sticky Options: (none)" + dotest tagdate-27-trunk-t7 \ +"${testcvs} status first-dir-trunk-t7" \ +"${PROG} status: Examining first-dir-trunk-t7 +=================================================================== +File: file1 Status: Up-to-date + + Working revision: 1\.2[^.]* + Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v + Sticky Tag: (none) + Sticky Date: [0-9.]* + Sticky Options: (none) + +=================================================================== +File: file2 Status: Up-to-date + + Working revision: 1\.1[^.]* + Repository revision: 1\.1 ${CVSROOT_DIRNAME}/first-dir/file2,v + Sticky Tag: (none) + Sticky Date: [0-9.]* + Sticky Options: (none)" + dotest tagdate-27-br2-t7 \ +"${testcvs} status first-dir-br2-t7" \ +"${PROG} status: Examining first-dir-br2-t7 +=================================================================== +File: file1 Status: Up-to-date + + Working revision: 1\.1\.4\.2[^.]* + Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v + Sticky Tag: br2 (branch: 1\.1\.4) + Sticky Date: (none) + Sticky Options: (none) + +=================================================================== +File: file3 Status: Up-to-date + + Working revision: 1\.1\.2\.1[^.]* + Repository revision: 1\.1\.2\.1 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v + Sticky Tag: br2 (branch: 1\.1\.2) + Sticky Date: (none) + Sticky Options: (none)" + dotest tagdate-27-trunk-t8 \ +"${testcvs} status first-dir-trunk-t8" \ +"${PROG} status: Examining first-dir-trunk-t8 +=================================================================== +File: file1 Status: Up-to-date + + Working revision: 1\.2[^.]* + Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v + Sticky Tag: (none) + Sticky Date: [0-9.]* + Sticky Options: (none) + +=================================================================== +File: file2 Status: Up-to-date + + Working revision: 1\.2[^.]* + Repository revision: 1\.2 ${CVSROOT_DIRNAME}/first-dir/file2,v + Sticky Tag: (none) + Sticky Date: [0-9.]* + Sticky Options: (none)" + dotest tagdate-27-br2-t8 \ +"${testcvs} status first-dir-br2-t8" \ +"${PROG} status: Examining first-dir-br2-t8 +=================================================================== +File: file1 Status: Up-to-date + + Working revision: 1\.1\.4\.2[^.]* + Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v + Sticky Tag: br2 (branch: 1\.1\.4) + Sticky Date: (none) + Sticky Options: (none) + +=================================================================== +File: file3 Status: Up-to-date + + Working revision: 1\.1\.2\.1[^.]* + Repository revision: 1\.1\.2\.1 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v + Sticky Tag: br2 (branch: 1\.1\.2) + Sticky Date: (none) + Sticky Options: (none)" + dotest tagdate-27-br2-t9 \ +"${testcvs} status first-dir-br2-t9" \ +"${PROG} status: Examining first-dir-br2-t9 +=================================================================== +File: file1 Status: Up-to-date + + Working revision: 1\.1\.4\.2[^.]* + Repository revision: 1\.1\.4\.2 ${CVSROOT_DIRNAME}/first-dir/file1,v + Sticky Tag: br2 (branch: 1\.1\.4) + Sticky Date: (none) + Sticky Options: (none) + +=================================================================== +File: file2 Status: Up-to-date + + Working revision: 1\.2\.2\.2[^.]* + Repository revision: 1\.2\.2\.2 ${CVSROOT_DIRNAME}/first-dir/file2,v + Sticky Tag: br2 (branch: 1\.2\.2) + Sticky Date: (none) + Sticky Options: (none) + +=================================================================== +File: file3 Status: Up-to-date + + Working revision: 1\.1\.2\.1[^.]* + Repository revision: 1\.1\.2\.1 ${CVSROOT_DIRNAME}/first-dir/Attic/file3,v + Sticky Tag: br2 (branch: 1\.1\.2) + Sticky Date: (none) + Sticky Options: (none)" + + # Now check the contents of the files + dotest tagdate-28-trunk-t1 'cat first-dir-trunk-t1/file1' 'trunk-1' + dotest tagdate-28-br2-t1 'cat first-dir-br2-t1/file1' 'trunk-1' + dotest tagdate-28-trunk-t2 'cat first-dir-trunk-t2/file1' 'trunk-2' + dotest tagdate-28-br2-t2 'cat first-dir-br2-t2/file1' 'trunk-1' + dotest tagdate-28-br2-t3 'cat first-dir-br2-t3/file1' 'br2-1' + dotest tagdate-28-br2-t4 'cat first-dir-br2-t4/file1' 'br2-2' + dotest tagdate-28-br2-t6a 'cat first-dir-br2-t6/file1' "br2-2" + dotest tagdate-28-br2-t6b 'cat first-dir-br2-t6/file3' "br2-1" + dotest tagdate-28-trunk-t7a 'cat first-dir-trunk-t7/file1' "trunk-2" + dotest tagdate-28-trunk-t7b 'cat first-dir-trunk-t7/file2' "trunk-1" + dotest tagdate-28-br2-t7a 'cat first-dir-br2-t7/file1' "br2-2" + dotest tagdate-28-br2-t7b 'cat first-dir-br2-t7/file3' "br2-1" + dotest tagdate-28-trunk-t8a 'cat first-dir-trunk-t8/file1' "trunk-2" + dotest tagdate-28-trunk-t8b 'cat first-dir-trunk-t8/file2' "trunk-2" + dotest tagdate-28-br2-t8a 'cat first-dir-br2-t8/file1' "br2-2" + dotest tagdate-28-br2-t8c 'cat first-dir-br2-t8/file3' "br2-1" + dotest tagdate-28-br2-t9a 'cat first-dir-br2-t9/file1' "br2-2" + dotest tagdate-28-br2-t9b 'cat first-dir-br2-t9/file2' "br2-1" + dotest tagdate-28-br2-t9c 'cat first-dir-br2-t9/file3' "br2-1" + cd .. + + unset date_T1 date_T2 date_T3 date_T4 date_T5 + unset date_T6 date_T7 date_T8 date_T9 + TZ=$save_TZ if $keep; then echo Keeping ${TESTDIR} and exiting due to --keep exit 0 fi - cd ../.. - rm -r 1 2 + rm -r 1 2 3 4 rm -rf ${CVSROOT_DIRNAME}/first-dir ;; @@ -23143,13 +25024,13 @@ add cat >${TESTDIR}/lockme <<EOF #!${TESTSHELL} -line=\`grep <\$1/\$2,v 'locks ${author}:1\.[0-9];'\` +line=\`grep <\$1/\$2,v 'locks $anyusername:1\.[0-9];'\` if test -z "\$line"; then # It isn't locked exit 0 else - user=\`echo \$line | sed -e 's/locks \\(${author}\\):[0-9.]*;.*/\\1/'\` - version=\`echo \$line | sed -e 's/locks ${author}:\\([0-9.]*\\);.*/\\1/'\` + user=\`echo \$line | sed -e 's/locks \\($anyusername\\):[0-9.]*;.*/\\1/'\` + version=\`echo \$line | sed -e 's/locks $anyusername:\\([0-9.]*\\);.*/\\1/'\` echo "\$user has file a-lock locked for version \$version" >&2 exit 1 fi @@ -26496,9 +28377,13 @@ Root ${CVSROOT_DIRNAME} noop EOF + # The "no such system user" error is occurring on at least one of + # our BSD 2.0.2 nightly test platforms. dotest_fail pserver-4.2 \ "${testcvs} --allow-root=${CVSROOT_DIRNAME} pserver" \ -"error 0: root not allowed" <<EOF +"error 0: root not allowed" \ +"E Fatal error, aborting\. +error 0 root: no such system user" <<EOF BEGIN AUTH REQUEST ${CVSROOT_DIRNAME} dontroot @@ -27596,28 +29481,56 @@ done" # # Test our exit directory so that tests that exit in an incorrect directory # are noticed during single test runs. + # + # FIXME? + # Sparc Solaris 9 is dereferencing paths here as if /bin/pwd were + # called when /tmp is a symlink. This might be a new problem with this + # test, but since this was recently tested I think it more likely to be + # A Solaris issue. if test "x$TESTDIR" != "x`pwd`"; then fail "cleanup: PWD != TESTDIR (\``pwd`' != \`$TESTDIR')" fi - # Test our temp directory for cvs-serv* directories and cvsXXXXXX temp - # files. We would like to not leave any behind. - if $remote && ls $TMPDIR/cvs-serv* >/dev/null 2>&1; then - # A true value means ls found files/directories with these names. - # Give the server some time to finish, then retry. - sleep 1 - if ls $TMPDIR/cvs-serv* >/dev/null 2>&1; then - fail "Found cvs-serv* directories in $TMPDIR." - fi - fi - if ls $TMPDIR/cvs?????? >/dev/null 2>&1; then - # A true value means ls found files/directories with these names. - fail "Found cvsXXXXXX temp files in $TMPDIR." - fi + # Reset val-tags to a pristine state. + rm -f $CVSROOT_DIRNAME/CVSROOT/val-tags + + verify_tmp_empty "post $what" done # The big loop -echo "OK, all tests completed." +# Set up summary data for output. +skippedoutput= +warningsoutput= +extendedinfo= +if test $skipped -ne 0; then + skippedoutput="$skipped test group" + if test $skipped -ne 1; then + skippedoutput="${skippedoutput}s" + fi + skippedoutput="$skippedoutput skipped" +fi +if test $warnings -ne 0; then + warningsoutput="$warnings test" + if test $warnings -ne 1; then + warningsoutput="${warningsoutput}s" + fi + warningsoutput="$warningsoutput passed with warnings" +fi +if test -n "$skippedoutput" || test -n "$warningsoutput"; then + extendedinfo=" (" + if test -n "$skippedoutput"; then + extendedinfo="$extendedinfo$skippedoutput" + fi + if test -n "$skippedoutput" && test -n "$warningsoutput"; then + extendedinfo="$extendedinfo and " + fi + if test -n "$warningsoutput"; then + extendedinfo="$extendedinfo$warningsoutput" + fi + extendedinfo="$extendedinfo)" +fi + +echo "OK, all $passed tests passed$extendedinfo." # TODO: # * Test `cvs update -d foo' (where foo does not exist). |