Makefile: Use $(sharedir)/gitweb for target 'install-gitweb'
[git/gsoc2010-gitweb.git] / t / lib-cvs.sh
blob4b3b793730604e5b513c5017f39f4560b3083338
1 #!/bin/sh
3 . ./test-lib.sh
5 unset CVS_SERVER
6 # for clean cvsps cache
7 HOME=$(pwd)
8 export HOME
10 if ! type cvs >/dev/null 2>&1
11 then
12 say 'skipping cvsimport tests, cvs not found'
13 test_done
16 CVS="cvs -f"
17 export CVS
19 cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'`
20 case "$cvsps_version" in
21 2.1 | 2.2*)
23 '')
24 say 'skipping cvsimport tests, cvsps not found'
25 test_done
28 say 'skipping cvsimport tests, unsupported cvsps version'
29 test_done
31 esac
33 test_cvs_co () {
34 # Usage: test_cvs_co BRANCH_NAME
35 rm -rf module-cvs-"$1"
36 if [ "$1" = "master" ]
37 then
38 $CVS co -P -d module-cvs-"$1" -A module
39 else
40 $CVS co -P -d module-cvs-"$1" -r "$1" module
44 test_git_co () {
45 # Usage: test_git_co BRANCH_NAME
46 (cd module-git && git checkout "$1")
49 test_cmp_branch_file () {
50 # Usage: test_cmp_branch_file BRANCH_NAME PATH
51 # The branch must already be checked out of CVS and git.
52 test_cmp module-cvs-"$1"/"$2" module-git/"$2"
55 test_cmp_branch_tree () {
56 # Usage: test_cmp_branch_tree BRANCH_NAME
57 # Check BRANCH_NAME out of CVS and git and make sure that all
58 # of the files and directories are identical.
60 test_cvs_co "$1" &&
61 test_git_co "$1" &&
63 cd module-cvs-"$1"
64 find . -type d -name CVS -prune -o -type f -print
65 ) | sort >module-cvs-"$1".list &&
67 cd module-git
68 find . -type d -name .git -prune -o -type f -print
69 ) | sort >module-git-"$1".list &&
70 test_cmp module-cvs-"$1".list module-git-"$1".list &&
71 cat module-cvs-"$1".list | while read f
73 test_cmp_branch_file "$1" "$f" || return 1
74 done