xref: /openbsd/regress/usr.bin/cvs/Makefile (revision 7db0b2bd)
1#	$OpenBSD: Makefile,v 1.9 2008/01/10 12:13:02 tobias Exp $
2
3# Regression tests by Niall O'Higgins <niallo@openbsd.org> and
4# Tobias Stoeckmann <tobias@openbsd.org>.
5# Based on OpenRCS regression framework.
6
7CVS?=		opencvs
8DIFF=		diff -u
9
10CLEANFILES=	regress_cvs_root regress_cvs_wcopy regress_cvs_stderr \
11		regress_cvs_stdout
12
13
14# These must be done in order.
15LTESTS= cvs-initial \
16	cvs-import-mflag \
17	cvs-checkout-rflag-HEAD \
18	cvs-checkout-rflag-inval_branch_rev \
19	cvs-checkout-rflag-too_high \
20	cvs-checkout \
21	cvs-checkout-pflag \
22	cvs-tag \
23	cvs-add \
24	cvs-commit-Fflag \
25	cvs-tag-branch \
26	cvs-checkout-rflag_branch \
27	cvs-commit-to_branch \
28	cvs-annotate \
29	cvs-annotate-rflag-inval_branch_rev \
30	cvs-annotate-rflag-inval_branch_rev-fflag \
31	cvs-checkout-rflag-1.1 \
32	cvs-update-Aflag \
33	cvs-status \
34	cvs-remove-fflag \
35	cvs-status-vflag
36# Known to fail.
37#	cvs-checkout-dflag
38#	cvs-rlog
39# Known to behave unconform to GNU cvs.
40#	cvs-annotate-rflag-unknown_symbol-fflag
41#	cvs-diff
42#	cvs-diff-file
43#	cvs-export
44#	cvs-log
45
46.for t in ${LTESTS}
47REGRESS_TARGETS+=test-${t}
48.endfor
49
50# XXX - should not print anything
51test-cvs-add:
52	@echo "initial content" > ${.OBJDIR}/regress_cvs_wcopy/seed/seed2.txt
53	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; \
54	    ${CVS} -q add seed2.txt > /dev/null 2> /dev/null
55#	    eval 'test `${CVS} -Q add seed2.txt | wc -l` -eq 0'
56
57test-cvs-annotate:
58	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; \
59	    eval 'test `${CVS} -Q annotate seed1.txt 2>/dev/null | wc -l` -eq 3'
60
61test-cvs-annotate-rflag-inval_branch_rev:
62	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; \
63	    eval 'test `${CVS} -Q annotate -r 1.2.3.4 seed1.txt 2>/dev/null \
64	    | wc -l` -eq 0'
65
66test-cvs-annotate-rflag-inval_branch_rev-fflag:
67	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; \
68	    eval 'test `${CVS} -Q annotate -f -r 1.2.3.4 seed1.txt 2>/dev/null \
69	    | wc -l` -eq 3'
70
71test-cvs-annotate-rflag-unknown_symbol-fflag:
72	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; \
73	    eval 'test `${CVS} -Q annotate -f -r UNKNOWN seed1.txt 2>/dev/null \
74	    | wc -l` -eq 0'
75
76test-cvs-checkout:
77	@rm -rf ${.OBJDIR}/regress_cvs_wcopy
78	@mkdir ${.OBJDIR}/regress_cvs_wcopy
79	@cd ${.OBJDIR}/regress_cvs_wcopy; \
80	    ${CVS} -Q -d ${.OBJDIR}/regress_cvs_root co seed > /dev/null
81	@test -f ${.OBJDIR}/regress_cvs_wcopy/seed/seed1.txt
82
83test-cvs-checkout-pflag:
84	@eval 'test `${CVS} -Q -d ${.OBJDIR}/regress_cvs_root checkout \
85	    -p seed/seed1.txt 2>/dev/null | wc -l` -eq 2'
86
87test-cvs-checkout-rflag_branch:
88	@rm -rf ${.OBJDIR}/regress_cvs_wcopy
89	@mkdir ${.OBJDIR}/regress_cvs_wcopy
90	@cd ${.OBJDIR}/regress_cvs_wcopy; \
91	    ${CVS} -Q -d ${.OBJDIR}/regress_cvs_root co -r FIRST_BRANCH seed \
92	    > /dev/null
93	@test -f ${.OBJDIR}/regress_cvs_wcopy/seed/seed1.txt
94	@eval 'test `grep -c TFIRST_BRANCH \
95	    ${.OBJDIR}/regress_cvs_wcopy/seed/CVS/Entries` -eq 2'
96
97test-cvs-checkout-rflag-inval_branch_rev:
98	@rm -rf ${.OBJDIR}/regress_cvs_wcopy
99	@mkdir ${.OBJDIR}/regress_cvs_wcopy
100	@cd ${.OBJDIR}/regress_cvs_wcopy; \
101	    ${CVS} -Q -d ${.OBJDIR}/regress_cvs_root co -r1.2.3.4 seed
102	@eval 'test ! -f ${.OBJDIR}/regress_cvs_wcopy/seed/seed1.txt'
103
104test-cvs-checkout-rflag-too_high:
105	@rm -rf ${.OBJDIR}/regress_cvs_wcopy
106	@mkdir ${.OBJDIR}/regress_cvs_wcopy
107	@cd ${.OBJDIR}/regress_cvs_wcopy; \
108	    ${CVS} -Q -d ${.OBJDIR}/regress_cvs_root co -r1.5 seed
109	@eval 'test ! -f ${.OBJDIR}/regress_cvs_wcopy/seed/seed1.txt'
110
111test-cvs-checkout-rflag-HEAD:
112	@rm -rf ${.OBJDIR}/regress_cvs_wcopy
113	@mkdir ${.OBJDIR}/regress_cvs_wcopy
114	@cd ${.OBJDIR}/regress_cvs_wcopy; \
115	    ${CVS} -Q -d ${.OBJDIR}/regress_cvs_root co -rHEAD seed > /dev/null
116	@test -f ${.OBJDIR}/regress_cvs_wcopy/seed/seed1.txt
117
118test-cvs-checkout-rflag-1.1:
119	@rm -rf ${.OBJDIR}/regress_cvs_wcopy
120	@mkdir ${.OBJDIR}/regress_cvs_wcopy; \
121	    cd ${.OBJDIR}/regress_cvs_wcopy; \
122	    ${CVS} -Q -d ${.OBJDIR}/regress_cvs_root co -r 1.1 seed > /dev/null
123	@test -f ${.OBJDIR}/regress_cvs_wcopy/seed/seed1.txt && \
124	    test -f ${.OBJDIR}/regress_cvs_wcopy/seed/seed2.txt
125
126test-cvs-checkout-dflag:
127	@${CVS} -Q -d ${.OBJDIR}/regress_cvs_root co -d \
128	    ${.OBJDIR}/regress_cvs_wcopy seed
129	@test -d ${.OBJDIR}/regress_cvs_wcopy
130
131test-cvs-commit-Fflag:
132	@sleep 1
133	@echo "second line" >> ${.OBJDIR}/regress_cvs_wcopy/seed/seed1.txt
134	@echo "commit seed repo" > ${.OBJDIR}/regress_cvs_wcopy/logmsg.txt
135	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; ${CVS} commit \
136	    -F ${.OBJDIR}/regress_cvs_wcopy/logmsg.txt > /dev/null
137	@grep "^@commit seed repo" \
138	    ${.OBJDIR}/regress_cvs_root/seed/seed1.txt,v > /dev/null
139	@eval 'test `cat ${.OBJDIR}/regress_cvs_root/seed/seed1.txt,v | wc -l` \
140	    -eq 60'
141	@test -f ${.OBJDIR}/regress_cvs_root/seed/seed2.txt,v
142
143test-cvs-commit-to_branch:
144	@sleep 1
145	@echo "first branch line" >> ${.OBJDIR}/regress_cvs_wcopy/seed/seed1.txt
146	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; ${CVS} commit \
147	    -m'first branch seed' > /dev/null
148	@eval 'test `cat ${.OBJDIR}/regress_cvs_root/seed/seed1.txt,v | wc -l` \
149	    -eq 80'
150#	@eval 'test `grep -c TFIRST_BRANCH \
151#	    ${.OBJDIR}/regress_cvs_wcopy/seed/CVS/Entries` -eq 2'
152
153test-cvs-diff:
154	@sleep 1
155	@echo "modified" > ${.OBJDIR}/regress_cvs_wcopy/seed/seed2.txt
156	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; \
157	    eval 'test `${CVS} -Q diff | wc -l` -eq 9'
158
159test-cvs-diff-file:
160	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; ${CVS} -Q diff seed1.txt
161
162test-cvs-export:
163	@mkdir ${.OBJDIR}/regress_cvs_wcopy; \
164	    cd ${.OBJDIR}/regress_cvs_wcopy; \
165	    ${CVS} -Q -d ${.OBJDIR}/regress_cvs_root export
166	@test -f ${.OBJDIR}/regress_cvs_wcopy/seed/seed1.txt
167
168test-cvs-import-mflag:
169	@cd ${.CURDIR}/import_seed; \
170	    ${CVS} -Q -d ${.OBJDIR}/regress_cvs_root import \
171	    -m'import seed repo' seed regress regress_import > /dev/null
172	@test -f ${.OBJDIR}/regress_cvs_root/seed/seed1.txt,v
173
174test-cvs-initial: clean
175	@${CVS} -d ${.OBJDIR}/regress_cvs_root init
176	@test -d ${.OBJDIR}/regress_cvs_root/CVSROOT
177
178test-cvs-log:
179	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; ${CVS} -Q log
180
181test-cvs-remove-fflag:
182	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; ${CVS} -Q remove -f seed1.txt
183
184test-cvs-rlog:
185	@${CVS} -Q -d ${.OBJDIR}/regress_cvs_root rlog seed
186
187test-cvs-status:
188	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; \
189	    eval 'test `${CVS} -Q status | wc -l` -eq 12'
190
191test-cvs-status-vflag:
192	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; \
193	    eval 'test `${CVS} -Q status -v | wc -l` -eq 21'
194
195test-cvs-tag:
196	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; \
197	    ${CVS} -Q tag FIRST_TAG > /dev/null
198	@grep FIRST_TAG ${.OBJDIR}/regress_cvs_root/seed/seed1.txt,v \
199	    > /dev/null
200
201test-cvs-tag-branch:
202	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; \
203	    ${CVS} -Q tag -b FIRST_BRANCH > /dev/null
204	@grep FIRST_BRANCH ${.OBJDIR}/regress_cvs_root/seed/seed1.txt,v \
205	    > /dev/null
206
207# XXX - Output is not GNU conform
208test-cvs-update-Aflag:
209	@cd ${.OBJDIR}/regress_cvs_wcopy/seed; \
210	    ${CVS} -Q update -A > /dev/null
211#	    eval 'test `${CVS} -q update -A | wc -l` -eq 1'
212	@eval 'test `grep -c T1 ${.OBJDIR}/regress_cvs_wcopy/seed/CVS/Entries` \
213	    -eq 0'
214
215clean:
216	@rm -rf ${CLEANFILES}
217
218.include <bsd.regress.mk>
219