#! /bin/sh


## --------------------- ##
## M4sh Initialization.  ##
## --------------------- ##

# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  emulate sh
  NULLCMD=:
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
  set -o posix
fi

# Name of the executable.
as_me=`echo "$0" |sed 's,\(.*[\\/]\+\)\?\([^\\/]\+\)[\\/]*,\2,'`

# If LINENO is not supported by the shell, produce a version of this
# script where LINENO is hard coded.  Rewrite if not up to date only.
# Comparing LINENO against _oline_ is not a good solution, since in
# the case of embedded executables (such as config.status within
# configure) you'd compare LINENO wrt config.status vs. _oline_ vs
# configure.  Hence a useless rewrite (not to mention the risk of
# ``infinite'' rewrites.  Merely check that LINENO is incremented
# between two lines, which is a property guaranteed for _oline_, hence
# it protects us from repetitive rewrites.
as_lineno_1=$LINENO
as_lineno_2=$LINENO
# Compute as_lineno_1 in two steps: some shells restart LINENO for
# subshells.
as_lineno_1=`(expr $as_lineno_1 + 1) 2>/dev/null`
if test "x$as_lineno_1" != "x$as_lineno_2"; then
  if test ! -f $as_me.lineno ||
     test x`ls -1dt $as_me.lineno $as_me 2>/dev/null | sed 1q` \
                != x$as_me.lineno; then
     # Be sure to write the pattern so that it doesn't replace itself:
     # it must not match itself.
     awk '{
            if ($0 ~ /[$]LINENO/)
              while (sub (/[$]LINENO/, NR))
                continue
            print
          }' <$as_me >$as_me.lineno
    chmod +x $as_me.lineno
  fi
  exec ${SHELL-/bin/sh} ./$as_me.lineno
fi

# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
as_cr_digits='0123456789'
as_cr_alnum=$as_cr_Letters$as_cr_digits

case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
  *c*,-n*) ECHO_N= ECHO_C='
' ECHO_T='	' ;;
  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac

if expr a : '\(a\)' >/dev/null 2>&1; then
  as_expr=expr
else
  as_expr=false
fi

rm -f conf$$ conf$$.exe conf$$.file
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
  # We could just check for DJGPP; but this test a) works b) is more generic
  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
  if test -f conf$$.exe; then
    # Don't use ln at all; we don't have any links
    as_ln_s='cp -p'
  else
    as_ln_s='ln -s'
  fi
elif ln conf$$.file conf$$ 2>/dev/null; then
  as_ln_s=ln
else
  as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.file

# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
  echo "#! $SHELL" >conftest.sh
  echo  "exit 0"   >>conftest.sh
  chmod +x conftest.sh
  if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then
    PATH_SEPARATOR=';'
  else
    PATH_SEPARATOR=:
  fi
  rm -f conftest.sh
fi

as_executable_p="test -f"

# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"

# Sed expression to map a string onto a valid variable name.
as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"

# Support unset when possible.
if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
  as_unset=unset
else
  as_unset=false
fi


# NLS nuisances.
$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; }
$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; }
$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; }
$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; }
$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; }
$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; }
$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; }
$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; }

# IFS
# We need space, tab and new line, in precisely that order.
as_nl='
'
IFS=" 	$as_nl"

# CDPATH.
$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; }

SHELL=${CONFIG_SHELL-/bin/sh}

# How were we run?
at_cli_args=${1+"$@"}

# Load the config file.
for at_file in atconfig atlocal
do
  test -r $at_file || continue
  . ./$at_file || { echo "$as_me: error: invalid content: $at_file" >&2
   { (exit 1); exit 1; }; }
done

AUTOTEST_PATH=`echo $AUTOTEST_PATH | tr ':' $PATH_SEPARATOR`

# Not all shells have the 'times' builtin; the subshell is needed to make
# sure we discard the 'times: not found' message from the shell.
at_times=:
(times) >/dev/null 2>&1 && at_times=times

# CLI Arguments to pass to the debugging scripts.
at_debug_args=
# -e sets to true
at_stop_on_error=false
# Shall we be verbose?
at_verbose=:
at_quiet=echo
# Shall we keep the debug scripts?  Must be `:' when test suite is
# run by a debug script, so that the script doesn't remove itself.
at_debug=false
# Display help message?
at_help=no
# Tests to run
at_tests=
# List of the tested programs.
at_victims="cvs"
# List of the tests.
at_tests_all=" banner-1 1 2 3 banner-2 4 5 6 7 8 9 10 11 12 banner-3 13 14 15 16 17 18 "
# Number of the last test.
at_last_test=18
# Description of all the tests.
at_help_all="1;basic.at:5;init;
2;basic.at:15;basica-0;
3;basic.at:46;basica-1;
4;acl.at:5;init;
5;acl.at:20;acl-admins;
6;acl.at:54;basic;
7;acl.at:113;branch-acl;
8;acl.at:214;dir-acl;
9;acl.at:339;dir-acl-others;
10;acl.at:368;default-file-acls;
11;acl.at:483;other-commands;
12;acl.at:587;user-groups;
13;racl.at:9;make-modules;
14;racl.at:35;racl-nosuch-module;
15;racl.at:55;simple-racl-grant;
16;racl.at:75;simple-racl;
17;racl.at:109;simple-racl-revoke;
18;racl.at:126;simple-racl;
"
# List of the output files.
at_data_files="stdout expout at-* stderr experr /tmp/cvs-sanity/1 /tmp/cvs-sanity/first-dir /tmp/cvs-sanity/first-dir
		 /tmp/cvs-sanity/cvsroot/first-dir/sdir "


while test $# -gt 0; do
  case $1 in
    --help | -h) at_help=short
        ;;

    --full-help | -H ) at_help=long
        ;;

    --version)
        echo "$as_me (cvs-nserver 1.11.1.52)"
        exit 0
        ;;

    --clean | -c )
        rm -rf $at_data_files \
               $as_me.[0-9] $as_me.[0-9][0-9] $as_me.[0-9][0-9][0-9] \
               $as_me.log devnull
        exit 0
        ;;

    -d) at_debug=:
        ;;

    -e) at_debug=:
        at_stop_on_error=:
        ;;

    -v) at_verbose=echo; at_quiet=:
        ;;

    -x) at_traceon='set -vx'; at_traceoff='set +vx'
        ;;

    [0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9])
        at_tests="$at_tests$1 "
        ;;

    # Ranges
    [0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-)
        at_range_start=`echo $1 |tr -d '-'`
        at_range=`echo " $at_tests_all " | \
          sed -e 's,^.* '$at_range_start' ,'$at_range_start' ,'`
        at_tests="$at_tests$at_range "
        ;;

    -[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9])
        at_range_end=`echo $1 |tr -d '-'`
        at_range=`echo " $at_tests_all " | \
          sed -e 's, '$at_range_end' .*$, '$at_range_end','`
        at_tests="$at_tests$at_range "
        ;;

    [0-9]-[0-9] | [0-9]-[0-9][0-9] | [0-9]-[0-9][0-9][0-9] | \
    [0-9]-[0-9][0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9] | \
    [0-9][0-9]-[0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9][0-9][0-9] | \
    [0-9][0-9][0-9]-[0-9][0-9][0-9] | \
    [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] | \
    [0-9][0-9][0-9][0-9]-[0-9][0-9][0-9][0-9] )
        at_range_start=`echo $1 |sed 's,-.*,,'`
        at_range_end=`echo $1 |sed 's,.*-,,'`
        # Maybe test to make sure start <= end?
        at_range=`echo " $at_tests_all " | \
          sed -e 's,^.* '$at_range_start' ,'$at_range_start' ,' \
              -e 's, '$at_range_end' .*$, '$at_range_end','`
        at_tests="$at_tests$at_range "
        ;;

    # Keywords.
    --keywords | -k )
        shift
        at_tests_selected=$at_help_all
        for at_keyword in `IFS=,; set X $1; shift; echo ${1+$@}`
        do
          # It is on purpose that we match the test group titles too.
          at_tests_selected=`echo "$at_tests_selected" |
                             egrep -i "^[^;]*;[^;]*;.*$at_keyword"`
        done
        at_tests_selected=`echo "$at_tests_selected" | sed 's/;.*//'`
        at_tests="$at_tests$at_tests_selected "
        ;;

    *=*)
  	at_envvar=`expr "x$1" : 'x\([^=]*\)='`
  	# Reject names that are not valid shell variable names.
  	expr "x$at_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
  	  { echo "$as_me: error: invalid variable name: $at_envvar" >&2
   { (exit 1); exit 1; }; }
  	at_value=`expr "x$1" : 'x[^=]*=\(.*\)'`
  	at_value=`echo "$at_value" | sed "s/'/'\\\\\\\\''/g"`
  	eval "$at_envvar='$at_value'"
  	export $at_envvar
	# Propagate to debug scripts.
  	at_debug_args="$at_debug_args $1"
  	;;

     *) echo "$as_me: invalid option: $1" >&2
        echo "Try \`$0 --help' for more information." >&2
        exit 1
        ;;
  esac
  shift
