|
Packit |
709fb3 |
#!/bin/sh
|
|
Packit |
709fb3 |
# Unit tests for vc-list-files
|
|
Packit |
709fb3 |
# Copyright (C) 2008-2017 Free Software Foundation, Inc.
|
|
Packit |
709fb3 |
# This file is part of the GNUlib Library.
|
|
Packit |
709fb3 |
#
|
|
Packit |
709fb3 |
# This program is free software: you can redistribute it and/or modify
|
|
Packit |
709fb3 |
# it under the terms of the GNU General Public License as published by
|
|
Packit |
709fb3 |
# the Free Software Foundation; either version 3 of the License, or
|
|
Packit |
709fb3 |
# (at your option) any later version.
|
|
Packit |
709fb3 |
#
|
|
Packit |
709fb3 |
# This program is distributed in the hope that it will be useful,
|
|
Packit |
709fb3 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
709fb3 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
709fb3 |
# GNU General Public License for more details.
|
|
Packit |
709fb3 |
#
|
|
Packit |
709fb3 |
# You should have received a copy of the GNU General Public License
|
|
Packit |
709fb3 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
: ${srcdir=.}
|
|
Packit |
709fb3 |
. "$srcdir/init.sh"; path_prepend_ "$abs_aux_dir" .
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
tmpdir=vc-cvs
|
|
Packit |
709fb3 |
repo=`pwd`/$tmpdir/repo
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
fail=0
|
|
Packit |
709fb3 |
for i in with-cvsu without; do
|
|
Packit |
709fb3 |
# On the first iteration, test using cvsu, if it's in your path.
|
|
Packit |
709fb3 |
# On the second iteration, ensure that cvsu fails, so we'll
|
|
Packit |
709fb3 |
# exercise the awk-using code.
|
|
Packit |
709fb3 |
if test $i = without; then
|
|
Packit |
709fb3 |
printf '%s\n' '#!/bin/sh' 'exit 1' > cvsu
|
|
Packit |
709fb3 |
chmod a+x cvsu
|
|
Packit |
709fb3 |
PATH=`pwd`:$PATH
|
|
Packit |
709fb3 |
export PATH
|
|
Packit |
709fb3 |
fi
|
|
Packit |
709fb3 |
ok=0
|
|
Packit |
709fb3 |
mkdir $tmpdir && cd $tmpdir &&
|
|
Packit |
709fb3 |
# without cvs, skip the test
|
|
Packit |
709fb3 |
{ ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 \
|
|
Packit |
709fb3 |
|| skip_ "cvs not found in PATH"; } &&
|
|
Packit |
709fb3 |
mkdir w && cd w &&
|
|
Packit |
709fb3 |
mkdir d &&
|
|
Packit |
709fb3 |
touch d/a b c &&
|
|
Packit |
709fb3 |
cvs -Q -d "$repo" import -m imp m M M0 &&
|
|
Packit |
709fb3 |
cvs -Q -d "$repo" co m && cd m &&
|
|
Packit |
709fb3 |
printf '%s\n' b c d/a > expected &&
|
|
Packit |
709fb3 |
vc-list-files | sort > actual &&
|
|
Packit |
709fb3 |
compare expected actual &&
|
|
Packit |
709fb3 |
ok=1
|
|
Packit |
709fb3 |
test $ok = 0 && fail=1
|
|
Packit |
709fb3 |
done
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
Exit $fail
|