]>
Commit | Line | Data |
---|---|---|
535bb893 MH |
1 | #!/bin/sh |
2 | ||
3 | . ./test-lib.sh | |
4 | ||
5 | unset CVS_SERVER | |
6 | # for clean cvsps cache | |
7 | HOME=$(pwd) | |
8 | export HOME | |
9 | ||
10 | if ! type cvs >/dev/null 2>&1 | |
11 | then | |
e8344e86 | 12 | skip_all='skipping cvsimport tests, cvs not found' |
535bb893 | 13 | test_done |
535bb893 MH |
14 | fi |
15 | ||
161261b1 MH |
16 | CVS="cvs -f" |
17 | export CVS | |
18 | ||
535bb893 MH |
19 | cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'` |
20 | case "$cvsps_version" in | |
21 | 2.1 | 2.2*) | |
22 | ;; | |
23 | '') | |
e8344e86 | 24 | skip_all='skipping cvsimport tests, cvsps not found' |
535bb893 | 25 | test_done |
535bb893 MH |
26 | ;; |
27 | *) | |
e8344e86 | 28 | skip_all='skipping cvsimport tests, unsupported cvsps version' |
535bb893 | 29 | test_done |
535bb893 MH |
30 | ;; |
31 | esac | |
cefa318d MH |
32 | |
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 | |
41 | fi | |
42 | } | |
43 | ||
44 | test_git_co () { | |
45 | # Usage: test_git_co BRANCH_NAME | |
46 | (cd module-git && git checkout "$1") | |
47 | } | |
48 | ||
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" | |
53 | } | |
54 | ||
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. | |
59 | ||
60 | test_cvs_co "$1" && | |
61 | test_git_co "$1" && | |
62 | ( | |
63 | cd module-cvs-"$1" | |
64 | find . -type d -name CVS -prune -o -type f -print | |
65 | ) | sort >module-cvs-"$1".list && | |
66 | ( | |
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 | |
72 | do | |
73 | test_cmp_branch_file "$1" "$f" || return 1 | |
74 | done | |
75 | } |