done

# Help message.
if test "$at_help" != no; then
  # If tests were specified, display only their title.
  if test -z "$at_tests"; then
    cat <<_ATEOF
Usage: $0 [OPTION]... [TESTS] [VAR=VALUE]

Run all the tests, or the selected TESTS.

Options:
  -h  Display this help message and the description of TESTS
  -c  Remove all the files this test suite might create and exit
  -e  Abort the test suite as soon as a test fails; implies -d
  -v  Force more detailed output, default for debugging scripts
  -d  Inhibit clean up and debug script creation, default for debugging scripts
  -x  Have the shell trace command execution

Tests:
_ATEOF
  else
    # "  1 42  45 " => " (1|42|45): "
    at_tests_pattern=`echo "$at_tests" | sed 's/^  *//;s/  *$//;s/  */|/g'`
    at_tests_pattern=" (${at_tests_pattern}): "
  fi
  case $at_help in
  short)
    echo "$at_help_all" |
      egrep -e "$at_tests_pattern" |
      awk 'BEGIN { FS = ";" }
           { if ($1) printf " %3d: %s\n", $1, $3 } ';;
  long)
    echo "$at_help_all" |
      egrep -e "$at_tests_pattern" |
      awk 'BEGIN { FS = ";" }
           { if ($1) printf " %3d: %-18s %s\n", $1, $2, $3
             if ($4) printf "      %s\n", $4 } ';;
  esac
  echo
  echo "Report bugs to <cvs-nserver-devel@lists.sourceforge.net>."
  exit 0
fi

# Tests to run.
test -z "$at_tests" && at_tests=$at_tests_all

# Don't take risks: use only absolute directories in PATH.
#
# For stand-alone test suites, AUTOTEST_PATH is relative to `.'.
#
# For embedded test suites, AUTOTEST_PATH is relative to the top level
# of the package.  Then expand it into build/src parts, since users
# may create executables in both places.
#
# There might be directories that don't exist, but don't redirect
# builtins' (eg., cd) stderr directly: Ultrix's sh hates that.
at_path=
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $AUTOTEST_PATH $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  case $as_dir in
  [\\/]* | ?:[\\/]* )
    at_path=$at_path$PATH_SEPARATOR$as_dir
    ;;
  * )
    if test -z "$top_builddir"; then
      # Stand-alone test suite.
      at_path=$at_path$PATH_SEPARATOR$as_dir
    else
      # Embedded test suite.
      at_path=$at_path$PATH_SEPARATOR$top_builddir/$as_dir
      at_path=$at_path$PATH_SEPARATOR$top_srcdir/$as_dir
    fi
    ;;
esac
done


# Now build and simplify PATH.
at_sep=
PATH=
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $at_path
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  as_dir=`(cd "$as_dir" && pwd) 2>/dev/null`
test -d "$as_dir" || continue
case $PATH in
                  $as_dir                 | \
                  $as_dir$PATH_SEPARATOR* | \
  *$PATH_SEPARATOR$as_dir                 | \
  *$PATH_SEPARATOR$as_dir$PATH_SEPARATOR* ) ;;
  *) PATH=$PATH$at_sep$as_dir
     at_sep=$PATH_SEPARATOR;;
esac
done

export PATH

# Can we diff with `/dev/null'?  DU 5.0 refuses.
if diff /dev/null /dev/null >/dev/null 2>&1; then
  at_devnull=/dev/null
else
  at_devnull=devnull
  cp /dev/null $at_devnull
fi

# Use `diff -u' when possible.
if diff -u $at_devnull $at_devnull >/dev/null 2>&1; then
  at_diff='diff -u'
else
  at_diff=diff
fi

# Setting up the FDs.
# 5 is stdout conditioned by verbosity.
if test $at_verbose = echo; then
  exec 5>&1
else
  exec 5>/dev/null
fi

# 6 is the log file.  To be preserved if `-d'.

if $at_debug; then
  exec 6>/dev/null
else
  exec 6>$as_me.log
fi

# Banners and logs.
cat <<\_ASBOX
## --------------------------------- ##
## cvs-nserver 1.11.1.52 test suite. ##
## --------------------------------- ##
_ASBOX
{
  cat <<\_ASBOX
## --------------------------------- ##
## cvs-nserver 1.11.1.52 test suite. ##
## --------------------------------- ##
_ASBOX
  echo

  echo "$as_me: command line was:"
  echo "  $ $0 $at_cli_args"
  echo

  # Try to find a few ChangeLogs in case it might help determining the
  # exact version.  Use the relative dir: if the top dir is a symlink,
  # find will not follow it (and options to follow the links are not
  # portable), which would result in no output here.

  if test -n "$top_srcdir"; then
    cat <<\_ASBOX
## ----------- ##
## ChangeLogs. ##
## ----------- ##
_ASBOX
    echo
    for at_file in `find "$top_srcdir" -name ChangeLog -print`
    do
      echo "$as_me: $at_file:"
      sed 's/^/| /;10q' $at_file
      echo
    done

    {
cat <<_ASUNAME
## --------- ##
## Platform. ##
## --------- ##

hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
uname -m = `(uname -m) 2>/dev/null || echo unknown`
uname -r = `(uname -r) 2>/dev/null || echo unknown`
uname -s = `(uname -s) 2>/dev/null || echo unknown`
uname -v = `(uname -v) 2>/dev/null || echo unknown`

/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`

/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`

_ASUNAME

as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  echo "PATH: $as_dir"
done

}
    echo
  fi

  # Inform about the contents of the config files.
  for at_file in atconfig atlocal
  do
    test -r $at_file || continue
    echo "$as_me: $at_file:"
    sed 's/^/| /' $at_file
    echo
  done

  cat <<\_ASBOX
## -------- ##
## Victims. ##
## -------- ##
_ASBOX
  echo
} >&6

