Commit b65954d1 authored by Junio C Hamano's avatar Junio C Hamano

Merge branch 'hv/cvsps-tests'

* hv/cvsps-tests:
  t/t9600: remove exit after test_done
  cvsimport: extend testcase about patchset order to contain branches
  cvsimport: add test illustrating a bug in cvsps
  Add a test of "git cvsimport"'s handling of tags and branches
  Add some tests of git-cvsimport's handling of vendor branches
  Test contents of entire cvsimported "master" tree contents
  Use CVS's -f option if available (ignore user's ~/.cvsrc file)
  Start a library for cvsimport-related tests
parents 1c9b2d3a 0eaadfe6
#!/bin/sh
. ./test-lib.sh
unset CVS_SERVER
# for clean cvsps cache
HOME=$(pwd)
export HOME
if ! type cvs >/dev/null 2>&1
then
say 'skipping cvsimport tests, cvs not found'
test_done
fi
CVS="cvs -f"
export CVS
cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'`
case "$cvsps_version" in
2.1 | 2.2*)
;;
'')
say 'skipping cvsimport tests, cvsps not found'
test_done
;;
*)
say 'skipping cvsimport tests, unsupported cvsps version'
test_done
;;
esac
test_cvs_co () {
# Usage: test_cvs_co BRANCH_NAME
rm -rf module-cvs-"$1"
if [ "$1" = "master" ]
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
}
#!/bin/sh
test_description='git cvsimport basic tests'
. ./test-lib.sh
. ./lib-cvs.sh
if ! test_have_prereq PERL; then
say 'skipping git cvsimport tests, perl not available'
......@@ -10,37 +10,13 @@ fi
CVSROOT=$(pwd)/cvsroot
export CVSROOT
unset CVS_SERVER
# for clean cvsps cache
HOME=$(pwd)
export HOME
if ! type cvs >/dev/null 2>&1
then
say 'skipping cvsimport tests, cvs not found'
test_done
fi
cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'`
case "$cvsps_version" in
2.1 | 2.2*)
;;
'')
say 'skipping cvsimport tests, cvsps not found'
test_done
;;
*)
say 'skipping cvsimport tests, unsupported cvsps version'
test_done
;;
esac
test_expect_success 'setup cvsroot' 'cvs init'
test_expect_success 'setup cvsroot' '$CVS init'
test_expect_success 'setup a cvs module' '
mkdir "$CVSROOT/module" &&
cvs co -d module-cvs module &&
$CVS co -d module-cvs module &&
cd module-cvs &&
cat <<EOF >o_fortuna &&
O Fortuna
......@@ -59,13 +35,13 @@ egestatem,
potestatem
dissolvit ut glaciem.
EOF
cvs add o_fortuna &&
$CVS add o_fortuna &&
cat <<EOF >message &&
add "O Fortuna" lyrics
These public domain lyrics make an excellent sample text.
EOF
cvs commit -F message &&
$CVS commit -F message &&
cd ..
'
......@@ -103,7 +79,7 @@ translate to English
My Latin is terrible.
EOF
cvs commit -F message &&
$CVS commit -F message &&
cd ..
'
......@@ -121,8 +97,8 @@ test_expect_success 'update cvs module' '
cd module-cvs &&
echo 1 >tick &&
cvs add tick &&
cvs commit -m 1
$CVS add tick &&
$CVS commit -m 1
cd ..
'
......@@ -140,7 +116,7 @@ test_expect_success 'cvsimport.module config works' '
test_expect_success 'import from a CVS working tree' '
cvs co -d import-from-wt module &&
$CVS co -d import-from-wt module &&
cd import-from-wt &&
git cvsimport -a -z0 &&
echo 1 >expect &&
......@@ -150,4 +126,6 @@ test_expect_success 'import from a CVS working tree' '
'
test_expect_success 'test entire HEAD' 'test_cmp_branch_tree master'
test_done
#!/bin/sh
# Description of the files in the repository:
#
# imported-once.txt:
#
# Imported once. 1.1 and 1.1.1.1 should be identical.
#
# imported-twice.txt:
#
# Imported twice. HEAD should reflect the contents of the
# second import (i.e., have the same contents as 1.1.1.2).
#
# imported-modified.txt:
#
# Imported, then modified on HEAD. HEAD should reflect the
# modification.
#
# imported-modified-imported.txt:
#
# Imported, then modified on HEAD, then imported again.
#
# added-imported.txt,v:
#
# Added with 'cvs add' to create 1.1, then imported with
# completely different contents to create 1.1.1.1, therefore the
# vendor branch was never the default branch.
#
# imported-anonymously.txt:
#
# Like imported-twice.txt, but with a vendor branch whose branch
# tag has been removed.
test_description='git cvsimport handling of vendor branches'
. ./lib-cvs.sh
CVSROOT="$TEST_DIRECTORY"/t9601/cvsroot
export CVSROOT
test_expect_success 'import a module with a vendor branch' '
git cvsimport -C module-git module
'
test_expect_success 'check HEAD out of cvs repository' 'test_cvs_co master'
test_expect_success 'check master out of git repository' 'test_git_co master'
test_expect_success 'check a file that was imported once' '
test_cmp_branch_file master imported-once.txt
'
test_expect_failure 'check a file that was imported twice' '
test_cmp_branch_file master imported-twice.txt
'
test_expect_success 'check a file that was imported then modified on HEAD' '
test_cmp_branch_file master imported-modified.txt
'
test_expect_success 'check a file that was imported, modified, then imported again' '
test_cmp_branch_file master imported-modified-imported.txt
'
test_expect_success 'check a file that was added to HEAD then imported' '
test_cmp_branch_file master added-imported.txt
'
test_expect_success 'a vendor branch whose tag has been removed' '
test_cmp_branch_file master imported-anonymously.txt
'
test_done
head 1.1;
access;
symbols
vtag-4:1.1.1.1
vbranchA:1.1.1;
locks; strict;
comment @# @;
1.1
date 2004.02.09.15.43.15; author kfogel; state Exp;
branches
1.1.1.1;
next ;
1.1.1.1
date 2004.02.09.15.43.16; author kfogel; state Exp;
branches;
next ;
desc
@@
1.1
log
@Add a file to the working copy.
@
text
@Adding this file, before importing it with different contents.
@
1.1.1.1
log
@Import (vbranchA, vtag-4).
@
text
@d1 1
a1 1
This is vtag-4 (on vbranchA) of added-then-imported.txt.
@
head 1.1;
branch 1.1.1;
access;
symbols
vtag-1:1.1.1.1;
locks; strict;
comment @# @;
1.1
date 2004.02.09.15.43.13; author kfogel; state Exp;
branches
1.1.1.1;
next ;
1.1.1.1
date 2004.02.09.15.43.13; author kfogel; state Exp;
branches;
next ;
desc
@@
1.1
log
@Initial revision
@
text
@This is vtag-1 (on vbranchA) of imported-anonymously.txt.
@
1.1.1.1
log
@Import (vbranchA, vtag-1).
@
text
@@
head 1.2;
access;
symbols
vtag-2:1.1.1.2
vtag-1:1.1.1.1
vbranchA:1.1.1;
locks; strict;
comment @# @;
1.2
date 2004.02.09.15.43.14; author kfogel; state Exp;
branches;
next 1.1;
1.1
date 2004.02.09.15.43.13; author kfogel; state Exp;
branches
1.1.1.1;
next ;
1.1.1.1
date 2004.02.09.15.43.13; author kfogel; state Exp;
branches;
next 1.1.1.2;
1.1.1.2
date 2004.02.09.15.43.13; author kfogel; state Exp;
branches;
next ;
desc
@@
1.2
log
@First regular commit, to imported-modified-imported.txt, on HEAD.
@
text
@This is a modification of imported-modified-imported.txt on HEAD.
It should supersede the version from the vendor branch.
@
1.1
log
@Initial revision
@
text
@d1 2
a2 1
This is vtag-1 (on vbranchA) of imported-modified-imported.txt.
@
1.1.1.1
log
@Import (vbranchA, vtag-1).
@
text
@@
1.1.1.2
log
@Import (vbranchA, vtag-2).
@
text
@d1 1
a1 1
This is vtag-2 (on vbranchA) of imported-modified-imported.txt.
@
head 1.2;
access;
symbols
vtag-1:1.1.1.1
vbranchA:1.1.1;
locks; strict;
comment @# @;
1.2
date 2004.02.09.15.43.14; author kfogel; state Exp;
branches;
next 1.1;
1.1
date 2004.02.09.15.43.13; author kfogel; state Exp;
branches
1.1.1.1;
next ;
1.1.1.1
date 2004.02.09.15.43.13; author kfogel; state Exp;
branches;
next ;
desc
@@
1.2
log
@Commit on HEAD.
@
text
@This is a modification of imported-modified.txt on HEAD.
It should supersede the version from the vendor branch.
@
1.1
log
@Initial revision
@
text
@d1 2
a2 1
This is vtag-1 (on vbranchA) of imported-modified.txt.
@
1.1.1.1
log
@Import (vbranchA, vtag-1).
@
text
@@
head 1.1;
branch 1.1.1;
access;
symbols
vtag-1:1.1.1.1
vbranchA:1.1.1;
locks; strict;
comment @# @;
1.1
date 2004.02.09.15.43.13; author kfogel; state Exp;
branches
1.1.1.1;
next ;
1.1.1.1
date 2004.02.09.15.43.13; author kfogel; state Exp;
branches;
next ;
desc
@@
1.1
log
@Initial revision
@
text
@This is vtag-1 (on vbranchA) of imported-once.txt.
@
1.1.1.1
log
@Import (vbranchA, vtag-1).
@
text
@@
head 1.1;
branch 1.1.1;
access;
symbols
vtag-2:1.1.1.2
vtag-1:1.1.1.1
vbranchA:1.1.1;
locks; strict;
comment @# @;
1.1
date 2004.02.09.15.43.13; author kfogel; state Exp;
branches
1.1.1.1;
next ;
1.1.1.1
date 2004.02.09.15.43.13; author kfogel; state Exp;
branches;
next 1.1.1.2;
1.1.1.2
date 2004.02.09.15.43.13; author kfogel; state Exp;
branches;
next ;
desc
@@
1.1
log
@Initial revision
@
text
@This is vtag-1 (on vbranchA) of imported-twice.txt.
@
1.1.1.1
log
@Import (vbranchA, vtag-1).
@
text
@@
1.1.1.2
log
@Import (vbranchA, vtag-2).
@
text
@d1 1
a1 1
This is vtag-2 (on vbranchA) of imported-twice.txt.
@
#!/bin/sh
# A description of the repository used for this test can be found in
# t9602/README.
test_description='git cvsimport handling of branches and tags'
. ./lib-cvs.sh
CVSROOT="$TEST_DIRECTORY"/t9602/cvsroot
export CVSROOT
test_expect_success 'import module' '
git cvsimport -C module-git module
'
test_expect_success 'test branch master' '
test_cmp_branch_tree master
'
test_expect_success 'test branch vendorbranch' '
test_cmp_branch_tree vendorbranch
'
test_expect_failure 'test branch B_FROM_INITIALS' '
test_cmp_branch_tree B_FROM_INITIALS
'
test_expect_failure 'test branch B_FROM_INITIALS_BUT_ONE' '
test_cmp_branch_tree B_FROM_INITIALS_BUT_ONE
'
test_expect_failure 'test branch B_MIXED' '
test_cmp_branch_tree B_MIXED
'
test_expect_success 'test branch B_SPLIT' '
test_cmp_branch_tree B_SPLIT
'
test_expect_failure 'test tag vendortag' '
test_cmp_branch_tree vendortag
'
test_expect_success 'test tag T_ALL_INITIAL_FILES' '
test_cmp_branch_tree T_ALL_INITIAL_FILES
'
test_expect_failure 'test tag T_ALL_INITIAL_FILES_BUT_ONE' '
test_cmp_branch_tree T_ALL_INITIAL_FILES_BUT_ONE
'
test_expect_failure 'test tag T_MIXED' '
test_cmp_branch_tree T_MIXED
'
test_done
This repository is for testing the ability to group revisions
correctly along tags and branches. Here is its history:
1. The initial import (revision 1.1 of everybody) created a
directory structure with a file named `default' in each dir:
./
default
sub1/default
subsubA/default
subsubB/default
sub2/default
subsubA/default
sub3/default
2. Then tagged everyone with T_ALL_INITIAL_FILES.
3. Then tagged everyone except sub1/subsubB/default with
T_ALL_INITIAL_FILES_BUT_ONE.