2013-11-26 01:03:06 +04:00
|
|
|
# Shell library sourced instead of ./test-lib.sh by cvsimport tests.
|
2009-02-23 08:08:10 +03:00
|
|
|
|
|
|
|
. ./test-lib.sh
|
|
|
|
|
|
|
|
unset CVS_SERVER
|
|
|
|
|
|
|
|
if ! type cvs >/dev/null 2>&1
|
|
|
|
then
|
2010-07-08 05:16:06 +04:00
|
|
|
skip_all='skipping cvsimport tests, cvs not found'
|
2009-02-23 08:08:10 +03:00
|
|
|
test_done
|
|
|
|
fi
|
|
|
|
|
2009-02-23 08:08:11 +03:00
|
|
|
CVS="cvs -f"
|
|
|
|
export CVS
|
|
|
|
|
2014-04-23 17:44:04 +04:00
|
|
|
cvsps_version=$(cvsps -h 2>&1 | sed -ne 's/cvsps version //p')
|
2009-02-23 08:08:10 +03:00
|
|
|
case "$cvsps_version" in
|
|
|
|
2.1 | 2.2*)
|
|
|
|
;;
|
|
|
|
'')
|
2010-07-08 05:16:06 +04:00
|
|
|
skip_all='skipping cvsimport tests, cvsps not found'
|
2009-02-23 08:08:10 +03:00
|
|
|
test_done
|
|
|
|
;;
|
|
|
|
*)
|
2010-07-08 05:16:06 +04:00
|
|
|
skip_all='skipping cvsimport tests, unsupported cvsps version'
|
2009-02-23 08:08:10 +03:00
|
|
|
test_done
|
|
|
|
;;
|
|
|
|
esac
|
2009-02-23 08:08:12 +03:00
|
|
|
|
2010-08-16 20:25:01 +04:00
|
|
|
setup_cvs_test_repository () {
|
|
|
|
CVSROOT="$(pwd)/.cvsroot" &&
|
|
|
|
cp -r "$TEST_DIRECTORY/$1/cvsroot" "$CVSROOT" &&
|
|
|
|
export CVSROOT
|
|
|
|
}
|
|
|
|
|
2009-02-23 08:08:12 +03:00
|
|
|
test_cvs_co () {
|
|
|
|
# Usage: test_cvs_co BRANCH_NAME
|
|
|
|
rm -rf module-cvs-"$1"
|
2020-11-19 02:44:43 +03:00
|
|
|
if [ "$1" = "main" ]
|
2009-02-23 08:08:12 +03:00
|
|
|
then
|
|
|
|
$CVS co -P -d module-cvs-"$1" -A module
|
|
|
|
else
|
|
|
|
$CVS co -P -d module-cvs-"$1" -r "$1" module
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
test_git_co () {
|
|
|
|
# Usage: test_git_co BRANCH_NAME
|
|
|
|
(cd module-git && git checkout "$1")
|
|
|
|
}
|
|
|
|
|
|
|
|
test_cmp_branch_file () {
|
|
|
|
# Usage: test_cmp_branch_file BRANCH_NAME PATH
|
|
|
|
# The branch must already be checked out of CVS and git.
|
|
|
|
test_cmp module-cvs-"$1"/"$2" module-git/"$2"
|
|
|
|
}
|
|
|
|
|
|
|
|
test_cmp_branch_tree () {
|
|
|
|
# Usage: test_cmp_branch_tree BRANCH_NAME
|
|
|
|
# Check BRANCH_NAME out of CVS and git and make sure that all
|
|
|
|
# of the files and directories are identical.
|
|
|
|
|
|
|
|
test_cvs_co "$1" &&
|
|
|
|
test_git_co "$1" &&
|
|
|
|
(
|
|
|
|
cd module-cvs-"$1"
|
|
|
|
find . -type d -name CVS -prune -o -type f -print
|
|
|
|
) | sort >module-cvs-"$1".list &&
|
|
|
|
(
|
|
|
|
cd module-git
|
|
|
|
find . -type d -name .git -prune -o -type f -print
|
|
|
|
) | sort >module-git-"$1".list &&
|
|
|
|
test_cmp module-cvs-"$1".list module-git-"$1".list &&
|
|
|
|
cat module-cvs-"$1".list | while read f
|
|
|
|
do
|
|
|
|
test_cmp_branch_file "$1" "$f" || return 1
|
|
|
|
done
|
|
|
|
}
|