#!/bin/sh

#
#  regression - Regression test driver for cvsmapfs.
#  Copyright (C) 1995 Brian Bartholomew <bb@wv.com>
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#  Please contact Working Version at http://www.wv.com for up-to-date
#  information on this code.
#

if [ `whoami` != 'root' ]
then
	echo "regression: must be run as root" 1>&2
	exit 1
fi

# umask setting doesn't matter for running mkregression

./mkregression

umask 022	# permissions chmod'ed to for cvs's reading depend on umask

(cd regressiondir/arena ; ../../cvsmapfs -p > ../one.1 2> ../one.2)
(cd regressiondir/arena ; ../../cvsmapfs -pw > ../two.1 2> ../two.2)
(cd regressiondir/arena ; ../../cvsmapfs -pw > ../three.1 2> ../three.2)
touch regressiondir/arena/[a-z]*
rmdir regressiondir/arena/dir
rm regressiondir/arena/links/link2
touch regressiondir/arena/links/link2
(cd regressiondir/arena ; ../../cvsmapfs -c < ../one.1 2> ../four.2)
(cd regressiondir/arena ; ../../cvsmapfs -cw < ../one.1 2> ../five.2)
(cd regressiondir/arena ; ../../cvsmapfs -cw < ../one.1 2> ../six.2)

diff baseline/one.1 regressiondir/one.1
echo 'expect symlink perms, owner, group, and time to differ'
echo ''

diff baseline/one.2 regressiondir/one.2

diff baseline/two.1 regressiondir/two.1
echo 'expect symlink perms, owner, group, and time to differ'
echo ''

diff baseline/two.2 regressiondir/two.2

diff baseline/three.1 regressiondir/three.1
echo 'dir time for "." different because second create modifies directory'
echo 'and third create notices'
echo ''

diff baseline/three.2 regressiondir/three.2
diff baseline/four.2 regressiondir/four.2
diff baseline/five.2 regressiondir/five.2
diff baseline/six.2 regressiondir/six.2
