@matheusbsbs / matheus-bagliano / commits / cefa318ddb
Fork 0

Test contents of entire cvsimported "master" tree contents

Test added for completeness (it passes). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Feb 23, 2009 at 06:08 UTC cefa318ddbc8565b50ac2eb9b6aab93e26cc0abe
2 files changed +46
t/lib-cvs.sh
+44
@@ -32,3 +32,47 @@ case "$cvsps_version" in
32 exit
33 ;;
34 esac
35 +
36 +test_cvs_co () {
37 + # Usage: test_cvs_co BRANCH_NAME
38 + rm -rf module-cvs-"$1"
39 + if [ "$1" = "master" ]
40 + then
41 + $CVS co -P -d module-cvs-"$1" -A module
42 + else
43 + $CVS co -P -d module-cvs-"$1" -r "$1" module
44 + fi
45 +}
46 +
47 +test_git_co () {
48 + # Usage: test_git_co BRANCH_NAME
49 + (cd module-git && git checkout "$1")
50 +}
51 +
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"
56 +}
57 +
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.
62 +
63 + test_cvs_co "$1" &&
64 + test_git_co "$1" &&
65 + (
66 + cd module-cvs-"$1"
67 + find . -type d -name CVS -prune -o -type f -print
68 + ) | sort >module-cvs-"$1".list &&
69 + (
70 + cd module-git
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
75 + do
76 + test_cmp_branch_file "$1" "$f" || return 1
77 + done
78 +}
t/t9600-cvsimport.sh
+2
@@ -121,4 +121,6 @@ test_expect_success 'import from a CVS working tree' '
121
122 '
123
124 +test_expect_success 'test entire HEAD' 'test_cmp_branch_tree master'
125 +
126 test_done