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