# Report what programs are being tested.
for at_program in : $at_victims
do
  test "$at_program" = : && continue
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
  IFS=$as_save_IFS
  test -z "$as_dir" && as_dir=.
  test -f $as_dir/$at_program && break
done

  if test -f $as_dir/$at_program; then
    {
      echo "testsuite.at:8: $as_dir/$at_program --version"
      $as_dir/$at_program --version
      echo
    } >&6 2>&1
  else
    { { echo "$as_me:$LINENO: error: cannot find $at_program" >&6
echo "$as_me: error: cannot find $at_program" >&2;}
   { (exit 1); exit 1; }; }
  fi
done

{
  cat <<\_ASBOX
## --------------------------- ##
## Silently running the tests. ##
## --------------------------- ##
_ASBOX
} >&6

at_start_date=`date`
at_start_time=`(date +%s) 2>/dev/null`
echo "$as_me: starting at: $at_start_date" >&6
at_fail_list=
at_skip_list=
at_test_count=0

for at_test in $at_tests
do
  at_status=0
  rm -rf $at_data_files
  # Clearly separate the tests when verbose.
  test $at_test_count != 0 && $at_verbose
  case $at_test in

  banner-1 ) # Banner 1. basic.at:3
    cat <<\_ATEOF

CVS basic features.

