1 # Shell library sourced instead of ./test-lib.sh by cvsimport tests.
7 if ! type cvs >/dev/null 2>&1
9 skip_all='skipping cvsimport tests, cvs not found'
16 cvsps_version=$(cvsps -h 2>&1 | sed -ne 's/cvsps version //p')
17 case "$cvsps_version" in
21 skip_all='skipping cvsimport tests, cvsps not found'
25 skip_all='skipping cvsimport tests, unsupported cvsps version'
30 setup_cvs_test_repository () {
31 CVSROOT="$(pwd)/.cvsroot" &&
32 cp -r "$TEST_DIRECTORY/$1/cvsroot" "$CVSROOT" &&
37 # Usage: test_cvs_co BRANCH_NAME
38 rm -rf module-cvs-"$1"
39 if [ "$1" = "master" ]
41 $CVS co -P -d module-cvs-"$1" -A module
43 $CVS co -P -d module-cvs-"$1" -r "$1" module
48 # Usage: test_git_co BRANCH_NAME
49 (cd module-git && git checkout "$1")
52 test_cmp_branch_file () {
53 # Usage: test_cmp_branch_file BRANCH_NAME PATH
54 # The branch must already be checked out of CVS and git.
55 test_cmp module-cvs-"$1"/"$2" module-git/"$2"
58 test_cmp_branch_tree () {
59 # Usage: test_cmp_branch_tree BRANCH_NAME
60 # Check BRANCH_NAME out of CVS and git and make sure that all
61 # of the files and directories are identical.
67 find . -type d -name CVS -prune -o -type f -print
68 ) | sort >module-cvs-"$1".list &&
71 find . -type d -name .git -prune -o -type f -print
72 ) | sort >module-git-"$1".list &&
73 test_cmp module-cvs-"$1".list module-git-"$1".list &&
74 cat module-cvs-"$1".list | while read f
76 test_cmp_branch_file "$1" "$f" || return 1