summaryrefslogtreecommitdiff
path: root/regress/usr.bin/cvs
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2008-03-10 20:03:22 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2008-03-10 20:03:22 +0000
commit201252fbac5a6c1b7213c6948d6bdbfbb089b454 (patch)
tree3b5de7419f9e4101b789824ebe980f8de8c35de6 /regress/usr.bin/cvs
parentfa58bafec771ab9acccf14d2a217e0ba0143f64f (diff)
Further improve regress for OpenCVS by including possibility to change and
check dates in RCS files (needed for various -D cases). As a reference, import has been adjusted. Also, it is no longer needed to supply -f option if CVS is specified with make. ok joris
Diffstat (limited to 'regress/usr.bin/cvs')
-rw-r--r--regress/usr.bin/cvs/Makefile112
-rw-r--r--regress/usr.bin/cvs/setdate.pl34
-rw-r--r--regress/usr.bin/cvs/test_cvs_import_01_seed1.txt,v40
-rw-r--r--regress/usr.bin/cvs/test_opencvs_import_01_seed1.txt,v42
4 files changed, 180 insertions, 48 deletions
diff --git a/regress/usr.bin/cvs/Makefile b/regress/usr.bin/cvs/Makefile
index 1ce4aaf1383..2bac00db0c1 100644
--- a/regress/usr.bin/cvs/Makefile
+++ b/regress/usr.bin/cvs/Makefile
@@ -1,10 +1,11 @@
-# $OpenBSD: Makefile,v 1.25 2008/02/15 23:26:58 xsa Exp $
+# $OpenBSD: Makefile,v 1.26 2008/03/10 20:03:21 tobias Exp $
# Regression tests by Niall O'Higgins <niallo@openbsd.org> and
# Tobias Stoeckmann <tobias@openbsd.org>.
# Based on OpenRCS regression framework.
-CVS?= opencvs -f
+CVS?= opencvs
+CVSCMD= ${CVS} -f
REGRESS_ROOT= ${.OBJDIR}/regress_cvs_root
REGRESS_WCOPY= ${.OBJDIR}/regress_cvs_wcopy
@@ -12,10 +13,18 @@ REGRESS_SEED= ${REGRESS_WCOPY}/seed
.if defined(REMOTE)
MYCVSROOT?= localhost:${REGRESS_ROOT}
+.if defined(CVS_SERVER)
+TESTFILE= $(CVS_SERVER)
.else
+TESTFILE= cvs
+.endif
+.else
+TESTFILE= ${CVS}
MYCVSROOT?= ${REGRESS_ROOT}
.endif
+DIFF= diff -u
+
CLEANFILES= regress_cvs_root regress_cvs_wcopy regress_cvs_stderr \
regress_cvs_stdout
@@ -69,51 +78,52 @@ REGRESS_TARGETS+=test-${t}
test-cvs-add:
@echo "initial content" > ${REGRESS_SEED}/seed2.txt
@cd ${REGRESS_SEED}; \
- ${CVS} -q add seed2.txt > /dev/null 2> /dev/null
-# eval 'test `${CVS} -Q add seed2.txt | wc -l` -eq 0'
+ ${CVSCMD} -q add seed2.txt > /dev/null 2> /dev/null
+# eval 'test `${CVSCMD} -Q add seed2.txt | wc -l` -eq 0'
test-cvs-add-dir:
@mkdir ${REGRESS_SEED}/subdir
- @cd ${REGRESS_SEED}; ${CVS} -q add subdir > /dev/null 2> /dev/null
+ @cd ${REGRESS_SEED}; ${CVSCMD} -q add subdir > /dev/null 2> /dev/null
@test -d ${REGRESS_SEED}/subdir/CVS && \
test -d ${REGRESS_ROOT}/seed/subdir
test-cvs-add-subdir_file:
@echo "initial content of seed3.txt" > ${REGRESS_SEED}/subdir/seed3.txt
@cd ${REGRESS_SEED}; \
- ${CVS} -q add subdir/seed3.txt > /dev/null 2> /dev/null
-# @eval 'test `${CVS} -Q add seed2.txt | wc -l` -eq 0'
+ ${CVSCMD} -q add subdir/seed3.txt > /dev/null 2> /dev/null
+# @eval 'test `${CVSCMD} -Q add seed2.txt | wc -l` -eq 0'
test-cvs-annotate:
@cd ${REGRESS_SEED}; \
- eval 'test `${CVS} -Q annotate seed1.txt 2>/dev/null | wc -l` -eq 3'
+ eval 'test `${CVSCMD} -Q annotate seed1.txt 2>/dev/null | \
+ wc -l` -eq 3'
test-cvs-annotate-rflag-inval_branch_rev:
@cd ${REGRESS_SEED}; \
- eval 'test `${CVS} -Q annotate -r 1.2.3.4 seed1.txt 2>/dev/null \
+ eval 'test `${CVSCMD} -Q annotate -r 1.2.3.4 seed1.txt 2>/dev/null \
| wc -l` -eq 0'
test-cvs-annotate-rflag-inval_branch_rev-fflag:
@cd ${REGRESS_SEED}; \
- eval 'test `${CVS} -Q annotate -f -r 1.2.3.4 seed1.txt 2>/dev/null \
- | wc -l` -eq 3'
+ eval 'test `${CVSCMD} -Q annotate -f -r 1.2.3.4 seed1.txt \
+ 2>/dev/null | wc -l` -eq 3'
test-cvs-annotate-rflag-unknown_symbol-fflag:
@cd ${REGRESS_SEED}; \
- eval 'test `${CVS} -Q annotate -f -r UNKNOWN seed1.txt 2>/dev/null \
- | wc -l` -eq 0'
+ eval 'test `${CVSCMD} -Q annotate -f -r UNKNOWN seed1.txt \
+ 2>/dev/null | wc -l` -eq 0'
test-cvs-checkout:
@rm -rf ${REGRESS_WCOPY}
@mkdir ${REGRESS_WCOPY}
- @cd ${REGRESS_WCOPY}; ${CVS} -Q -d ${MYCVSROOT} co seed > /dev/null
+ @cd ${REGRESS_WCOPY}; ${CVSCMD} -Q -d ${MYCVSROOT} co seed > /dev/null
@test -f ${REGRESS_SEED}/seed1.txt
test-cvs-checkout-kflag-k-rflag-HEAD:
@rm -rf ${REGRESS_WCOPY}
@mkdir ${REGRESS_WCOPY}
@cd ${REGRESS_WCOPY}; \
- ${CVS} -Q -d ${MYCVSROOT} co -rHEAD -kkv seed > /dev/null
+ ${CVSCMD} -Q -d ${MYCVSROOT} co -rHEAD -kkv seed > /dev/null
@test -f ${REGRESS_SEED}/seed1.txt
@eval 'test `grep -c -e THEAD -e -kkv \
${REGRESS_SEED}/CVS/Entries | wc -l` -eq 1'
@@ -124,40 +134,40 @@ test-cvs-checkout-kflag-kv-rflag-1.1:
@rm -rf ${REGRESS_WCOPY}
@mkdir ${REGRESS_WCOPY}
@cd ${REGRESS_WCOPY}; \
- ${CVS} -Q -d ${MYCVSROOT} co -r 1.1 -kkv seed > /dev/null
+ ${CVSCMD} -Q -d ${MYCVSROOT} co -r 1.1 -kkv seed > /dev/null
@test -f ${REGRESS_SEED}/seed1.txt;
@eval 'test `grep -c -e T1.1 -e -kkv \
${REGRESS_SEED}/CVS/Entries | wc -l` -eq 1'
test-cvs-checkout-pflag:
- @eval 'test `${CVS} -Q -d ${MYCVSROOT} checkout \
+ @eval 'test `${CVSCMD} -Q -d ${MYCVSROOT} checkout \
-p seed/seed1.txt 2>/dev/null | wc -l` -eq 2'
test-cvs-checkout-rflag_branch:
@rm -rf ${REGRESS_WCOPY}
@mkdir ${REGRESS_WCOPY}
@cd ${REGRESS_WCOPY}; \
- ${CVS} -Q -d ${MYCVSROOT} co -r FIRST_BRANCH seed > /dev/null
+ ${CVSCMD} -Q -d ${MYCVSROOT} co -r FIRST_BRANCH seed > /dev/null
@test -f ${REGRESS_SEED}/seed1.txt
@eval 'test `grep -c TFIRST_BRANCH ${REGRESS_SEED}/CVS/Entries` -eq 2'
test-cvs-checkout-rflag-inval_branch_rev:
@rm -rf ${REGRESS_WCOPY}
@mkdir ${REGRESS_WCOPY}
- @cd ${REGRESS_WCOPY}; ${CVS} -Q -d ${MYCVSROOT} co -r1.2.3.4 seed
+ @cd ${REGRESS_WCOPY}; ${CVSCMD} -Q -d ${MYCVSROOT} co -r1.2.3.4 seed
@eval 'test ! -f ${REGRESS_SEED}/seed1.txt'
test-cvs-checkout-rflag-too_high:
@rm -rf ${REGRESS_WCOPY}
@mkdir ${REGRESS_WCOPY}
- @cd ${REGRESS_WCOPY}; ${CVS} -Q -d ${MYCVSROOT} co -r1.5 seed
+ @cd ${REGRESS_WCOPY}; ${CVSCMD} -Q -d ${MYCVSROOT} co -r1.5 seed
@eval 'test ! -f ${REGRESS_SEED}/seed1.txt'
test-cvs-checkout-rflag-HEAD:
@rm -rf ${REGRESS_WCOPY}
@mkdir ${REGRESS_WCOPY}
@cd ${REGRESS_WCOPY}; \
- ${CVS} -Q -d ${MYCVSROOT} co -rHEAD seed > /dev/null
+ ${CVSCMD} -Q -d ${MYCVSROOT} co -rHEAD seed > /dev/null
@test -f ${REGRESS_SEED}/seed1.txt;
@eval 'test `grep -c THEAD ${REGRESS_SEED}/CVS/Entries | wc -l` -eq 1'
@@ -165,22 +175,21 @@ test-cvs-checkout-rflag-1.1:
@rm -rf ${REGRESS_WCOPY}
@mkdir ${REGRESS_WCOPY}
@cd ${REGRESS_WCOPY}; \
- ${CVS} -Q -d ${MYCVSROOT} co -r 1.1 seed > /dev/null
+ ${CVSCMD} -Q -d ${MYCVSROOT} co -r 1.1 seed > /dev/null
@test -f ${REGRESS_SEED}/seed1.txt && test -f ${REGRESS_SEED}/seed2.txt
test-cvs-checkout-dflag:
@rm -rf ${REGRESS_WCOPY}
@mkdir ${REGRESS_WCOPY}
@cd ${REGRESS_WCOPY}; \
- ${CVS} -Q -d ${MYCVSROOT} co -d seed2 seed > /dev/null
+ ${CVSCMD} -Q -d ${MYCVSROOT} co -d seed2 seed > /dev/null
@test -d ${REGRESS_WCOPY}/seed2/CVS
test-cvs-checkout-subdir:
- @echo "test-cvs-checkout-subdir"
@rm -rf ${REGRESS_WCOPY}
@mkdir ${REGRESS_WCOPY}
@cd ${REGRESS_WCOPY}; \
- ${CVS} -Q -d ${MYCVSROOT} co seed/subdir > /dev/null
+ ${CVSCMD} -Q -d ${MYCVSROOT} co seed/subdir > /dev/null
@test -f ${REGRESS_SEED}/subdir/seed3.txt && \
test ! -f ${REGRESS_SEED}/seed2.txt
@@ -188,7 +197,7 @@ test-cvs-commit-Fflag:
@sleep 1
@echo "second line" >> ${REGRESS_SEED}/seed1.txt
@echo "commit seed repo" > ${REGRESS_WCOPY}/logmsg.txt
- @cd ${REGRESS_SEED}; ${CVS} commit \
+ @cd ${REGRESS_SEED}; ${CVSCMD} commit \
-F ${REGRESS_WCOPY}/logmsg.txt > /dev/null
@grep "^@commit seed repo" \
${REGRESS_ROOT}/seed/seed1.txt,v > /dev/null
@@ -197,94 +206,101 @@ test-cvs-commit-Fflag:
test-cvs-commit-to_branch:
@sleep 1
- @cd ${REGRESS_SEED}; ${CVS} commit -m'first branch seed' > /dev/null
+ @cd ${REGRESS_SEED}; ${CVSCMD} commit -m'first branch seed' > /dev/null
@eval 'test `cat ${REGRESS_ROOT}/seed/seed1.txt,v | wc -l` -eq 80'
@eval 'test `grep -c TFIRST_BRANCH ${REGRESS_SEED}/CVS/Entries` -eq 2'
test-cvs-diff:
@sleep 1
@echo "modified" > ${REGRESS_SEED}/seed2.txt
- @cd ${REGRESS_SEED}; eval 'test `${CVS} -Q diff | wc -l` -eq 9'
+ @cd ${REGRESS_SEED}; eval 'test `${CVSCMD} -Q diff | wc -l` -eq 9'
test-cvs-diff-file:
@sleep 1
@echo "first branch line" >> ${REGRESS_SEED}/seed1.txt
@cd ${REGRESS_SEED}; \
- eval 'test `${CVS} -Q diff seed1.txt | wc -l` -eq 7'
+ eval 'test `${CVSCMD} -Q diff seed1.txt | wc -l` -eq 7'
test-cvs-export:
@rm -rf ${REGRESS_WCOPY}
@mkdir ${REGRESS_WCOPY}
@cd ${REGRESS_WCOPY}; \
- ${CVS} -Q -d ${MYCVSROOT} export -r HEAD seed > /dev/null
+ ${CVSCMD} -Q -d ${MYCVSROOT} export -r HEAD seed > /dev/null
@test -f ${REGRESS_SEED}/seed1.txt
test-cvs-import-mflag:
@cd ${.CURDIR}/import_seed; \
- ${CVS} -Q -d ${MYCVSROOT} import \
+ touch -t 200001010100 seed1.txt; \
+ ${CVSCMD} -Q -d ${MYCVSROOT} import \
-m'import seed repo' seed regress regress_import > /dev/null
- @test -f ${REGRESS_ROOT}/seed/seed1.txt,v
+ @chmod u+w ${REGRESS_ROOT}/seed/seed1.txt,v
+ @perl ${.CURDIR}/setdate.pl ${REGRESS_ROOT}/seed/seed1.txt,v 1.1 \
+ 2000.01.01.00.00.00
+ @perl ${.CURDIR}/setdate.pl ${REGRESS_ROOT}/seed/seed1.txt,v 1.1.1.1 \
+ 2000.01.01.00.00.00
+ @sed "s/author `whoami`/author user/" \
+ ${REGRESS_ROOT}/seed/seed1.txt,v | \
+ ${DIFF} - ${.CURDIR}/test_${TESTFILE}_import_01_seed1.txt,v
test-cvs-initial: clean
- @${CVS} -d ${MYCVSROOT} init
+ @${CVSCMD} -d ${MYCVSROOT} init
@test -d ${REGRESS_ROOT}/CVSROOT
test-cvs-log:
- @cd ${REGRESS_SEED}; eval 'test `${CVS} -Q log | wc -l` -eq 68'
+ @cd ${REGRESS_SEED}; eval 'test `${CVSCMD} -Q log | wc -l` -eq 68'
test-cvs-release-dflag: test-cvs-checkout
- @cd ${REGRESS_WCOPY}; ${CVS} -Q -d ${MYCVSROOT} release -d seed
+ @cd ${REGRESS_WCOPY}; ${CVSCMD} -Q -d ${MYCVSROOT} release -d seed
@test ! -d ${.OBJDIR}/regress_cvs_wcopy/seed
@eval 'test `grep '^F' ${REGRESS_ROOT}/CVSROOT/history | wc -l` -eq 1'
test-cvs-remove-fflag:
- @cd ${REGRESS_SEED}; ${CVS} -Q remove -f seed1.txt
+ @cd ${REGRESS_SEED}; ${CVSCMD} -Q remove -f seed1.txt
@test ! -f ${REGRESS_SEED}/seed1.txt
test-cvs-rlog:
- @eval 'test `${CVS} -Q -d ${MYCVSROOT} rlog seed | wc -l` -eq 65'
+ @eval 'test `${CVSCMD} -Q -d ${MYCVSROOT} rlog seed | wc -l` -eq 65'
test-cvs-status:
- @cd ${REGRESS_SEED}; eval 'test `${CVS} -Q status | wc -l` -eq 18'
+ @cd ${REGRESS_SEED}; eval 'test `${CVSCMD} -Q status | wc -l` -eq 18'
test-cvs-status-vflag:
- @cd ${REGRESS_SEED}; eval 'test `${CVS} -Q status -v | wc -l` -eq 30'
+ @cd ${REGRESS_SEED}; eval 'test `${CVSCMD} -Q status -v | wc -l` -eq 30'
test-cvs-tag:
- @cd ${REGRESS_SEED}; ${CVS} -Q tag FIRST_TAG > /dev/null
+ @cd ${REGRESS_SEED}; ${CVSCMD} -Q tag FIRST_TAG > /dev/null
@grep FIRST_TAG ${REGRESS_ROOT}/seed/seed1.txt,v > /dev/null
test-cvs-tag-branch:
- @cd ${REGRESS_SEED}; ${CVS} -Q tag -b FIRST_BRANCH > /dev/null
+ @cd ${REGRESS_SEED}; ${CVSCMD} -Q tag -b FIRST_BRANCH > /dev/null
@grep FIRST_BRANCH ${REGRESS_ROOT}/seed/seed1.txt,v > /dev/null
test-cvs-rtag-one_more_branch:
- @${CVS} -d ${MYCVSROOT} -Q rtag -b SECOND_BRANCH seed > /dev/null
+ @${CVSCMD} -d ${MYCVSROOT} -Q rtag -b SECOND_BRANCH seed > /dev/null
@grep SECOND_BRANCH ${REGRESS_ROOT}/seed/seed2.txt,v \
| grep 4 > /dev/null
test-cvs-update-Aflag:
- @cd ${REGRESS_SEED}; ${CVS} -Q update -A > /dev/null
+ @cd ${REGRESS_SEED}; ${CVSCMD} -Q update -A > /dev/null
@eval 'test `grep -c -e T1 -e kkv ${REGRESS_SEED}/CVS/Entries` -eq 0'
test-cvs-update-Aflag-kflag-kv:
- @cd ${REGRESS_SEED}; ${CVS} -Q update -A -kv > /dev/null
+ @cd ${REGRESS_SEED}; ${CVSCMD} -Q update -A -kv > /dev/null
@eval 'test `grep -c T1 ${REGRESS_SEED}/CVS/Entries` -eq 0'
@eval 'test `grep -c kv ${REGRESS_SEED}/CVS/Entries` -eq 2'
test-cvs-update-Aflag-kflag-k-rflag-1.1:
- @cd ${REGRESS_SEED}; ${CVS} -Q update -A -kk -r 1.1 > /dev/null
+ @cd ${REGRESS_SEED}; ${CVSCMD} -Q update -A -kk -r 1.1 > /dev/null
@eval 'test `grep -c T1 ${REGRESS_SEED}/CVS/Entries` -eq 2'
@eval 'test `grep -c kk ${REGRESS_SEED}/CVS/Entries` -eq 2'
test-cvs-update-Aflag-rflag-1.1:
- @cd ${REGRESS_SEED}; ${CVS} -Q update -A -r 1.1 > /dev/null
+ @cd ${REGRESS_SEED}; ${CVSCMD} -Q update -A -r 1.1 > /dev/null
@eval 'test `grep -c T1 ${REGRESS_SEED}/CVS/Entries` -eq 2'
@eval 'test `grep -c kk ${REGRESS_SEED}/CVS/Entries` -eq 0'
test-cvs-update-for_subdir:
- @echo "test-cvs-update-for_subdir"
- @cd ${REGRESS_SEED}; ${CVS} -Q update > /dev/null
+ @cd ${REGRESS_SEED}; ${CVSCMD} -Q update > /dev/null
@test -f ${REGRESS_SEED}/subdir/seed3.txt && \
test ! -f ${REGRESS_SEED}/seed1.txt && \
test ! -f ${REGRESS_SEED}/seed2.txt
diff --git a/regress/usr.bin/cvs/setdate.pl b/regress/usr.bin/cvs/setdate.pl
new file mode 100644
index 00000000000..a265dc2d5f1
--- /dev/null
+++ b/regress/usr.bin/cvs/setdate.pl
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+# $OpenBSD: setdate.pl,v 1.1 2008/03/10 20:03:21 tobias Exp $
+#
+# Sets "date x;" of specified revision in rcsfile to date.
+# This script is needed to make -D checks available. CVS adjusts dates
+# to gmt, so it is impossible to write tests which can be used in
+# all timezones.
+#
+# usage: setdate.pl rcsfile revision date
+
+my $gotrev;
+my @lines;
+
+die "usage: setdate.pl file revision date\n" if ($#ARGV != 2);
+
+open FILE, "< $ARGV[0]" or die "cannot open file $ARGV[0] for reading\n";
+@lines = <FILE>;
+close FILE;
+
+$gotrev = 0;
+open FILE, "> $ARGV[0]" or die "cannot open file $ARGV[0] for writing\n";
+for (@lines) {
+ if ($gotrev) {
+ if (m/^date\s+(.*?);/) {
+ s/$1/$ARGV[2]/;
+ break;
+ }
+ $gotrev = 0;
+ }
+ $gotrev = 1 if (m/^$ARGV[1]\n$/);
+ print FILE "$_";
+}
+close FILE;
+
diff --git a/regress/usr.bin/cvs/test_cvs_import_01_seed1.txt,v b/regress/usr.bin/cvs/test_cvs_import_01_seed1.txt,v
new file mode 100644
index 00000000000..0b745d3cab9
--- /dev/null
+++ b/regress/usr.bin/cvs/test_cvs_import_01_seed1.txt,v
@@ -0,0 +1,40 @@
+head 1.1;
+branch 1.1.1;
+access ;
+symbols regress_import:1.1.1.1 regress:1.1.1;
+locks ; strict;
+comment @# @;
+
+
+1.1
+date 2000.01.01.00.00.00; author user; state Exp;
+branches 1.1.1.1;
+next ;
+
+1.1.1.1
+date 2000.01.01.00.00.00; author user; state Exp;
+branches ;
+next ;
+
+
+desc
+@@
+
+
+
+1.1
+log
+@Initial revision
+@
+text
+@$Id: seed1.txt,v 1.1 2007/06/05 05:49:41 niallo Exp $
+a test file for the seed repository
+@
+
+
+1.1.1.1
+log
+@import seed repo
+@
+text
+@@
diff --git a/regress/usr.bin/cvs/test_opencvs_import_01_seed1.txt,v b/regress/usr.bin/cvs/test_opencvs_import_01_seed1.txt,v
new file mode 100644
index 00000000000..ca709c9e907
--- /dev/null
+++ b/regress/usr.bin/cvs/test_opencvs_import_01_seed1.txt,v
@@ -0,0 +1,42 @@
+head 1.1;
+branch 1.1.1;
+access;
+symbols
+ regress_import:1.1.1.1
+ regress:1.1.0.1;
+locks; strict;
+comment @# @;
+
+
+1.1
+date 2000.01.01.00.00.00; author user; state Exp;
+branches
+ 1.1.1.1;
+next ;
+
+1.1.1.1
+date 2000.01.01.00.00.00; author user; state Exp;
+branches;
+next ;
+
+
+desc
+@@
+
+
+1.1
+log
+@Initial revision
+@
+text
+@$Id: seed1.txt,v 1.1 2007/06/05 05:49:41 niallo Exp $
+a test file for the seed repository
+@
+
+
+1.1.1.1
+log
+@import seed repo
+@
+text
+@@