_ATEOF
    ;;

  1 ) # 1. basic.at:5: init
    at_setup_line='basic.at:5'
    $at_verbose "1. basic.at:5: testing init..."
    $at_quiet $ECHO_N "  1: basic.at:5        $ECHO_C"
    (
      $at_traceon


$at_traceoff
$at_verbose "basic.at:11:
rm -rf -- /tmp/cvs-sanity
mkdir /tmp/cvs-sanity
cvs -d /tmp/cvs-sanity/cvsroot init
"
echo basic.at:11 >at-check-line
( $at_traceon;
rm -rf -- /tmp/cvs-sanity
mkdir /tmp/cvs-sanity
cvs -d /tmp/cvs-sanity/cvsroot init
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff $at_devnull  at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "basic.at:11: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;

  2 ) # 2. basic.at:15: basica-0
    at_setup_line='basic.at:15'
    $at_verbose "2. basic.at:15: testing basica-0..."
    $at_quiet $ECHO_N "  2: basic.at:15       $ECHO_C"
    (
      $at_traceon



CVSROOT=/tmp/cvs-sanity/cvsroot
export CVSROOT




# Tests basica-0a and basica-0b provide the equivalent of the:
#    mkdir ${CVSROOT_DIRNAME}/first-dir
# used by many of the tests.  It is "more official" in the sense
# that is does everything through CVS; the reason most of the
# tests don't use it is mostly historical.

# basica-0a
$at_traceoff
$at_verbose "basic.at:31: cd /tmp/cvs-sanity
mkdir 1
cd 1
cvs -q co -l ."
echo basic.at:31 >at-check-line
( $at_traceon; cd /tmp/cvs-sanity
mkdir 1
cd 1
cvs -q co -l . ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff $at_devnull  at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "basic.at:31: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


# basica-0b
cat >expout <<'_ATEOF'
Directory /tmp/cvs-sanity/cvsroot/first-dir added to the repository
_ATEOF


$at_traceoff
$at_verbose "basic.at:41: cd /tmp/cvs-sanity/1
mkdir first-dir
cvs add first-dir
"
echo basic.at:41 >at-check-line
( $at_traceon; cd /tmp/cvs-sanity/1
mkdir first-dir
cvs add first-dir
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "basic.at:41: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;

  3 ) # 3. basic.at:46: basica-1
    at_setup_line='basic.at:46'
    $at_verbose "3. basic.at:46: testing basica-1..."
    $at_quiet $ECHO_N "  3: basic.at:46       $ECHO_C"
    (
      $at_traceon



CVSROOT=/tmp/cvs-sanity/cvsroot
export CVSROOT




# basica-1
$at_traceoff
$at_verbose "basic.at:56: cd /tmp/cvs-sanity
cvs -q co first-dir
"
echo basic.at:56 >at-check-line
( $at_traceon; cd /tmp/cvs-sanity
cvs -q co first-dir
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff $at_devnull  at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "basic.at:56: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


# basica-1a0
$at_traceoff
$at_verbose "basic.at:61: cd /tmp/cvs-sanity/first-dir
cvs -q update
"
echo basic.at:61 >at-check-line
( $at_traceon; cd /tmp/cvs-sanity/first-dir
cvs -q update
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff $at_devnull  at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "basic.at:61: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


# basica-1a1
$at_traceoff
$at_verbose "basic.at:66: cd /tmp/cvs-sanity/first-dir
cvs -q diff -c
"
echo basic.at:66 >at-check-line
( $at_traceon; cd /tmp/cvs-sanity/first-dir
cvs -q diff -c
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff $at_devnull  at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "basic.at:66: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


# basica-1a2
$at_traceoff
$at_verbose "basic.at:71: cd /tmp/cvs-sanity/first-dir
cvs -q status
"
echo basic.at:71 >at-check-line
( $at_traceon; cd /tmp/cvs-sanity/first-dir
cvs -q status
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff $at_devnull  at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "basic.at:71: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


$at_traceoff
$at_verbose "basic.at:74: cd /tmp/cvs-sanity/first-dir
mkdir sdir"
echo basic.at:74 >at-check-line
( $at_traceon; cd /tmp/cvs-sanity/first-dir
mkdir sdir ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff $at_devnull  at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "basic.at:74: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


# basica-1a10
cat >expout <<'_ATEOF'
Directory /tmp/cvs-sanity/cvsroot/first-dir/sdir added to the repository
_ATEOF


$at_traceoff
$at_verbose "basic.at:82: cd /tmp/cvs-sanity/first-dir
cvs -n add sdir"
echo basic.at:82 >at-check-line
( $at_traceon; cd /tmp/cvs-sanity/first-dir
cvs -n add sdir ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "basic.at:82: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


# basica-1a11
$at_traceoff
$at_verbose "basic.at:86: test -d /tmp/cvs-sanity/cvs-root/first-dir/sdir
"
echo basic.at:86 >at-check-line
( $at_traceon; test -d /tmp/cvs-sanity/cvs-root/first-dir/sdir
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff $at_devnull  at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   1) ;;
   *) $at_verbose "basic.at:86: exit code was $at_status, expected 1" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


cat >expout <<'_ATEOF'
Directory /tmp/cvs-sanity/cvsroot/first-dir/sdir added to the repository
_ATEOF


$at_traceoff
$at_verbose "basic.at:93: cd /tmp/cvs-sanity/first-dir
cvs add sdir"
echo basic.at:93 >at-check-line
( $at_traceon; cd /tmp/cvs-sanity/first-dir
cvs add sdir ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "basic.at:93: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;


  banner-2 ) # Banner 2. acl.at:3
    cat <<\_ATEOF

CVS ACL features (cvs acl).

_ATEOF
    ;;

  4 ) # 4. acl.at:5: init
    at_setup_line='acl.at:5'
    $at_verbose "4. acl.at:5: testing init..."
    $at_quiet $ECHO_N "  4: acl.at:5          $ECHO_C"
    (
      $at_traceon


$at_traceoff
$at_verbose "acl.at:11:
rm -rf -- /tmp/cvs-sanity
mkdir /tmp/cvs-sanity
cvs -d /tmp/cvs-sanity/cvsroot init
"
echo acl.at:11 >at-check-line
( $at_traceon;
rm -rf -- /tmp/cvs-sanity
mkdir /tmp/cvs-sanity
cvs -d /tmp/cvs-sanity/cvsroot init
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff $at_devnull  at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:11: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;

  5 ) # 5. acl.at:20: acl-admins
    at_setup_line='acl.at:20'
    $at_verbose "5. acl.at:20: testing acl-admins..."
    $at_quiet $ECHO_N "  5: acl.at:20         $ECHO_C"
    (
      $at_traceon



CVSROOT=:pserver:alice@localhost:/tmp/cvs-sanity/cvsroot
export CVSROOT



$at_traceoff
$at_verbose "acl.at:24:
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
"
echo acl.at:24 >at-check-line
( $at_traceon;
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
(echo stderr:; cat at-stderr) >&5
(echo stdout:; cat at-stdout) >&5
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:24: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs [server aborted]: alice is not allowed to manage ACLs
_ATEOF


$at_traceoff
$at_verbose "acl.at:34:
cd ./test-area/
cvs -q co -l .
cvs acl grant alice checkin,checkout foo
"
echo acl.at:34 >at-check-line
( $at_traceon;
cd ./test-area/
cvs -q co -l .
cvs acl grant alice checkin,checkout foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   1) ;;
   *) $at_verbose "acl.at:34: exit code was $at_status, expected 1" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


#
# allow alice and bob to manage acls
#
cat <<EOF > /tmp/cvs-sanity/cvsroot/CVSROOT/acl-admins
alice
bob
EOF

    $at_times >at-times
    )
    at_status=$?
    ;;

  6 ) # 6. acl.at:54: basic
    at_setup_line='acl.at:54'
    $at_verbose "6. acl.at:54: testing basic..."
    $at_quiet $ECHO_N "  6: acl.at:54         $ECHO_C"
    (
      $at_traceon



CVSROOT=:pserver:alice@localhost:/tmp/cvs-sanity/cvsroot
export CVSROOT


$at_traceoff
$at_verbose "acl.at:59: rm -rf ./test-area
mkdir test-area"
echo acl.at:59 >at-check-line
( $at_traceon; rm -rf ./test-area
mkdir test-area ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff $at_devnull  at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:59: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



cat >expout <<'_ATEOF'
Directory /tmp/cvs-sanity/cvsroot/top-dir added to the repository
_ATEOF


$at_traceoff
$at_verbose "acl.at:71:
cd test-area
cvs -q co -l .
mkdir top-dir
cvs add top-dir
"
echo acl.at:71 >at-check-line
( $at_traceon;
cd test-area
cvs -q co -l .
mkdir top-dir
cvs add top-dir
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:71: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



cat >experr <<'_ATEOF'
cvs server: scheduling file `foo' for addition
cvs server: scheduling file `bar' for addition
cvs server: use 'cvs commit' to add these files permanently
_ATEOF


cat >expout <<'_ATEOF'
RCS file: /tmp/cvs-sanity/cvsroot/top-dir/foo,v
done
Checking in foo;
/tmp/cvs-sanity/cvsroot/top-dir/foo,v  <--  foo
initial revision: 1.1
done
RCS file: /tmp/cvs-sanity/cvsroot/top-dir/bar,v
done
Checking in bar;
/tmp/cvs-sanity/cvsroot/top-dir/bar,v  <--  bar
initial revision: 1.1
done
_ATEOF


$at_traceoff
$at_verbose "acl.at:101:
cd test-area/top-dir/
echo \"Foo file\" > foo
echo \"Bar file\" > bar
cvs add foo bar
cvs ci -m \"Initial checkin\" foo bar
"
echo acl.at:101 >at-check-line
( $at_traceon;
cd test-area/top-dir/
echo "Foo file" > foo
echo "Bar file" > bar
cvs add foo bar
cvs ci -m "Initial checkin" foo bar
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:101: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



    $at_times >at-times
    )
    at_status=$?
    ;;

  7 ) # 7. acl.at:113: branch-acl
    at_setup_line='acl.at:113'
    $at_verbose "7. acl.at:113: testing branch-acl..."
    $at_quiet $ECHO_N "  7: acl.at:113        $ECHO_C"
    (
      $at_traceon



CVSROOT=:pserver:alice@localhost:/tmp/cvs-sanity/cvsroot
export CVSROOT



$at_traceoff
$at_verbose "acl.at:117:
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
"
echo acl.at:117 >at-check-line
( $at_traceon;
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
(echo stderr:; cat at-stderr) >&5
(echo stdout:; cat at-stdout) >&5
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:117: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


$at_traceoff
$at_verbose "acl.at:118:
cd test-area/
cvs co top-dir/
"
echo acl.at:118 >at-check-line
( $at_traceon;
cd test-area/
cvs co top-dir/
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
(echo stderr:; cat at-stderr) >&5
(echo stdout:; cat at-stdout) >&5
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:118: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# check for invalid branch permissions
#

cat >expout <<'_ATEOF'
_ATEOF


cat >experr <<'_ATEOF'
cvs [server aborted]: Invalid branch permissions 'invalid'
_ATEOF


$at_traceoff
$at_verbose "acl.at:133:
cd test-area/top-dir/
cvs acl grant alice invalid foo
"
echo acl.at:133 >at-check-line
( $at_traceon;
cd test-area/top-dir/
cvs acl grant alice invalid foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   1) ;;
   *) $at_verbose "acl.at:133: exit code was $at_status, expected 1" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# verify that setting checkout-only permission works
#

cat >expout <<'_ATEOF'
Setting 'checkout' permissions for 'alice' on file top-dir/foo
_ATEOF


$at_traceoff
$at_verbose "acl.at:147:
cd test-area/top-dir/
cvs acl grant alice checkout foo
"
echo acl.at:147 >at-check-line
( $at_traceon;
cd test-area/top-dir/
cvs acl grant alice checkout foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:147: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# verify that checkout is allowed for alice
#

cat >expout <<'_ATEOF'
U top-dir/bar
U top-dir/foo
_ATEOF


cat >experr <<'_ATEOF'
cvs server: Updating top-dir
_ATEOF


$at_traceoff
$at_verbose "acl.at:165:
cd test-area/
rm -rf top-dir/
cvs co top-dir/
"
echo acl.at:165 >at-check-line
( $at_traceon;
cd test-area/
rm -rf top-dir/
cvs co top-dir/
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:165: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# verify that checkin is not allowed for alice
#

cat >expout <<'_ATEOF'
_ATEOF


cat >experr <<'_ATEOF'
cvs server: checkin permission for foo denied for user alice
cvs [server aborted]: correct above errors first!
_ATEOF


$at_traceoff
$at_verbose "acl.at:182:
cd test-area/top-dir/
echo \"New contents\" > foo
cvs ci -m \"New contents\" foo
"
echo acl.at:182 >at-check-line
( $at_traceon;
cd test-area/top-dir/
echo "New contents" > foo
cvs ci -m "New contents" foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   1) ;;
   *) $at_verbose "acl.at:182: exit code was $at_status, expected 1" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# verify that neither checkin, nor checkout is allowed for bob
#


CVSROOT=:pserver:bob@localhost:/tmp/cvs-sanity/cvsroot
export CVSROOT


cat >expout <<'_ATEOF'
U top-dir/bar
_ATEOF

cat >experr <<'_ATEOF'
cvs server: Updating top-dir
cvs server: update permission for foo denied for user bob
_ATEOF


$at_traceoff
$at_verbose "acl.at:203:
rm -rf test-area/
mkdir test-area/
cd test-area/
cvs -q up -l .
cvs co top-dir
"
echo acl.at:203 >at-check-line
( $at_traceon;
rm -rf test-area/
mkdir test-area/
cd test-area/
cvs -q up -l .
cvs co top-dir
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:203: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;

  8 ) # 8. acl.at:214: dir-acl
    at_setup_line='acl.at:214'
    $at_verbose "8. acl.at:214: testing dir-acl..."
    $at_quiet $ECHO_N "  8: acl.at:214        $ECHO_C"
    (
      $at_traceon



CVSROOT=:pserver:alice@localhost:/tmp/cvs-sanity/cvsroot
export CVSROOT


$at_traceoff
$at_verbose "acl.at:224:
rm -rf ./test-area/
mkdir test-area/
cd test-area/
cvs -q co -l .
cvs co top-dir
"
echo acl.at:224 >at-check-line
( $at_traceon;
rm -rf ./test-area/
mkdir test-area/
cd test-area/
cvs -q co -l .
cvs co top-dir
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
(echo stderr:; cat at-stderr) >&5
(echo stdout:; cat at-stdout) >&5
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:224: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


#
# verify that invalid permissions do not work
#
cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs [server aborted]: Invalid directory permissions 'invalid'
_ATEOF


$at_traceoff
$at_verbose "acl.at:237:
cd test-area/
cvs acl grant alice invalid ./top-dir/
"
echo acl.at:237 >at-check-line
( $at_traceon;
cd test-area/
cvs acl grant alice invalid ./top-dir/
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   1) ;;
   *) $at_verbose "acl.at:237: exit code was $at_status, expected 1" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# verify that setting permissions works
#
cat >expout <<'_ATEOF'
Setting 'access' permissions for 'alice' on directory top-dir/
_ATEOF


$at_traceoff
$at_verbose "acl.at:250:
cd test-area/
cvs acl grant alice access ./top-dir/
"
echo acl.at:250 >at-check-line
( $at_traceon;
cd test-area/
cvs acl grant alice access ./top-dir/
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff $at_devnull  at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:250: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# verify that alice can get access permissions to top-dir now
#
cat >experr <<'_ATEOF'
cvs server: Updating top-dir
_ATEOF


cat >expout <<'_ATEOF'
U top-dir/bar
U top-dir/foo
_ATEOF


$at_traceoff
$at_verbose "acl.at:269:
cd test-area/
rm -rf ./top-dir/
cvs co top-dir
"
echo acl.at:269 >at-check-line
( $at_traceon;
cd test-area/
rm -rf ./top-dir/
cvs co top-dir
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:269: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# verify that alice is not allowed to add files to the top-dir
#

cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs server: add permission for baz denied for user alice
_ATEOF


$at_traceoff
$at_verbose "acl.at:285:
cd test-area/top-dir/
echo \"Baz file\" > ./baz
cvs add ./baz
"
echo acl.at:285 >at-check-line
( $at_traceon;
cd test-area/top-dir/
echo "Baz file" > ./baz
cvs add ./baz
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   1) ;;
   *) $at_verbose "acl.at:285: exit code was $at_status, expected 1" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# verify that alice is not allowed to commit revisions to the top-dir
#

cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs server: checkin permission for bar denied for user alice
cvs [server aborted]: correct above errors first!
_ATEOF


$at_traceoff
$at_verbose "acl.at:302:
cd test-area/top-dir/
echo \"New contents\" > bar
cvs ci -m \"New contents\" bar
"
echo acl.at:302 >at-check-line
( $at_traceon;
cd test-area/top-dir/
echo "New contents" > bar
cvs ci -m "New contents" bar
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   1) ;;
   *) $at_verbose "acl.at:302: exit code was $at_status, expected 1" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# verify that alice is not allowed to create directories in the top-dir
#
cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs server: add permission for sdir denied for user alice
_ATEOF


$at_traceoff
$at_verbose "acl.at:316:
cd test-area/top-dir/
mkdir sdir
cvs add sdir
"
echo acl.at:316 >at-check-line
( $at_traceon;
cd test-area/top-dir/
mkdir sdir
cvs add sdir
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   1) ;;
   *) $at_verbose "acl.at:316: exit code was $at_status, expected 1" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# verify that alice is not allowed to remove files here
#
cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs server: remove permission for bar denied for user alice
_ATEOF


$at_traceoff
$at_verbose "acl.at:331:
cd test-area/top-dir/
cvs rm -f bar
cvs ci -m \"Removed\" bar
"
echo acl.at:331 >at-check-line
( $at_traceon;
cd test-area/top-dir/
cvs rm -f bar
cvs ci -m "Removed" bar
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:331: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;

  9 ) # 9. acl.at:339: dir-acl-others
    at_setup_line='acl.at:339'
    $at_verbose "9. acl.at:339: testing dir-acl-others..."
    $at_quiet $ECHO_N "  9: acl.at:339        $ECHO_C"
    (
      $at_traceon



CVSROOT=:pserver:bob@localhost:/tmp/cvs-sanity/cvsroot
export CVSROOT


cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs server: update permission for . denied for user bob
cvs server: update permission for top-dir denied for user bob
_ATEOF


$at_traceoff
$at_verbose "acl.at:357:
touch /tmp/cvs-sanity/cvsroot/CVSROOT/default-deny
rm -rf test-area/
mkdir test-area/
cd test-area/
cvs -q co -l .
cvs co top-dir
rm -f /tmp/cvs-sanity/cvsroot/CVSROOT/default-deny
"
echo acl.at:357 >at-check-line
( $at_traceon;
touch /tmp/cvs-sanity/cvsroot/CVSROOT/default-deny
rm -rf test-area/
mkdir test-area/
cd test-area/
cvs -q co -l .
cvs co top-dir
rm -f /tmp/cvs-sanity/cvsroot/CVSROOT/default-deny
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:357: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;

  10 ) # 10. acl.at:368: default-file-acls
    at_setup_line='acl.at:368'
    $at_verbose "10. acl.at:368: testing default-file-acls..."
    $at_quiet $ECHO_N " 10: acl.at:368        $ECHO_C"
    (
      $at_traceon



CVSROOT=:pserver:alice@localhost:/tmp/cvs-sanity/cvsroot
export CVSROOT


#
# first we give alice read-write access to the directory itself
# then checkout the working directory
#

cat >expout <<'_ATEOF'
U top-dir/bar
U top-dir/foo
Setting 'access,modify' permissions for 'alice' on directory top-dir/
_ATEOF


cat >experr <<'_ATEOF'
cvs server: Updating top-dir
_ATEOF


$at_traceoff
$at_verbose "acl.at:392:
rm -rf test-area/
mkdir test-area/
cd test-area/
cvs -q co -l .
cvs co top-dir/
cvs acl grant alice access,modify top-dir/
"
echo acl.at:392 >at-check-line
( $at_traceon;
rm -rf test-area/
mkdir test-area/
cd test-area/
cvs -q co -l .
cvs co top-dir/
cvs acl grant alice access,modify top-dir/
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:392: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


#
# check that setting default file permission works
#

cat >expout <<'_ATEOF'
Setting default file permissions 'default:checkout' for 'alice' on directory top-dir/
_ATEOF

cat >experr <<'_ATEOF'
_ATEOF


$at_traceoff
$at_verbose "acl.at:406:
cd test-area/
cvs acl grant alice default:checkout top-dir/
"
echo acl.at:406 >at-check-line
( $at_traceon;
cd test-area/
cvs acl grant alice default:checkout top-dir/
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:406: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


#
# check that alice still can checkout the files
# (note that 'foo' file still has the 'checkout-only' permission from
# previous tests)
#
cat >expout <<'_ATEOF'
U top-dir/bar
U top-dir/foo
_ATEOF

cat >experr <<'_ATEOF'
cvs server: Updating top-dir
_ATEOF


$at_traceoff
$at_verbose "acl.at:427:
rm -rf test-area/
mkdir test-area/
cd test-area/
cvs -q co -l .
cvs co top-dir
"
echo acl.at:427 >at-check-line
( $at_traceon;
rm -rf test-area/
mkdir test-area/
cd test-area/
cvs -q co -l .
cvs co top-dir
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:427: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# check that alice cannot check the files with default permissions in
#
cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs server: checkin permission for bar denied for user alice
cvs [server aborted]: correct above errors first!
_ATEOF


$at_traceoff
$at_verbose "acl.at:443:
cd test-area/top-dir/
echo \"New contents\" > bar
cvs ci -m \"New contents\" bar
"
echo acl.at:443 >at-check-line
( $at_traceon;
cd test-area/top-dir/
echo "New contents" > bar
cvs ci -m "New contents" bar
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   1) ;;
   *) $at_verbose "acl.at:443: exit code was $at_status, expected 1" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# check that alice _can_ check in the files with explicitly-set permissions
#

cat >expout <<'_ATEOF'
Setting 'checkin,checkout' permissions for 'alice' on file top-dir/bar
_ATEOF

cat >experr <<'_ATEOF'
_ATEOF


$at_traceoff
$at_verbose "acl.at:458:
cd test-area/
cvs acl grant alice checkin,checkout top-dir/bar
"
echo acl.at:458 >at-check-line
( $at_traceon;
cd test-area/
cvs acl grant alice checkin,checkout top-dir/bar
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:458: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



cat >expout <<'_ATEOF'
Checking in bar;
/tmp/cvs-sanity/cvsroot/top-dir/bar,v  <--  bar
new revision: 1.2; previous revision: 1.1
done
_ATEOF

cat >experr <<'_ATEOF'
_ATEOF


$at_traceoff
$at_verbose "acl.at:472:
cd test-area/top-dir/
echo \"New contents\" > bar
cvs ci -m \"New contents\" bar
"
echo acl.at:472 >at-check-line
( $at_traceon;
cd test-area/top-dir/
echo "New contents" > bar
cvs ci -m "New contents" bar
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:472: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;

  11 ) # 11. acl.at:483: other-commands
    at_setup_line='acl.at:483'
    $at_verbose "11. acl.at:483: testing other-commands..."
    $at_quiet $ECHO_N " 11: acl.at:483        $ECHO_C"
    (
      $at_traceon


#
# we set the "no permission for alice
#

cat >expout <<'_ATEOF'
Setting 'none' permissions for 'alice' on file top-dir/foo
_ATEOF

cat >experr <<'_ATEOF'
_ATEOF


$at_traceoff
$at_verbose "acl.at:497:
cd test-area/top-dir/
cvs acl grant alice none foo
"
echo acl.at:497 >at-check-line
( $at_traceon;
cd test-area/top-dir/
cvs acl grant alice none foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:497: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


#
# check that 'cvs diff' does not work
#
cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs server: diff permission for foo denied for user alice
_ATEOF


$at_traceoff
$at_verbose "acl.at:510:
cd test-area/top-dir/
echo \"New contents\" > foo
cvs diff foo
"
echo acl.at:510 >at-check-line
( $at_traceon;
cd test-area/top-dir/
echo "New contents" > foo
cvs diff foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:510: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


#
# check that 'cvs annotate' does not work
#
cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs server: annotate permission for foo denied for user alice
_ATEOF


$at_traceoff
$at_verbose "acl.at:522:
cd test-area/top-dir/
cvs annotate foo
"
echo acl.at:522 >at-check-line
( $at_traceon;
cd test-area/top-dir/
cvs annotate foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:522: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# check that 'cvs history' does not work FIXME
#

# AT_CHECK([
# cd test-area/top-dir/
# cvs history foo
# ], 0, [expout], [experr])


#
# check that 'cvs patch' shows patches only for bar
#
cat >experr <<'_ATEOF'
cvs server: Diffing top-dir
cvs server: patch permission for foo denied for user alice
_ATEOF


cat >expout <<'_ATEOF'
Index: top-dir/bar
diff -u top-dir/bar:1.1 top-dir/bar:1.2
@@ -1 +1 @@
-Bar file
+New contents
_ATEOF


$at_traceoff
$at_verbose "acl.at:553:
cd test-area/
cvs patch -r 1.1 -u top-dir | grep -v '^---\\|^+++'
"
echo acl.at:553 >at-check-line
( $at_traceon;
cd test-area/
cvs patch -r 1.1 -u top-dir | grep -v '^---\|^+++'
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:553: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# 'cvs admin' is disabled in server mode
#

cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs [server aborted]: cvs admin is not allowed in server mode
_ATEOF


$at_traceoff
$at_verbose "acl.at:568:
cd test-area/top-dir/
cvs admin -t-descriptive-text foo
"
echo acl.at:568 >at-check-line
( $at_traceon;
cd test-area/top-dir/
cvs admin -t-descriptive-text foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   1) ;;
   *) $at_verbose "acl.at:568: exit code was $at_status, expected 1" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



#
# check that 'cvs log' does not work
#

cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs server: log permission for foo denied for user alice
_ATEOF


$at_traceoff
$at_verbose "acl.at:582:
cd test-area/top-dir/
cvs log foo
"
echo acl.at:582 >at-check-line
( $at_traceon;
cd test-area/top-dir/
cvs log foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:582: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;

  12 ) # 12. acl.at:587: user-groups
    at_setup_line='acl.at:587'
    $at_verbose "12. acl.at:587: testing user-groups..."
    $at_quiet $ECHO_N " 12: acl.at:587        $ECHO_C"
    (
      $at_traceon


cat >expout <<'_ATEOF'
Setting 'access,modify' permissions for '%devel' on directory top-dir/
Setting 'checkout,checkin' permissions for '%devel' on file top-dir/foo
_ATEOF

cat >experr <<'_ATEOF'
_ATEOF


$at_traceoff
$at_verbose "acl.at:599:
cd test-area/
cvs acl grant %devel access,modify top-dir/
cd top-dir/
cvs acl grant %devel checkout,checkin foo
"
echo acl.at:599 >at-check-line
( $at_traceon;
cd test-area/
cvs acl grant %devel access,modify top-dir/
cd top-dir/
cvs acl grant %devel checkout,checkin foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:599: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



cat <<'EOF' > /tmp/cvs-sanity/cvsroot/CVSROOT/cvsgroup
%devel: mike, nick
EOF



CVSROOT=:pserver:mike@localhost:/tmp/cvs-sanity/cvsroot
export CVSROOT


cat >experr <<'_ATEOF'
cvs server: Updating top-dir
cvs server: update permission for bar denied for user mike
_ATEOF

cat >expout <<'_ATEOF'
U top-dir/foo
_ATEOF


$at_traceoff
$at_verbose "acl.at:621:
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
cvs co top-dir
"
echo acl.at:621 >at-check-line
( $at_traceon;
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
cvs co top-dir
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:621: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



cat >expout <<'_ATEOF'
Checking in foo;
/tmp/cvs-sanity/cvsroot/top-dir/foo,v  <--  foo
new revision: 1.2; previous revision: 1.1
done
_ATEOF

cat >experr <<'_ATEOF'
_ATEOF


$at_traceoff
$at_verbose "acl.at:635:
cd test-area/top-dir/
echo \"New mike contents\" > foo
cvs ci -m \"mike did something\" foo
"
echo acl.at:635 >at-check-line
( $at_traceon;
cd test-area/top-dir/
echo "New mike contents" > foo
cvs ci -m "mike did something" foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "acl.at:635: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;


  banner-3 ) # Banner 3. racl.at:3
    cat <<\_ATEOF

CVS ACL features (cvs racl).

_ATEOF
    ;;

  13 ) # 13. racl.at:9: make-modules
    at_setup_line='racl.at:9'
    $at_verbose "13. racl.at:9: testing make-modules..."
    $at_quiet $ECHO_N " 13: racl.at:9         $ECHO_C"
    (
      $at_traceon



CVSROOT=:pserver:alice@localhost:/tmp/cvs-sanity/cvsroot
export CVSROOT


$at_traceoff
$at_verbose "racl.at:30:
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
mkdir foo bar
cvs add foo bar
echo This is read me file for foo > foo/README
echo This is read me file for bar > bar/README
cvs add foo/README bar/README
cvs ci -m \"Initial releases\" .

cat <<EOF > /tmp/cvs-sanity/cvsroot/CVSROOT/acl-admins
alice
bob
EOF

"
echo racl.at:30 >at-check-line
( $at_traceon;
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
mkdir foo bar
cvs add foo bar
echo This is read me file for foo > foo/README
echo This is read me file for bar > bar/README
cvs add foo/README bar/README
cvs ci -m "Initial releases" .

cat <<EOF > /tmp/cvs-sanity/cvsroot/CVSROOT/acl-admins
alice
bob
EOF

 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
(echo stderr:; cat at-stderr) >&5
(echo stdout:; cat at-stdout) >&5
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "racl.at:30: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;

  14 ) # 14. racl.at:35: racl-nosuch-module
    at_setup_line='racl.at:35'
    $at_verbose "14. racl.at:35: testing racl-nosuch-module..."
    $at_quiet $ECHO_N " 14: racl.at:35        $ECHO_C"
    (
      $at_traceon



CVSROOT=:pserver:alice@localhost:/tmp/cvs-sanity/cvsroot
export CVSROOT


cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
_ATEOF


$at_traceoff
$at_verbose "racl.at:45:
cd ./test-area/
cvs racl grant alice tag:REL nosuchmodule
"
echo racl.at:45 >at-check-line
( $at_traceon;
cd ./test-area/
cvs racl grant alice tag:REL nosuchmodule
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "racl.at:45: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon

### FIXME the test above should fail with "no such module"

    $at_times >at-times
    )
    at_status=$?
    ;;

  15 ) # 15. racl.at:55: simple-racl-grant
    at_setup_line='racl.at:55'
    $at_verbose "15. racl.at:55: testing simple-racl-grant..."
    $at_quiet $ECHO_N " 15: racl.at:55        $ECHO_C"
    (
      $at_traceon


cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
_ATEOF


$at_traceoff
$at_verbose "racl.at:66:
cd ./test-area/
cvs racl grant alice tag:RELEASE foo
cvs racl grant alice tag:PATCHES foo
cvs racl grant bob tag:RELEASE bar
cvs racl grant bob tag:PATCHES bar
"
echo racl.at:66 >at-check-line
( $at_traceon;
cd ./test-area/
cvs racl grant alice tag:RELEASE foo
cvs racl grant alice tag:PATCHES foo
cvs racl grant bob tag:RELEASE bar
cvs racl grant bob tag:PATCHES bar
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "racl.at:66: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;

  16 ) # 16. racl.at:75: simple-racl
    at_setup_line='racl.at:75'
    $at_verbose "16. racl.at:75: testing simple-racl..."
    $at_quiet $ECHO_N " 16: racl.at:75        $ECHO_C"
    (
      $at_traceon



CVSROOT=:pserver:alice@localhost:/tmp/cvs-sanity/cvsroot
export CVSROOT



$at_traceoff
$at_verbose "racl.at:79:
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
"
echo racl.at:79 >at-check-line
( $at_traceon;
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
(echo stderr:; cat at-stderr) >&5
(echo stdout:; cat at-stdout) >&5
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "racl.at:79: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs rtag: Tagging foo
_ATEOF


$at_traceoff
$at_verbose "racl.at:88:
cd ./test-area/
cvs rtag RELEASE-1 foo
"
echo racl.at:88 >at-check-line
( $at_traceon;
cd ./test-area/
cvs rtag RELEASE-1 foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "racl.at:88: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



CVSROOT=:pserver:bob@localhost:/tmp/cvs-sanity/cvsroot
export CVSROOT



$at_traceoff
$at_verbose "racl.at:92:
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
"
echo racl.at:92 >at-check-line
( $at_traceon;
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
(echo stderr:; cat at-stderr) >&5
(echo stdout:; cat at-stdout) >&5
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "racl.at:92: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs rtag: bob is not allowed to tag foo as RELEASE-2
_ATEOF


$at_traceoff
$at_verbose "racl.at:101:
cd ./test-area/
cvs -d \$CVSROOT rtag RELEASE-2 foo
"
echo racl.at:101 >at-check-line
( $at_traceon;
cd ./test-area/
cvs -d $CVSROOT rtag RELEASE-2 foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   1) ;;
   *) $at_verbose "racl.at:101: exit code was $at_status, expected 1" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;

  17 ) # 17. racl.at:109: simple-racl-revoke
    at_setup_line='racl.at:109'
    $at_verbose "17. racl.at:109: testing simple-racl-revoke..."
    $at_quiet $ECHO_N " 17: racl.at:109       $ECHO_C"
    (
      $at_traceon

cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
_ATEOF


$at_traceoff
$at_verbose "racl.at:117:
cd ./test-area/
cvs racl revoke alice tag:RELEASE foo
cvs racl revoke bob tag:RELEASE bar
"
echo racl.at:117 >at-check-line
( $at_traceon;
cd ./test-area/
cvs racl revoke alice tag:RELEASE foo
cvs racl revoke bob tag:RELEASE bar
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "racl.at:117: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;

  18 ) # 18. racl.at:126: simple-racl
    at_setup_line='racl.at:126'
    $at_verbose "18. racl.at:126: testing simple-racl..."
    $at_quiet $ECHO_N " 18: racl.at:126       $ECHO_C"
    (
      $at_traceon



CVSROOT=:pserver:alice@localhost:/tmp/cvs-sanity/cvsroot
export CVSROOT



$at_traceoff
$at_verbose "racl.at:130:
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
"
echo racl.at:130 >at-check-line
( $at_traceon;
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
(echo stderr:; cat at-stderr) >&5
(echo stdout:; cat at-stdout) >&5
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "racl.at:130: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs rtag: alice is not allowed to tag foo as RELEASE-1-2-3
_ATEOF


$at_traceoff
$at_verbose "racl.at:139:
cd ./test-area/
cvs rtag RELEASE-1-2-3 foo
"
echo racl.at:139 >at-check-line
( $at_traceon;
cd ./test-area/
cvs rtag RELEASE-1-2-3 foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   1) ;;
   *) $at_verbose "racl.at:139: exit code was $at_status, expected 1" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



CVSROOT=:pserver:bob@localhost:/tmp/cvs-sanity/cvsroot
export CVSROOT



$at_traceoff
$at_verbose "racl.at:143:
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
"
echo racl.at:143 >at-check-line
( $at_traceon;
rm -rf ./test-area/
mkdir ./test-area/
cd ./test-area/
cvs -q co -l .
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
(echo stderr:; cat at-stderr) >&5
(echo stdout:; cat at-stdout) >&5
case $at_status in
   77) exit 77;;
   0) ;;
   *) $at_verbose "racl.at:143: exit code was $at_status, expected 0" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon



cat >expout <<'_ATEOF'
_ATEOF

cat >experr <<'_ATEOF'
cvs rtag: bob is not allowed to tag foo as RELEASE-2-3-4
_ATEOF


$at_traceoff
$at_verbose "racl.at:152:
cd ./test-area/
cvs -d \$CVSROOT rtag RELEASE-2-3-4 foo
"
echo racl.at:152 >at-check-line
( $at_traceon;
cd ./test-area/
cvs -d $CVSROOT rtag RELEASE-2-3-4 foo
 ) >at-stdout 2>at-stder1
at_status=$?
egrep '^ *\+' at-stder1 >&2
egrep -v '^ *\+' at-stder1 >at-stderr
at_failed=false
$at_diff experr at-stderr >&5 || at_failed=:
$at_diff expout at-stdout >&5 || at_failed=:
case $at_status in
   77) exit 77;;
   1) ;;
   *) $at_verbose "racl.at:152: exit code was $at_status, expected 1" >&2
      at_failed=:;;
esac

$at_failed && exit 1
$at_traceon


    $at_times >at-times
    )
    at_status=$?
    ;;


  * )
    echo $as_me: no such test: $at_test
    continue
    ;;
  esac
  case $at_test in
    banner-*) ;;
    *)
      if test ! -f at-check-line; then
        sed "s/^ */$as_me: warning: /" <<_ATEOF
        A failure happened in a test group before any test could be
        run. This means that test suite is improperly designed.  Please
        report this failure to <cvs-nserver-devel@lists.sourceforge.net>.
_ATEOF
    	echo "$at_setup_line" >at-check-line
      fi
      at_test_count=`expr 1 + $at_test_count`
      $at_verbose $ECHO_N "$at_test. $at_setup_line: $ECHO_C"
      case $at_status in
        0) at_msg="ok"
           ;;
        77) at_msg="ok (skipped near \``cat at-check-line`')"
            at_skip_list="$at_skip_list $at_test"
            ;;
        *) at_msg="FAILED near \``cat at-check-line`'"
           at_fail_list="$at_fail_list $at_test"
           ;;
      esac
      echo $at_msg
      at_log_msg="$at_test. $at_setup_line: $at_msg"
      # If the test failed, at-times is not available.
      test -f at-times && at_log_msg="$at_log_msg	(`sed 1d at-times`)"
      echo "$at_log_msg" >&6
      $at_stop_on_error && test -n "$at_fail_list" && break
      ;;
  esac
done

at_stop_date=`date`
at_stop_time=`(date +%s) 2>/dev/null`
echo "$as_me: ending at: $at_stop_date" >&6
at_duration_s=`(expr $at_stop_time - $at_start_time) 2>/dev/null`
at_duration_m=`(expr $at_duration_s / 60) 2>/dev/null`
at_duration_h=`(expr $at_duration_m / 60) 2>/dev/null`
at_duration_s=`(expr $at_duration_s % 60) 2>/dev/null`
at_duration_m=`(expr $at_duration_m % 60) 2>/dev/null`
at_duration="${at_duration_h}h ${at_duration_m}m ${at_duration_s}s"
if test "$at_duration" != "h m s"; then
  echo "$as_me: test suite duration: $at_duration" >&6
fi

# Cleanup everything unless the user wants the files.
$at_debug || rm -rf $at_data_files

# Wrap up the test suite with summary statistics.
at_skip_count=`set dummy $at_skip_list; shift; echo $#`
at_fail_count=`set dummy $at_fail_list; shift; echo $#`
if test $at_fail_count = 0; then
  if test $at_skip_count = 0; then
    sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## All $at_test_count tests were successful. ##
_ASBOX
  else
    sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## All $at_test_count tests were successful ($at_skip_count skipped). ##
_ASBOX
  fi
elif test $at_debug = false; then
  if $at_stop_on_error; then
    cat <<\_ASBOX
## ------------------------------------------------------------ ##
## ERROR: One of the tests failed, inhibiting subsequent tests. ##
## ------------------------------------------------------------ ##
_ASBOX
  else
    sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## ERROR: Suite unsuccessful, $at_fail_count of $at_test_count tests failed. ##
_ASBOX
  fi

  # Remove any debugging script resulting from a previous run.
  rm -f $as_me.[0-9] $as_me.[0-9][0-9] $as_me.[0-9][0-9][0-9]

  echo
  echo $ECHO_N "Writing \`$as_me.NN' scripts, with NN =$ECHO_C"
  for at_group in $at_fail_list
  do
    # Normalize the names so that `ls' lists them in order.
    at_format=`echo $at_last_test | sed 's/././g'`
    at_number=`expr "000$at_group" : ".*\($at_format\)"`
    echo $ECHO_N " $at_number$ECHO_C"
    ( echo "#! /bin/sh"
      echo 'exec ${CONFIG_SHELL-'"$SHELL"'}' "$0" \
           '-v -d' "$at_debug_args" "$at_group" '${1+"$@"}'
      echo 'exit 1'
    ) >$as_me.$at_number
    chmod +x $as_me.$at_number
  done
  echo ', done'
  echo
  echo 'You may investigate any problem if you feel able to do so, in which'
  echo 'case the test suite provides a good starting point.'
  echo
  echo 'Now, failed tests will be executed again, verbosely, and logged'
  echo 'in the file '$as_me'.log.'

  {
    echo
    echo
    cat <<\_ASBOX
## ------------------------ ##
## Summary of the failures. ##
## ------------------------ ##
_ASBOX

    # Summary of failed and skipped tests.
    if test $at_fail_count != 0; then
      echo "Failed tests:"
      $SHELL $0 $at_fail_list --help
      echo
    fi
    if test $at_skip_count != 0; then
      echo "Skipped tests:"
      $SHELL $0 $at_skip_list --help
      echo
    fi
    echo

    cat <<\_ASBOX
## -------------------------------------- ##
## Verbosely re-running the failing tests ##
## -------------------------------------- ##
_ASBOX
    echo
  } >&6

  $SHELL $0 -v -d $at_debug_args $at_fail_list 2>&1 | tee -a $as_me.log

  {
    echo
    if test -n "$top_srcdir"; then
      cat <<\_ASBOX
## ------------------- ##
## Configuration logs. ##
## ------------------- ##
_ASBOX
      echo
      for at_file in `find "$top_srcdir" -name config.log -print`
      do
  	echo "$as_me: $at_file:"
  	sed 's/^/| /;10q' $at_file
  	echo
      done
    fi
  } >&6


  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## $as_me.log is created. ##
_ASBOX

  echo
  echo "Please send \`$as_me.log' to <cvs-nserver-devel@lists.sourceforge.net>,"
  echo "along with all information you think might help."
  exit 1
fi

exit 0
